Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9fa4cc96 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Add Dock Settings menu item to DeskClock.

Bug: 2367275
parent 6e371787
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@
    <item android:id="@+id/menu_item_add_alarm"
        android:title="@string/add_alarm"
        android:icon="@drawable/ic_menu_add"/>
    <item android:id="@+id/menu_item_dock_settings"
        android:title="@string/menu_item_dock_settings"
        android:icon="@android:drawable/ic_menu_preferences"/>
</menu>

+2 −0
Original line number Diff line number Diff line
@@ -246,6 +246,8 @@
         respond. This is a sign of an error; if the weather widget is not
         present on the device, we show nothing at all. -->
    <string name="weather_fetch_failure">Weather information currently unavailable.</string>

    <string name="menu_item_dock_settings">Dock settings</string>
</resources>

+15 −7
Original line number Diff line number Diff line
@@ -94,6 +94,9 @@ public class DeskClock extends Activity {
    // Alarm action for midnight (so we can update the date display).
    private static final String ACTION_MIDNIGHT = "com.android.deskclock.MIDNIGHT";

    // Intent to broadcast for dock settings.
    private static final String DOCK_SETTINGS_ACTION = "com.android.settings.DOCK_SETTINGS";

    // Interval between polls of the weather widget. Its refresh period is
    // likely to be much longer (~3h), but we want to pick up any changes
    // within 5 minutes.
@@ -757,15 +760,20 @@ public class DeskClock extends Activity {

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == R.id.menu_item_alarms) {
        switch (item.getItemId()) {
            case R.id.menu_item_alarms:
                startActivity(new Intent(DeskClock.this, AlarmClock.class));
                return true;
        } else if (item.getItemId() == R.id.menu_item_add_alarm) {
            case R.id.menu_item_add_alarm:
                AlarmClock.addNewAlarm(this);
                return true;
        }
            case R.id.menu_item_dock_settings:
                startActivity(new Intent(DOCK_SETTINGS_ACTION));
                return true;
            default:
                return false;
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {