@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_preview_contacts); mList = (ListView) this.findViewById(R.id.preview_list); selectAll = (Button) this.findViewById(R.id.select_all_preview_multiple); confirmAll = (Button) this.findViewById(R.id.preview_multiple); Intent intent = getIntent(); data = (String[]) intent.getExtra("contacts"); initList(); selectAll.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub // ListView list=(ListView)v.getParent(); // list.getAdapter().getItem(0). } }); }
@Override public void onReceive(final Context context, final Intent intent) { final String action = intent.getAction(); if (Intent.MTK_ACTION_UNREAD_CHANGED.equals(action)) { final ComponentName componentName = (ComponentName) intent.getExtra(Intent.MTK_EXTRA_UNREAD_COMPONENT); final int unreadNum = intent.getIntExtra(Intent.MTK_EXTRA_UNREAD_NUMBER, -1); if (LauncherLog.DEBUG) { LauncherLog.d( TAG, "Receive unread broadcast: componentName = " + componentName + ", unreadNum = " + unreadNum + ", mCallbacks = " + mCallbacks + getUnreadSupportShortcutInfo()); } if (mCallbacks != null && componentName != null && unreadNum != -1) { final int index = supportUnreadFeature(componentName); if (index >= 0) { boolean ret = setUnreadNumberAt(index, unreadNum); if (ret) { final UnreadCallbacks callbacks = mCallbacks.get(); if (callbacks != null) { callbacks.bindComponentUnreadChanged(componentName, unreadNum); } } } } } }
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Util.Action.ACTION_MEDIA_MOUNT_UPDATEUI.equals(action)) { // M: Add by mtk80800, sd card mounted, reminder user to refresh showDialog(DIALOG_SDCARDMOUNTED); } else if (Util.Action.ACTION_MEDIA_UNMOUNT_UPDATEUI.equals(action)) { // M: Add by mtk80800, sdcard unmount, reset download info and finish this activity String path = (String) intent.getExtra("storagePath"); if (mPath.contains(path)) { Xlog.w(TAG, "SDcard unmount, finish activity"); if (mDownloadInfo.getActivityID() < 0) { Toast.makeText(context, R.string.sdcard_unmount, Toast.LENGTH_LONG).show(); } SdPkgInstallActivity.this.finish(); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_BLUETOOTH_SCAN && resultCode == RESULT_OK) { final BluetoothDevice fBluetoothDevice = (BluetoothDevice) data.getExtra("device"); if (fBluetoothDevice != null) { Log.i( TAG, "Bluetooth device name = " + fBluetoothDevice.getName() + ", address = " + fBluetoothDevice.getAddress()); mMidiManager.openBluetoothDevice( fBluetoothDevice, new MidiManager.OnDeviceOpenedListener() { @Override public void onDeviceOpened(MidiDevice device) { onBluetoothDeviceOpen(fBluetoothDevice, device); } }, null); } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView(R.layout.activity_multi_delete); intent = this.getIntent(); items = (ArrayList<MultiDeleteItem>) intent.getExtra("mlist"); threadId = items.get(0).threadId; Log.v(TAG, "items.size: " + items.size() + " tostring: " + items.toString()); mAdapter = new DifferentItemAdapter(); setContentView(R.layout.listview_fixed_headerandfooter); final ListView lv = (ListView) findViewById(android.R.id.list); lv.setAdapter(mAdapter); selectAll = (Button) findViewById(R.id.select_all_delete_multiple); deleteButton = (Button) findViewById(R.id.delete_multiple); mQueryHandler = new BackgroundQueryHandler(this.getContentResolver()); selectAll.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub for (int i = 0; i < lv.getCount(); i++) { isSelected.put(i, true); } mAdapter.notifyDataSetChanged(); } }); deleteButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub if (lv.getCount() == isSelected.size()) { // ComposeMessageActivity.confirmDeleteThread(items.get(0).threadId); } else { for (int i = 0; i < lv.getCount(); i++) { if (isSelected.get(i)) { if (items.get(i).smsType.equalsIgnoreCase("sms")) { smsList.add(items.get(i).MsgId); } else if (items.get(i).smsType.equalsIgnoreCase("mms")) { mmsList.add(items.get(i).MsgId); } } } if (smsList.size() > 0) { for (int i = 0; i < smsList.size(); i++) { // MultiDeleteActivity.this.getContentResolver() // .delete(TraditionalActivity.ALL_INBOX, // "_id= " + smsList.get(i), null); // mQueryHandler.startDelete( QUERY_DELETE, null, TraditionalActivity.ALL_INBOX, "_id= " + smsList.get(i) + " and locked = 0", null); } } if (mmsList.size() > 0) { for (int i = 0; i < mmsList.size(); i++) { // MultiDeleteActivity.this.getContentResolver() // .delete(TraditionalActivity.ALL_MMS_INBOX, // "_id= " + mmsList.get(i), null); // mQueryHandler.startDelete( QUERY_DELETE, null, TraditionalActivity.ALL_MMS_INBOX, "_id= " + mmsList.get(i) + " and locked = 0", null); } } MessagingNotification.nonBlockingUpdateNewMessageIndicator( MultiDeleteActivity.this, MessagingNotification.THREAD_NONE, false); } Intent intent = getIntent(); Log.v("MultiDeleteActivity", "MultiDeleteActivity intent"); MultiDeleteActivity.this.setResult(RESULT_OK, intent); MultiDeleteActivity.this.finish(); } }); // lv.addFooterView(v); }