mirror of https://github.com/M66B/FairEmail.git
Setup welcome collapsible
This commit is contained in:
parent
135b9f7cf0
commit
1c70668f45
|
@ -67,6 +67,9 @@ public class FragmentSetup extends FragmentBase {
|
||||||
private TextView tvPrivacy;
|
private TextView tvPrivacy;
|
||||||
private TextView tvSupport;
|
private TextView tvSupport;
|
||||||
|
|
||||||
|
private ImageButton ibWelcome;
|
||||||
|
private Group grpWelcome;
|
||||||
|
|
||||||
private TextView tvNoInternet;
|
private TextView tvNoInternet;
|
||||||
private ImageButton ibHelp;
|
private ImageButton ibHelp;
|
||||||
private Button btnQuick;
|
private Button btnQuick;
|
||||||
|
@ -128,6 +131,8 @@ public class FragmentSetup extends FragmentBase {
|
||||||
|
|
||||||
tvPrivacy = view.findViewById(R.id.tvPrivacy);
|
tvPrivacy = view.findViewById(R.id.tvPrivacy);
|
||||||
tvSupport = view.findViewById(R.id.tvSupport);
|
tvSupport = view.findViewById(R.id.tvSupport);
|
||||||
|
ibWelcome = view.findViewById(R.id.ibWelcome);
|
||||||
|
grpWelcome = view.findViewById(R.id.grpWelcome);
|
||||||
|
|
||||||
tvNoInternet = view.findViewById(R.id.tvNoInternet);
|
tvNoInternet = view.findViewById(R.id.tvNoInternet);
|
||||||
ibHelp = view.findViewById(R.id.ibHelp);
|
ibHelp = view.findViewById(R.id.ibHelp);
|
||||||
|
@ -186,6 +191,18 @@ public class FragmentSetup extends FragmentBase {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateWelcome();
|
||||||
|
|
||||||
|
ibWelcome.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(view.getContext());
|
||||||
|
boolean setup_welcome = !prefs.getBoolean("setup_welcome", true);
|
||||||
|
prefs.edit().putBoolean("setup_welcome", setup_welcome).apply();
|
||||||
|
updateWelcome();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ibHelp.setOnClickListener(new View.OnClickListener() {
|
ibHelp.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -658,6 +675,13 @@ public class FragmentSetup extends FragmentBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateWelcome() {
|
||||||
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
boolean setup_welcome = prefs.getBoolean("setup_welcome", true);
|
||||||
|
ibWelcome.setImageLevel(setup_welcome ? 0 /* less */ : 1 /* more */);
|
||||||
|
grpWelcome.setVisibility(setup_welcome ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateManual() {
|
private void updateManual() {
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
|
|
|
@ -123,6 +123,23 @@
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/tvPrivacy"
|
app:layout_constraintStart_toEndOf="@id/tvPrivacy"
|
||||||
app:layout_constraintTop_toBottomOf="@id/analytics" />
|
app:layout_constraintTop_toBottomOf="@id/analytics" />
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/ibWelcome"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tvSupport"
|
||||||
|
app:srcCompat="@drawable/expander" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.Group
|
||||||
|
android:id="@+id/grpWelcome"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:constraint_referenced_ids="intro,simple,issue,analytics,tvPrivacy,tvSupport" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue