From 14addf5ed00b473b33d77efead6a4ea05ba49e38 Mon Sep 17 00:00:00 2001 From: M M Arif Date: Fri, 6 Mar 2020 01:56:42 +0500 Subject: [PATCH] added theme selection to settings, updated login layout. --- .../mian/gitnex/activities/BaseActivity.java | 14 ++- .../gitnex/adapters/ReposListAdapter.java | 1 + .../gitnex/fragments/SettingsFragment.java | 51 +++++++++++ .../main/res/drawable/ic_arrow_back_24dp.xml | 5 ++ app/src/main/res/layout/activity_login.xml | 51 ++++++----- .../main/res/layout/activity_org_detail.xml | 2 +- .../main/res/layout/activity_repo_detail.xml | 1 - app/src/main/res/layout/fragment_profile.xml | 1 + .../res/layout/layout_settings_appearance.xml | 90 ++++++++++++------- app/src/main/res/values/attrs.xml | 1 + app/src/main/res/values/strings.xml | 10 ++- app/src/main/res/values/themes.xml | 49 ++++++---- 12 files changed, 196 insertions(+), 80 deletions(-) create mode 100644 app/src/main/res/drawable/ic_arrow_back_24dp.xml diff --git a/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java b/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java index ece3082b..77138600 100644 --- a/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java @@ -15,13 +15,21 @@ public abstract class BaseActivity extends AppCompatActivity { @Override public void onCreate(Bundle savedInstanceState) { - setTheme(R.style.AppThemeLight); + final TinyDB tinyDb = new TinyDB(getApplicationContext()); + + if(tinyDb.getInt("themeId") == 0) { + setTheme(R.style.AppTheme); + } + else if(tinyDb.getInt("themeId") == 1) { + setTheme(R.style.AppThemeLight); + } + else { + setTheme(R.style.AppTheme); + } super.onCreate(savedInstanceState); setContentView(getLayoutResourceId()); - final TinyDB tinyDb = new TinyDB(getApplicationContext()); - if(tinyDb.getInt("customFontId") == 0) { FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/roboto.ttf"); diff --git a/app/src/main/java/org/mian/gitnex/adapters/ReposListAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/ReposListAdapter.java index 6244d642..2b54a4b7 100644 --- a/app/src/main/java/org/mian/gitnex/adapters/ReposListAdapter.java +++ b/app/src/main/java/org/mian/gitnex/adapters/ReposListAdapter.java @@ -104,6 +104,7 @@ public class ReposListAdapter extends RecyclerView.Adapter + + diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 0110a542..c8a4f3cd 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -64,30 +64,35 @@ - + + android:spinnerMode="dropdown" + android:padding="10dp" /> + + + + @@ -106,8 +111,8 @@ android:inputType="textUri" android:background="@drawable/shape_inputs" android:textColor="?attr/inputTextColor" - android:textColorHint="?attr/primaryBackgroundColor" - android:textColorHighlight="?attr/primaryTextColor" + android:textColorHint="?attr/hintColor" + android:textColorHighlight="?attr/hintColor" android:hint="@string/instanceUrl" /> @@ -139,8 +144,8 @@ android:drawablePadding="10dp" android:background="@drawable/shape_inputs" android:textColor="?attr/inputTextColor" - android:textColorHint="?attr/primaryBackgroundColor" - android:textColorHighlight="?attr/primaryTextColor" + android:textColorHint="?attr/hintColor" + android:textColorHighlight="?attr/hintColor" android:hint="@string/passWord" android:inputType="textPassword" /> @@ -156,8 +161,8 @@ android:drawablePadding="10dp" android:background="@drawable/shape_inputs" android:textColor="?attr/inputTextColor" - android:textColorHint="?attr/primaryBackgroundColor" - android:textColorHighlight="?attr/primaryTextColor" + android:textColorHint="?attr/hintColor" + android:textColorHighlight="?attr/hintColor" android:hint="@string/loginOTP" android:inputType="number" /> @@ -173,8 +178,8 @@ android:drawablePadding="10dp" android:background="@drawable/shape_inputs" android:textColor="?attr/inputTextColor" - android:textColorHint="?attr/primaryBackgroundColor" - android:textColorHighlight="?attr/primaryTextColor" + android:textColorHint="?attr/hintColor" + android:textColorHighlight="?attr/hintColor" android:hint="@string/copyToken" android:inputType="text" android:visibility="gone" /> diff --git a/app/src/main/res/layout/activity_org_detail.xml b/app/src/main/res/layout/activity_org_detail.xml index c9b25083..1ee2e762 100644 --- a/app/src/main/res/layout/activity_org_detail.xml +++ b/app/src/main/res/layout/activity_org_detail.xml @@ -13,7 +13,6 @@ android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="@dimen/appbar_padding_top" android:theme="@style/AppTheme.AppBarOverlay"> diff --git a/app/src/main/res/layout/activity_repo_detail.xml b/app/src/main/res/layout/activity_repo_detail.xml index fce878b7..ce6408e5 100644 --- a/app/src/main/res/layout/activity_repo_detail.xml +++ b/app/src/main/res/layout/activity_repo_detail.xml @@ -13,7 +13,6 @@ android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingTop="@dimen/appbar_padding_top" android:theme="@style/AppTheme.AppBarOverlay"> + + + + + + + + + + + + + + + + - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 7035e28e..4e85bd09 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -3,6 +3,7 @@ + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f4fccd1b..de0225ab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -259,6 +259,12 @@ Home Screen My Repositories Select Home Screen + Font + Choose Font + Roboto + Select App Theme + Theme + Dark No more data available @@ -543,8 +549,4 @@ Pull Request was merged successfully Pull Request is not available for merge - Font - Choose Font - Roboto - diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 40beb351..4c5c432d 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -14,8 +14,11 @@ @color/colorWhite @style/AppThemeCheckBoxStyle @color/darkGreen - @style/AppThemeConfirmDialog + @style/AppThemeConfirmDialog @style/AppThemePopupMenuStyle + @drawable/ic_arrow_back_24dp + @style/AppThemeDarkSearchAutoCompleteTextView + @color/hintColor @@ -32,41 +35,51 @@ @color/lightThemeInputTextColor @style/AppThemeLightCheckBoxStyle @color/darkGreen - @style/AppThemeLightConfirmDialog - @style/AppThemePopupMenuStyle + @style/AppThemeLightConfirmDialog + @style/AppThemeLightPopupMenuStyle + @drawable/ic_arrow_back_24dp + @style/AppThemeLightSearchAutoCompleteTextView + @color/hintColor + + + + - - -