public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(CONNECTIVITY_CHANGE_ACTION) && NetworkStatusManager.this.mListening) { boolean noConnectivity = intent.getBooleanExtra("noConnectivity", false); if (noConnectivity) { NetworkStatusManager.this.mState = NetworkStatusManager.State.NOT_CONNECTED; } else { NetworkStatusManager.this.mState = NetworkStatusManager.State.CONNECTED; } NetworkStatusManager.this.mNetworkInfo = intent.getParcelableExtra("networkInfo"); NetworkStatusManager.this.mOtherNetworkInfo = intent.getParcelableExtra("otherNetwork"); NetworkStatusManager.this.mReason = intent.getStringExtra("reason"); NetworkStatusManager.this.mIsFailOver = intent.getBooleanExtra("isFailover", false); Log.d( "NetworkStatusManager", "onReceive(): mNetworkInfo=" + NetworkStatusManager.this.mNetworkInfo + " mOtherNetworkInfo = " + (NetworkStatusManager.this.mOtherNetworkInfo == null ? "[none]" : NetworkStatusManager.this.mOtherNetworkInfo + " noConn=" + noConnectivity) + " mState=" + NetworkStatusManager.this.mState.toString()); NetworkStatusManager.this.mIsWifi = NetworkStatusManager.checkIsWifi(NetworkStatusManager.this.mContext); } else { Log.w( "NetworkStatusManager", "onReceived() called with " + NetworkStatusManager.this.mState.toString() + " and " + intent); } }
/** * Method used to send back the result to the {@link RequestManager} * * @param intent The value passed to {@link onHandleIntent(Intent)}. It must contain the {@link * ResultReceiver} and the requestId * @param data A {@link Bundle} the data to send back * @param code The success/error code to send back */ protected void sendResult(final Intent intent, Bundle data, final int code) { if (LogConfig.DP_DEBUG_LOGS_ENABLED) { Log.d(LOG_TAG, "sendResult : " + ((code == SUCCESS_CODE) ? "Success" : "Failure")); } ResultReceiver receiver = (ResultReceiver) intent.getParcelableExtra(INTENT_EXTRA_RECEIVER); if (receiver != null) { Bundle result = null; // Also adding the request parameters (can be useful when receiving the result) if (intent != null && intent.getExtras() != null) { result = intent.getExtras(); result.putAll(data); } if (result == null) { result = new Bundle(); } result.putInt( RequestManager.RECEIVER_EXTRA_REQUEST_ID, intent.getIntExtra(INTENT_EXTRA_REQUEST_ID, -1)); result.putBoolean( RequestManager.RECEIVER_EXTRA_REQUEST_SAVE_IN_MEMORY, intent.getBooleanExtra(INTENT_EXTRA_IS_POST_REQUEST, false) || intent.getBooleanExtra(INTENT_EXTRA_SAVE_IN_MEMORY, false)); result.putInt(RequestManager.RECEIVER_EXTRA_RESULT_CODE, code); receiver.send(code, result); } }
@Override public void onReceive(Context context, Intent intent) { wm = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); ConnectivityManager connection = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); netInfo = connection.getActiveNetworkInfo(); failOver = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false); noConnection = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); if (!noConnection) { WifiInfo wi = wm.getConnectionInfo(); if (failOver && netInfo != null && netInfo.isConnected()) { Intent intentB = new Intent(NETWORK_STATUS_CHANGED); intentB.putExtra("active", true); intentB.putExtra("SSID", wi.getSSID()); context.sendBroadcast(intentB); } else { Intent intentB = new Intent(NETWORK_STATUS_CHANGED); intentB.putExtra("active", true); intentB.putExtra("SSID", wi.getSSID()); context.sendBroadcast(intentB); } } else if (noConnection) { Intent intentB = new Intent(NETWORK_STATUS_CHANGED); intentB.putExtra("active", false); context.sendBroadcast(intentB); } else { Log.d("Network Manager", "Network Offline...No Intent Fired"); } }
@Override public int onStartCommand(Intent intent, int flags, int startId) { logInfo("onStartCommand()"); if (intent != null) { boolean disconnect = intent.getBooleanExtra("disconnect", false); boolean reconnect = intent.getBooleanExtra("reconnect", false); create_account = intent.getBooleanExtra("create_account", false); logInfo("disconnect/reconnect: " + disconnect + " " + reconnect); if (disconnect) { if (mConnectingThread != null || mIsConnected.get()) connectionFailed(getString(R.string.conn_networkchg)); return START_STICKY; } if (reconnect) { // reset reconnection timeout mReconnectTimeout = RECONNECT_AFTER; if (mConnectionDemanded.get()) doConnect(); else stopSelf(); // started by YaximBroadcastReceiver, no connection initiation return START_STICKY; } } mConnectionDemanded.set(mConfig.autoConnect); doConnect(); return START_STICKY; }
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { mBatteryLevel.setSummary(Utils.getBatteryPercentage(intent)); mBatteryStatus.setSummary(Utils.getBatteryStatus(getResources(), intent)); } else if (SPN_STRINGS_UPDATED_ACTION.equals(action)) { String operatorName = null; String plmn = null; String spn = null; if (intent.getBooleanExtra(EXTRA_SHOW_PLMN, false)) { plmn = intent.getStringExtra(EXTRA_PLMN); if (plmn != null) { operatorName = plmn; } } if (intent.getBooleanExtra(EXTRA_SHOW_SPN, false)) { spn = intent.getStringExtra(EXTRA_SPN); if (spn != null) { operatorName = spn; } } Preference p = findPreference(KEY_OPERATOR_NAME); if (p != null) { mExt.updateOpNameFromRec(p, operatorName); } } }
/** * @param context remote context * @param c cursor for reading data * @param intent broadcast intent initiated the replacement, don't save it * @param appWidgetId * @param listViewId */ public WidgetListAdapter( Context context, Intent intent, ComponentName provider, int appWidgetId, int listViewId) throws IllegalArgumentException { super(); mAppWidgetId = appWidgetId; mListViewId = listViewId; mContentResolver = context.getContentResolver(); mIntent = intent; mAppWidgetProvider = provider; mInflater = LayoutInflater.from(context); // verify is contentProvider requery is allowed mAllowRequery = intent.getBooleanExtra( LauncherIntent.Extra.Scroll.EXTRA_DATA_PROVIDER_ALLOW_REQUERY, false); // Get the layout if for items mItemLayoutId = intent.getIntExtra(LauncherIntent.Extra.Scroll.EXTRA_ITEM_LAYOUT_ID, -1); if (mItemLayoutId <= 0) throw (new IllegalArgumentException("The passed layout id is illegal")); mItemChildrenClickable = intent.getBooleanExtra(LauncherIntent.Extra.Scroll.EXTRA_ITEM_CHILDREN_CLICKABLE, false); mItemActionUriIndex = intent.getIntExtra(LauncherIntent.Extra.Scroll.EXTRA_ITEM_ACTION_VIEW_URI_INDEX, -1); // Generate item mapping generateItemMapping(intent); mAsyncQuery = new MyQueryHandler(mContentResolver); // Generate data cache from content provider mHandler.post(mGenerateDataCacheRunnable); }
private void holdIntent(Intent intent) { if (intent == null) { finishAfterDone(0); return; } PlatformManager.getInstance().onHandleNewIntent(this, intent); final String action = intent.getAction(); final int platform = intent.getIntExtra(EXTRA_PLATFORM, -1); final boolean onlyWeixin = intent.getBooleanExtra(EXTRA_ONLY_WEIXIN, false); final CharSequence title = intent.getCharSequenceExtra(EXTRA_TITLE); final Serializable extra = intent.getSerializableExtra(EXTRA_DATA); if (extra instanceof ShareState) { Pattern pattern = Pattern.compile("★"); Matcher matcher = pattern.matcher(title); if (matcher.find()) { ((SpannableString) title) .setSpan( new ImageSpan(getContext(), R.drawable.app_ic_red_packet), matcher.start(), matcher.end(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } isToBinded = intent.getBooleanExtra(EXTRA_TO_BIND, false); if (ACTION_SHARE.equals(action)) { final ShareDialog shareDialog; if (Build.BRAND.equals("vivo")) { shareDialog = new ShareDialog(this, title, onlyWeixin, null); } else { shareDialog = new ShareDialog(this, title, onlyWeixin); } shareDialog.setAlarmListener( new IAlarm.AlarmListener() { @Override public void onShow(IAlarm alarm) {} @Override public void onDismiss(IAlarm alarm) {} @Override public void onCancel(IAlarm alarm) { finishAfterDone(0); } }); shareDialog.setOnPositionClickListener( new ShareDialog.OnPositionClickListener() { @Override public void onClick(int platformType) { showLoading(); prepareData(platformType, extra); } }); shareDialog.show(); } else if (ACTION_LOGIN.equals(action)) { showLoading(); PlatformManager.getInstance().bind(getContext(), platform, PlatformActivity.this); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (isFinishing()) return; Intent intent = getIntent(); account = QuestionViewer.getAccount(intent); user = QuestionViewer.getUser(intent); if (AccountManager.getInstance().getAccount(account) == null || user == null) { Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND); finish(); return; } if (intent.getBooleanExtra(EXTRA_FIELD_CANCEL, false)) { try { OTRManager.getInstance().abortSmp(account, user); } catch (NetworkException e) { Application.getInstance().onError(e); } finish(); return; } showQuestion = intent.getBooleanExtra(EXTRA_FIELD_SHOW_QUESTION, true); answerRequest = intent.getBooleanExtra(EXTRA_FIELD_ANSWER_REQUEST, false); if (showQuestion) { setContentView(R.layout.question_viewer); questionView = (EditText) findViewById(R.id.question); questionView.setEnabled(!answerRequest); if (answerRequest) questionView.setText(intent.getStringExtra(Intent.EXTRA_TEXT)); else findViewById(R.id.cancel).setVisibility(View.GONE); } else setContentView(R.layout.secret_viewer); findViewById(R.id.cancel).setOnClickListener(this); findViewById(R.id.send).setOnClickListener(this); }
@Override public void onNewIntent(Intent intent) { setIntent(intent); // onNewIntent doesn't autoset our "internal" intent String initialFolder; mUnreadMessageCount = 0; String accountUuid = intent.getStringExtra(EXTRA_ACCOUNT); mAccount = Preferences.getPreferences(this).getAccount(accountUuid); if (mAccount == null) { // This shouldn't normally happen. But apparently it does. See issue 2261. finish(); return; } initialFolder = intent.getStringExtra(EXTRA_INITIAL_FOLDER); boolean fromNotification = intent.getBooleanExtra(EXTRA_FROM_NOTIFICATION, false); if (fromNotification && mAccount.goToUnreadMessageSearch()) { MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount); openUnreadSearch(this, mAccount); finish(); } else if (initialFolder != null && !K9.FOLDER_NONE.equals(initialFolder)) { onOpenFolder(initialFolder); finish(); } else if (intent.getBooleanExtra(EXTRA_FROM_SHORTCUT, false) && !K9.FOLDER_NONE.equals(mAccount.getAutoExpandFolderName())) { onOpenFolder(mAccount.getAutoExpandFolderName()); finish(); } else { initializeActivityView(); } }
@Override public void onReceive(Context context, Intent intent) { boolean syncStart = intent.getBooleanExtra(Synchronizer.SYNC_START, false); boolean syncDone = intent.getBooleanExtra(Synchronizer.SYNC_DONE, false); boolean showToast = intent.getBooleanExtra(Synchronizer.SYNC_SHOW_TOAST, false); int progress = intent.getIntExtra(Synchronizer.SYNC_PROGRESS_UPDATE, -1); if (syncStart) { synchronizerMenuItem.setVisible(false); setSupportProgress(Window.PROGRESS_START); setSupportProgressBarIndeterminate(true); setSupportProgressBarIndeterminateVisibility(true); } else if (syncDone) { setSupportProgressBarVisibility(false); setSupportProgressBarIndeterminateVisibility(false); refreshDisplay(); synchronizerMenuItem.setVisible(true); if (showToast) Toast.makeText(context, R.string.sync_successful, Toast.LENGTH_SHORT).show(); } else if (progress >= 0 && progress <= 100) { if (progress == 100) setSupportProgressBarIndeterminateVisibility(false); setSupportProgressBarIndeterminate(false); int normalizedProgress = (Window.PROGRESS_END - Window.PROGRESS_START) / 100 * progress; setSupportProgress(normalizedProgress); refreshDisplay(); } }
@Override public void onReceive(Context context, Intent intent) { if (intent != null) { String action = intent.getAction(); if (action != null) { if (action.equals(actionMain)) { boolean operating = intent.getBooleanExtra("operating", false); if (onReceive != null) { onReceive.onStateChange(operating); } } else if (action.equals(actionProgress)) { int size = intent.getIntExtra("size", 0); int position = intent.getIntExtra("position", 0); String name = intent.getStringExtra("name"); if (onReceive != null) { onReceive.onProgress(name, position, size); } } else if (actionInMutax(action)) { boolean operating = intent.getBooleanExtra("operating", false); if (onReceive != null) { onReceive.onMutaxMessage(operating); } } } } }
/** * @param context remote context * @param c cursor for reading data * @param intent broadcast intent initiated the replacement, don't save it * @param appWidgetId * @param listViewId */ public WidgetCursorAdapter( Activity a, Context context, Cursor c, Intent intent, ComponentName provider, int appWidgetId, int listViewId) throws IllegalArgumentException { super(context, c); mAppWidgetId = appWidgetId; mListViewId = listViewId; mAppWidgetProvider = provider; mInflater = LayoutInflater.from(context); // mActivity = a; // verify is contentProvider requery is allowed mAllowRequery = intent.getBooleanExtra( LauncherIntent.Extra.Scroll.EXTRA_DATA_PROVIDER_ALLOW_REQUERY, false); // Get the layout if for items mItemLayoutId = intent.getIntExtra(LauncherIntent.Extra.Scroll.EXTRA_ITEM_LAYOUT_ID, -1); if (mItemLayoutId <= 0) throw (new IllegalArgumentException("The passed layout id is illegal")); mItemChildrenClickable = intent.getBooleanExtra(LauncherIntent.Extra.Scroll.EXTRA_ITEM_CHILDREN_CLICKABLE, false); mItemActionUriIndex = intent.getIntExtra(LauncherIntent.Extra.Scroll.EXTRA_ITEM_ACTION_VIEW_URI_INDEX, -1); // Generate generateItemMapping(intent); }
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i("ServiceStartArguments", "Starting #" + startId + ": " + intent.getExtras()); Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.arg2 = flags; msg.obj = intent.getExtras(); mServiceHandler.sendMessage(msg); Log.i("ServiceStartArguments", "Sending: " + msg); // For the start fail button, we will simulate the process dying // for some reason in onStartCommand(). if (intent.getBooleanExtra("fail", false)) { // Don't do this if we are in a retry... the system will // eventually give up if we keep crashing. if ((flags & START_FLAG_RETRY) == 0) { // Since the process hasn't finished handling the command, // it will be restarted with the command again, regardless of // whether we return START_REDELIVER_INTENT. Process.killProcess(Process.myPid()); } } // Normally we would consistently return one kind of result... // however, here we will select between these two, so you can see // how they impact the behavior. Try killing the process while it // is in the middle of executing the different commands. return intent.getBooleanExtra("redeliver", false) ? START_REDELIVER_INTENT : START_NOT_STICKY; }
/** Treat the result of next activity */ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // If it's requested to finish the activity if (data.getBooleanExtra(EXTRA_FINISH_ACTIVITY, false)) { finish(); } // If it's requested to check the entry of a village in search if (CHECK_VILLAGE) { super.onActivityResult(requestCode, resultCode, data); village_id = data.getIntExtra(ZoneChoiceActivity.EXTRA_RETURNED_ZONE_ID, -1); zone_id = data.getIntExtra(ZoneChoiceActivity.EXTRA_PARENT_ZONE_ID, -1); Database db = new Database(this); Cursor villageCursor = db.getZoneById(village_id); if (villageCursor.getCount() > 0) { String villageName = villageCursor.getString(1); Button villageButton = ((Button) findViewById(R.id.buttonVillage)); villageButton.setText(villageName); } CHECK_VILLAGE = false; return; } // If it's requested to create a new patient if (data.getBooleanExtra(EXTRA_MODE_CREATE, false)) { mode = CREATE; showPicker(findViewById(R.id.linearLayoutSearch)); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == INTENT_NEXTWIZARD) { if (resultCode == RESULT_OK) { boolean isAppExit = data.getBooleanExtra("EXIT", false); boolean isUserExist = data.getBooleanExtra("USER_EXIST", false); String tempContactInfo = data.getStringExtra("TEMP_CONTACT_INFO"); if (isAppExit) { Intent intent = getIntent(); intent.putExtra("EXIT", true); setResult(RESULT_OK, intent); finish(); } else if (isUserExist) { overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right); tempUserInfoList.clear(); editUserEmailAddress.setText(""); editUserEmailAddress.requestFocus(); PMWF_Log.fnlog(PMWF_Log.INFO, "UsersInformation::onActivityResult()", tempContactInfo); } else { overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right); tempUserInfoList.clear(); tempContactInfo = data.getStringExtra("TEMP_CONTACT_INFO"); } } } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_one_player_versus_post_game); // Get player name Intent intent = getIntent(); playerName = intent.getStringExtra("PlayerName"); playerPlaceFleet = intent.getBooleanExtra("PlayerPlaceFleet", false); boolean playerWon = intent.getBooleanExtra("PlayerWon", true); // Set Personalised congratulations TextView textView = (TextView) findViewById(R.id.versus_player_textview); if (playerWon) { String personalisedCongratulations = playerName + ", " + getString(R.string.congratulations); textView.setText(personalisedCongratulations); setTitle(R.string.congratulations_title); } else { String personalisedCommiserations = playerName + ", " + getString(R.string.commiserations); textView.setText(personalisedCommiserations); setTitle(R.string.commiserations_title); } // Reset onePlayerRadar save resetSavedGameState(); saveOnePlayerVersusGameMarker(); }
@Override public void onReceive(Context arg0, Intent arg1) { // TODO Auto-generated method stub long id = arg1.getLongExtra("id", 0); for (int i = 0; i < fileList.size(); i++) { TransferredFile mTransferredFile = fileList.get(i); if (mTransferredFile.getId() == id) { if (arg1.getAction() == Common.ACTION_REFRESH) { System.out.println("接收到刷新广播" + id); mTransferredFile.setLength(arg1.getLongExtra("length", 0)); mTransferredFile.setStart(arg1.getBooleanExtra("isstart", false)); mTransferredFile.setStarting(arg1.getBooleanExtra("isstarting", false)); mTransferredFile.setSpeed(arg1.getDoubleExtra("speed", 0)); fileList.set(i, mTransferredFile); break; } else if (arg1.getAction() == Common.ACTION_REMOVELOAD) { System.out.println("接收到传输中断广播"); handler.sendEmptyMessage(0); } else if (arg1.getAction() == Common.ACTION_COMPLETED) { System.out.println("接收到传输完成广播"); fileList.remove(i); loadingNum.setText("正在上传(" + fileList.size() + ")"); doneFileList.addFirst(mTransferredFile); loadedNum.setText("已上传(" + doneFileList.size() + ")"); loadedAdapter.notifyDataSetChanged(); break; } } } handler.sendEmptyMessage(0); }
public int onStartCommand(Intent intent, int flags, int startId) { Log.i("unidevel.UnlockService", "onStartCommand"); if (intent != null && intent.hasExtra("lock") && intent.hasExtra("unlock")) { boolean lock = intent.getBooleanExtra("lock", false); boolean unlock = intent.getBooleanExtra("unlock", true); SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this); if (pref != null) { SharedPreferences.Editor edit = pref.edit(); edit.putBoolean("aunlocker.lock", lock); edit.putBoolean("aunlocker.unlock", unlock); edit.commit(); } } if (this.receiver == null) { Log.i("unidevel.UnlockService", "onStartCommand.registerReceiver"); this.receiver = new ScreenReceiver(); this.receiver.setService(this); IntentFilter it = new IntentFilter(); it.addAction(Intent.ACTION_SCREEN_OFF); it.addAction(Intent.ACTION_SCREEN_ON); registerReceiver(this.receiver, it); PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); if (!pm.isScreenOn()) { Log.i("unidevel.UnlockService", "onStartCommand init with screen off"); onScreenOff(); } else { Log.i("unidevel.UnlockService", "onStartCommand init with screen on"); onScreenOn(); } } return Service.START_STICKY; }
@Override public void onReceive(Context context, Intent intent) { if (!SettingsStorage.getInstance().isEnableLogProfileSwitches()) { return; } if (intent == null) { return; } if (ACTION_FLUSH_LOG.equals(intent.getAction()) || intent.getBooleanExtra(ACTION_FLUSH_LOG, false)) { flushLogToDB(context); return; } ContentValues values = new ContentValues(); values.put(DB.SwitchLogDB.NAME_TIME, System.currentTimeMillis()); values.put(DB.SwitchLogDB.NAME_MESSAGE, intent.getStringExtra(EXTRA_LOG_ENTRY)); values.put(DB.SwitchLogDB.NAME_TRIGGER, intent.getStringExtra(DB.SwitchLogDB.NAME_TRIGGER)); values.put(DB.SwitchLogDB.NAME_PROFILE, intent.getStringExtra(DB.SwitchLogDB.NAME_PROFILE)); values.put(DB.SwitchLogDB.NAME_VIRTGOV, intent.getStringExtra(DB.SwitchLogDB.NAME_VIRTGOV)); values.put(DB.SwitchLogDB.NAME_AC, intent.getIntExtra(DB.SwitchLogDB.NAME_AC, -1)); values.put(DB.SwitchLogDB.NAME_BATTERY, intent.getIntExtra(DB.SwitchLogDB.NAME_BATTERY, -1)); values.put(DB.SwitchLogDB.NAME_CALL, intent.getIntExtra(DB.SwitchLogDB.NAME_CALL, -1)); values.put(DB.SwitchLogDB.NAME_HOT, intent.getIntExtra(DB.SwitchLogDB.NAME_HOT, -1)); values.put(DB.SwitchLogDB.NAME_LOCKED, intent.getIntExtra(DB.SwitchLogDB.NAME_LOCKED, -1)); Builder opp = ContentProviderOperation.newInsert(DB.SwitchLogDB.CONTENT_URI); opp.withValues(values); operations.add(opp.build()); if (operations.size() > 10 || intent.getBooleanExtra(EXTRA_FLUSH_LOG, false)) { flushLogToDB(context); } }
public void a(Context context, Intent intent) { int i = intent.getIntExtra("account_id", -1); boolean flag = intent.getBooleanExtra("silent", false); boolean flag1 = intent.getBooleanExtra("live_message", false); boolean flag2 = intent.getBooleanExtra("deferred_notif", false); intent = cez.l; cfd.a(context, i, flag, flag1, flag2); }
private final void updateSyncState(Intent intent) { boolean isActive = intent.getBooleanExtra("active", false); boolean isFailing = intent.getBooleanExtra("failing", false); if (isActive) { setVisibility(VISIBLE); } else { setVisibility(GONE); } }
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @SuppressLint("NewApi") @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.video: Intent intent = new Intent(getApplicationContext(), affich_child_video.class); intent.putExtra("URISRT", MainIntent.getStringExtra("URISRT")); intent.putExtra("URI", MainIntent.getStringExtra("URI")); intent.putExtra("DELAY", MainIntent.getIntExtra("DELAY", 0)); intent.putExtra("SWITCH", MainIntent.getBooleanExtra("SWITCH", false)); intent.putExtra("VIEW", MainIntent.getStringExtra("VIEW")); intent.putExtra("PATHMP4", yourDir.getAbsolutePath()); intent.putExtra("PATHSRT", MainIntent.getStringExtra("PATHSRT")); startActivity(intent); return true; case R.id.srt: Intent intent2 = new Intent(getApplicationContext(), affich_child.class); intent2.putExtra("URISRT", MainIntent.getStringExtra("URISRT")); intent2.putExtra("URI", MainIntent.getStringExtra("URI")); intent2.putExtra("DELAY", MainIntent.getIntExtra("DELAY", 0)); intent2.putExtra("SWITCH", MainIntent.getBooleanExtra("SWITCH", false)); intent2.putExtra("VIEW", MainIntent.getStringExtra("VIEW")); intent2.putExtra("PATHMP4", MainIntent.getStringExtra("PATHMP4")); intent2.putExtra("PATHSRT", yourDir.getAbsolutePath()); startActivity(intent2); return true; case R.id.path: Intent intent3 = new Intent(getApplicationContext(), selectPath.class); intent3.putExtra("URISRT", MainIntent.getStringExtra("URISRT")); intent3.putExtra("URI", MainIntent.getStringExtra("URI")); intent3.putExtra("DELAY", MainIntent.getIntExtra("DELAY", 0)); intent3.putExtra("SWITCH", MainIntent.getBooleanExtra("SWITCH", false)); intent3.putExtra("VIEW", MainIntent.getStringExtra("VIEW")); intent3.putExtra("PATHMP4", MainIntent.getStringExtra("PATHMP4")); intent3.putExtra("PATHSRT", MainIntent.getStringExtra("PATHSRT")); startActivity(intent3); return true; case R.id.about: Intent intent5 = new Intent(getApplicationContext(), about.class); intent5.putExtra("VIEW", MainIntent.getStringExtra("VIEW")); intent5.putExtra("NAMESRT", MainIntent.getStringExtra("NAMESRT")); intent5.putExtra("URISRT", MainIntent.getStringExtra("URISRT")); intent5.putExtra("URI", MainIntent.getStringExtra("URI")); intent5.putExtra("PATHSRT", MainIntent.getStringExtra("PATHSRT")); intent5.putExtra("DELAY", MainIntent.getIntExtra("DELAY", 0)); intent5.putExtra("SWITCH", MainIntent.getBooleanExtra("SWITCH", false)); intent5.putExtra("PATHMP4", MainIntent.getStringExtra("PATHMP4")); startActivity(intent5); return true; } return super.onOptionsItemSelected(item); }
// Step 13.3(发送消息步骤3) @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); mIsCheating = data.getBooleanExtra(CheatActivity.KEY_CHEATED, false); mHaveCheating = data.getBooleanExtra(CheatActivity.KEY_ERASE, false); CheatArray[mCurrentIndex] = mCurrentIndex; // mTmpCheated = data.getBooleanExtra(CheatActivity.KEY_NEXT_CHEAT, // false); // Log.d("xiaoxi","onActivityResult()::mTmpCheated " + mTmpCheated); }
@Override public void onReceive(Context context, Intent intent) { if (!intent.getBooleanExtra("isPlay", false)) { mHandler.removeCallbacks(mUpdateTimeTask); showCorrectButtons(false); if (!intent.getBooleanExtra("isPause", false)) layout_player.setVisibility(View.GONE); } else { mHandler.removeCallbacks(mUpdateTimeTask); updateProgressBar(); showCorrectButtons(true); } }
/** Create a new BrowserBookmarksPage. */ @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); // Grab the app icon size as a resource. mIconSize = getResources().getDimensionPixelSize(android.R.dimen.app_icon_size); Intent intent = getIntent(); if (Intent.ACTION_CREATE_SHORTCUT.equals(intent.getAction())) { mCreateShortcut = true; } mDisableNewWindow = intent.getBooleanExtra("disable_new_window", false); mMostVisited = intent.getBooleanExtra("mostVisited", false); if (mCreateShortcut) { setTitle(R.string.browser_bookmarks_page_bookmarks_text); } setContentView(R.layout.empty_history); mEmptyView = findViewById(R.id.empty_view); mEmptyView.setVisibility(View.GONE); SharedPreferences p = getPreferences(MODE_PRIVATE); // See if the user has set a preference for the view mode of their // bookmarks. Otherwise default to grid mode. BookmarkViewMode preference = BookmarkViewMode.NONE; if (mMostVisited) { // For the most visited page, only use list mode. preference = BookmarkViewMode.LIST; } else { preference = BookmarkViewMode.values()[ p.getInt(PREF_BOOKMARK_VIEW_MODE, BookmarkViewMode.GRID.ordinal())]; } switchViewMode(preference); final boolean createShortcut = mCreateShortcut; final boolean mostVisited = mMostVisited; final String url = intent.getStringExtra("url"); final String title = intent.getStringExtra("title"); final Bitmap thumbnail = (Bitmap) intent.getParcelableExtra("thumbnail"); new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... unused) { BrowserBookmarksAdapter adapter = new BrowserBookmarksAdapter( BrowserBookmarksPage.this, url, title, thumbnail, createShortcut, mostVisited); mHandler.obtainMessage(ADAPTER_CREATED, adapter).sendToTarget(); return null; } }.execute(); }
protected void start(Intent intent) { mIntent = intent; boolean retry = intent.getBooleanExtra(ECDHKeyService.EXTRA_RETRY, false); if (retry && CMAccount.DEBUG) Log.d(TAG, "Scheduled retry"); boolean upload = intent.getBooleanExtra(ECDHKeyService.EXTRA_UPLOAD, true); int keyCount = getKeyCount(); if (keyCount < MINIMUM_KEYS && !retry) { generateKeyPairs(MINIMUM_KEYS - keyCount); } if (upload) uploadKeyPairs(); }
@Override public int onStartCommand(Intent intent, int flags, int startId) { // In base al tipo di intent che arriva faccio azioni diverse if (intent.getBooleanExtra(PLAY, false)) { message = intent.getStringExtra(UI1.EXTRA_MESSAGE); if (!sessionName.equals(message)) { stop(); } sessionName = message; play(); } if (intent.getBooleanExtra(PAUSE, false)) pause(); if (intent.getBooleanExtra(ECHO, false)) { echo(); } if (intent.getBooleanExtra(VOLUME, false)) { boolean up = intent.getBooleanExtra("up", false); double volume = intent.getDoubleExtra("volume", 0.0); volume(up, volume); } if (intent.getBooleanExtra(SPEED, false)) { boolean up = intent.getBooleanExtra("up", false); int intensity = intent.getIntExtra("intensity", -1); speed(up, intensity); } if (intent.getBooleanExtra(DELAY, false)) { delay(); } return Service.START_STICKY; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Intent intent = getIntent(); mFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); mFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mAutoFinishOnConnection = intent.getBooleanExtra(EXTRA_AUTO_FINISH_ON_CONNECT, false); mIsNetworkRequired = intent.getBooleanExtra(EXTRA_IS_NETWORK_REQUIRED, false); mIsWifiRequired = intent.getBooleanExtra(EXTRA_IS_WIFI_REQUIRED, false); // Behave like the user already selected a network if we do not require selection mUserSelectedNetwork = !intent.getBooleanExtra(EXTRA_REQUIRE_USER_NETWORK_SELECTION, false); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (sPhotoSize == null) { final DisplayMetrics metrics = new DisplayMetrics(); final WindowManager wm = (WindowManager) getActivity().getSystemService(Context.WINDOW_SERVICE); final ImageUtils.ImageSize imageSize = ImageUtils.sUseImageSize; wm.getDefaultDisplay().getMetrics(metrics); switch (imageSize) { case EXTRA_SMALL: // Use a photo that's 80% of the "small" size sPhotoSize = (Math.min(metrics.heightPixels, metrics.widthPixels) * 800) / 1000; break; case SMALL: // Fall through. case NORMAL: // Fall through. default: sPhotoSize = Math.min(metrics.heightPixels, metrics.widthPixels); break; } } final Bundle bundle = getArguments(); if (bundle == null) { return; } mIntent = bundle.getParcelable(ARG_INTENT); mDisplayThumbsFullScreen = mIntent.getBooleanExtra(Intents.EXTRA_DISPLAY_THUMBS_FULLSCREEN, false); mPosition = bundle.getInt(ARG_POSITION); mOnlyShowSpinner = bundle.getBoolean(ARG_SHOW_SPINNER); mProgressBarNeeded = true; if (savedInstanceState != null) { final Bundle state = savedInstanceState.getBundle(STATE_INTENT_KEY); if (state != null) { mIntent = new Intent().putExtras(state); } } if (mIntent != null) { mResolvedPhotoUri = mIntent.getStringExtra(Intents.EXTRA_RESOLVED_PHOTO_URI); mThumbnailUri = mIntent.getStringExtra(Intents.EXTRA_THUMBNAIL_URI); mWatchNetworkState = mIntent.getBooleanExtra(Intents.EXTRA_WATCH_NETWORK, false); } }
public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action)) { synchronized (this) { UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); if (device != null) { // Log.d("1", "DEATTCHED-" + device); } } } // if (UsbManager.ACTION_USB_DEVICE_ATTACHED.equals(action)) { synchronized (this) { UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) { if (device != null) { // Log.d("1", "ATTACHED-" + device); } } else { PendingIntent mPermissionIntent; mPermissionIntent = PendingIntent.getBroadcast( MainActivity.this, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_ONE_SHOT); mUsbManager.requestPermission(device, mPermissionIntent); } } } // if (ACTION_USB_PERMISSION.equals(action)) { synchronized (this) { UsbDevice device = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE); if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)) { if (device != null) { // Log.d("1", "PERMISSION-" + device); } } } } }