Replacements

This commit is contained in:
Thomas 2022-11-28 17:06:27 +01:00
parent 216887800b
commit 11ea166a0d
8 changed files with 29 additions and 11 deletions

View File

@ -139,6 +139,7 @@ import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;
import app.fedilab.android.helper.PinnedTimelineHelper;
import app.fedilab.android.helper.PushHelper;
import app.fedilab.android.helper.ThemeHelper;
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonConversation;
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
import app.fedilab.android.ui.fragment.timeline.FragmentNotificationContainer;
@ -301,7 +302,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
} else {
BaseMainActivity.currentToken = sharedpreferences.getString(Helper.PREF_USER_TOKEN, null);
}
ThemeHelper.initiliazeColors(BaseMainActivity.this);
mamageNewIntent(getIntent());
filterFetched = false;

View File

@ -60,6 +60,19 @@ public class ThemeHelper {
return typedValue.data;
}
public static void initiliazeColors(Activity activity) {
TypedValue typedValue = new TypedValue();
Resources.Theme theme = activity.getTheme();
theme.resolveAttribute(R.attr.linkColor, typedValue, true);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
linkColor = -1;
if (prefs.getBoolean("use_custom_theme", false)) {
linkColor = prefs.getInt("theme_link_color", -1);
}
if (linkColor == -1) {
linkColor = typedValue.data;
}
}
public static int fetchAccentColor(Context context) {
TypedValue typedValue = new TypedValue();

View File

@ -19,7 +19,8 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?backgroundColor"
android:background="?android:windowBackground"
android:orientation="vertical"
android:padding="12dp"
tools:context=".activities.LoginActivity">

View File

@ -17,7 +17,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="?backgroundColor"
android:background="?android:windowBackground"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatImageButton

View File

@ -17,7 +17,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?backgroundColor"
android:background="?android:windowBackground"
android:orientation="vertical"
android:padding="12dp">

View File

@ -18,7 +18,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?backgroundColor"
android:background="?android:windowBackground"
android:orientation="vertical"
android:padding="12dp">

View File

@ -16,8 +16,10 @@
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?android:windowBackground"
android:layout_height="match_parent">
<!-- Listview status -->
@ -98,9 +100,9 @@
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/fab_margin"
android:contentDescription="@string/create_domain_block"
android:src="@drawable/ic_baseline_add_24"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="ContentDescription" />
</RelativeLayout>

View File

@ -1,4 +1,5 @@
<resources>
<attr name="linkColor" type="color" />
<style name="AppTheme" parent="Theme.Material3.Light.NoActionBar">
<item name="colorPrimary">@color/deep_purple_700</item>
@ -9,7 +10,7 @@
<item name="colorSecondaryVariant">@color/indigo_900</item>
<item name="colorOnSecondary">@color/white</item>
<item name="linkColor">@color/light_link_toot</item>
<item name="colorError">@color/red_900</item>
<item name="windowNoTitle">true</item>
@ -31,7 +32,7 @@
<item name="colorSecondary">@color/indigo_700</item>
<item name="colorSecondaryVariant">@color/indigo_900</item>
<item name="colorOnSecondary">@color/indigo_600</item>
<item name="linkColor">@color/dark_link_toot</item>
<item name="colorError">@color/red_900</item>
<item name="windowNoTitle">true</item>
<!-- specify enter and exit transitions -->
@ -52,7 +53,7 @@
<item name="colorPrimary">@color/deep_purple_700</item>
<item name="colorPrimaryVariant">@color/deep_purple_900</item>
<item name="colorOnPrimary">@color/white</item>
<item name="linkColor">@color/light_link_toot</item>
<item name="colorSecondary">@color/indigo_700</item>
<item name="colorSecondaryVariant">@color/indigo_900</item>
<item name="colorOnSecondary">@color/white</item>
@ -66,7 +67,7 @@
<item name="colorPrimary">@color/deep_purple_700</item>
<item name="colorPrimaryVariant">@color/deep_purple_900</item>
<item name="colorOnPrimary">@color/white</item>
<item name="linkColor">@color/dark_link_toot</item>
<item name="colorSecondary">@color/indigo_700</item>
<item name="colorSecondaryVariant">@color/indigo_900</item>
<item name="colorOnSecondary">@color/white</item>