summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Brabham <optedoblivion@cyngn.com>2015-04-24 13:56:00 -0700
committerWilhelm Fitzpatrick <rafial@cyngn.com>2015-12-22 17:35:40 -0800
commit1cf3c5654cec94a8ee3d96a3a3baacac863d3967 (patch)
tree66c15567adf61d6ca9210682d9fe70b00b402259
parentfe8545077f64c7c5d0dec994df87bd41e4cfaade (diff)
downloadandroid_packages_apps_DeskClock-1cf3c5654cec94a8ee3d96a3a3baacac863d3967.tar.gz
android_packages_apps_DeskClock-1cf3c5654cec94a8ee3d96a3a3baacac863d3967.tar.bz2
android_packages_apps_DeskClock-1cf3c5654cec94a8ee3d96a3a3baacac863d3967.zip
Make new menu entry to link to cLock widget settings.
Change-Id: I13ca3156c34eccdd8f60d8585281ae0585aac58e
-rw-r--r--res/menu/desk_clock_menu.xml3
-rw-r--r--res/values/cm_strings.xml4
-rw-r--r--src/com/android/deskclock/DeskClock.java17
3 files changed, 24 insertions, 0 deletions
diff --git a/res/menu/desk_clock_menu.xml b/res/menu/desk_clock_menu.xml
index b2420506f..f4c9c6789 100644
--- a/res/menu/desk_clock_menu.xml
+++ b/res/menu/desk_clock_menu.xml
@@ -22,6 +22,9 @@
<item android:id="@+id/menu_item_settings"
android:title="@string/menu_item_settings"
android:icon="@android:drawable/ic_menu_preferences"/>
+ <item android:id="@+id/menu_item_widget_settings"
+ android:title="@string/menu_item_widget_settings"
+ android:icon="@android:drawable/ic_menu_preferences"/>
<item android:id="@+id/menu_item_help"
android:title="@string/menu_item_help"
android:icon="@android:drawable/ic_menu_preferences"/>
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index a23739dbe..aa597101c 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -15,6 +15,10 @@
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Setting title for accessing the cLock widget settings -->
+ <string name="menu_item_widget_settings">Widget settings</string>
+ <string name="activity_not_found">Activity not found!</string>
+
<!-- Setting title for showing/hiding the alarm status bar icon -->
<string name="show_status_bar_icon_title">Show icon</string>
diff --git a/src/com/android/deskclock/DeskClock.java b/src/com/android/deskclock/DeskClock.java
index 39e5f221b..1c0d91b98 100644
--- a/src/com/android/deskclock/DeskClock.java
+++ b/src/com/android/deskclock/DeskClock.java
@@ -19,6 +19,7 @@ package com.android.deskclock;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.ActivityNotFoundException;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -41,6 +42,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
+import android.widget.Toast;
import com.android.deskclock.alarms.AlarmStateManager;
import com.android.deskclock.events.Events;
import com.android.deskclock.provider.Alarm;
@@ -69,6 +71,10 @@ public class DeskClock extends BaseActivity
// Alarm action for midnight (so we can update the date display).
private static final String KEY_SELECTED_TAB = "selected_tab";
public static final String SELECT_TAB_INTENT_EXTRA = "deskclock.select.tab";
+ private static final String LC_PACKAGE = "com.cyanogenmod.lockclock";
+ private static final String LC_ACTIVITY = LC_PACKAGE + ".preference.Preferences";
+ private static final ComponentName sWidgetSettingComponentName = new ComponentName
+ (LC_PACKAGE, LC_ACTIVITY);
// Request code used when SettingsActivity is launched.
private static final int REQUEST_CHANGE_SETTINGS = 1;
@@ -333,6 +339,17 @@ public class DeskClock extends BaseActivity
startActivityForResult(new Intent(DeskClock.this, SettingsActivity.class),
REQUEST_CHANGE_SETTINGS);
return true;
+ case R.id.menu_item_widget_settings:
+ Intent wsi = new Intent();
+ wsi.setComponent(sWidgetSettingComponentName);
+ try {
+ startActivity(wsi);
+ } catch (ActivityNotFoundException e) {
+ Toast.makeText(this, getResources().getString(R.string.activity_not_found),
+ Toast.LENGTH_SHORT).show();
+ Log.w(LOG_TAG, "Cannot find the activity!");
+ }
+ return true;
case R.id.menu_item_help:
Intent i = item.getIntent();
if (i != null) {