Show number of delayed send messages

pull/197/head
M66B 4 years ago
parent 21cdd9c144
commit 47e8bc4b40

@ -130,6 +130,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
static final String ACTION_VIEW_MESSAGES = BuildConfig.APPLICATION_ID + ".VIEW_MESSAGES";
static final String ACTION_SEARCH_ADDRESS = BuildConfig.APPLICATION_ID + ".SEARCH_ADDRESS";
static final String ACTION_VIEW_THREAD = BuildConfig.APPLICATION_ID + ".VIEW_THREAD";
static final String ACTION_VIEW_OUTBOX = BuildConfig.APPLICATION_ID + ".VIEW_OUTBOX";
static final String ACTION_EDIT_FOLDER = BuildConfig.APPLICATION_ID + ".EDIT_FOLDER";
static final String ACTION_EDIT_ANSWERS = BuildConfig.APPLICATION_ID + ".EDIT_ANSWERS";
static final String ACTION_EDIT_ANSWER = BuildConfig.APPLICATION_ID + ".EDIT_ANSWER";
@ -645,6 +646,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
iff.addAction(ACTION_VIEW_MESSAGES);
iff.addAction(ACTION_SEARCH_ADDRESS);
iff.addAction(ACTION_VIEW_THREAD);
iff.addAction(ACTION_VIEW_OUTBOX);
iff.addAction(ACTION_EDIT_FOLDER);
iff.addAction(ACTION_EDIT_ANSWERS);
iff.addAction(ACTION_EDIT_ANSWER);
@ -1334,6 +1336,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
onSearchAddress(intent);
else if (ACTION_VIEW_THREAD.equals(action))
onViewThread(intent);
else if (ACTION_VIEW_OUTBOX.equals(action))
onMenuOutbox();
else if (ACTION_EDIT_FOLDER.equals(action))
onEditFolder(intent);
else if (ACTION_EDIT_ANSWERS.equals(action))

@ -245,6 +245,13 @@ public interface DaoMessage {
boolean filter_archive,
boolean ascending, boolean debug);
@Query("SELECT COUNT(*) FROM message" +
" JOIN folder_view AS folder ON folder.id = message.folder" +
" LEFT JOIN operation ON operation.message = message.id" +
" WHERE " + is_outbox +
" AND operation.id IS NULL")
LiveData<Integer> liveOutboxPending();
@Query("SELECT account.name AS accountName" +
", COUNT(message.id) AS count" +
", SUM(message.ui_seen) AS seen" +

@ -248,6 +248,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private SeekBar sbThread;
private ImageButton ibDown;
private ImageButton ibUp;
private ImageButton ibOutbox;
private TextView tvOutboxCount;
private ImageButton ibSeen;
private ImageButton ibUnflagged;
private ImageButton ibSnoozed;
@ -258,6 +260,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private Group grpHintSwipe;
private Group grpHintSelect;
private Group grpReady;
private Group grpOutbox;
private FloatingActionButton fabReply;
private FloatingActionButton fabCompose;
private FloatingActionButton fabMore;
@ -458,6 +461,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
sbThread = view.findViewById(R.id.sbThread);
ibDown = view.findViewById(R.id.ibDown);
ibUp = view.findViewById(R.id.ibUp);
ibOutbox = view.findViewById(R.id.ibOutbox);
tvOutboxCount = view.findViewById(R.id.tvOutboxCount);
ibSeen = view.findViewById(R.id.ibSeen);
ibUnflagged = view.findViewById(R.id.ibUnflagged);
ibSnoozed = view.findViewById(R.id.ibSnoozed);
@ -469,6 +474,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
grpHintSwipe = view.findViewById(R.id.grpHintSwipe);
grpHintSelect = view.findViewById(R.id.grpHintSelect);
grpReady = view.findViewById(R.id.grpReady);
grpOutbox = view.findViewById(R.id.grpOutbox);
fabReply = view.findViewById(R.id.fabReply);
fabCompose = view.findViewById(R.id.fabCompose);
@ -771,6 +777,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
});
ibOutbox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(v.getContext());
lbm.sendBroadcast(new Intent(ActivityView.ACTION_VIEW_OUTBOX));
}
});
ibSeen.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -1126,6 +1140,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
bottom_navigation.setVisibility(actionbar && viewType == AdapterMessage.ViewType.THREAD ? View.INVISIBLE : View.GONE);
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
grpOutbox.setVisibility(View.GONE);
fabReply.hide();
@ -3728,6 +3743,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
updateState(folders);
}
});
db.message().liveOutboxPending().observe(getViewLifecycleOwner(), new Observer<Integer>() {
@Override
public void onChanged(Integer pending) {
if (pending != null && pending > 10)
tvOutboxCount.setText("+");
else
tvOutboxCount.setText(pending == null || pending == 0 ? null : NF.format(pending));
grpOutbox.setVisibility(pending == null || pending == 0 ? View.GONE : View.VISIBLE);
}
});
break;
case FOLDER:
@ -3741,6 +3766,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
updateState(folders);
}
});
db.message().liveOutboxPending().observe(getViewLifecycleOwner(), new Observer<Integer>() {
@Override
public void onChanged(Integer pending) {
if (pending != null && pending > 10)
tvOutboxCount.setText("+");
else
tvOutboxCount.setText(pending == null || pending == 0 ? null : NF.format(pending));
grpOutbox.setVisibility(pending == null || pending == 0 ? View.GONE : View.VISIBLE);
}
});
break;
case THREAD:

@ -0,0 +1,19 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal"
android:autoMirrored="true">
<path
android:fillColor="@android:color/white"
android:pathData="M5,10.5l6,1.5l-6,1.5v3.49l5.39,-2.27c0.6,-1.73 1.86,-3.16 3.48,-3.97L5,7.01V10.5z"
android:strokeAlpha="0.3"
android:fillAlpha="0.3"/>
<path
android:fillColor="@android:color/white"
android:pathData="M11,12l-6,-1.5V7.01l8.87,3.74c0.94,-0.47 2,-0.75 3.13,-0.75c0.1,0 0.19,0.01 0.28,0.01L3,4v16l7,-2.95c0,-0.02 0,-0.03 0,-0.05c0,-0.8 0.14,-1.56 0.39,-2.28L5,16.99V13.5L11,12z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M17,12c-2.76,0 -5,2.24 -5,5s2.24,5 5,5c2.76,0 5,-2.24 5,-5S19.76,12 17,12zM18.65,19.35l-2.15,-2.15V14h1v2.79l1.85,1.85L18.65,19.35z"/>
</vector>

@ -234,6 +234,30 @@
app:layout_constraintStart_toEndOf="@+id/ibDown"
app:srcCompat="@drawable/twotone_vertical_align_top_24" />
<ImageButton
android:id="@+id/ibOutbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/title_folder_outbox"
android:padding="12dp"
android:tint="?attr/colorSeparator"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="@drawable/twotone_schedule_send_24" />
<TextView
android:id="@+id/tvOutboxCount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="6dp"
android:paddingVertical="3dp"
android:text="3"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="@+id/ibOutbox"
app:layout_constraintTop_toTopOf="@+id/ibOutbox" />
<ImageButton
android:id="@+id/ibSeen"
android:layout_width="wrap_content"
@ -324,6 +348,12 @@
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="rvMessage" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpOutbox"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="ibOutbox,tvOutboxCount" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.SwipeRefreshLayoutEx>

Loading…
Cancel
Save