diff options
author | John Spurlock <jspurlock@google.com> | 2015-04-15 21:15:55 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2015-04-16 05:50:46 -0400 |
commit | b8e02b8bd003fdcd5e680c7a6b37e1797ec12cc9 (patch) | |
tree | f3ab81383819b844bfc75a5862875f82234e5387 /src/com/android/settings/notification | |
parent | 4e53ac6dc8325fa719d200533639645e67aa322b (diff) | |
download | packages_apps_Settings-b8e02b8bd003fdcd5e680c7a6b37e1797ec12cc9.zip packages_apps_Settings-b8e02b8bd003fdcd5e680c7a6b37e1797ec12cc9.tar.gz packages_apps_Settings-b8e02b8bd003fdcd5e680c7a6b37e1797ec12cc9.tar.bz2 |
Settings: Fabulous "Add rule" button.
Bug: 20064962
Change-Id: If7ff9d6cdfc61e5dd9e0d3bc4e2228c5fdaf9fa9
Diffstat (limited to 'src/com/android/settings/notification')
-rw-r--r-- | src/com/android/settings/notification/ZenModeAutomationSettings.java | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/com/android/settings/notification/ZenModeAutomationSettings.java b/src/com/android/settings/notification/ZenModeAutomationSettings.java index f2ee71d..6636b33 100644 --- a/src/com/android/settings/notification/ZenModeAutomationSettings.java +++ b/src/com/android/settings/notification/ZenModeAutomationSettings.java @@ -33,14 +33,14 @@ import android.service.notification.ZenModeConfig.ScheduleInfo; import android.service.notification.ZenModeConfig.ZenRule; import android.text.format.DateFormat; import android.util.Log; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; +import android.view.View; +import android.view.View.OnClickListener; import com.android.internal.logging.MetricsLogger; import com.android.settings.R; import com.android.settings.notification.ManagedServiceSettings.Config; import com.android.settings.notification.ZenRuleNameDialog.RuleInfo; +import com.android.settings.widget.FloatingActionButton; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -59,7 +59,6 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); - setHasOptionsMenu(true); addPreferencesFromResource(R.xml.zen_mode_automation_settings); mServiceListing = new ServiceListing(mContext, CONFIG); mServiceListing.addCallback(mServiceListingCallback); @@ -68,6 +67,21 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase { } @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + final FloatingActionButton fab = getFloatingActionButton(); + fab.setVisibility(View.VISIBLE); + fab.setImageResource(R.drawable.ic_menu_add_white); + fab.setContentDescription(getString(R.string.zen_mode_time_add_rule)); + fab.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + showAddRuleDialog(); + } + }); + } + + @Override public void onDestroy() { super.onDestroy(); mServiceListing.setListening(false); @@ -75,20 +89,6 @@ public class ZenModeAutomationSettings extends ZenModeSettingsBase { } @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - inflater.inflate(R.menu.zen_mode_automation, menu); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == R.id.add) { - showAddRuleDialog(); - return true; - } - return super.onOptionsItemSelected(item); - } - - @Override protected void onZenModeChanged() { // don't care } |