mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Fix text in option menu within image preview
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
b0758e4b74
commit
57b0d425b6
1 changed files with 19 additions and 2 deletions
|
@ -24,6 +24,7 @@ package com.owncloud.android.ui.preview;
|
|||
import android.accounts.Account;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
|
@ -36,6 +37,8 @@ import android.os.AsyncTask;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
|
@ -70,6 +73,8 @@ import com.owncloud.android.utils.DisplayUtils;
|
|||
import com.owncloud.android.utils.MimeType;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
@ -313,16 +318,28 @@ public class PreviewImageFragment extends FileFragment implements Injectable {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.item_file, menu);
|
||||
|
||||
int nightModeFlag = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
|
||||
if (Configuration.UI_MODE_NIGHT_NO == nightModeFlag) {
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
MenuItem menuItem = menu.getItem(i);
|
||||
|
||||
SpannableString spanString = new SpannableString(menuItem.getTitle().toString());
|
||||
spanString.setSpan(new ForegroundColorSpan(Color.BLACK), 0, spanString.length(), 0);
|
||||
menuItem.setTitle(spanString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void onPrepareOptionsMenu(Menu menu) {
|
||||
public void onPrepareOptionsMenu(@NotNull Menu menu) {
|
||||
super.onPrepareOptionsMenu(menu);
|
||||
|
||||
if (containerActivity.getStorageManager() != null && getFile() != null) {
|
||||
|
|
Loading…
Reference in a new issue