mirror of https://github.com/M66B/FairEmail.git
Show selected count
This commit is contained in:
parent
916a499c0f
commit
c2d6b8576c
|
@ -240,6 +240,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
private FloatingActionButton fabReply;
|
private FloatingActionButton fabReply;
|
||||||
private FloatingActionButton fabCompose;
|
private FloatingActionButton fabCompose;
|
||||||
private FloatingActionButton fabMore;
|
private FloatingActionButton fabMore;
|
||||||
|
private TextView tvSelectedCount;
|
||||||
private FloatingActionButton fabSearch;
|
private FloatingActionButton fabSearch;
|
||||||
private FloatingActionButton fabError;
|
private FloatingActionButton fabError;
|
||||||
|
|
||||||
|
@ -444,6 +445,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
fabReply = view.findViewById(R.id.fabReply);
|
fabReply = view.findViewById(R.id.fabReply);
|
||||||
fabCompose = view.findViewById(R.id.fabCompose);
|
fabCompose = view.findViewById(R.id.fabCompose);
|
||||||
fabMore = view.findViewById(R.id.fabMore);
|
fabMore = view.findViewById(R.id.fabMore);
|
||||||
|
tvSelectedCount = view.findViewById(R.id.tvSelectedCount);
|
||||||
fabSearch = view.findViewById(R.id.fabSearch);
|
fabSearch = view.findViewById(R.id.fabSearch);
|
||||||
fabError = view.findViewById(R.id.fabError);
|
fabError = view.findViewById(R.id.fabError);
|
||||||
|
|
||||||
|
@ -975,6 +977,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tvSelectedCount.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
onMore();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
fabSearch.setOnClickListener(new View.OnClickListener() {
|
fabSearch.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -1117,6 +1126,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
fabSearch.hide();
|
fabSearch.hide();
|
||||||
|
|
||||||
fabMore.hide();
|
fabMore.hide();
|
||||||
|
tvSelectedCount.setVisibility(View.GONE);
|
||||||
fabError.hide();
|
fabError.hide();
|
||||||
|
|
||||||
if (viewType == AdapterMessage.ViewType.THREAD) {
|
if (viewType == AdapterMessage.ViewType.THREAD) {
|
||||||
|
@ -1226,10 +1236,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
if (activity != null)
|
if (activity != null)
|
||||||
activity.invalidateOptionsMenu();
|
activity.invalidateOptionsMenu();
|
||||||
|
|
||||||
if (selectionTracker != null && selectionTracker.hasSelection())
|
updateMore();
|
||||||
fabMore.show();
|
|
||||||
else
|
|
||||||
fabMore.hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3090,11 +3097,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
loadMessages(false);
|
loadMessages(false);
|
||||||
|
|
||||||
updateExpanded();
|
updateExpanded();
|
||||||
|
updateMore();
|
||||||
if (selectionTracker != null && selectionTracker.hasSelection())
|
|
||||||
fabMore.show();
|
|
||||||
else
|
|
||||||
fabMore.hide();
|
|
||||||
|
|
||||||
// Folder
|
// Folder
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
|
@ -3878,6 +3881,17 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
swipeRefresh.setRefreshing(refreshing);
|
swipeRefresh.setRefreshing(refreshing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateMore() {
|
||||||
|
if (selectionTracker != null && selectionTracker.hasSelection()) {
|
||||||
|
fabMore.show();
|
||||||
|
tvSelectedCount.setText(NF.format(selectionTracker.getSelection().size()));
|
||||||
|
tvSelectedCount.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
fabMore.hide();
|
||||||
|
tvSelectedCount.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void loadMessages(final boolean top) {
|
private void loadMessages(final boolean top) {
|
||||||
if (viewType == AdapterMessage.ViewType.THREAD && onclose != null) {
|
if (viewType == AdapterMessage.ViewType.THREAD && onclose != null) {
|
||||||
ViewModelMessages model = new ViewModelProvider(getActivity()).get(ViewModelMessages.class);
|
ViewModelMessages model = new ViewModelProvider(getActivity()).get(ViewModelMessages.class);
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="?attr/colorPrimary" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
</shape>
|
|
@ -340,6 +340,20 @@
|
||||||
app:backgroundTint="?attr/colorFabBackground"
|
app:backgroundTint="?attr/colorFabBackground"
|
||||||
app:srcCompat="@drawable/baseline_more_vert_24" />
|
app:srcCompat="@drawable/baseline_more_vert_24" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvSelectedCount"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/selected_count_background"
|
||||||
|
android:elevation="7dp"
|
||||||
|
android:paddingHorizontal="6dp"
|
||||||
|
android:paddingVertical="3dp"
|
||||||
|
android:text="3"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
|
android:textColor="@color/action_foreground"
|
||||||
|
app:layout_anchor="@id/fabMore"
|
||||||
|
app:layout_anchorGravity="center_horizontal|bottom" />
|
||||||
|
|
||||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/fabSearch"
|
android:id="@+id/fabSearch"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
Loading…
Reference in New Issue