Commit 87f8619f authored by Hussein's avatar Hussein

Merge branch 'bug/P4A-871' into develop

parents a7d49f01 09ef801b
buildscript {
ext {
buildConfig = [
'compileSdk' : 28,
'compileSdk' : 29,
'targetSdk' : 28,
'minSdk' : 21,
'versionCode' : 43,
......
......@@ -30,6 +30,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.core.content.ContextCompat;
import androidx.core.view.GravityCompat;
import androidx.core.view.ViewCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentManager.OnBackStackChangedListener;
......@@ -445,6 +446,23 @@ public class MessageList extends PepActivity implements MessageListFragmentListe
setupNavigationFoldersList();
createFoldersMenu();
setNavigationViewInsets();
}
private void setNavigationViewInsets() {
ViewCompat.setOnApplyWindowInsetsListener(
navigationView,
(v, insets) -> {
View view = navigationView.findViewById(R.id.menu_header);
view.setPadding(
view.getPaddingLeft(),
insets.getSystemWindowInsetTop(),
view.getPaddingRight(),
view.getPaddingBottom()
);
return insets.consumeSystemWindowInsets();
});
}
private void setupNavigationFoldersList() {
......
......@@ -338,7 +338,7 @@ class SettingsActivity : PEpImporterActivity(), PreferenceFragmentCompat.OnPrefe
TOP, MIDDLE, BOTTOM
}
private fun accountLocation(account: BaseAccount): EnumSet<ACCOUNT_LOCATION> {
private fun accountLocation(account: BaseAccount?): EnumSet<ACCOUNT_LOCATION> {
val accountLocation = EnumSet.of(ACCOUNT_LOCATION.MIDDLE)
if (accounts.size > 0) {
if (accounts[0] == account) {
......
......@@ -2,6 +2,7 @@ package com.fsck.k9.ui.settings.account
import android.app.AlertDialog
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.view.View
import android.widget.Toast
......@@ -63,6 +64,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
initializeCryptoSettings(account)
initializeFolderSettings(account)
initializeAccountpEpKeyReset(account)
initializeNewRingtoneOptions()
if (!BuildConfig.WITH_KEY_SYNC) {
hideKeySyncOptions()
......@@ -174,6 +176,12 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
findPreference(PREFERENCE_PEP_ENABLE_SYNC_ACCOUNT)?.remove()
}
private fun initializeNewRingtoneOptions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
findPreference(PREFERENCE_RINGTONE)?.remove()
}
}
private fun dopEpKeyReset(account: Account) {
disableKeyResetClickListener()
loading?.visibility = View.VISIBLE
......@@ -289,6 +297,7 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
private const val PREFERENCE_SENT_FOLDER = "sent_folder"
private const val PREFERENCE_SPAM_FOLDER = "spam_folder"
private const val PREFERENCE_TRASH_FOLDER = "trash_folder"
private const val PREFERENCE_RINGTONE = "account_ringtone"
private const val PREFERENCE_PEP_ACCOUNT_KEY_RESET = "pep_key_reset_account"
private const val PREFERENCE_PEP_ENABLE_SYNC_ACCOUNT = "pep_enable_sync_account"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/menu_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/colorPrimaryDark"
android:gravity="bottom"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<RelativeLayout
......@@ -18,7 +19,8 @@
android:paddingTop="24dp">
<FrameLayout android:id="@+id/nav_header_image_container"
<FrameLayout
android:id="@+id/nav_header_image_container"
android:layout_width="64dp"
android:layout_height="64dp">
......@@ -34,8 +36,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="36sp"
android:textColor="@color/white"
android:textSize="36sp"
tools:text="A" />
</FrameLayout>
......@@ -43,10 +45,10 @@
android:id="@+id/first_account_container"
android:layout_width="40dp"
android:layout_height="40dp"
android:visibility="gone"
tools:visibility="visible"
android:layout_alignTop="@+id/nav_header_image_container"
android:layout_alignParentEnd="true"
android:layout_alignTop="@+id/nav_header_image_container">
android:visibility="gone"
tools:visibility="visible">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="40dp"
......@@ -54,22 +56,24 @@
android:layout_gravity="center_vertical"
android:src="@color/colorPrimary" />
<TextView android:id="@+id/first_account"
<TextView
android:id="@+id/first_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="24sp"
android:textColor="@color/white"
android:textSize="24sp"
tools:text="B" />
</FrameLayout>
<FrameLayout android:id="@+id/second_account_container"
<FrameLayout
android:id="@+id/second_account_container"
android:layout_width="40dp"
android:layout_height="40dp"
android:visibility="gone"
tools:visibility="visible"
android:layout_marginRight="16dp"
android:layout_toLeftOf="@id/first_account_container">
android:layout_toLeftOf="@id/first_account_container"
android:visibility="gone"
tools:visibility="visible">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="40dp"
......@@ -82,8 +86,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="24sp"
android:textColor="@color/white"
android:textSize="24sp"
tools:text="C" />
</FrameLayout>
</RelativeLayout>
......@@ -105,16 +109,16 @@
android:id="@+id/nav_header_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:maxLines="1"
android:paddingTop="16dp"
tools:text="android.studio@android.com" />
<ImageView
android:id="@+id/nav_header_accounts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:background="@drawable/ic_nav_header_accounts"
android:visibility="gone"
......@@ -124,8 +128,8 @@
android:id="@+id/nav_header_folders"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:background="@drawable/ic_nav_header_folders"
android:visibility="gone"
......
......@@ -8,7 +8,6 @@
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<LinearLayout
......@@ -51,29 +50,27 @@
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
android:layout_gravity="start">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
<LinearLayout
android:layout_width="wrap_content"
android:orientation="vertical"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="@+id/menu_header"
layout="@layout/nav_header_main" />
<include
android:id="@+id/navigation_bar_folders_layout"
layout="@layout/navigation_bar_folders" />
<include layout="@layout/nav_header_main" />
<include
android:id="@+id/navigation_bar_accounts_layout"
layout="@layout/navigation_bar_accounts" />
</LinearLayout>
<include
android:id="@+id/navigation_bar_folders_layout"
layout="@layout/navigation_bar_folders" />
<include
android:id="@+id/navigation_bar_accounts_layout"
layout="@layout/navigation_bar_accounts" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment