1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-22 21:16:57 +00:00

Initial commit for updated flow of themes. (Check description)

Removed DayNight theme. Added a 'white' theme for Light, and 'black' theme for Dark.
Users will have to set the type of Light or Dark theme they want to use.
Default is white for light, black for dark.
More themes will be added later.
This commit is contained in:
Ammar Githam 2020-09-13 19:21:14 +09:00
parent fb20deb9ee
commit ebdaae94d1
26 changed files with 372 additions and 114 deletions

View File

@ -15,7 +15,7 @@
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:theme="@style/AppTheme.Light.White"
tools:ignore="UnusedAttribute">
<activity
android:name=".activities.MainActivity"

View File

@ -6,7 +6,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import awais.instagrabber.utils.LocaleUtils;
import awais.instagrabber.utils.Utils;
import awais.instagrabber.utils.ThemeUtils;
public abstract class BaseLanguageActivity extends AppCompatActivity {
protected BaseLanguageActivity() {
@ -15,7 +15,7 @@ public abstract class BaseLanguageActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
Utils.changeTheme(getApplicationContext());
super.onCreate(savedInstanceState);
ThemeUtils.changeTheme(this);
}
}

View File

@ -90,7 +90,8 @@ public class MainActivity extends BaseLanguageActivity {
R.id.commentsViewerFragment,
R.id.followViewerFragment,
R.id.directMessagesSettingsFragment,
R.id.notificationsViewer);
R.id.notificationsViewer,
R.id.themePreferencesFragment);
private static final Map<Integer, Integer> NAV_TO_MENU_ID_MAP = new HashMap<>();
private static final List<Integer> REMOVE_COLLAPSING_TOOLBAR_SCROLL_DESTINATIONS = Collections.singletonList(R.id.commentsViewerFragment);
private static final String FIRST_FRAGMENT_GRAPH_INDEX_KEY = "firstFragmentGraphIndex";

View File

@ -725,7 +725,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
if (context == null) return;
new AlertDialog.Builder(context)
.setItems(options, profileDialogListener)
.setNeutralButton(R.string.cancel, null)
.setNegativeButton(R.string.cancel, null)
.show();
});
}

View File

@ -4,10 +4,13 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
import awais.instagrabber.R;
import awais.instagrabber.activities.MainActivity;
import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.LocaleUtils;
@ -44,4 +47,11 @@ public abstract class BasePreferencesFragment extends PreferenceFragmentCompat i
shouldRecreate = false;
activity.recreate();
}
@NonNull
protected Preference getDivider(final Context context) {
final Preference divider = new Preference(context);
divider.setLayoutResource(R.layout.item_pref_divider);
return divider;
}
}

View File

@ -119,9 +119,7 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
});
generalCategory.addPreference(aboutPreference);
final Preference divider = new Preference(context);
divider.setLayoutResource(R.layout.item_pref_divider);
screen.addPreference(divider);
screen.addPreference(getDivider(context));
final Preference versionPreference = getPreference(R.string.version,
BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")", -1, preference -> {
@ -129,6 +127,7 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
return true;
});
screen.addPreference(versionPreference);
screen.addPreference(getDivider(context));
final Preference reminderPreference = getPreference(R.string.reminder, R.string.reminder_summary, R.drawable.ic_warning, null);
reminderPreference.setSelectable(false);

View File

@ -4,9 +4,11 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.fragment.app.FragmentActivity;
import androidx.navigation.NavDirections;
import androidx.navigation.fragment.NavHostFragment;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
@ -46,17 +48,18 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
screen.addPreference(generalCategory);
generalCategory.setTitle(R.string.pref_category_general);
generalCategory.setIconSpaceReserved(false);
generalCategory.addPreference(getThemePreference(context));
generalCategory.addPreference(getDefaultTabPreference());
generalCategory.addPreference(getUpdateCheckPreference());
generalCategory.addPreference(getAutoPlayVideosPreference());
generalCategory.addPreference(getAlwaysMuteVideosPreference());
final PreferenceCategory themeCategory = new PreferenceCategory(context);
screen.addPreference(themeCategory);
themeCategory.setTitle(R.string.pref_category_theme);
themeCategory.setIconSpaceReserved(false);
themeCategory.addPreference(getThemePreference());
themeCategory.addPreference(getAmoledThemePreference());
// screen.addPreference(getDivider(context));
// final PreferenceCategory themeCategory = new PreferenceCategory(context);
// screen.addPreference(themeCategory);
// themeCategory.setTitle(R.string.pref_category_theme);
// themeCategory.setIconSpaceReserved(false);
// themeCategory.addPreference(getAmoledThemePreference());
final PreferenceCategory downloadsCategory = new PreferenceCategory(context);
screen.addPreference(downloadsCategory);
@ -120,10 +123,6 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
final ListPreference preference = new ListPreference(context);
preference.setEnabled(isLoggedIn);
preference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
final FragmentActivity activity = getActivity();
if (activity == null) {
return preference;
}
final TypedArray mainNavIds = getResources().obtainTypedArray(R.array.main_nav_ids);
final int length = mainNavIds.length();
final String[] values = new String[length];
@ -152,39 +151,14 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
return preference;
}
private Preference getThemePreference() {
final Context context = getContext();
if (context == null) return null;
final ListPreference preference = new ListPreference(context);
preference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
final int length = getResources().getStringArray(R.array.theme_presets).length;
final String[] values = new String[length];
for (int i = 0; i < length; i++) {
values[i] = String.valueOf(i);
}
preference.setKey(Constants.APP_THEME);
preference.setTitle(R.string.theme_settings);
preference.setDialogTitle(R.string.theme_settings);
preference.setEntries(R.array.theme_presets);
private Preference getThemePreference(@NonNull final Context context) {
final Preference preference = new Preference(context);
preference.setTitle(R.string.pref_category_theme);
// preference.setIcon(R.drawable.ic_format_paint_24);
preference.setIconSpaceReserved(false);
preference.setEntryValues(values);
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
shouldRecreate();
return true;
});
return preference;
}
private SwitchPreferenceCompat getAmoledThemePreference() {
final Context context = getContext();
if (context == null) return null;
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
preference.setKey(Constants.AMOLED_THEME);
preference.setTitle(R.string.use_amoled_dark_theme);
preference.setIconSpaceReserved(false);
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
final boolean isNight = Utils.isNight(context, settingsHelper.getThemeCode(true));
if (isNight) shouldRecreate();
preference.setOnPreferenceClickListener(preference1 -> {
final NavDirections navDirections = SettingsPreferencesFragmentDirections.actionSettingsPreferencesFragmentToThemePreferencesFragment();
NavHostFragment.findNavController(this).navigate(navDirections);
return true;
});
return preference;

View File

@ -0,0 +1,94 @@
package awais.instagrabber.fragments.settings;
import android.content.Context;
import android.content.res.TypedArray;
import androidx.annotation.NonNull;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import awais.instagrabber.R;
import awais.instagrabber.utils.Constants;
public class ThemePreferencesFragment extends BasePreferencesFragment {
@Override
void setupPreferenceScreen(final PreferenceScreen screen) {
final Context context = getContext();
if (context == null) return;
screen.addPreference(getThemePreference(context));
screen.addPreference(getLightThemePreference(context));
screen.addPreference(getDarkThemePreference(context));
}
private Preference getThemePreference(@NonNull final Context context) {
final ListPreference preference = new ListPreference(context);
preference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
final int length = getResources().getStringArray(R.array.theme_presets).length;
final String[] values = new String[length];
for (int i = 0; i < length; i++) {
values[i] = String.valueOf(i);
}
preference.setKey(Constants.APP_THEME);
preference.setTitle(R.string.theme_settings);
preference.setDialogTitle(R.string.theme_settings);
preference.setEntries(R.array.theme_presets);
preference.setIconSpaceReserved(false);
preference.setEntryValues(values);
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
shouldRecreate();
return true;
});
return preference;
}
private Preference getLightThemePreference(final Context context) {
final ListPreference preference = new ListPreference(context);
preference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
final TypedArray lightThemeValues = getResources().obtainTypedArray(R.array.light_theme_values);
final int length = lightThemeValues.length();
final String[] values = new String[length];
for (int i = 0; i < length; i++) {
final int resourceId = lightThemeValues.getResourceId(i, -1);
if (resourceId < 0) continue;
values[i] = String.valueOf(resourceId);
}
lightThemeValues.recycle();
preference.setKey(Constants.PREF_LIGHT_THEME);
preference.setTitle(R.string.light_theme_settings);
preference.setDialogTitle(R.string.light_theme_settings);
preference.setEntries(R.array.light_themes);
preference.setIconSpaceReserved(false);
preference.setEntryValues(values);
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
shouldRecreate();
return true;
});
return preference;
}
private Preference getDarkThemePreference(final Context context) {
final ListPreference preference = new ListPreference(context);
preference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
final TypedArray darkThemeValues = getResources().obtainTypedArray(R.array.dark_theme_values);
final int length = darkThemeValues.length();
final String[] values = new String[length];
for (int i = 0; i < length; i++) {
final int resourceId = darkThemeValues.getResourceId(i, -1);
if (resourceId < 0) continue;
values[i] = String.valueOf(resourceId);
}
darkThemeValues.recycle();
preference.setKey(Constants.PREF_DARK_THEME);
preference.setTitle(R.string.dark_theme_settings);
preference.setDialogTitle(R.string.dark_theme_settings);
preference.setEntries(R.array.dark_themes);
preference.setIconSpaceReserved(false);
preference.setEntryValues(values);
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
shouldRecreate();
return true;
});
return preference;
}
}

View File

@ -24,7 +24,7 @@ public final class Constants {
public static final String INSTADP = "instadp";
// deprecated: public static final String STORIESIG = "storiesig";
public static final String STORY_VIEWER = "story_viewer";
public static final String AMOLED_THEME = "amoled_theme";
// deprecated: public static final String AMOLED_THEME = "amoled_theme";
public static final String CHECK_ACTIVITY = "check_activity";
public static final String CHECK_UPDATES = "check_updates";
// never Export
@ -79,4 +79,6 @@ public final class Constants {
public static final String NOTIF_GROUP_NAME = "awais.instagrabber.InstaNotif";
public static final int ACTIVITY_NOTIFICATION_ID = 1800000000;
public static final String ACTION_SHOW_ACTIVITY = "show_activity";
public static final String PREF_DARK_THEME = "dark_theme";
public static final String PREF_LIGHT_THEME = "light_theme";
}

View File

@ -8,7 +8,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.StringDef;
import androidx.appcompat.app.AppCompatDelegate;
import static awais.instagrabber.utils.Constants.AMOLED_THEME;
import static awais.instagrabber.utils.Constants.APP_LANGUAGE;
import static awais.instagrabber.utils.Constants.APP_THEME;
import static awais.instagrabber.utils.Constants.AUTOLOAD_POSTS;
@ -29,6 +28,8 @@ import static awais.instagrabber.utils.Constants.FOLDER_SAVE_TO;
import static awais.instagrabber.utils.Constants.INSTADP;
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
import static awais.instagrabber.utils.Constants.PREF_DARK_THEME;
import static awais.instagrabber.utils.Constants.PREF_LIGHT_THEME;
import static awais.instagrabber.utils.Constants.PREV_INSTALL_VERSION;
import static awais.instagrabber.utils.Constants.SHOW_QUICK_ACCESS_DIALOG;
import static awais.instagrabber.utils.Constants.SKIPPED_VERSION;
@ -116,10 +117,10 @@ public final class SettingsHelper {
public @interface StringSettings {}
@StringDef({DOWNLOAD_USER_FOLDER, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
AUTOLOAD_POSTS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, INSTADP,
AMOLED_THEME, CHECK_ACTIVITY, CHECK_UPDATES})
AUTOLOAD_POSTS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, INSTADP,
CHECK_ACTIVITY, CHECK_UPDATES})
public @interface BooleanSettings {}
@StringDef({PREV_INSTALL_VERSION})
@StringDef({PREV_INSTALL_VERSION, PREF_DARK_THEME, PREF_LIGHT_THEME})
public @interface IntegerSettings {}
}

View File

@ -0,0 +1,50 @@
package awais.instagrabber.utils;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatDelegate;
import awais.instagrabber.R;
import static awais.instagrabber.utils.Utils.settingsHelper;
public final class ThemeUtils {
private static final String TAG = "ThemeUtils";
public static void changeTheme(@NonNull final Context context) {
int themeCode = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; // this is fallback / default
if (settingsHelper != null) themeCode = settingsHelper.getThemeCode(false);
if (themeCode == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM && Build.VERSION.SDK_INT < 29) {
themeCode = AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
}
final boolean isNight = isNight(context, themeCode);
final int themeResId = isNight ? settingsHelper.getInteger(Constants.PREF_DARK_THEME)
: settingsHelper.getInteger(Constants.PREF_LIGHT_THEME);
final int finalThemeResId;
if (themeResId <= 0) {
// Nothing set in settings
finalThemeResId = isNight ? R.style.AppTheme_Dark_Black
: R.style.AppTheme_Light_White;
} else finalThemeResId = themeResId;
// Log.d(TAG, "changeTheme: finalThemeResId: " + finalThemeResId);
context.setTheme(finalThemeResId);
}
public static boolean isNight(final Context context, final int themeCode) {
// check if setting is set to 'Dark'
boolean isNight = themeCode == AppCompatDelegate.MODE_NIGHT_YES;
// if not dark check if themeCode is MODE_NIGHT_FOLLOW_SYSTEM or MODE_NIGHT_AUTO_BATTERY
if (!isNight && (themeCode == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM || themeCode == AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY)) {
// check if resulting theme would be NIGHT
final int uiMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
isNight = uiMode == Configuration.UI_MODE_NIGHT_YES;
}
return isNight;
}
}

View File

@ -64,39 +64,6 @@ public final class Utils {
return Math.round((dp * displayMetrics.densityDpi) / 160.0f);
}
public static void changeTheme(final Context context) {
int themeCode = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM; // this is fallback / default
if (settingsHelper != null) themeCode = settingsHelper.getThemeCode(false);
if (themeCode == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM && Build.VERSION.SDK_INT < 29)
themeCode = AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
boolean isAmoledEnabled = false;
if (settingsHelper != null) {
isAmoledEnabled = settingsHelper.getBoolean(Constants.AMOLED_THEME);
}
AppCompatDelegate.setDefaultNightMode(themeCode);
// use amoled theme only if enabled in settings
if (isAmoledEnabled && isNight(context, themeCode)) {
// set amoled theme
Log.d(TAG, "settings amoled theme");
context.setTheme(R.style.Theme_Amoled);
}
}
public static boolean isNight(final Context context, final int themeCode) {
// check if setting is set to 'Dark'
boolean isNight = themeCode == AppCompatDelegate.MODE_NIGHT_YES;
// if not dark check if themeCode is MODE_NIGHT_FOLLOW_SYSTEM or MODE_NIGHT_AUTO_BATTERY
if (!isNight && (themeCode == AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM || themeCode == AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY)) {
// check if resulting theme would be NIGHT
final int uiMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
isNight = uiMode == Configuration.UI_MODE_NIGHT_YES;
}
return isNight;
}
public static void setTooltipText(final View view, @StringRes final int tooltipTextRes) {
if (view != null && tooltipTextRes != 0 && tooltipTextRes != -1) {
final Context context = view.getContext();

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M18,4V3c0,-0.55 -0.45,-1 -1,-1H5c-0.55,0 -1,0.45 -1,1v4c0,0.55 0.45,1 1,1h12c0.55,0 1,-0.45 1,-1V6h1v4H9v11c0,0.55 0.45,1 1,1h2c0.55,0 1,-0.45 1,-1v-9h8V4h-3z" />
</vector>

View File

@ -1,6 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path

View File

@ -1,9 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z" />
</vector>

View File

@ -11,7 +11,7 @@
limitations under the License
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#1f000000" />
<solid android:color="@color/grey_600_a20" />
<size
android:width="1dp"
android:height="1dp" />

View File

@ -48,5 +48,5 @@
android:layout_gravity="end"
android:scaleType="fitCenter"
android:visibility="gone"
app:srcCompat="@drawable/ic_star" />
app:srcCompat="@drawable/ic_star_24" />
</FrameLayout>

View File

@ -2,4 +2,4 @@
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@drawable/preference_list_divider_material" />
android:background="@drawable/pref_list_divider_material" />

View File

@ -4,6 +4,9 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="8dp">
<com.facebook.drawee.view.SimpleDraweeView
@ -16,15 +19,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:roundAsCircle="true"
tools:src="@mipmap/ic_launcher" />
tools:background="@mipmap/ic_launcher" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvUsername"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:gravity="center_vertical"
android:paddingStart="4dp"
android:paddingLeft="4dp"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:paddingEnd="4dp"
android:paddingRight="4dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
@ -39,16 +42,17 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center_vertical"
android:paddingStart="4dp"
android:paddingLeft="4dp"
android:paddingEnd="4dp"
android:paddingRight="4dp"
tools:visibility="gone"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/ivProfilePic"
app:layout_constraintTop_toBottomOf="@id/tvUsername"
tools:text="full name" />
tools:text="full name"
tools:visibility="visible" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/isVerified"

View File

@ -13,6 +13,7 @@
android:id="@+id/profile_pic"
android:layout_width="@dimen/image_size_40"
android:layout_height="@dimen/image_size_40"
android:background="@android:color/transparent"
android:scaleType="centerCrop"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
@ -22,6 +23,7 @@
android:id="@+id/full_name"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@android:color/transparent"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingLeft="16dp"
@ -39,11 +41,13 @@
android:id="@+id/username"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@android:color/transparent"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingLeft="16dp"
android:paddingEnd="16dp"
android:paddingRight="16dp"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/arrow_down"
app:layout_constraintStart_toEndOf="@id/profile_pic"
@ -54,6 +58,7 @@
android:id="@+id/arrow_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:padding="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -51,7 +51,11 @@
<fragment
android:id="@+id/settingsPreferencesFragment"
android:name="awais.instagrabber.fragments.settings.SettingsPreferencesFragment"
android:label="@string/action_settings" />
android:label="@string/action_settings">
<action
android:id="@+id/action_settingsPreferencesFragment_to_themePreferencesFragment"
app:destination="@id/themePreferencesFragment" />
</fragment>
<fragment
android:id="@+id/aboutFragment"
android:name="awais.instagrabber.fragments.settings.AboutFragment"
@ -61,4 +65,8 @@
android:name="awais.instagrabber.fragments.NotificationsViewerFragment"
android:label="@string/title_notifications"
tools:layout="@layout/fragment_notifications_viewer" />
<fragment
android:id="@+id/themePreferencesFragment"
android:name="awais.instagrabber.fragments.settings.ThemePreferencesFragment"
android:label="@string/theme_settings" />
</navigation>

View File

@ -117,4 +117,16 @@
<item>@navigation/profile_nav_graph</item>
<item>@navigation/more_nav_graph</item>
</array>
<string-array name="light_themes">
<item>@string/light_white_theme</item>
</string-array>
<string-array name="light_theme_values">
<item>@style/AppTheme.Light.White</item>
</string-array>
<string-array name="dark_themes">
<item>@string/dark_black_theme</item>
</string-array>
<string-array name="dark_theme_values">
<item>@style/AppTheme.Dark.Black</item>
</string-array>
</resources>

View File

@ -35,4 +35,34 @@
<!-- Amoled Colors -->
<color name="background_amoled">#000000</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="grey_50">#FAFAFA</color>
<color name="grey_100">#F5F5F5</color>
<color name="grey_200">#EEEEEE</color>
<color name="grey_300">#E0E0E0</color>
<color name="grey_400">#BDBDBD</color>
<color name="grey_500">#9E9E9E</color>
<color name="grey_600">#757575</color>
<color name="grey_700">#616161</color>
<color name="grey_800">#424242</color>
<color name="grey_900">#212121</color>
<color name="grey_600_a20">#32757575</color>
<color name="blue_50">#E3F2FD</color>
<color name="blue_100">#BBDEFB</color>
<color name="blue_200">#90CAF9</color>
<color name="blue_300">#64B5F6</color>
<color name="blue_400">#42A5F5</color>
<color name="blue_500">#2196F3</color>
<color name="blue_600">#1E88E5</color>
<color name="blue_700">#1976D2</color>
<color name="blue_800">#1565C0</color>
<color name="blue_900">#0D47A1</color>
<color name="blue_A100">#82B1FF</color>
<color name="blue_A200">#448AFF</color>
<color name="blue_A400">#2979FF</color>
<color name="blue_A700">#2962FF</color>
</resources>

View File

@ -277,4 +277,8 @@
<string name="about_category_3pt_summary">The following third-party open-source libraries are used:</string>
<string name="reminder">Reminder</string>
<string name="reminder_summary">Please use this app responsibly. Downloaded images should only be used for purposes allowed by applicable laws.</string>
<string name="light_white_theme">White</string>
<string name="dark_black_theme">Black</string>
<string name="light_theme_settings">Light theme</string>
<string name="dark_theme_settings">Dark theme</string>
</resources>

View File

@ -45,4 +45,50 @@
<item name="subtitleTextStyle">?attr/textAppearanceSubtitle1</item>
<item name="background">?attr/colorPrimary</item>
</style>
<style name="Widget.BottomNavigationView.Light.White" parent="@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface">
<item name="colorPrimary">@color/black</item>
</style>
<style name="Widget.BottomNavigationView.Dark.Black" parent="@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface">
<item name="colorPrimary">@color/white</item>
</style>
<style name="Widget.MaterialComponents.Button.Light.White" parent="Widget.MaterialComponents.Button">
<item name="materialThemeOverlay">@style/ThemeOverlay.Button.Dark.Black</item>
</style>
<style name="Widget.MaterialComponents.Button.Dark.Black" parent="Widget.MaterialComponents.Button">
<item name="materialThemeOverlay">@style/ThemeOverlay.Button.Dark.Black</item>
</style>
<style name="ThemeOverlay.Button.Dark.Black" parent="">
<item name="colorPrimary">@color/white</item>
</style>
<style name="Widget.Dialog.Dark.Black" parent="@style/Theme.AppCompat.Dialog">
<item name="android:background">@color/grey_800</item>
</style>
<style name="Widget.AlertDialog.Dark.Black" parent="@style/Theme.AppCompat.Dialog.Alert">
<item name="android:background">@color/grey_800</item>
</style>
<style name="Widget.AppCompat.CompoundButton.Switch.Dark.Black" parent="@style/Widget.AppCompat.CompoundButton.Switch">
<item name="trackTint">@color/grey_800</item>
<item name="colorControlActivated">@color/blue_900</item>
</style>
<style name="ThemeOverlay.Switch.Dark.Black" parent="">
<item name="colorOnSurface">@color/grey_800</item>
</style>
<style name="Widget.AppCompat.ListView.DropDown.Dark.Black" parent="@style/Widget.AppCompat.ListView.DropDown">
<item name="android:background">@color/grey_800</item>
</style>
<style name="PreferenceFragmentCompatStyle.Dark.Black" parent="PreferenceFragment.Material">
<item name="android:divider">@drawable/pref_list_divider_material</item>
</style>
</resources>

View File

@ -1,19 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog</item>
<item name="android:windowAnimationStyle">@style/AppTheme.WindowAnimationTransition</item>
<item name="bottomNavigationStyle">@style/AppTheme.BottomNavigationView</item>
<style name="AppTheme.Base" parent="Theme.MaterialComponents.Light.NoActionBar">
<!--<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog</item>-->
<!--<item name="android:windowAnimationStyle">@style/AppTheme.WindowAnimationTransition</item>-->
<!--<item name="bottomNavigationStyle">@style/AppTheme.BottomNavigationView</item>-->
<item name="windowActionModeOverlay">true</item>
<item name="actionModeStyle">@style/Widget.App.ActionMode</item>
<item name="actionModeCloseDrawable">@drawable/ic_close_24</item>
<item name="actionBarTheme">@style/ThemeOverlay.AppTheme.Dark.ActionBar</item>
<item name="android:textColorLink">@color/blue_700</item>
<item name="android:textColorHighlight">@color/blue_300</item>
<!--<item name="actionModeStyle">@style/Widget.App.ActionMode</item>-->
<!--<item name="actionBarTheme">@style/ThemeOverlay.AppTheme.Dark.ActionBar</item>-->
</style>
<style name="Theme.Amoled" parent="AppTheme">
<item name="android:colorBackground">@color/background_amoled</item>
<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Dark</item>
<style name="AppTheme" parent="AppTheme.Base" />
<style name="AppTheme.Light.White" parent="AppTheme.Base">
<item name="colorPrimary">@color/white</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorSecondary">@color/white</item>
<item name="colorOnSecondary">@color/black</item>
<item name="colorSurface">@color/white</item>
<item name="colorOnSurface">@color/black</item>
<item name="colorAccent">@color/black</item>
<item name="android:windowBackground">@color/white</item>
<item name="bottomNavigationStyle">@style/Widget.BottomNavigationView.Light.White</item>
<item name="materialButtonStyle">@style/Widget.MaterialComponents.Button.Light.White</item>
</style>
<style name="AppTheme.Dark.Black" parent="AppTheme.Base">
<item name="colorPrimary">@color/black</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/black</item>
<item name="colorOnSecondary">@color/white</item>
<item name="colorSurface">@color/black</item>
<item name="colorOnSurface">@color/white</item>
<item name="colorAccent">@color/blue_A700</item>
<item name="colorControlHighlight">@color/grey_600</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
<item name="android:textColorHint">@color/grey_500</item>
<item name="android:windowBackground">@color/black</item>
<item name="bottomNavigationStyle">@style/Widget.BottomNavigationView.Dark.Black</item>
<item name="materialButtonStyle">@style/Widget.MaterialComponents.Button.Dark.Black</item>
<item name="android:dialogTheme">@style/Widget.Dialog.Dark.Black</item>
<item name="alertDialogTheme">@style/Widget.AlertDialog.Dark.Black</item>
<item name="switchStyle">@style/Widget.AppCompat.CompoundButton.Switch.Dark.Black</item>
<item name="android:dropDownListViewStyle">@style/Widget.AppCompat.ListView.DropDown.Dark.Black</item>
<item name="preferenceFragmentCompatStyle">@style/PreferenceFragmentCompatStyle.Dark.Black</item>
</style>
<style name="Theme.Amoled" parent="AppTheme.Base">
<!--<item name="android:colorBackground">@color/background_amoled</item>-->
<!--<item name="bottomSheetDialogTheme">@style/AppTheme.BottomSheetDialog.Dark</item>-->
</style>
<style name="AppTheme.BottomSheetDialog.Dark" parent="Theme.MaterialComponents.BottomSheetDialog" />