mirror of https://github.com/M66B/FairEmail.git
Added home button
This commit is contained in:
parent
7bd1b0171f
commit
a95387d147
|
@ -117,6 +117,7 @@ public class FragmentMessages extends FragmentBase {
|
|||
private TextView tvNoEmail;
|
||||
private FixedRecyclerView rvMessage;
|
||||
private SeekBar seekBar;
|
||||
private ImageButton ibUp;
|
||||
private BottomNavigationView bottom_navigation;
|
||||
private ContentLoadingProgressBar pbWait;
|
||||
private Group grpSupport;
|
||||
|
@ -272,6 +273,7 @@ public class FragmentMessages extends FragmentBase {
|
|||
tvNoEmail = view.findViewById(R.id.tvNoEmail);
|
||||
rvMessage = view.findViewById(R.id.rvMessage);
|
||||
seekBar = view.findViewById(R.id.seekBar);
|
||||
ibUp = view.findViewById(R.id.ibUp);
|
||||
bottom_navigation = view.findViewById(R.id.bottom_navigation);
|
||||
pbWait = view.findViewById(R.id.pbWait);
|
||||
grpSupport = view.findViewById(R.id.grpSupport);
|
||||
|
@ -333,7 +335,7 @@ public class FragmentMessages extends FragmentBase {
|
|||
rvMessage.setHasFixedSize(false);
|
||||
//rvMessage.setItemViewCacheSize(10);
|
||||
//rvMessage.getRecycledViewPool().setMaxRecycledViews(0, 10);
|
||||
LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
||||
final LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
||||
rvMessage.setLayoutManager(llm);
|
||||
|
||||
DividerItemDecoration itemDecorator = new DividerItemDecoration(getContext(), llm.getOrientation()) {
|
||||
|
@ -461,6 +463,22 @@ public class FragmentMessages extends FragmentBase {
|
|||
}
|
||||
});
|
||||
|
||||
ibUp.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int pos = llm.findLastVisibleItemPosition();
|
||||
if (pos != RecyclerView.NO_POSITION)
|
||||
do {
|
||||
Long key = adapter.getKeyAtPosition(pos);
|
||||
if (key != null && isExpanded(key)) {
|
||||
rvMessage.scrollToPosition(pos);
|
||||
break;
|
||||
}
|
||||
pos--;
|
||||
} while (pos >= 0);
|
||||
}
|
||||
});
|
||||
|
||||
bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
|
||||
|
@ -558,6 +576,7 @@ public class FragmentMessages extends FragmentBase {
|
|||
swipeRefresh.setEnabled(pull);
|
||||
tvNoEmail.setVisibility(View.GONE);
|
||||
seekBar.setVisibility(View.GONE);
|
||||
ibUp.setVisibility(viewType == AdapterMessage.ViewType.THREAD ? View.VISIBLE : View.GONE);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(false);
|
||||
bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(false);
|
||||
bottom_navigation.setVisibility(View.GONE);
|
||||
|
@ -1054,7 +1073,7 @@ public class FragmentMessages extends FragmentBase {
|
|||
if (message == null || message.uid == null)
|
||||
return null;
|
||||
|
||||
if (values.containsKey("expanded") && values.get("expanded").contains(message.id))
|
||||
if (isExpanded(message.id))
|
||||
return null;
|
||||
|
||||
if (EntityFolder.OUTBOX.equals(message.folderType))
|
||||
|
@ -1064,6 +1083,10 @@ public class FragmentMessages extends FragmentBase {
|
|||
}
|
||||
};
|
||||
|
||||
private boolean isExpanded(long id) {
|
||||
return (values.containsKey("expanded") && values.get("expanded").contains(id));
|
||||
}
|
||||
|
||||
private void onActionMove(String folderType) {
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("account", account);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
|
||||
</vector>
|
|
@ -182,6 +182,15 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibUp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/baseline_home_24"
|
||||
app:layout_constraintBottom_toTopOf="@id/seekBar"
|
||||
app:layout_constraintEnd_toEndOf="@id/seekBar" />
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/bottom_navigation"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in New Issue