diff options
author | Chris Wren <cwren@android.com> | 2016-04-06 23:38:05 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-04-06 23:38:05 +0000 |
commit | bc60c595394eb7865c373d28758d510a3667089f (patch) | |
tree | 421aefd0ce4eb524ee43829cc80d51a0a674c83b | |
parent | df1baf8e15b3e81786024540eb63eede164f7c8f (diff) | |
parent | e6ea907e7cf8eb8f8ab04f238ab834ba970b4f45 (diff) | |
download | experimental-bc60c595394eb7865c373d28758d510a3667089f.tar.gz |
Revert "port to NotificationManagerCompat to test APIs"
am: e6ea907
* commit 'e6ea907e7cf8eb8f8ab04f238ab834ba970b4f45':
Revert "port to NotificationManagerCompat to test APIs"
Change-Id: Ib360dd1959068aedb48529be71201e837a26ca01
5 files changed, 4 insertions, 27 deletions
diff --git a/NotificationShowcase/res/layout/main.xml b/NotificationShowcase/res/layout/main.xml index d082544..ddad922 100644 --- a/NotificationShowcase/res/layout/main.xml +++ b/NotificationShowcase/res/layout/main.xml @@ -8,6 +8,5 @@ <Button android:id="@+id/button1" android:text="@string/post_button_label" android:layout_height="wrap_content" android:layout_width="match_parent" android:onClick="doPost"></Button> <Button android:id="@+id/button2" android:text="@string/remove_button_label" android:layout_height="wrap_content" android:layout_width="match_parent" android:onClick="doRemove"></Button> <Button android:id="@+id/button3" android:text="@string/prefs_button_label" android:layout_height="wrap_content" android:layout_width="match_parent" android:onClick="doPrefs"></Button> - <Button android:id="@+id/disable" android:text="@string/no_button_label" android:layout_height="wrap_content" android:layout_width="match_parent" android:onClick="doDisable"></Button> </LinearLayout> </FrameLayout> diff --git a/NotificationShowcase/res/values/strings.xml b/NotificationShowcase/res/values/strings.xml index cd7239e..ca534c9 100644 --- a/NotificationShowcase/res/values/strings.xml +++ b/NotificationShowcase/res/values/strings.xml @@ -5,9 +5,6 @@ <string name="post_button_label">Post Notifications</string> <string name="remove_button_label">Remove Notifications</string> <string name="prefs_button_label">Preferences</string> - <string name="disable_button_label">Disable Notifications</string> - <string name="enable_button_label">Enable Notifications</string> - <string name="no_button_label">No Idea Dog</string> <string name="answered">call answered</string> <string name="ignored">call ignored</string> <string name="full_screen_name">Full Screen Activity</string> diff --git a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationService.java b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationService.java index 5fb2a2b..2c21a7e 100644 --- a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationService.java +++ b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationService.java @@ -19,6 +19,7 @@ package com.android.example.notificationshowcase; import android.app.AlarmManager; import android.app.IntentService; import android.app.Notification; +import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ComponentName; import android.content.ContentResolver; @@ -35,7 +36,6 @@ import android.net.Uri; import android.os.SystemClock; import android.provider.ContactsContract; import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; import android.support.v7.preference.PreferenceManager; import android.text.SpannableString; import android.text.TextUtils; @@ -185,7 +185,8 @@ public class NotificationService extends IntentService { @Override protected void onHandleIntent(Intent intent) { - NotificationManagerCompat noMa = NotificationManagerCompat.from(this); + NotificationManager noMa = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); if (ACTION_DESTROY.equals(intent.getAction())) { noMa.cancelAll(); return; diff --git a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java index 2d0d09b..8d1a2fc 100644 --- a/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java +++ b/NotificationShowcase/src/com/android/example/notificationshowcase/NotificationShowcaseActivity.java @@ -8,11 +8,8 @@ import android.app.NotificationManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; -import android.net.Uri; import android.os.Bundle; -import android.support.v4.app.NotificationManagerCompat; import android.view.View; -import android.widget.Button; public class NotificationShowcaseActivity extends Activity { private static final String TAG = "NotificationShowcase"; @@ -22,18 +19,6 @@ public class NotificationShowcaseActivity extends Activity { setContentView(R.layout.main); } - @Override - protected void onResume() { - super.onResume(); - Button disableBtn = (Button) findViewById(R.id.disable); - NotificationManagerCompat noMa = NotificationManagerCompat.from(this); - if(noMa.areNotificationsEnabled()) { - disableBtn.setText(R.string.disable_button_label); - } else { - disableBtn.setText(R.string.enable_button_label); - } - } - public void doPost(View v) { Intent intent = new Intent(NotificationService.ACTION_CREATE); intent.setComponent(new ComponentName(this, NotificationService.class)); @@ -51,9 +36,4 @@ public class NotificationShowcaseActivity extends Activity { intent.setComponent(new ComponentName(this, SettingsActivity.class)); startActivity(intent); } - - public void doDisable(View v) { - startActivity(new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, - Uri.parse("package:com.android.example.notificationshowcase"))); - } } diff --git a/NotificationShowcase/src/com/android/example/notificationshowcase/ProgressService.java b/NotificationShowcase/src/com/android/example/notificationshowcase/ProgressService.java index cbc3476..799708d 100644 --- a/NotificationShowcase/src/com/android/example/notificationshowcase/ProgressService.java +++ b/NotificationShowcase/src/com/android/example/notificationshowcase/ProgressService.java @@ -59,7 +59,7 @@ public class ProgressService extends IntentService { noMa.notify(NotificationService.NOTIFICATION_ID + mId, NotificationService.makeUploadNotification( ProgressService.this, mProgress, mWhen)); - mProgress += 2; + mProgress += 10; if (mProgress <= 100) { handler.postDelayed(this, 1000); } |