diff options
author | Josh Guilfoyle <jasta00@gmail.com> | 2010-11-16 16:57:35 -0800 |
---|---|---|
committer | Josh Guilfoyle <jasta00@gmail.com> | 2010-11-18 17:34:28 -0800 |
commit | 3b1d941cad77d40b46a6ccd7cf3e60f2b1680648 (patch) | |
tree | ff845fa2bc415cf7ed86dc3bf5a14d261eaf8e50 | |
parent | c377bac8fc0933bcf0fe40d672adf00aebdfa887 (diff) | |
download | frameworks_base-3b1d941cad77d40b46a6ccd7cf3e60f2b1680648.zip frameworks_base-3b1d941cad77d40b46a6ccd7cf3e60f2b1680648.tar.gz frameworks_base-3b1d941cad77d40b46a6ccd7cf3e60f2b1680648.tar.bz2 |
Reverted "buy ringtone" feature.
Change-Id: I4e1f20394d078d335be377ab1bf6558af4d87688
-rw-r--r-- | core/java/com/android/internal/app/RingtonePickerActivity.java | 77 | ||||
-rw-r--r-- | media/java/android/media/RingtoneManager.java | 11 |
2 files changed, 18 insertions, 70 deletions
diff --git a/core/java/com/android/internal/app/RingtonePickerActivity.java b/core/java/com/android/internal/app/RingtonePickerActivity.java index fcd0029..ddddabe 100644 --- a/core/java/com/android/internal/app/RingtonePickerActivity.java +++ b/core/java/com/android/internal/app/RingtonePickerActivity.java @@ -16,10 +16,11 @@ package com.android.internal.app; +import com.android.internal.app.AlertActivity; +import com.android.internal.app.AlertController; + import android.content.DialogInterface; import android.content.Intent; -import android.content.pm.PackageManager.NameNotFoundException; -import android.content.res.Resources; import android.database.Cursor; import android.media.Ringtone; import android.media.RingtoneManager; @@ -58,9 +59,6 @@ public final class RingtonePickerActivity extends AlertActivity implements /** The position in the list of the 'Default' item. */ private int mDefaultRingtonePos = -1; - /** The position in the list of the 'Buy ringtone' item (should be 0). */ - private int mBuyPos = -1; - /** The position in the list of the last clicked item. */ private int mClickedPos = -1; @@ -69,10 +67,7 @@ public final class RingtonePickerActivity extends AlertActivity implements /** Whether this list has the 'Silent' item. */ private boolean mHasSilentItem; - - /** Whether this list has the 'Buy ringtone' item. */ - private boolean mHasBuyItem; - + /** The Uri to place a checkmark next to. */ private Uri mExistingUri; @@ -99,19 +94,13 @@ public final class RingtonePickerActivity extends AlertActivity implements * On item clicked */ public void onClick(DialogInterface dialog, int which) { - if (which == mBuyPos) { - startActivity(new Intent(Intent.ACTION_VIEW, - Uri.parse("http://wap.t-zones.com"))); - finish(); - } - // Save the position of most recently clicked item mClickedPos = which; - + // Play clip playRingtone(which, 0); } - + }; @Override @@ -131,13 +120,10 @@ public final class RingtonePickerActivity extends AlertActivity implements if (mUriForDefaultItem == null) { mUriForDefaultItem = Settings.System.DEFAULT_RINGTONE_URI; } - + // Get whether to show the 'Silent' item mHasSilentItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true); - - // Get whether to show the 'Buy ringtones' item - mHasBuyItem = intent.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_BUY, false); - + // Give the Activity so it can do managed queries mRingtoneManager = new RingtoneManager(this); @@ -182,11 +168,7 @@ public final class RingtonePickerActivity extends AlertActivity implements } public void onPrepareListView(ListView listView) { - - if (mHasBuyItem) { - mBuyPos = addBuyItem(listView); - } - + if (mHasDefaultItem) { mDefaultRingtonePos = addDefaultRingtoneItem(listView); @@ -220,52 +202,29 @@ public final class RingtonePickerActivity extends AlertActivity implements * @param textResId The resource ID of the text for the item. * @return The position of the inserted item. */ - private int addStaticItem(ListView listView, int resId, int textResId) { - return addStaticItem(listView, resId, getResources().getText(textResId)); - } - - private int addStaticItem(ListView listView, int resId, CharSequence text) { - TextView textView = (TextView) getLayoutInflater().inflate(resId, listView, false); - textView.setText(text); + private int addStaticItem(ListView listView, int textResId) { + TextView textView = (TextView) getLayoutInflater().inflate( + com.android.internal.R.layout.select_dialog_singlechoice, listView, false); + textView.setText(textResId); listView.addHeaderView(textView); mStaticItemCount++; return listView.getHeaderViewsCount() - 1; } - - private int addBuyItem(ListView listView) { - String buyRingtones = null; - try { - Resources res = getPackageManager().getResourcesForApplication("com.tmobile.resources"); - int textResId = res.getIdentifier("buy_ringtones", "string", "com.tmobile.resources"); - if (textResId != 0) { - return addStaticItem(listView, - com.android.internal.R.layout.select_dialog_item, - res.getText(textResId)); - } - } catch (NameNotFoundException e) { - /* Ignore, we just won't the "buy ringtones" option. */ - } - return -1; - } - + private int addDefaultRingtoneItem(ListView listView) { - return addStaticItem(listView, - com.android.internal.R.layout.select_dialog_singlechoice, - com.android.internal.R.string.ringtone_default); + return addStaticItem(listView, com.android.internal.R.string.ringtone_default); } private int addSilentItem(ListView listView) { - return addStaticItem(listView, - com.android.internal.R.layout.select_dialog_singlechoice, - com.android.internal.R.string.ringtone_silent); + return addStaticItem(listView, com.android.internal.R.string.ringtone_silent); } /* * On click of Ok/Cancel buttons */ public void onClick(DialogInterface dialog, int which) { - boolean positiveResult = which == BUTTON1 && mClickedPos != mBuyPos; - + boolean positiveResult = which == BUTTON1; + // Stop playing the previous ringtone mRingtoneManager.stopPreviousRingtone(); diff --git a/media/java/android/media/RingtoneManager.java b/media/java/android/media/RingtoneManager.java index adfb305..e490b08 100644 --- a/media/java/android/media/RingtoneManager.java +++ b/media/java/android/media/RingtoneManager.java @@ -110,17 +110,6 @@ public class RingtoneManager { "android.intent.extra.ringtone.SHOW_SILENT"; /** - * Given to the ringtone picker as a boolean. Whether to show an item for - * "Buy ringtones". - * - * @see #ACTION_RINGTONE_PICKER - * - * @hide - */ - public static final String EXTRA_RINGTONE_SHOW_BUY = - "com.tmobile.intent.extra.ringtone.SHOW_BUY"; - - /** * Given to the ringtone picker as a boolean. Whether to include DRM ringtones. */ public static final String EXTRA_RINGTONE_INCLUDE_DRM = |