mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-01-07 00:20:08 +02:00
Some fixes with the theme
This commit is contained in:
parent
5fdb654aa2
commit
c2c780f58e
5 changed files with 37 additions and 9 deletions
|
@ -38,6 +38,8 @@ import app.fedilab.android.helper.ThemeHelper;
|
||||||
@SuppressLint("Registered")
|
@SuppressLint("Registered")
|
||||||
public class BaseActivity extends AppCompatActivity {
|
public class BaseActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
public static int currentThemeId;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Helper.installProvider();
|
Helper.installProvider();
|
||||||
EmojiManager.install(new EmojiOneProvider());
|
EmojiManager.install(new EmojiOneProvider());
|
||||||
|
@ -58,9 +60,11 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
switch (defaultLight) {
|
switch (defaultLight) {
|
||||||
case "LIGHT":
|
case "LIGHT":
|
||||||
setTheme(R.style.AppTheme);
|
setTheme(R.style.AppTheme);
|
||||||
|
currentThemeId = R.style.AppTheme;
|
||||||
break;
|
break;
|
||||||
case "SOLARIZED_LIGHT":
|
case "SOLARIZED_LIGHT":
|
||||||
setTheme(R.style.SolarizedAppTheme);
|
setTheme(R.style.SolarizedAppTheme);
|
||||||
|
currentThemeId = R.style.SolarizedAppTheme;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -69,12 +73,15 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
switch (defaultDark) {
|
switch (defaultDark) {
|
||||||
case "DARK":
|
case "DARK":
|
||||||
setTheme(R.style.AppTheme);
|
setTheme(R.style.AppTheme);
|
||||||
|
currentThemeId = R.style.AppTheme;
|
||||||
break;
|
break;
|
||||||
case "SOLARIZED_DARK":
|
case "SOLARIZED_DARK":
|
||||||
setTheme(R.style.SolarizedAppTheme);
|
setTheme(R.style.SolarizedAppTheme);
|
||||||
|
currentThemeId = R.style.SolarizedAppTheme;
|
||||||
break;
|
break;
|
||||||
case "BLACK":
|
case "BLACK":
|
||||||
setTheme(R.style.BlackAppTheme);
|
setTheme(R.style.BlackAppTheme);
|
||||||
|
currentThemeId = R.style.BlackAppTheme;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -84,22 +91,27 @@ public class BaseActivity extends AppCompatActivity {
|
||||||
case "LIGHT":
|
case "LIGHT":
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
setTheme(R.style.AppTheme);
|
setTheme(R.style.AppTheme);
|
||||||
|
currentThemeId = R.style.AppTheme;
|
||||||
break;
|
break;
|
||||||
case "DARK":
|
case "DARK":
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
setTheme(R.style.AppTheme);
|
setTheme(R.style.AppTheme);
|
||||||
|
currentThemeId = R.style.AppTheme;
|
||||||
break;
|
break;
|
||||||
case "SOLARIZED_LIGHT":
|
case "SOLARIZED_LIGHT":
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||||
setTheme(R.style.SolarizedAppTheme);
|
setTheme(R.style.SolarizedAppTheme);
|
||||||
|
currentThemeId = R.style.SolarizedAppTheme;
|
||||||
break;
|
break;
|
||||||
case "SOLARIZED_DARK":
|
case "SOLARIZED_DARK":
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
setTheme(R.style.SolarizedAppTheme);
|
setTheme(R.style.SolarizedAppTheme);
|
||||||
|
currentThemeId = R.style.SolarizedAppTheme;
|
||||||
break;
|
break;
|
||||||
case "BLACK":
|
case "BLACK":
|
||||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||||
setTheme(R.style.BlackAppTheme);
|
setTheme(R.style.BlackAppTheme);
|
||||||
|
currentThemeId = R.style.BlackAppTheme;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ package app.fedilab.android.helper;
|
||||||
|
|
||||||
import static android.content.Context.DOWNLOAD_SERVICE;
|
import static android.content.Context.DOWNLOAD_SERVICE;
|
||||||
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||||
|
import static app.fedilab.android.activities.BaseActivity.currentThemeId;
|
||||||
import static app.fedilab.android.helper.LogoHelper.getNotificationIcon;
|
import static app.fedilab.android.helper.LogoHelper.getNotificationIcon;
|
||||||
import static app.fedilab.android.webview.ProxyHelper.setProxy;
|
import static app.fedilab.android.webview.ProxyHelper.setProxy;
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
@ -1984,6 +1986,19 @@ public class Helper {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int dialogStyle() {
|
||||||
|
PackageInfo packageInfo = null;
|
||||||
|
if (R.style.AppThemeBar == currentThemeId || R.style.AppTheme == currentThemeId) {
|
||||||
|
return R.style.AppThemeAlertDialog;
|
||||||
|
} else if (R.style.SolarizedAppThemeBar == currentThemeId || R.style.SolarizedAppTheme == currentThemeId) {
|
||||||
|
return R.style.SolarizedAlertDialog;
|
||||||
|
} else if (R.style.BlackAppThemeBar == currentThemeId || R.style.BlackAppTheme == currentThemeId) {
|
||||||
|
return R.style.BlackAlertDialog;
|
||||||
|
}
|
||||||
|
return R.style.AppTheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Enum that described actions to replace inside a toot content
|
//Enum that described actions to replace inside a toot content
|
||||||
public enum PatternType {
|
public enum PatternType {
|
||||||
MENTION,
|
MENTION,
|
||||||
|
|
|
@ -43,6 +43,7 @@ import app.fedilab.android.BaseMainActivity;
|
||||||
import app.fedilab.android.R;
|
import app.fedilab.android.R;
|
||||||
import app.fedilab.android.databinding.FragmentNotificationContainerBinding;
|
import app.fedilab.android.databinding.FragmentNotificationContainerBinding;
|
||||||
import app.fedilab.android.databinding.PopupNotificationSettingsBinding;
|
import app.fedilab.android.databinding.PopupNotificationSettingsBinding;
|
||||||
|
import app.fedilab.android.helper.Helper;
|
||||||
import app.fedilab.android.ui.pageadapter.FedilabNotificationPageAdapter;
|
import app.fedilab.android.ui.pageadapter.FedilabNotificationPageAdapter;
|
||||||
import app.fedilab.android.viewmodel.mastodon.NotificationsVM;
|
import app.fedilab.android.viewmodel.mastodon.NotificationsVM;
|
||||||
import es.dmoral.toasty.Toasty;
|
import es.dmoral.toasty.Toasty;
|
||||||
|
@ -85,13 +86,13 @@ public class FragmentNotificationContainer extends Fragment {
|
||||||
}
|
}
|
||||||
AtomicBoolean changes = new AtomicBoolean(false);
|
AtomicBoolean changes = new AtomicBoolean(false);
|
||||||
binding.settings.setOnClickListener(v -> {
|
binding.settings.setOnClickListener(v -> {
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireActivity());
|
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(requireActivity(), Helper.dialogStyle());
|
||||||
PopupNotificationSettingsBinding dialogView = PopupNotificationSettingsBinding.inflate(getLayoutInflater());
|
PopupNotificationSettingsBinding dialogView = PopupNotificationSettingsBinding.inflate(getLayoutInflater());
|
||||||
dialogBuilder.setView(dialogView.getRoot());
|
dialogBuilder.setView(dialogView.getRoot());
|
||||||
|
|
||||||
|
|
||||||
dialogView.clearAllNotif.setOnClickListener(v1 -> {
|
dialogView.clearAllNotif.setOnClickListener(v1 -> {
|
||||||
AlertDialog.Builder db = new AlertDialog.Builder(requireActivity());
|
AlertDialog.Builder db = new AlertDialog.Builder(requireActivity(), Helper.dialogStyle());
|
||||||
db.setTitle(R.string.delete_notification_ask_all);
|
db.setTitle(R.string.delete_notification_ask_all);
|
||||||
db.setMessage(R.string.delete_notification_all_warning);
|
db.setMessage(R.string.delete_notification_all_warning);
|
||||||
db.setPositiveButton(R.string.delete_all, (dialog, id) -> {
|
db.setPositiveButton(R.string.delete_all, (dialog, id) -> {
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical">
|
||||||
android:padding="@dimen/fab_margin">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycler_view"
|
android:id="@+id/recycler_view"
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?colorSurface"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
@ -33,14 +34,14 @@
|
||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:tabMaxWidth="0dp" />
|
app:tabMaxWidth="0dp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/settings"
|
android:id="@+id/settings"
|
||||||
style="@style/Widget.AppCompat.Button.Borderless.Colored"
|
style="@style/Widget.Material3.Button.OutlinedButton.Icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="48dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="48dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:minWidth="48dp"
|
android:minWidth="48dp"
|
||||||
android:src="@drawable/ic_more" />
|
app:icon="@drawable/ic_more" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue