Added do not show again option for changelog

pull/215/head
M66B 7 months ago
parent 4b9de6f263
commit cc1c62ba8c

@ -1531,6 +1531,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
Bundle args = new Bundle();
args.putString("name", "CHANGELOG.md");
args.putString("option", "show_changelog");
FragmentDialogMarkdown fragment = new FragmentDialogMarkdown();
fragment.setArguments(args);
fragment.show(getSupportFragmentManager(), "changelog");

@ -21,11 +21,16 @@ package eu.faircode.email;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Spanned;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageButton;
import android.widget.TextView;
@ -33,6 +38,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.Group;
import androidx.core.text.method.LinkMovementMethodCompat;
import androidx.preference.PreferenceManager;
import java.io.InputStream;
@ -43,14 +49,27 @@ public class FragmentDialogMarkdown extends FragmentDialogBase {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_markdown, null);
final Context context = getContext();
String option = getArguments().getString("option");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_markdown, null);
final TextView tvMarkdown = dview.findViewById(R.id.tvMarkdown);
final CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
final ImageButton ibCancel = dview.findViewById(R.id.ibCancel);
final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
final Group grpReady = dview.findViewById(R.id.grpReady);
tvMarkdown.setText(null);
cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
prefs.edit().putBoolean(option, !checked).apply();
}
});
ibCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -58,23 +77,22 @@ public class FragmentDialogMarkdown extends FragmentDialogBase {
}
});
Dialog dialog = new Dialog(getContext());
Dialog dialog = new Dialog(context);
//dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(dview);
dialog.getWindow().setLayout(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT);
new SimpleTask<Spanned>() {
@Override
protected void onPreExecute(Bundle args) {
grpReady.setVisibility(View.GONE);
cbNotAgain.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Bundle args) {
grpReady.setVisibility(View.VISIBLE);
cbNotAgain.setVisibility(TextUtils.isEmpty(option) ? View.GONE : View.VISIBLE);
pbWait.setVisibility(View.GONE);
}
@ -121,4 +139,10 @@ public class FragmentDialogMarkdown extends FragmentDialogBase {
return dialog;
}
@Override
public void onStart() {
super.onStart();
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
}
}

@ -3,17 +3,19 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:padding="24dp"
tools:context="eu.faircode.email.ActivityView">
<ScrollView
android:id="@+id/scroll"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="0dp"
android:fadeScrollbars="false"
android:minHeight="120dp"
android:orientation="vertical"
android:padding="24dp"
android:scrollbarStyle="outsideOverlay"
android:scrollbarStyle="outsideInset"
app:layout_constraintBottom_toTopOf="@+id/cbNotAgain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -34,13 +36,25 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<CheckBox
android:id="@+id/cbNotAgain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_no_show_again"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/scroll" />
<ImageButton
android:id="@+id/ibCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@android:string/no"
android:padding="12dp"
android:paddingEnd="12dp"
android:tooltipText="@android:string/no"
app:layout_constraintEnd_toEndOf="@+id/scroll"
app:layout_constraintTop_toTopOf="@+id/scroll"

@ -2344,6 +2344,7 @@
<string name="title_ask_what">Ask what to do</string>
<string name="title_no_ask_again">Do not ask this again</string>
<string name="title_no_ask_for_again">Do not ask this again for %1$s</string>
<string name="title_no_show_again">Do not show this again</string>
<string name="title_undo_privacy">This can be undone in the privacy-settings tab page</string>
<string name="title_no_body">No message text found</string>
<string name="title_large_body">This message is very large and this may cause problems!</string>

Loading…
Cancel
Save