Show capabilities after check

This commit is contained in:
M66B 2019-02-10 08:21:16 +00:00
parent 56cc9043de
commit cba389c103
3 changed files with 43 additions and 2 deletions

View File

@ -118,6 +118,8 @@ public class FragmentAccount extends FragmentBase {
private Button btnCheck; private Button btnCheck;
private ContentLoadingProgressBar pbCheck; private ContentLoadingProgressBar pbCheck;
private TextView tvIdle; private TextView tvIdle;
private TextView tvMove;
private TextView tvUidPlus;
private ArrayAdapter<EntityFolder> adapter; private ArrayAdapter<EntityFolder> adapter;
private Spinner spDrafts; private Spinner spDrafts;
@ -194,6 +196,8 @@ public class FragmentAccount extends FragmentBase {
pbCheck = view.findViewById(R.id.pbCheck); pbCheck = view.findViewById(R.id.pbCheck);
tvIdle = view.findViewById(R.id.tvIdle); tvIdle = view.findViewById(R.id.tvIdle);
tvMove = view.findViewById(R.id.tvMove);
tvUidPlus = view.findViewById(R.id.tvUidPlus);
spDrafts = view.findViewById(R.id.spDrafts); spDrafts = view.findViewById(R.id.spDrafts);
spSent = view.findViewById(R.id.spSent); spSent = view.findViewById(R.id.spSent);
@ -231,6 +235,8 @@ public class FragmentAccount extends FragmentBase {
btnCheck.setVisibility(position > 0 ? View.VISIBLE : View.GONE); btnCheck.setVisibility(position > 0 ? View.VISIBLE : View.GONE);
tvIdle.setVisibility(View.GONE); tvIdle.setVisibility(View.GONE);
tvMove.setVisibility(View.GONE);
tvUidPlus.setVisibility(View.GONE);
Object tag = adapterView.getTag(); Object tag = adapterView.getTag();
if (tag != null && (Integer) tag == position) if (tag != null && (Integer) tag == position)
@ -463,6 +469,8 @@ public class FragmentAccount extends FragmentBase {
btnAdvanced.setVisibility(View.GONE); btnAdvanced.setVisibility(View.GONE);
tvIdle.setVisibility(View.GONE); tvIdle.setVisibility(View.GONE);
tvMove.setVisibility(View.GONE);
tvUidPlus.setVisibility(View.GONE);
btnCheck.setVisibility(View.GONE); btnCheck.setVisibility(View.GONE);
pbCheck.setVisibility(View.GONE); pbCheck.setVisibility(View.GONE);
@ -541,6 +549,8 @@ public class FragmentAccount extends FragmentBase {
Helper.setViewsEnabled(view, false); Helper.setViewsEnabled(view, false);
pbCheck.setVisibility(View.VISIBLE); pbCheck.setVisibility(View.VISIBLE);
tvIdle.setVisibility(View.GONE); tvIdle.setVisibility(View.GONE);
tvMove.setVisibility(View.GONE);
tvUidPlus.setVisibility(View.GONE);
grpFolders.setVisibility(View.GONE); grpFolders.setVisibility(View.GONE);
tvError.setVisibility(View.GONE); tvError.setVisibility(View.GONE);
} }
@ -604,8 +614,11 @@ public class FragmentAccount extends FragmentBase {
throw ex; throw ex;
} }
if (istore instanceof IMAPStore) if (istore instanceof IMAPStore) {
result.idle = ((IMAPStore) istore).hasCapability("IDLE"); result.idle = ((IMAPStore) istore).hasCapability("IDLE");
result.move = ((IMAPStore) istore).hasCapability("MOVE");
result.uidplus = ((IMAPStore) istore).hasCapability("UIDPLUS");
}
boolean inbox = false; boolean inbox = false;
boolean archive = false; boolean archive = false;
@ -706,6 +719,8 @@ public class FragmentAccount extends FragmentBase {
boolean pop = args.getBoolean("pop"); boolean pop = args.getBoolean("pop");
tvIdle.setVisibility(result.idle || pop ? View.GONE : View.VISIBLE); tvIdle.setVisibility(result.idle || pop ? View.GONE : View.VISIBLE);
tvMove.setVisibility(result.move || pop ? View.GONE : View.VISIBLE);
tvUidPlus.setVisibility(result.uidplus || pop ? View.GONE : View.VISIBLE);
if (pop) { if (pop) {
grpFolders.setVisibility(View.GONE); grpFolders.setVisibility(View.GONE);
@ -1503,5 +1518,7 @@ public class FragmentAccount extends FragmentBase {
EntityAccount account; EntityAccount account;
List<EntityFolder> folders; List<EntityFolder> folders;
boolean idle; boolean idle;
boolean move;
boolean uidplus;
} }
} }

View File

@ -463,6 +463,28 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnCheck" /> app:layout_constraintTop_toBottomOf="@+id/btnCheck" />
<TextView
android:id="@+id/tvMove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_no_move"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvIdle" />
<TextView
android:id="@+id/tvUidPlus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_no_uidplus"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvMove" />
<TextView <TextView
android:id="@+id/tvDrafts" android:id="@+id/tvDrafts"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -549,7 +571,7 @@
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/barrier_folders" app:layout_constraintStart_toEndOf="@id/barrier_folders"
app:layout_constraintTop_toBottomOf="@id/tvIdle" /> app:layout_constraintTop_toBottomOf="@id/tvUidPlus" />
<TextView <TextView
android:id="@+id/tvDraftsRemark" android:id="@+id/tvDraftsRemark"

View File

@ -242,6 +242,8 @@
<string name="title_no_inbox">Inbox not found</string> <string name="title_no_inbox">Inbox not found</string>
<string name="title_no_primary_drafts">No primary account or no drafts folder</string> <string name="title_no_primary_drafts">No primary account or no drafts folder</string>
<string name="title_no_idle">This provider does not support push messages. This will delay reception of new messages and increase battery usage.</string> <string name="title_no_idle">This provider does not support push messages. This will delay reception of new messages and increase battery usage.</string>
<string name="title_no_move">This provider does not support MOVE</string>
<string name="title_no_uidplus">This provider does not support UIDPLUS</string>
<string name="title_no_sync">Synchronization errors since %1$s</string> <string name="title_no_sync">Synchronization errors since %1$s</string>
<string name="title_drafts_required">A drafts folder is required to send messages</string> <string name="title_drafts_required">A drafts folder is required to send messages</string>
<string name="title_account_delete">Delete this account permanently?</string> <string name="title_account_delete">Delete this account permanently?</string>