diff --git a/SecondsClock/build.gradle b/SecondsClock/build.gradle index d99e710..324d1be 100644 --- a/SecondsClock/build.gradle +++ b/SecondsClock/build.gradle @@ -24,8 +24,8 @@ android { applicationId "uk.co.yahoo.p1rpp.secondsclock" minSdk 26 targetSdk 26 - versionCode 6 - versionName "2.2" + versionCode 7 + versionName "2.3" } buildTypes { release { diff --git a/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/Activity_common.java b/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/Activity_common.java index d6566b7..7a40dd2 100644 --- a/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/Activity_common.java +++ b/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/Activity_common.java @@ -30,13 +30,16 @@ public abstract class Activity_common extends Activity implements View.OnLongCli protected static final int CONFIGURE = 0; // m_currentView default value - // View IDs for buttons, to switch on click or long click: + // View IDs for top level menu buttons, to switch on click or long click: // also used as widget touch preference values, except that // CONFIGURE_NEW_WIDGET isn't a widget touch preference, and - // CHOOSE_ACTION isn't a button, as we're already doing it if we get here. + // GO_SECONDS_CLOCK isn't a button because we're alread there, + // and CHOOSE_ACTION is both a button in the widget configuration page + // and a possible action when teh widget is touched. protected static final int LONGPRESSHELP = 9091; protected static final int GO_SYSTEM_CLOCK = LONGPRESSHELP + 1; - protected static final int CONFIGURE_NEW_WIDGET = GO_SYSTEM_CLOCK + 1; + protected static final int GO_SECONDS_CLOCK = GO_SYSTEM_CLOCK + 1; + protected static final int CONFIGURE_NEW_WIDGET = GO_SECONDS_CLOCK + 1; protected static final int CONFIGURE_EXISTING_WIDGET = CONFIGURE_NEW_WIDGET + 1; protected static final int CONFIGURE_NIGHT_CLOCK = diff --git a/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/MainActivity.java b/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/MainActivity.java index 6d18eb0..730bdbb 100644 --- a/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/MainActivity.java +++ b/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/MainActivity.java @@ -89,6 +89,7 @@ public void onClick(View v) { case GO_SYSTEM_CLOCK: goSystemClock(); break; + // GO_SECONDS_CLOCK isn't a main menu button case CONFIGURE_NEW_WIDGET: m_prefs.edit().putInt("Wview", CONFIGURE).commit(); startActivity(new Intent( @@ -105,6 +106,12 @@ public void onClick(View v) { m_prefs.edit().putInt("Wview", CONFIGURE) .putInt("Wconfiguring", 1).commit(); doToast(R.string.actionoldwidget); + Intent homeIntent= new Intent(Intent.ACTION_MAIN); + homeIntent.addCategory(Intent.CATEGORY_HOME); + homeIntent.setFlags( + Intent.FLAG_ACTIVITY_NEW_TASK + | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(homeIntent); finish(); break; case CONFIGURE_NIGHT_CLOCK: @@ -131,6 +138,7 @@ public boolean onLongClick(View v) { doToast(R.string.mainactivityhelp); return true; case GO_SYSTEM_CLOCK: doToast(R.string.helpgosysclock); return true; + // GO_SECONDS_CLOCK isn't a main menu button case CONFIGURE_NEW_WIDGET: doToast(R.string.helpconfignewwidget); return true; case CONFIGURE_THIS_WIDGET: @@ -211,7 +219,8 @@ protected void onStart() { sendBroadcast(intent); } } - // CHOOSE_ACTION or we got launched: onResume will set up our screen. + // CHOOSE_ACTION or GO_SECONDS_CLOCK or we got launched: + // onResume will set up our screen. } @SuppressLint("SetTextI18n") diff --git a/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/SecondsClockWidget.java b/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/SecondsClockWidget.java index 8014157..a676a5f 100644 --- a/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/SecondsClockWidget.java +++ b/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/SecondsClockWidget.java @@ -56,10 +56,10 @@ void updateAppWidget( if (Objects.requireNonNull(widgetIds).contains(thisWidget)) { // Get the preferences for this widget. showTime = - prefs.getInt(key +" showTime", 2); // include seconds + prefs.getInt(key + "showTime", 2); // include seconds showWeekDay = - prefs.getInt(key + " showWeekDay", 2); // long format - showShortDate = prefs.getInt(key +" showShortDate", 0); + prefs.getInt(key + "showWeekDay", 2); // long format + showShortDate = prefs.getInt(key + "showShortDate", 0); showMonthDay = prefs.getInt(key + "showMonthDay", 1); showMonth = diff --git a/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/WidgetConfigureActivity.java b/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/WidgetConfigureActivity.java index f1e1901..3be44bb 100644 --- a/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/WidgetConfigureActivity.java +++ b/SecondsClock/src/main/java/uk/co/yahoo/p1rpp/secondsclock/WidgetConfigureActivity.java @@ -51,6 +51,7 @@ public class WidgetConfigureActivity extends ConfigureActivity private Button fgButton; private Button chooseButton; private CheckBox sysClockCheckBox; + private CheckBox secondsClockCheckBox; private CheckBox configThisCheckBox; private CheckBox configNightClockCheckBox; private CheckBox runNightClockCheckBox; @@ -80,7 +81,10 @@ public boolean onLongClick(View v) { case SETTEXTCOLOUR: doToast(R.string.setfgcolourhelp); return true; case SETBACKGROUNDCOLOUR: doToast(R.string.setbgcolourhelp); return true; case GO_SYSTEM_CLOCK: - doToast(R.string.touchrunnightclock); + doToast(R.string.helptouchsysclock); + return true; + case GO_SECONDS_CLOCK: + doToast(R.string.helptouchsecondsclock); return true; case CONFIGURE_EXISTING_WIDGET: doToast(R.string.helpconfigwidget); @@ -100,54 +104,37 @@ public boolean onLongClick(View v) { } return super.onLongClick(v); } + + private void fixCheckBoxes(int action) { + if (!recursive) { + recursive = true; + sysClockCheckBox.setChecked(action == GO_SYSTEM_CLOCK); + secondsClockCheckBox.setChecked(action == GO_SECONDS_CLOCK); + configThisCheckBox.setChecked(action == CONFIGURE_EXISTING_WIDGET); + configNightClockCheckBox.setChecked(action == CONFIGURE_NIGHT_CLOCK); + runNightClockCheckBox.setChecked(action == GO_NIGHT_CLOCK); + chooseCheckBox.setChecked(action == CHOOSE_ACTION); + recursive = false; + } + } + @SuppressLint("ApplySharedPref") @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (isChecked) { - switch (buttonView.getId()) { - case GO_SYSTEM_CLOCK: - configThisCheckBox.setChecked(false); - configNightClockCheckBox.setChecked(false); - runNightClockCheckBox.setChecked(false); - chooseCheckBox.setChecked(false); - m_prefs.edit().putInt( - m_key + "touchaction", GO_SYSTEM_CLOCK).commit(); - break; - case CONFIGURE_EXISTING_WIDGET: - sysClockCheckBox.setChecked(false); - configNightClockCheckBox.setChecked(false); - runNightClockCheckBox.setChecked(false); - chooseCheckBox.setChecked(false); - m_prefs.edit().putInt(m_key + "touchaction", - CONFIGURE_EXISTING_WIDGET).commit(); - break; - case CONFIGURE_NIGHT_CLOCK: - sysClockCheckBox.setChecked(false); - configThisCheckBox.setChecked(false); - runNightClockCheckBox.setChecked(false); - chooseCheckBox.setChecked(false); - m_prefs.edit().putInt( - m_key + "touchaction", CONFIGURE_NIGHT_CLOCK).commit(); - break; - case GO_NIGHT_CLOCK: - sysClockCheckBox.setChecked(false); - configThisCheckBox.setChecked(false); - configNightClockCheckBox.setChecked(false); - chooseCheckBox.setChecked(false); - m_prefs.edit().putInt( - m_key + "touchaction", GO_NIGHT_CLOCK).commit(); - break; - case CHOOSE_ACTION: - sysClockCheckBox.setChecked(false); - configThisCheckBox.setChecked(false); - configNightClockCheckBox.setChecked(false); - runNightClockCheckBox.setChecked(false); - m_prefs.edit().putInt( - m_key + "touchaction", CHOOSE_ACTION).commit(); - break; - default: - super.onCheckedChanged(buttonView, isChecked); - } + int action = buttonView.getId(); + switch (action) { + case GO_SYSTEM_CLOCK: + case GO_SECONDS_CLOCK: + case CONFIGURE_EXISTING_WIDGET: + case CONFIGURE_NIGHT_CLOCK: + case GO_NIGHT_CLOCK:; + case CHOOSE_ACTION:; + fixCheckBoxes(action); + m_prefs.edit().putInt( + m_key + "touchaction", action).commit(); + break; + default: + super.onCheckedChanged(buttonView, isChecked); } } @@ -313,7 +300,6 @@ private void doMainLayout() { ScrollView lscroll = new ScrollView(this); lscroll.setScrollbarFadingEnabled(false); LinearLayout l1 = new LinearLayout(this); - l1.setBackgroundColor(0xFF000000); if (m_orientation == Configuration.ORIENTATION_LANDSCAPE) { l1.setOrientation(LinearLayout.HORIZONTAL); LinearLayout l2 = new LinearLayout(this); @@ -404,7 +390,6 @@ protected void doChooserLayout() { LinearLayout lc = makeChooser(); int pad = (int)(5 * m_density); LinearLayout l1 = new LinearLayout(this); - l1.setBackgroundColor(0xFF000000); demobox.addView(demo); demoboxbox.setLayoutParams(lpMatchWrap); demoboxbox.setOrientation(LinearLayout.VERTICAL); @@ -549,13 +534,13 @@ protected void doActionLayout() { lbuttons.setOrientation(LinearLayout.VERTICAL); lbuttons.addView(centredLabel(R.string.actionpage, LONGPRESSHELP)); lbuttons.addView(sysClockCheckBox, lpWrapWrap); + lbuttons.addView(secondsClockCheckBox, lpWrapWrap); lbuttons.addView(configThisCheckBox, lpWrapWrap); lbuttons.addView(configNightClockCheckBox, lpWrapWrap); lbuttons.addView(runNightClockCheckBox, lpWrapWrap); lbuttons.addView(chooseCheckBox, lpWrapWrap); LinearLayout l1 = new LinearLayout(this); // default orientation is HORIZONTAL - l1.setBackgroundColor(0xFF000000); if (m_orientation == Configuration.ORIENTATION_LANDSCAPE) { LinearLayout l2 = new LinearLayout(this); l2.setOrientation(LinearLayout.VERTICAL); @@ -690,7 +675,7 @@ public void onCheckedChanged( showSecondsCheckBox.setVisibility(View.INVISIBLE); } } - m_prefs.edit().putInt("WshowTime", showTime).commit(); + m_prefs.edit().putInt(m_key + "showTime", showTime).commit(); updateWidget(); updateDemo(); } @@ -711,7 +696,7 @@ public void onCheckedChanged( } else { showTime = 1; } - m_prefs.edit().putInt("WshowTime", showTime).commit(); + m_prefs.edit().putInt(m_key + "showTime", showTime).commit(); updateWidget(); updateDemo(); } @@ -732,40 +717,41 @@ public void onCheckedChanged( chooseButton = new Button(this); chooseButton.setId(CHOOSE_ACTION); chooseButton.setAllCaps(false); - chooseButton.setText(R.string.chooseaction); + chooseButton.setText(R.string.setaction); chooseButton.setOnClickListener(this); chooseButton.setOnLongClickListener(this); - int action = m_prefs.getInt(m_key + "touchaction", CHOOSE_ACTION); sysClockCheckBox = new CheckBox(this); sysClockCheckBox.setId(GO_SYSTEM_CLOCK); sysClockCheckBox.setText(getString(R.string.gosysclock)); - sysClockCheckBox.setChecked(action == GO_SYSTEM_CLOCK); sysClockCheckBox.setOnCheckedChangeListener(this); sysClockCheckBox.setOnLongClickListener(this); + secondsClockCheckBox = new CheckBox(this); + secondsClockCheckBox.setId(GO_SECONDS_CLOCK); + secondsClockCheckBox.setText(getString(R.string.gosecondsclock)); + secondsClockCheckBox.setOnCheckedChangeListener(this); + secondsClockCheckBox.setOnLongClickListener(this); configThisCheckBox = new CheckBox(this); configThisCheckBox.setId(CONFIGURE_EXISTING_WIDGET); configThisCheckBox.setText(getString(R.string.configwidget)); - configThisCheckBox.setChecked(action == CONFIGURE_EXISTING_WIDGET); configThisCheckBox.setOnCheckedChangeListener(this); configThisCheckBox.setOnLongClickListener(this); configNightClockCheckBox = new CheckBox(this); configNightClockCheckBox.setId(CONFIGURE_NIGHT_CLOCK); configNightClockCheckBox.setText(getString(R.string.confignightclock)); - configNightClockCheckBox.setChecked(action == CONFIGURE_NIGHT_CLOCK); configNightClockCheckBox.setOnCheckedChangeListener(this); configNightClockCheckBox.setOnLongClickListener(this); runNightClockCheckBox = new CheckBox(this); runNightClockCheckBox.setId(GO_NIGHT_CLOCK); runNightClockCheckBox.setText(getString(R.string.runnightclock)); - runNightClockCheckBox.setChecked(action == GO_NIGHT_CLOCK); runNightClockCheckBox.setOnCheckedChangeListener(this); runNightClockCheckBox.setOnLongClickListener(this); chooseCheckBox = new CheckBox(this); chooseCheckBox.setId(CHOOSE_ACTION); chooseCheckBox.setText(getString(R.string.chooseaction)); - chooseCheckBox.setChecked(action == CHOOSE_ACTION); chooseCheckBox.setOnCheckedChangeListener(this); chooseCheckBox.setOnLongClickListener(this); + int action = m_prefs.getInt(m_key + "touchaction", CHOOSE_ACTION); + fixCheckBoxes(action); saturationValue.addTextChangedListener(new TextWatcher() { @Override diff --git a/SecondsClock/src/main/res/drawable/ic_launcher.png b/SecondsClock/src/main/res/drawable/ic_launcher.png index 159e85b..128c2d1 100644 Binary files a/SecondsClock/src/main/res/drawable/ic_launcher.png and b/SecondsClock/src/main/res/drawable/ic_launcher.png differ diff --git a/SecondsClock/src/main/res/values/strings.xml b/SecondsClock/src/main/res/values/strings.xml index d9a857e..cbf453b 100644 --- a/SecondsClock/src/main/res/values/strings.xml +++ b/SecondsClock/src/main/res/values/strings.xml @@ -17,6 +17,9 @@ default clock app. Check this box to make a touch on the widget go to the device\'s default clock app. + Go to SecondsClock app + Check this box to make a touch on the + widget go to this app (SecondsClock). Configure new widget Touch this button to set the configuration for new widgets. To create a new widget, long press in an empty @@ -33,7 +36,7 @@ to configure. Configure this widget Touch this button to configure the - the widegt that you touched. + widget that you touched. Check this box to make a touch on the widget go to the configuration page to reconfigure it. Configure full screen clock @@ -46,7 +49,7 @@ the full screen clock. Check this box to make a touch on the widget run the full screen clock. - Choose action when touched + Go to action menu when touched Check this box to make a touch on the widget go to the top level menu for the app to choose what to do next. @@ -72,7 +75,7 @@ This page allows you to configure a widget. If you came here from a particular widget, it reconfigures that: if you came here from the top level page, - it sets the the configuration for new widgets. + it sets the configuration for new widgets. You can make multiple widgets with different configurations. Long press on anything for a longer description of what it does. This page allows you to configure diff --git a/fastlane/metadata/android/en-US/changeLogs/7.txt b/fastlane/metadata/android/en-US/changeLogs/7.txt new file mode 100644 index 0000000..9523f54 --- /dev/null +++ b/fastlane/metadata/android/en-US/changeLogs/7.txt @@ -0,0 +1 @@ +Fix issues 3, 4, 5, 6