From 700246d31ac3d84dfcf3cf23c3906af853dabcf3 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 23 Jan 2021 19:59:31 +0100 Subject: [PATCH] Expander for more options --- .../java/eu/faircode/email/FragmentSetup.java | 33 ++++++++++ app/src/main/res/layout/fragment_setup.xml | 62 +++++++++++++------ 2 files changed, 77 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentSetup.java b/app/src/main/java/eu/faircode/email/FragmentSetup.java index b0b376336b..86ec33fcfb 100644 --- a/app/src/main/java/eu/faircode/email/FragmentSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentSetup.java @@ -62,6 +62,9 @@ public class FragmentSetup extends FragmentBase { private Button btnQuick; private TextView tvQuickNew; + private ImageButton ibManual; + private TextView tvManual; + private Button btnAccount; private Button btnIdentity; @@ -80,6 +83,7 @@ public class FragmentSetup extends FragmentBase { private Button btnInbox; + private Group grpManual; private Group grpDataSaver; private int textColorPrimary; @@ -103,6 +107,9 @@ public class FragmentSetup extends FragmentBase { btnQuick = view.findViewById(R.id.btnQuick); tvQuickNew = view.findViewById(R.id.tvQuickNew); + ibManual = view.findViewById(R.id.ibManual); + tvManual = view.findViewById(R.id.tvManual); + btnAccount = view.findViewById(R.id.btnAccount); btnIdentity = view.findViewById(R.id.btnIdentity); @@ -121,6 +128,7 @@ public class FragmentSetup extends FragmentBase { btnInbox = view.findViewById(R.id.btnInbox); + grpManual = view.findViewById(R.id.grpManual); grpDataSaver = view.findViewById(R.id.grpDataSaver); PackageManager pm = getContext().getPackageManager(); @@ -208,6 +216,31 @@ public class FragmentSetup extends FragmentBase { } }); + ibManual.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (grpManual.getVisibility() == View.GONE) { + ibManual.setImageLevel(0 /* less */); + grpManual.setVisibility(View.VISIBLE); + } else { + ibManual.setImageLevel(1 /* more */); + grpManual.setVisibility(View.GONE); + } + } + }); + + tvManual.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ibManual.setPressed(true); + ibManual.setPressed(false); + ibManual.performClick(); + } + }); + + ibManual.setImageLevel(BuildConfig.DEBUG ? 0 /* less */ : 1 /* more */); + grpManual.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE); + btnAccount.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/res/layout/fragment_setup.xml b/app/src/main/res/layout/fragment_setup.xml index 7c1372fb82..da6379bd45 100644 --- a/app/src/main/res/layout/fragment_setup.xml +++ b/app/src/main/res/layout/fragment_setup.xml @@ -94,38 +94,45 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvQuickRemarkMultiple" /> -