public void setAudio(Uri audio, String name, Map<String, ?> extras) { synchronized (this) { mAudioUri = audio; } mNameView.setText(name); mAlbumView.setText((String) extras.get("album")); mArtistView.setText((String) extras.get("artist")); String extName = name.substring(name.lastIndexOf('.') + 1); Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_launcher_record_audio); if (extName.equals("dcf")) { MmsLog.i(TAG, "contain drm audio"); if (EncapsulatedFeatureOption.MTK_DRM_APP) { Drawable front = getResources().getDrawable(EncapsulatedR.drawable.drm_red_lock); EncapsulatedDrmManagerClient drmManager = new EncapsulatedDrmManagerClient(mContext); Bitmap drmBitmap = drmManager.overlayBitmap(bitmap, front); mAudioImageView.setImageBitmap(drmBitmap); if (bitmap != null && !bitmap.isRecycled()) { bitmap.recycle(); bitmap = null; } } else { mAudioImageView.setImageBitmap(bitmap); } } else { mAudioImageView.setImageBitmap(bitmap); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; if (info == null) { MmsLog.i(LOG_TAG, "onCreateContextMenu,menuInfo is null"); return; } int position = info.position; if (position >= 3) { int index = position - 3; CellBroadcastChannel channel = mChannelArray.get(index); String channelName = channel.getChannelName(); menu.setHeaderTitle(channelName); if (channel.getChannelState()) { menu.add(0, MENU_CHANNEL_ENABLE_DISABLE, 0, R.string.disable); } else { menu.add(0, MENU_CHANNEL_ENABLE_DISABLE, 0, R.string.enable); } menu.add(1, MENU_CHANNEL_EDIT, 0, R.string.cb_menu_edit); menu.add(2, MENU_CHANNEL_DELETE, 0, R.string.cb_menu_delete); } }
private void showLanguageSelectDialog() { final boolean[] temp = new boolean[LANGUAGE_NUM]; final boolean[] temp2 = new boolean[LANGUAGE_NUM]; boolean allLanguagesFlag = true; for (int i = 1; i < temp.length; i++) { CellBroadcastLanguage tLanguage = mLanguageList.get(i); if (tLanguage != null) { MmsLog.d(LOG_TAG, "language status " + tLanguage.getLanguageState()); temp[i] = tLanguage.getLanguageState(); temp2[i] = tLanguage.getLanguageState(); } else { MmsLog.i(LOG_TAG, "showLanguageSelectDialog() init the language list failed when i=" + i); } if (!temp[i]) { allLanguagesFlag = false; // not select all languages } } // init "All Languages" selection MmsLog.d(LOG_TAG, "All language status " + allLanguagesFlag); mLanguageList.get(0).setLanguageState(allLanguagesFlag); temp[0] = allLanguagesFlag; temp2[0] = allLanguagesFlag; final AlertDialog.Builder dlgBuilder = new AlertDialog.Builder(this); dlgBuilder.setTitle(getString(R.string.cb_dialog_title_language_choice)); dlgBuilder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { int tLength = temp.length; // if select "all languages" if (temp[0]) { for (int i = 0; i < tLength; i++) { temp[i] = true; } } // select a language at least boolean flag = false; for (int i = 0; i < tLength; i++) { mLanguageList.get(i).setLanguageState(temp[i]); if (temp[i]) { flag = true; } } if (flag) { SmsBroadcastConfigInfo[] langList = makeLanguageConfigArray(); setCellBroadcastConfig(langList); } else { displayMessage(R.string.cb_error_language_select); for (int i = 0; i < tLength; i++) { mLanguageList.get(i).setLanguageState(temp2[i]); } } } }); dlgBuilder.setNegativeButton(R.string.cancel, null); DialogInterface.OnMultiChoiceClickListener multiChoiceListener = new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) { temp[whichButton] = isChecked; AlertDialog languageDialog = null; if (dialog instanceof AlertDialog) { languageDialog = (AlertDialog) dialog; } if (whichButton == 0) { if (languageDialog != null) { for (int i = 1; i < temp.length; ++i) { ListView items = languageDialog.getListView(); items.setItemChecked(i, isChecked); temp[i] = isChecked; } } } else { if ((!isChecked) && (languageDialog != null)) { ListView items = languageDialog.getListView(); items.setItemChecked(0, isChecked); temp[0] = false; } else if (isChecked && (languageDialog != null)) { /// M: ALPS00641361 @{ // if select all language, the first item should be checked // // MTK add setCheckedAlllanguageItem(temp, isChecked, languageDialog); /// @} } } } }; dlgBuilder.setMultiChoiceItems(R.array.language_list_values, temp, multiChoiceListener); AlertDialog languageDialog = dlgBuilder.create(); if (languageDialog != null) { languageDialog.show(); } }