From d4ebe8a0baded2ce3dbab67c28c8c0a74351d8f6 Mon Sep 17 00:00:00 2001 From: Forrest Guice Date: Sun, 4 Sep 2022 18:27:45 -0700 Subject: [PATCH] help Adds 'online help' for widget title substitutions. --- .../suntimeswidget/SuntimesConfigActivity0.java | 16 ++++++++++++++++ app/src/main/res/values/strings.xml | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/forrestguice/suntimeswidget/SuntimesConfigActivity0.java b/app/src/main/java/com/forrestguice/suntimeswidget/SuntimesConfigActivity0.java index bb82fae67..18d68a19d 100644 --- a/app/src/main/java/com/forrestguice/suntimeswidget/SuntimesConfigActivity0.java +++ b/app/src/main/java/com/forrestguice/suntimeswidget/SuntimesConfigActivity0.java @@ -27,6 +27,7 @@ import android.graphics.Color; import android.graphics.Paint; import android.graphics.Typeface; +import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; @@ -99,6 +100,8 @@ public class SuntimesConfigActivity0 extends AppCompatActivity protected static final String DIALOGTAG_ABOUT = "about"; protected static final String DIALOGTAG_HELP = "help"; + protected static final String HELPTAG_SUBSTITUTIONS = "help_substitutions"; + protected int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; protected boolean reconfigure = false; protected ContentValues themeValues; @@ -726,6 +729,8 @@ public void onClick(View v) { HelpDialog helpDialog = new HelpDialog(); helpDialog.setContent(getString(R.string.help_appearance_title)); + helpDialog.setShowNeutralButton(getString(R.string.configAction_onlineHelp)); + helpDialog.setNeutralButtonListener(helpDialogListener_substitutions, HELPTAG_SUBSTITUTIONS); helpDialog.show(getSupportFragmentManager(), DIALOGTAG_HELP); } }); @@ -2266,6 +2271,17 @@ public void onBackPressed() { overridePendingTransition(R.anim.transition_cancel_in, R.anim.transition_cancel_out); } + /** + * HelpDialog (title substitutions) + */ + private final View.OnClickListener helpDialogListener_substitutions = new View.OnClickListener() + { + @Override + public void onClick(View v) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.help_substitutions_url)))); + } + }; + //////////////////////////////////////////////////////////////////////////////////////////////// /** diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6cf978ff3..5df38318e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1872,7 +1872,8 @@ * %m for mode (short) (e.g. Solstice)
* %M for mode (long) (e.g. Winter Solstice)
* %o for order (e.g. Closest Event, Upcoming Event)
- ]]> + ]]> + https://github.com/forrestguice/SuntimesWidget/wiki/Help#data-substitutions %1$s]]>