Added settings button to error page

pull/203/head
M66B 3 years ago
parent 6c4a9d2b46
commit a2ed0ab2e0

@ -42,18 +42,31 @@ public class ActivityError extends ActivityBase {
TextView tvTitle = view.findViewById(R.id.tvTitle);
TextView tvMessage = view.findViewById(R.id.tvMessage);
ImageButton ibSetting = view.findViewById(R.id.ibSetting);
ImageButton ibInfo = view.findViewById(R.id.ibInfo);
Intent intent = getIntent();
String type = intent.getStringExtra("type");
String title = intent.getStringExtra("title");
String message = intent.getStringExtra("message");
long account = intent.getLongExtra("account", -1L);
int faq = intent.getIntExtra("faq", -1);
tvTitle.setText(title);
tvMessage.setMovementMethod(LinkMovementMethod.getInstance());
tvMessage.setText(message);
ibSetting.setVisibility(account < 0 ? View.GONE : View.VISIBLE);
ibSetting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(view.getContext(), ActivitySetup.class)
.setAction("target:accounts")
.putExtra("target", "accounts");
startActivity(intent);
}
});
ibInfo.setVisibility(faq > 0 ? View.VISIBLE : View.GONE);
ibInfo.setOnClickListener(new View.OnClickListener() {
@Override

@ -4902,6 +4902,7 @@ class Core {
intent.putExtra("type", channel);
intent.putExtra("title", title);
intent.putExtra("message", message);
intent.putExtra("account", account.id);
intent.putExtra("faq", 22);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pi = PendingIntentCompat.getActivity(

@ -1171,6 +1171,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
intent.putExtra("type", "alert");
intent.putExtra("title", title);
intent.putExtra("message", message);
intent.putExtra("account", account.id);
intent.putExtra("faq", 23);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent piAlert = PendingIntentCompat.getActivity(

@ -41,6 +41,9 @@
android:id="@+id/tvTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableStart="@drawable/twotone_warning_24"
android:drawablePadding="6dp"
android:drawableTint="?attr/colorError"
android:text="Error"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary"
@ -53,7 +56,7 @@
android:id="@+id/tvMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginTop="24dp"
android:autoLink="all"
android:text="Error"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
@ -64,11 +67,22 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTitle" />
<ImageButton
android:id="@+id/ibSetting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:contentDescription="@string/title_setup"
android:tooltipText="@string/title_setup"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvMessage"
app:srcCompat="@drawable/twotone_settings_24" />
<ImageButton
android:id="@+id/ibInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginTop="24dp"
android:contentDescription="@string/title_info"
android:tooltipText="@string/title_info"
app:layout_constraintEnd_toEndOf="parent"

Loading…
Cancel
Save