Refactoring

pull/194/merge
M66B 3 years ago
parent 7d87f2b444
commit ecc9bc2bf3

@ -83,6 +83,14 @@ public class FragmentBase extends Fragment {
static final String ACTION_STORE_ATTACHMENT = BuildConfig.APPLICATION_ID + ".STORE_ATTACHMENT";
static final String ACTION_STORE_ATTACHMENTS = BuildConfig.APPLICATION_ID + ".STORE_ATTACHMENTS";
protected ActionBar getSupportActionBar() {
FragmentActivity activity = getActivity();
if (activity instanceof ActivityBase)
return ((ActivityBase) activity).getSupportActionBar();
else
return null;
}
protected void setTitle(int resid) {
setTitle(getString(resid));
}

@ -108,6 +108,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.appcompat.widget.SwitchCompat;
@ -1572,11 +1573,10 @@ public class FragmentCompose extends FragmentBase {
menu.findItem(R.id.menu_zoom).setTitle(ssbZoom);
PopupMenuLifecycle.insertIcon(context, menu.findItem(R.id.menu_zoom), false);
FragmentActivity activity = getActivity();
Context tcontext = (activity instanceof ActivityBase
? ((ActivityBase) activity).getSupportActionBar().getThemedContext() : context);
ActionBar actionBar = getSupportActionBar();
Context actionBarContext = (actionBar == null ? context : actionBar.getThemedContext());
int colorEncrypt = Helper.resolveColor(context, R.attr.colorEncrypt);
int colorActionForeground = Helper.resolveColor((tcontext), android.R.attr.textColorPrimary);
int colorActionForeground = Helper.resolveColor(actionBarContext, android.R.attr.textColorPrimary);
View v = menu.findItem(R.id.menu_encrypt).getActionView();
ImageButton ib = v.findViewById(R.id.button);

Loading…
Cancel
Save