diff --git a/app/src/main/java/app/fedilab/android/MainApplication.java b/app/src/main/java/app/fedilab/android/MainApplication.java index 334b693d..a54a1fc5 100644 --- a/app/src/main/java/app/fedilab/android/MainApplication.java +++ b/app/src/main/java/app/fedilab/android/MainApplication.java @@ -61,9 +61,9 @@ public class MainApplication extends MultiDexApplication { List list = CyaneaTheme.Companion.from(getAssets(), "themes/cyanea_themes.json"); int theme = sharedpreferences.getInt(getString(R.string.SET_THEME), 0); boolean custom_theme = sharedpreferences.getBoolean("use_custom_theme", false); - if (!custom_theme) { + /*if (!custom_theme) { list.get(theme).apply(Cyanea.getInstance()); - } + }*/ StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); diff --git a/app/src/main/java/app/fedilab/android/helper/ThemeHelper.java b/app/src/main/java/app/fedilab/android/helper/ThemeHelper.java index 6ef95e3e..a056c067 100644 --- a/app/src/main/java/app/fedilab/android/helper/ThemeHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/ThemeHelper.java @@ -101,6 +101,14 @@ public class ThemeHelper { } } + public static int getBackgroundColor(Context context) { + if (Cyanea.getInstance().isDark()) { + return ContextCompat.getColor(context, R.color.cyanea_background_dark); + } else { + return ContextCompat.getColor(context, R.color.cyanea_background_light); + } + } + public static void applyThemeBar(BaseActivity activity) { if (Cyanea.getInstance().isDark()) { activity.setTheme(R.style.AppThemeBarDark); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonAccount.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonAccount.java index ffdf5e53..add5ca2a 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonAccount.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonAccount.java @@ -40,6 +40,7 @@ import app.fedilab.android.client.mastodon.entities.RelationShip; import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.MastodonHelper; +import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.ui.drawer.AccountAdapter; import app.fedilab.android.ui.pageadapter.FedilabProfileTLPageAdapter; import app.fedilab.android.viewmodel.mastodon.AccountsVM; @@ -70,7 +71,7 @@ public class FragmentMastodonAccount extends Fragment { viewModelKey = getArguments().getString(Helper.ARG_VIEW_MODEL_KEY, ""); timelineType = (Timeline.TimeLineEnum) getArguments().get(Helper.ARG_TIMELINE_TYPE); } - + binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity())); flagLoading = false; binding = FragmentPaginationBinding.inflate(inflater, container, false); return binding.getRoot(); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java index 74d07af9..454647f0 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonContext.java @@ -36,6 +36,7 @@ import app.fedilab.android.client.mastodon.entities.Status; import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.helper.DividerDecoration; import app.fedilab.android.helper.Helper; +import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.ui.drawer.StatusAdapter; import app.fedilab.android.viewmodel.mastodon.StatusesVM; @@ -68,7 +69,7 @@ public class FragmentMastodonContext extends Fragment { binding.swipeContainer.setColorSchemeColors( c1, c1, c1 ); - + binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity())); statusesVM = new ViewModelProvider(FragmentMastodonContext.this).get(StatusesVM.class); binding.recyclerView.setNestedScrollingEnabled(true); this.statuses = new ArrayList<>(); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonConversation.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonConversation.java index 4235fda6..dce28eeb 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonConversation.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonConversation.java @@ -36,6 +36,7 @@ import app.fedilab.android.client.mastodon.entities.Conversation; import app.fedilab.android.client.mastodon.entities.Conversations; import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.helper.MastodonHelper; +import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.ui.drawer.ConversationAdapter; import app.fedilab.android.viewmodel.mastodon.TimelinesVM; @@ -56,6 +57,7 @@ public class FragmentMastodonConversation extends Fragment { currentFragment = this; flagLoading = false; binding = FragmentPaginationBinding.inflate(inflater, container, false); + binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity())); return binding.getRoot(); } diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java index 63ed9293..c47f77a9 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java @@ -40,6 +40,7 @@ import app.fedilab.android.client.mastodon.entities.Notifications; import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.MastodonHelper; +import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.ui.drawer.NotificationAdapter; import app.fedilab.android.viewmodel.mastodon.NotificationsVM; @@ -67,6 +68,7 @@ public class FragmentMastodonNotification extends Fragment { if (getArguments() != null) { notificationType = (NotificationTypeEnum) getArguments().get(Helper.ARG_NOTIFICATION_TYPE); } + binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity())); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); String excludedCategories = sharedpreferences.getString(getString(R.string.SET_EXCLUDED_NOTIFICATIONS_TYPE) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance, null); int c1 = getResources().getColor(R.color.cyanea_accent_reference); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTag.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTag.java index 65836ef7..2e7d5bf6 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTag.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTag.java @@ -34,6 +34,7 @@ import app.fedilab.android.client.mastodon.entities.Tag; import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.MastodonHelper; +import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.ui.drawer.TagAdapter; import app.fedilab.android.viewmodel.mastodon.SearchVM; @@ -52,6 +53,7 @@ public class FragmentMastodonTag extends Fragment { } binding = FragmentPaginationBinding.inflate(inflater, container, false); + binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity())); return binding.getRoot(); } diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java index fc1c794c..2c02cf8d 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java @@ -51,6 +51,7 @@ import app.fedilab.android.client.mastodon.entities.Statuses; import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.MastodonHelper; +import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.ui.drawer.StatusAdapter; import app.fedilab.android.viewmodel.mastodon.AccountsVM; import app.fedilab.android.viewmodel.mastodon.SearchVM; @@ -162,6 +163,7 @@ public class FragmentMastodonTimeline extends Fragment { } LocalBroadcastManager.getInstance(requireActivity()).registerReceiver(receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION)); binding = FragmentPaginationBinding.inflate(inflater, container, false); + binding.getRoot().setBackgroundColor(ThemeHelper.getBackgroundColor(requireActivity())); return binding.getRoot(); } diff --git a/app/src/main/res/layout/fragment_pagination.xml b/app/src/main/res/layout/fragment_pagination.xml index a294b7af..9deee798 100644 --- a/app/src/main/res/layout/fragment_pagination.xml +++ b/app/src/main/res/layout/fragment_pagination.xml @@ -15,7 +15,7 @@ see . --> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index b50136e1..27c38586 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -5,7 +5,7 @@ 8dp 176dp 16dp - 12dp + 6dp 2dp 10dp false