Fix pinned

This commit is contained in:
tom79 2019-11-10 19:20:44 +01:00
parent 615c9dd4ec
commit 9c2156385b
33 changed files with 100 additions and 33 deletions

View File

@ -19,9 +19,11 @@ import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.StrictMode;
import android.util.Log;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;
import androidx.preference.PreferenceManager;
import com.evernote.android.job.JobManager;
import com.franmontiel.localechanger.LocaleChanger;
@ -89,7 +91,21 @@ public class MainApplication extends MultiDexApplication {
} else {
list.get(1).apply(Cyanea.getInstance());
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
int accent = prefs.getInt("theme_accent", -1);
int primary = prefs.getInt("theme_primary", -1);
int pref_color_background = prefs.getInt("pref_color_background", -1);
boolean pref_color_navigation_bar = prefs.getBoolean("pref_color_navigation_bar", true);
if( primary != -1 ) {
Cyanea.getInstance().edit().primary(primary).apply();
}
if( accent != -1){
Cyanea.getInstance().edit().accent(accent).apply();
}
if( pref_color_background != -1){
Cyanea.getInstance().edit().background(pref_color_background).apply();
}
Cyanea.getInstance().edit().shouldTintNavBar(pref_color_navigation_bar).apply();
ApplicationJob.cancelAllJob(BackupStatusesSyncJob.BACKUP_SYNC);
BackupStatusesSyncJob.schedule(false);

View File

@ -9,6 +9,11 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
import com.jaredrummler.cyanea.Cyanea;
import com.jaredrummler.cyanea.prefs.CyaneaTheme;
import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.helper.Helper;
@ -47,6 +52,10 @@ public class ColorSettingsFragment extends PreferenceFragmentCompat {
editor.remove("theme_link_color");
editor.remove("theme_icons_color");
editor.remove("theme_background_color");
editor.remove("pref_color_background");
editor.remove("pref_color_navigation_bar");
editor.remove("theme_accent");
editor.remove("theme_primary");
editor.commit();
dialog.dismiss();
setPreferenceScreen(null);

View File

@ -1,4 +1,4 @@
<vector android:height="24dp" android:tint="#14161B"
<vector android:height="24dp" android:tint="#FFFFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFFFF" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>

View File

@ -4,6 +4,6 @@
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="?attr/iconColorMenu"
android:fillColor="#FFFFFF"
android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z" />
</vector>

View File

@ -549,7 +549,7 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/account_tabLayout"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
android:layout_height="wrap_content"
app:tabMode="fixed"

View File

@ -32,7 +32,7 @@
android:id="@+id/admin_tablayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
app:tabMode="fixed"
app:tabGravity="fill" />

View File

@ -36,7 +36,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
/>
</com.google.android.material.appbar.AppBarLayout>

View File

@ -36,7 +36,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
/>
</com.google.android.material.appbar.AppBarLayout>

View File

@ -38,7 +38,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
/>
</com.google.android.material.appbar.AppBarLayout>

View File

@ -38,7 +38,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
>
@ -70,7 +70,7 @@
android:layout_width="0dp"
android:layout_weight="1"
app:tabGravity="fill"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
app:tabMaxWidth="0dp"
android:layout_height="wrap_content" />

View File

@ -21,7 +21,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
/>
</com.google.android.material.appbar.AppBarLayout>

View File

@ -21,7 +21,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
/>
</com.google.android.material.appbar.AppBarLayout>

View File

@ -38,7 +38,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
/>
</com.google.android.material.appbar.AppBarLayout>

View File

@ -27,7 +27,7 @@
android:id="@+id/search_tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
app:tabMode="fixed"
app:tabGravity="fill" />

View File

@ -12,7 +12,7 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/settings_tablayout"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
android:layout_height="wrap_content"
app:tabMode="scrollable"

View File

@ -558,7 +558,7 @@
android:id="@+id/account_tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
app:tabMode="fixed"
app:tabGravity="fill" />

View File

@ -20,7 +20,7 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
>
<include layout="@layout/conversation_action_bar"/>

View File

@ -27,7 +27,7 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabSelectedTextColor="?colorAccent"

View File

@ -37,12 +37,12 @@
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
/>
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:paddingLeft="@dimen/fab_margin"
android:paddingRight="@dimen/fab_margin"

View File

@ -28,7 +28,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">

View File

@ -28,7 +28,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<ImageView

View File

@ -28,7 +28,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<ImageView

View File

@ -29,7 +29,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<ImageView

View File

@ -28,7 +28,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<ImageView

View File

@ -28,7 +28,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<ImageView

View File

@ -28,7 +28,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<LinearLayout

View File

@ -28,7 +28,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<LinearLayout

View File

@ -25,7 +25,7 @@
android:id="@+id/tabLayout"
android:layout_width="match_parent"
app:tabGravity="fill"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
app:tabMaxWidth="0dp"
android:layout_height="wrap_content" />

View File

@ -24,7 +24,7 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
app:tabGravity="fill"
app:tabMaxWidth="0dp"

View File

@ -22,7 +22,7 @@
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
app:tabSelectedTextColor="?colorAccent"
android:layout_width="match_parent"
app:tabGravity="fill"

View File

@ -28,7 +28,7 @@
app:contentInsetEnd="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:background="?colorPrimary"
tools:ignore="UnusedAttribute">
<ImageView

View File

@ -1267,4 +1267,6 @@
<string name="make_an_action">Make an action</string>
<string name="translation">Translation</string>
<string name="image_preview">Image preview</string>
<string name="change_theme">Change the theme</string>
</resources>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
app:iconSpaceReserved="false"
android:defaultValue="-1"
@ -36,6 +37,45 @@
android:key="theme_background_color"
android:title="@string/background_color_title"
android:summary="@string/background_color"/>
<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
app:iconSpaceReserved="false"
android:defaultValue="-1"
android:key="theme_primary"
android:summary="@string/pref_primary_color_summary"
android:title="@string/pref_primary_color_title"
app:cpv_dialogTitle="@string/pref_primary_color_title"/>
<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
app:iconSpaceReserved="false"
android:defaultValue="-1"
android:key="theme_accent"
android:summary="@string/pref_accent_color_summary"
android:title="@string/pref_accent_color_title"
app:cpv_dialogTitle="@string/pref_accent_color_title"/>
<androidx.preference.SwitchPreferenceCompat
app:iconSpaceReserved="false"
android:defaultValue="@bool/should_tint_nav_bar"
android:key="pref_color_navigation_bar"
android:summary="@string/pref_colored_navigation_bar_summary"
android:title="@string/pref_colored_navigation_bar_title"
/>
<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
app:iconSpaceReserved="false"
android:defaultValue="@color/cyanea_background_light"
android:key="pref_color_background"
android:summary="@string/pref_background_color_summary"
android:title="@string/pref_background_color_title"
app:cpv_colorPresets="@array/cyanea_background_color_presets"
app:cpv_dialogTitle="@string/pref_background_color_title"
app:cpv_showColorShades="false"
tools:ignore="PrivateResource"/>
<Preference android:title="@string/reset_color"
app:iconSpaceReserved="false"
android:id="@+id/resetButton"