Added help to review dialog

pull/197/head
M66B 4 years ago
parent 160a658ed9
commit aa90ebe23d

@ -37,6 +37,7 @@ import android.content.res.ColorStateList;
import android.database.sqlite.SQLiteConstraintException;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Typeface;
@ -8075,13 +8076,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_review, null);
TextView tvHelp = dview.findViewById(R.id.tvHelp);
return new AlertDialog.Builder(getContext())
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
Dialog dialog = new AlertDialog.Builder(getContext())
.setView(dview)
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("review_asked", true).apply();
startActivity(Helper.getIntentRate(getContext()));
}
@ -8089,18 +8092,28 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putBoolean("review_asked", true).apply();
}
})
.setNeutralButton(R.string.title_later, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefs.edit().putLong("review_later", new Date().getTime()).apply();
}
})
.create();
tvHelp.setPaintFlags(tvHelp.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
tvHelp.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
prefs.edit().putLong("review_later", new Date().getTime()).apply();
startActivity(Helper.getIntentIssue(v.getContext()));
}
});
return dialog;
}
}

@ -31,6 +31,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMessage" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvHelp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:drawableTint="?android:attr/textColorLink"
android:text="@string/title_need_help"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorLink"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvExplanation" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvOnce"
android:layout_width="wrap_content"
@ -40,6 +52,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvExplanation" />
app:layout_constraintTop_toBottomOf="@id/tvHelp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>

@ -983,6 +983,7 @@
You have been using FairEmail for a while.
It would be appreciated if you could rate FairEmail in the Play Store.
</string>
<string name="title_need_help">I need help</string>
<string name="title_ask_once">This message will only appear once, unless you select \'Later\'</string>
<string name="title_third_party">You are using a version of a third party</string>

Loading…
Cancel
Save