Set background color in activity

pull/215/head
M66B 7 months ago
parent 1083865e77
commit a25ab1367f

@ -109,6 +109,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
setSupportActionBar(toolbar);
FragmentDialogTheme.setBackground(this, container, this instanceof ActivityCompose);
super.setContentView(container);
}

@ -75,7 +75,6 @@ public class ActivityDMARC extends ActivityBase {
grpReady = findViewById(R.id.grpReady);
// Initialize
FragmentDialogTheme.setBackground(this, view, false);
grpReady.setVisibility(View.GONE);
load();

@ -57,7 +57,6 @@ public class ActivityDSN extends ActivityBase {
grpReady = findViewById(R.id.grpReady);
// Initialize
FragmentDialogTheme.setBackground(this, view, false);
grpReady.setVisibility(View.GONE);
load();

@ -207,7 +207,6 @@ public class ActivityEML extends ActivityBase {
});
// Initialize
FragmentDialogTheme.setBackground(this, view, false);
vSeparatorAttachments.setVisibility(View.GONE);
grpReady.setVisibility(View.GONE);
cardHeaders.setVisibility(View.GONE);

@ -208,7 +208,6 @@ public class ActivitySignature extends ActivityBase {
});
// Initialize
FragmentDialogTheme.setBackground(this, view, true);
tvHtmlRemark.setVisibility(View.GONE);
style_bar.setVisibility(View.GONE);

@ -108,8 +108,6 @@ public class FragmentAbout extends FragmentBase {
llContributors.addView(tv);
}
FragmentDialogTheme.setBackground(context, view, false);
return view;
}

@ -626,7 +626,6 @@ public class FragmentAccount extends FragmentBase {
// Initialize
Helper.setViewsEnabled(view, false);
FragmentDialogTheme.setBackground(getContext(), view, false);
tvGmailHint.setVisibility(View.GONE);

@ -291,8 +291,6 @@ public class FragmentAccounts extends FragmentBase {
animator = Helper.getFabAnimator(fab, getViewLifecycleOwner());
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
if (settings) {
fab.show();
fabCompose.hide();

@ -198,8 +198,6 @@ public class FragmentAnswer extends FragmentBase {
});
// Initialize
FragmentDialogTheme.setBackground(context, view, true);
etLabel.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
cbExternal.setVisibility(View.GONE);
cbSnippet.setVisibility(View.GONE);

@ -197,7 +197,6 @@ public class FragmentAnswers extends FragmentBase {
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);

@ -1084,7 +1084,6 @@ public class FragmentCompose extends FragmentBase {
// Initialize
setHasOptionsMenu(true);
FragmentDialogTheme.setBackground(getContext(), view, true);
if (keyboard_no_fullscreen) {
// https://developer.android.com/reference/android/view/inputmethod/EditorInfo#IME_FLAG_NO_FULLSCREEN

@ -649,25 +649,33 @@ public class FragmentDialogTheme extends FragmentDialogBase {
boolean solarized = theme.startsWith("solarized");
boolean you = theme.startsWith("you_");
Integer color = null;
if (cards) {
if (you && (!dark || !black) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
view.setBackgroundColor(ContextCompat.getColor(context, dark
color = ContextCompat.getColor(context, dark
? android.R.color.system_background_dark
: android.R.color.system_background_light));
: android.R.color.system_background_light);
else {
if (compose) {
if (!dark || solarized)
view.setBackgroundColor(Helper.resolveColor(context, R.attr.colorCardBackground));
color = Helper.resolveColor(context, R.attr.colorCardBackground);
} else {
if (!dark && !solarized)
view.setBackgroundColor(ContextCompat.getColor(context, beige
color = ContextCompat.getColor(context, beige
? R.color.lightColorBackground_cards_beige
: R.color.lightColorBackground_cards));
: R.color.lightColorBackground_cards);
}
}
} else {
if (tabular_card_bg)
view.setBackgroundColor(Helper.resolveColor(context, R.attr.colorCardBackground));
color = Helper.resolveColor(context, R.attr.colorCardBackground);
}
if (color == null)
color = ContextCompat.getColor(context, dark
? android.R.color.system_background_dark
: android.R.color.system_background_light);
view.setBackgroundColor(color);
}
}

@ -443,7 +443,6 @@ public class FragmentFolders extends FragmentBase {
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
fabAdd.hide();

@ -183,7 +183,6 @@ public class FragmentIdentities extends FragmentBase {
animator = Helper.getFabAnimator(fab, getViewLifecycleOwner());
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);

@ -577,7 +577,6 @@ public class FragmentIdentity extends FragmentBase {
// Initialize
Helper.setViewsEnabled(view, false);
FragmentDialogTheme.setBackground(getContext(), view, false);
btnAutoConfig.setEnabled(false);
pbAutoConfig.setVisibility(View.GONE);

@ -19,6 +19,7 @@ package eu.faircode.email;
Copyright 2018-2024 by Marcel Bokhorst (M66B)
*/
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -71,8 +72,6 @@ public class FragmentLegend extends FragmentBase {
}
}
FragmentDialogTheme.setBackground(getContext(), view, false);
return view;
}
@ -82,7 +81,10 @@ public class FragmentLegend extends FragmentBase {
layout = savedInstanceState.getInt("fair:layout");
if (layout < 0) {
final Context context = getContext();
TabLayout tabLayout = view.findViewById(R.id.tab_layout);
tabLayout.setBackgroundColor(Helper.resolveColor(context, R.attr.colorCardBackground));
tabLayout.setupWithViewPager(pager);
Bundle args = getArguments();

@ -1998,7 +1998,6 @@ public class FragmentMessages extends FragmentBase
setBackPressedCallback(backPressedCallback);
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
grpAirplane.setVisibility(View.GONE);
grpNotifications.setVisibility(View.GONE);
grpBatteryOptimizations.setVisibility(View.GONE);

@ -256,10 +256,12 @@ public class FragmentOptions extends FragmentBase {
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
final Context context = getContext();
TabLayout tabLayout = view.findViewById(R.id.tab_layout);
tabLayout.setBackgroundColor(Helper.resolveColor(context, R.attr.colorCardBackground));
tabLayout.setupWithViewPager(pager);
final Context context = getContext();
int colorAccent = Helper.resolveColor(context, androidx.appcompat.R.attr.colorAccent);
for (int i = 0; i < tabLayout.getTabCount(); i++) {
Drawable d = ContextCompat.getDrawable(context, PAGE_ICONS[i]);

@ -284,7 +284,6 @@ public class FragmentOptionsBackup extends FragmentBase implements SharedPrefere
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
Helper.linkPro(tvExportPro);
cardCloud.setVisibility(!BuildConfig.PLAY_STORE_RELEASE &&
!TextUtils.isEmpty(BuildConfig.CLOUD_URI)

@ -635,8 +635,6 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
return view;

@ -643,7 +643,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
tvNetworkMetered.setVisibility(View.GONE);
tvNetworkRoaming.setVisibility(View.GONE);
grpCustomDns.setVisibility(debug || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);

@ -1467,7 +1467,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
swFaviconsPartial.setText(getString(R.string.title_advanced_favicons_partial,
Helper.humanReadableByteCount(ContactInfo.FAVICON_READ_BYTES, false)));
grpAvatar.setVisibility(BuildConfig.PLAY_STORE_RELEASE ? View.GONE : View.VISIBLE);

@ -478,8 +478,6 @@ public class FragmentOptionsEncryption extends FragmentBase
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
boolean debug = prefs.getBoolean("debug", false);
cardDebug.setVisibility(debug || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);

@ -689,8 +689,6 @@ public class FragmentOptionsIntegrations extends FragmentBase implements SharedP
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
cardVirusTotal.setVisibility(BuildConfig.PLAY_STORE_RELEASE ? View.GONE : View.VISIBLE);
cardSend.setVisibility(BuildConfig.PLAY_STORE_RELEASE ? View.GONE : View.VISIBLE);
cardOpenAi.setVisibility(TextUtils.isEmpty(BuildConfig.OPENAI_ENDPOINT) ? View.GONE : View.VISIBLE);

@ -2007,8 +2007,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
swPowerMenu.setVisibility(!BuildConfig.PLAY_STORE_RELEASE &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R
? View.VISIBLE : View.GONE);

@ -748,8 +748,6 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
swNotifyTransliterate.setVisibility(TextHelper.canTransliterate() ? View.VISIBLE : View.GONE);
swUnseenIgnored.setVisibility(Helper.isXiaomi() ? View.GONE : View.VISIBLE);
swAlertOnce.setVisibility(Helper.isXiaomi() || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);

@ -599,8 +599,6 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
StringBuilder sb = new StringBuilder();
for (String value : EmailService.getId(getContext()).values()) {
if (sb.length() > 0)

@ -796,8 +796,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
String re1 = getString(R.string.title_subject_reply, "");
String re2 = getString(R.string.title_subject_reply_alt, "");
((RadioButton) view.findViewById(R.id.rbRe1)).setText(re1);

@ -573,8 +573,6 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
rvBlocklist.setAdapter(badapter);
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
swOutlookThread.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
tvSubjectThreading.setText(getString(R.string.title_advanced_subject_threading_hint, MessageHelper.MAX_SUBJECT_AGE));

@ -363,7 +363,6 @@ public class FragmentPop extends FragmentBase {
// Initialize
Helper.setViewsEnabled(view, false);
FragmentDialogTheme.setBackground(getContext(), view, false);
if (!DnsHelper.hasDnsSec()) {
Helper.hide(cbDnsSec);

@ -233,8 +233,6 @@ public class FragmentRules extends FragmentBase {
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);

@ -865,8 +865,6 @@ public class FragmentSetup extends FragmentBase implements SharedPreferences.OnS
});
// Initialize
FragmentDialogTheme.setBackground(getContext(), view, false);
tvNoInternet.setVisibility(View.GONE);
btnIdentity.setEnabled(false);
tvNoComposable.setVisibility(View.GONE);

Loading…
Cancel
Save