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/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..1b2ed6cc 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
@@ -5,6 +5,8 @@ import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
+import android.view.ViewGroup;
+import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatDelegate;
@@ -55,6 +57,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 +85,15 @@ 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);
+ ViewGroup.LayoutParams currentParams = toolbar.getLayoutParams();
+ toolbar.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, currentParams.height));
+ toolbar.setTitle("");
+ setSupportActionBar(toolbar);
+ }
//Initialize drawer
createDrawer();
@@ -108,8 +117,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 +198,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 +244,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 +255,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..41f3d803 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
@@ -46,6 +46,7 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import timber.log.Timber;
+import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.DISPLAY_COMPACT_TABS;
import static gr.thmmy.mthmmy.activities.settings.SettingsActivity.DISPLAY_RELATIVE_TIME;
// TODO: Replace MultiDexApplication with Application after KitKat support is dropped
@@ -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..9c4ac7fe 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,7 +22,7 @@
@@ -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..d5a23673 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..1469e633 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" />
+
+
+
+