mirror of https://github.com/M66B/FairEmail.git
Added folder legend
This commit is contained in:
parent
6c6dcca0ac
commit
692534bef5
|
@ -126,6 +126,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
static final String ACTION_STORE_ATTACHMENT = BuildConfig.APPLICATION_ID + ".STORE_ATTACHMENT";
|
||||
static final String ACTION_DECRYPT = BuildConfig.APPLICATION_ID + ".DECRYPT";
|
||||
static final String ACTION_SHOW_PRO = BuildConfig.APPLICATION_ID + ".SHOW_PRO";
|
||||
static final String ACTION_SHOW_LEGEND = BuildConfig.APPLICATION_ID + ".SHOW_LEGEND";
|
||||
|
||||
static final String UPDATE_LATEST_API = "https://api.github.com/repos/M66B/open-source-email/releases/latest";
|
||||
static final long UPDATE_INTERVAL = 12 * 3600 * 1000L; // milliseconds
|
||||
|
@ -350,6 +351,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
iff.addAction(ACTION_STORE_ATTACHMENT);
|
||||
iff.addAction(ACTION_DECRYPT);
|
||||
iff.addAction(ACTION_SHOW_PRO);
|
||||
iff.addAction(ACTION_SHOW_LEGEND);
|
||||
lbm.registerReceiver(receiver, iff);
|
||||
|
||||
if (!pgpService.isBound())
|
||||
|
@ -1060,6 +1062,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
onDecrypt(intent);
|
||||
else if (ACTION_SHOW_PRO.equals(intent.getAction()))
|
||||
onShowPro(intent);
|
||||
else if (ACTION_SHOW_LEGEND.equals(intent.getAction()))
|
||||
onMenuLegend();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
private final static int action_delete_local = 2;
|
||||
private final static int action_empty_trash = 3;
|
||||
private final static int action_edit_properties = 4;
|
||||
private final static int action_legend = 5;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
@ -181,20 +182,45 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
if (folder.account != null)
|
||||
popupMenu.getMenu().add(Menu.NONE, action_edit_properties, 4, R.string.title_edit_properties);
|
||||
|
||||
popupMenu.getMenu().add(Menu.NONE, action_legend, 5, R.string.menu_legend);
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem target) {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
switch (target.getItemId()) {
|
||||
case action_synchronize_now:
|
||||
onActionSynchronizeNow();
|
||||
break;
|
||||
|
||||
case action_delete_local:
|
||||
OnActionDeleteLocal();
|
||||
break;
|
||||
|
||||
case action_empty_trash:
|
||||
onActionEmptyTrash();
|
||||
break;
|
||||
|
||||
case action_edit_properties:
|
||||
onActionEditProperties();
|
||||
break;
|
||||
|
||||
case action_legend:
|
||||
onActionLegend();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onActionSynchronizeNow() {
|
||||
Log.i(Helper.TAG, folder.name + " requesting sync");
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(
|
||||
new Intent(ServiceSynchronize.ACTION_SYNCHRONIZE_FOLDER)
|
||||
.setType("account/" + (folder.account == null ? "outbox" : Long.toString(folder.account)))
|
||||
.putExtra("folder", folder.id));
|
||||
break;
|
||||
}
|
||||
|
||||
case action_delete_local:
|
||||
private void OnActionDeleteLocal() {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", folder.id);
|
||||
args.putBoolean("outbox", folder.account == null);
|
||||
|
@ -217,10 +243,9 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
Helper.unexpectedError(context, ex);
|
||||
}
|
||||
}.load(context, owner, args);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case action_empty_trash:
|
||||
private void onActionEmptyTrash() {
|
||||
new DialogBuilderLifecycle(context, owner)
|
||||
.setMessage(R.string.title_empty_trash_ask)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
|
@ -264,15 +289,18 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
break;
|
||||
}
|
||||
|
||||
case action_edit_properties:
|
||||
private void onActionEditProperties() {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(
|
||||
new Intent(ActivityView.ACTION_EDIT_FOLDER)
|
||||
.putExtra("id", folder.id));
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
|
||||
private void onActionLegend() {
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(new Intent(ActivityView.ACTION_SHOW_LEGEND));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -388,5 +388,77 @@
|
|||
app:layout_constraintStart_toEndOf="@id/ivClosing"
|
||||
app:layout_constraintTop_toTopOf="@id/ivClosing" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSyncKeep"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="123/456"
|
||||
android:textAppearance="@android:style/TextAppearance.Small"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tvSyncKeepLegend"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvClosing" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSyncKeep"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@drawable/baseline_mail_outline_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tvSyncKeepLegend"
|
||||
app:layout_constraintStart_toEndOf="@id/tvSyncKeep"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSyncKeep" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSyncKeepLegend"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:text="@string/title_legend_sync_keep"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/ivSyncKeep"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSyncKeep" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/barrierSyncKeep"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="tvSyncKeep,ivSyncKeep,tvSyncKeepLegend" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDownloadFetch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="123/456"
|
||||
android:textAppearance="@android:style/TextAppearance.Small"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tvDownloadLegend"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/barrierSyncKeep" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivDownloadFetch"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="6dp"
|
||||
android:src="@drawable/baseline_sync_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tvDownloadLegend"
|
||||
app:layout_constraintStart_toEndOf="@id/tvDownloadFetch"
|
||||
app:layout_constraintTop_toTopOf="@id/tvDownloadFetch" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDownloadLegend"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="18dp"
|
||||
android:text="@string/title_legend_download_fetch"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/ivDownloadFetch"
|
||||
app:layout_constraintTop_toTopOf="@id/ivDownloadFetch" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
|
@ -313,6 +313,8 @@
|
|||
<string name="title_legend_synchronizing">Synchronizing</string>
|
||||
<string name="title_legend_downloading">Downloading</string>
|
||||
<string name="title_legend_closing">Closing</string>
|
||||
<string name="title_legend_sync_keep">Number of days to synchronize / to keep messages</string>
|
||||
<string name="title_legend_download_fetch">Number of message bodies downloaded / headers fetched</string>
|
||||
|
||||
<string name="title_hint_folder_actions">Long press for options</string>
|
||||
<string name="title_hint_support">If you have a question or a problem, please use the support menu to get help</string>
|
||||
|
|
Loading…
Reference in New Issue