From 8bcbaf6be5e907885f20bd8de5441da484ba598d Mon Sep 17 00:00:00 2001 From: Ezerous Date: Thu, 3 Dec 2020 14:57:31 +0200 Subject: [PATCH 1/2] Up dependencies --- app/build.gradle | 10 +++++----- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 66fd4c43..7405e986 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "gr.thmmy.mthmmy" minSdkVersion 19 targetSdkVersion 29 - versionCode 28 - versionName "1.8.5" + versionCode 29 + versionName "1.9.0" archivesBaseName = "mTHMMY-v$versionName" buildConfigField "String", "CURRENT_BRANCH", "\"" + getCurrentBranch() + "\"" buildConfigField "String", "COMMIT_HASH", "\"" + getCommitHash() + "\"" @@ -83,13 +83,13 @@ dependencies { implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.exifinterface:exifinterface:1.2.0' implementation 'androidx.multidex:multidex:2.0.1' //TODO: Remove when minSdkVersion >= 21 implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.firebase:firebase-analytics:17.4.4' - implementation 'com.google.firebase:firebase-crashlytics:17.1.1' - implementation 'com.google.firebase:firebase-messaging:20.2.4' + implementation 'com.google.firebase:firebase-crashlytics:17.3.0' + implementation 'com.google.firebase:firebase-messaging:21.0.0' implementation 'com.snatik:storage:2.1.0' implementation('com.squareup.okhttp3:okhttp:3.12.12') { //TODO: Warning: OkHttp has dropped support for Android 19 since OkHttp 3.13! diff --git a/build.gradle b/build.gradle index f3f7c2fb..5f3d866c 100644 --- a/build.gradle +++ b/build.gradle @@ -9,8 +9,8 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:4.1.1' - classpath 'com.google.gms:google-services:4.3.3' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0' + classpath 'com.google.gms:google-services:4.3.4' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1' classpath 'org.ajoberstar.grgit:grgit-core:3.1.1' // Also change in app/gradle/grgit.gradle classpath "com.github.ben-manes:gradle-versions-plugin:0.21.0" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c2cb1bb4..68581bed 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Nov 11 12:38:13 EET 2020 +#Thu Dec 03 14:56:57 EET 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip From 97f87016b03b5cb5a6782b08b4888ff8d2f6fcce Mon Sep 17 00:00:00 2001 From: Ezerous Date: Thu, 3 Dec 2020 20:50:29 +0200 Subject: [PATCH 2/2] Add option for main screen tabs style --- .../mthmmy/activities/main/MainActivity.java | 26 +++++++++++++------ .../activities/settings/SettingsActivity.java | 1 + .../activities/settings/SettingsFragment.java | 4 +++ .../gr/thmmy/mthmmy/base/BaseApplication.java | 7 +++++ app/src/main/res/layout/activity_main.xml | 1 + app/src/main/res/layout/fragment_forum.xml | 4 +-- app/src/main/res/layout/fragment_recent.xml | 4 +-- app/src/main/res/layout/fragment_unread.xml | 4 +-- app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/strings.xml | 3 +++ .../res/xml-v26/app_preferences_guest.xml | 6 +++++ .../main/res/xml-v26/app_preferences_user.xml | 6 +++++ .../main/res/xml/app_preferences_guest.xml | 6 +++++ app/src/main/res/xml/app_preferences_user.xml | 6 +++++ 14 files changed, 65 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java index 58a3b8db..bd5abffb 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java @@ -55,6 +55,7 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF private SectionsPagerAdapter sectionsPagerAdapter; private ViewPager viewPager; private TabLayout tabLayout; + private boolean displayCompactTabs; //Fix for vector drawables on android <21 static { @@ -82,9 +83,13 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF return; //Avoid executing the code below } - toolbar = findViewById(R.id.toolbar); - toolbar.setTitle(""); - setSupportActionBar(toolbar); + displayCompactTabs = BaseApplication.getInstance().isDisplayCompactTabsEnabled(); + + if(displayCompactTabs) { + toolbar = findViewById(R.id.toolbar); + toolbar.setTitle(""); + setSupportActionBar(toolbar); + } //Initialize drawer createDrawer(); @@ -108,8 +113,8 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF if ((preferredTab != 3 && preferredTab != 4) || sessionManager.isLoggedIn()) tabLayout.getTabAt(preferredTab).select(); - for (int i = 0; i < tabLayout.getTabCount(); i++) - updateTabIcon(i); + if(!displayCompactTabs) + updateTabIcons(); setMainActivity(this); } @@ -189,7 +194,8 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF fragmentList.add(fragment); fragmentTitleList.add(title); notifyDataSetChanged(); - updateTabIcon(fragmentList.size() - 1); + if(!displayCompactTabs) + updateTabIcon(fragmentList.size() - 1); } void removeFragment(int position) { @@ -234,6 +240,10 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF tabLayout.getTabAt(2).setIcon(getResources().getDrawable(R.drawable.ic_fiber_new_white_24dp)); } + private void updateTabIcons (){ + for (int i = 0; i < tabLayout.getTabCount(); i++) + updateTabIcon(i); + } public void updateTabs() { if (!sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 3) @@ -241,8 +251,8 @@ public class MainActivity extends BaseActivity implements RecentFragment.RecentF else if (sessionManager.isLoggedIn() && sectionsPagerAdapter.getCount() == 2) sectionsPagerAdapter.addFragment(UnreadFragment.newInstance(3), "UNREAD"); - for (int i = 0; i < tabLayout.getTabCount(); i++) - updateTabIcon(i); + if(!displayCompactTabs) + updateTabIcons(); } //-------------------------------FragmentPagerAdapter END------------------------------------------- diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java index e9cc61f6..40fab7a7 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsActivity.java @@ -9,6 +9,7 @@ import gr.thmmy.mthmmy.base.BaseActivity; public class SettingsActivity extends BaseActivity { public static final String DEFAULT_HOME_TAB = "pref_app_main_default_tab_key"; + public static final String DISPLAY_COMPACT_TABS = "pref_app_display_compact_tabs_key"; public static final String DISPLAY_RELATIVE_TIME = "pref_app_display_relative_time_key"; public static final String NOTIFICATION_LED_KEY = "pref_notification_led_enable_key"; public static final String NOTIFICATION_VIBRATION_KEY = "pref_notification_vibration_enable_key"; diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java index 983c542a..a639c199 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/settings/SettingsFragment.java @@ -224,6 +224,10 @@ public class SettingsFragment extends PreferenceFragmentCompat implements Shared && BaseApplication.getInstance().isDisplayRelativeTimeEnabled() != sharedPreferences.getBoolean(key, false)) { displayRestartAppToTakeEffectToast(); } + else if (key.equals(getString(R.string.pref_app_display_compact_tabs_key)) + && BaseApplication.getInstance().isDisplayCompactTabsEnabled() != sharedPreferences.getBoolean(key, false)) { + displayRestartAppToTakeEffectToast(); + } } private void displayRestartAppToTakeEffectToast() { diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java index 61c32078..71ebc4ae 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java +++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java @@ -47,6 +47,7 @@ import okhttp3.Request; import timber.log.Timber; import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.DISPLAY_RELATIVE_TIME; +import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.DISPLAY_COMPACT_TABS; // TODO: Replace MultiDexApplication with Application after KitKat support is dropped public class BaseApplication extends MultiDexApplication { @@ -63,6 +64,7 @@ public class BaseApplication extends MultiDexApplication { private SessionManager sessionManager; private boolean displayRelativeTime; + private boolean displayCompactTabs; //Display Metrics private static float widthDp; @@ -105,6 +107,7 @@ public class BaseApplication extends MultiDexApplication { setDisplayMetrics(); displayRelativeTime = settingsSharedPrefs.getBoolean(DISPLAY_RELATIVE_TIME, true); + displayCompactTabs = settingsSharedPrefs.getBoolean(DISPLAY_COMPACT_TABS, true); } private void initFirebase(SharedPreferences settingsSharedPrefs) { @@ -233,6 +236,10 @@ public class BaseApplication extends MultiDexApplication { return displayRelativeTime; } + public boolean isDisplayCompactTabsEnabled() { + return displayCompactTabs; + } + //-------------------- Firebase -------------------- public void logFirebaseAnalyticsEvent(String event, Bundle params) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 79069193..1fd17ba9 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -33,6 +33,7 @@ android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="1.0" + android:paddingBottom="2dp" app:tabMaxWidth="0dp" app:tabGravity="fill" app:tabMode="fixed" diff --git a/app/src/main/res/layout/fragment_forum.xml b/app/src/main/res/layout/fragment_forum.xml index 8b65bca9..29e311be 100644 --- a/app/src/main/res/layout/fragment_forum.xml +++ b/app/src/main/res/layout/fragment_forum.xml @@ -17,7 +17,6 @@ android:layout_height="match_parent" android:background="@color/background" android:paddingBottom="4dp" - android:paddingTop="4dp" app:layoutManager="LinearLayoutManager" tools:context=".activities.main.forum.ForumFragment" /> @@ -26,11 +25,12 @@ android:id="@+id/progressBar" style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" android:layout_width="match_parent" - android:layout_height="@dimen/progress_bar_height" + android:layout_height="@dimen/progress_bar_unpadded_height" android:layout_alignParentTop="true" android:indeterminate="true" android:visibility="invisible" app:mpb_indeterminateTint="@color/accent" + app:mpb_useIntrinsicPadding = "false" app:mpb_progressStyle="horizontal" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_recent.xml b/app/src/main/res/layout/fragment_recent.xml index 421b6fd9..790d8b87 100644 --- a/app/src/main/res/layout/fragment_recent.xml +++ b/app/src/main/res/layout/fragment_recent.xml @@ -17,7 +17,6 @@ android:layout_height="match_parent" android:background="@color/background" android:paddingBottom="4dp" - android:paddingTop="4dp" app:layoutManager="LinearLayoutManager" tools:context=".activities.main.recent.RecentFragment" tools:listitem="@layout/fragment_recent_row" /> @@ -27,10 +26,11 @@ android:id="@+id/progressBar" style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" android:layout_width="match_parent" - android:layout_height="@dimen/progress_bar_height" + android:layout_height="@dimen/progress_bar_unpadded_height" android:layout_alignParentTop="true" android:indeterminate="true" android:visibility="invisible" app:mpb_indeterminateTint="@color/accent" + app:mpb_useIntrinsicPadding = "false" app:mpb_progressStyle="horizontal" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_unread.xml b/app/src/main/res/layout/fragment_unread.xml index 7e7238ca..44780490 100644 --- a/app/src/main/res/layout/fragment_unread.xml +++ b/app/src/main/res/layout/fragment_unread.xml @@ -23,7 +23,6 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" - android:paddingTop="4dp" android:paddingBottom="4dp" app:layoutManager="LinearLayoutManager" tools:context=".activities.main.unread.UnreadFragment" @@ -47,11 +46,12 @@ android:id="@+id/progressBar" style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal.NoPadding" android:layout_width="match_parent" - android:layout_height="@dimen/progress_bar_height" + android:layout_height="@dimen/progress_bar_unpadded_height" android:layout_alignParentTop="true" android:indeterminate="true" android:visibility="invisible" app:mpb_indeterminateTint="@color/accent" + app:mpb_useIntrinsicPadding = "false" app:mpb_progressStyle="horizontal" /> 36dp 16dp 10dp + 3dp 16sp 24sp 24dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 43af28b3..f203b8cf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -175,6 +175,9 @@ pref_app_display_relative_time_key Display relative time Considering that you haven\'t set some weird custom time format + pref_app_display_compact_tabs_key + Display compact tabs + Home screen tabs will occupy less space Notifications pref_notification_vibration_enable_key diff --git a/app/src/main/res/xml-v26/app_preferences_guest.xml b/app/src/main/res/xml-v26/app_preferences_guest.xml index 1e04ec41..f366c6e0 100644 --- a/app/src/main/res/xml-v26/app_preferences_guest.xml +++ b/app/src/main/res/xml-v26/app_preferences_guest.xml @@ -20,6 +20,12 @@ android:title="@string/pref_title_display_relative_time" android:summary="@string/pref_summary_display_relative_time" app:iconSpaceReserved="false" /> + + + +