1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

Added legend to compose

This commit is contained in:
M66B 2020-01-12 09:12:20 +01:00
parent 0416b2c97e
commit 6d4f858d01
3 changed files with 36 additions and 0 deletions

View file

@ -90,6 +90,9 @@ import androidx.constraintlayout.widget.Group;
import androidx.core.content.FileProvider;
import androidx.cursoradapter.widget.SimpleCursorAdapter;
import androidx.documentfile.provider.DocumentFile;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.Observer;
import androidx.preference.PreferenceManager;
@ -1027,6 +1030,9 @@ public class FragmentCompose extends FragmentBase {
case R.id.menu_clear:
StyleHelper.apply(R.id.menu_clear, etBody);
return true;
case R.id.menu_legend:
onMenuLegend();
return true;
case R.id.menu_contact_group:
onMenuContactGroup();
return true;
@ -1141,6 +1147,21 @@ public class FragmentCompose extends FragmentBase {
bottom_navigation.setLayoutParams(params);
}
private void onMenuLegend() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
getParentFragmentManager().popBackStack("legend", FragmentManager.POP_BACK_STACK_INCLUSIVE);
Bundle args = new Bundle();
args.putString("tab", "compose");
Fragment fragment = new FragmentLegend();
fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getParentFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("legend");
fragmentTransaction.commit();
}
private void onMenuContactGroup() {
Bundle args = new Bundle();
args.putLong("working", working);

View file

@ -72,6 +72,16 @@ public class FragmentLegend extends FragmentBase {
if (layout < 0) {
TabLayout tabLayout = view.findViewById(R.id.tab_layout);
tabLayout.setupWithViewPager(pager);
Bundle args = getArguments();
if (args != null) {
String tab = args.getString("tab");
if ("compose".equals(tab))
pager.setCurrentItem(3);
args.remove("tab");
setArguments(args);
}
}
}

View file

@ -25,6 +25,11 @@
android:title="@string/title_compact"
app:showAsAction="never" />
<item
android:id="@+id/menu_legend"
android:title="@string/menu_legend"
app:showAsAction="never" />
<item
android:id="@+id/menu_clear"
android:title="@string/title_style_clear"