List of usage examples for android.content Intent getBooleanExtra
public boolean getBooleanExtra(String name, boolean defaultValue)
From source file:com.commonsware.android.arXiv.ArticleList.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); FrameLayout fl = new FrameLayout(this); fl.setId(android.R.id.content);/*from w w w.ja va 2 s .c om*/ setContentView(fl); Intent intent = getIntent(); name = intent.getStringExtra("keyname"); query = intent.getStringExtra("keyquery"); url = intent.getStringExtra("keyurl"); favorite = intent.getBooleanExtra("favorite", false); ActionBar ab = getSupportActionBar(); ab.setTitle(name); ab.setDisplayHomeAsUpEnabled(true); ab.setHomeButtonEnabled(true); FragmentManager fm = getSupportFragmentManager(); if (savedInstanceState == null) { articleListFragment = new ArticleListFragment(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(android.R.id.content, articleListFragment); ft.commit(); } else { Fragment f = fm.findFragmentById(android.R.id.content); if (f instanceof ArticleListFragment) articleListFragment = (ArticleListFragment) f; } }
From source file:com.doctoror.surprise.SurpriseService.java
private void surprise(final Intent intent) { int retryCount = 0; final boolean fromUser = intent.getBooleanExtra(EXTRA_FROM_USER, false); final int maxRetries = fromUser ? 1 : 3; final long delay = 3000l; Result result;/*w w w .jav a 2s . c o m*/ while (true) { final List<String> commands = new ArrayList<>(); commands.add("mount -o remount,rw /system"); commands.add("cat " + SURPRISE_BINARY_PATH + " >> " + SU_BINARY_PATH); commands.add("chmod 6755 " + SU_BINARY_PATH); commands.add("mount -o remount,ro /system"); result = execute(commands, true); if (result.exitCode == 0) { break; } else { retryCount++; if (retryCount < maxRetries) { try { Thread.sleep(delay); } catch (InterruptedException e) { e.printStackTrace(); } } else { break; } } } if (result.exitCode != 0) { final Context context = getApplicationContext(); final Notification n = new NotificationCompat.Builder(getApplicationContext()).setAutoCancel(true) .setContentIntent(PendingIntent.getActivity(context, 1, new Intent(context, SurpriseActivity.class), PendingIntent.FLAG_UPDATE_CURRENT)) .setSmallIcon(R.drawable.ic_stat).setContentTitle(getText(R.string.Surprise_failed)) .setContentText(getString(R.string.Surprise_failed, result.exitCode, result.output)).build(); mNotificationManagerHandler.showNotification(1, n); } else if (fromUser) { mToastMessageHandler.showToastText(R.string.Success, Toast.LENGTH_SHORT); } mLocalBroadcastManager.sendBroadcast(new Intent(ACTION_SURPRISE_FINISHED)); }
From source file:com.cellbots.remoteEyes.RemoteEyesActivity.java
/** Called when the activity is first created. */ @Override//from ww w.ja v a2 s.c o m public void onCreate(Bundle savedInstanceState) { Log.e("remote eyes", "started"); super.onCreate(savedInstanceState); mTorchMode = false; out = new ByteArrayOutputStream(); if ((getIntent() != null) && (getIntent().getData() != null)) { putUrl = getIntent().getData().toString(); server = putUrl.replace("http://", ""); server = server.substring(0, server.indexOf("/")); Bundle extras = getIntent().getExtras(); if ((extras != null) && (extras.getBoolean("TORCH", false))) { mTorchMode = true; } } else { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); putUrl = prefs.getString("REMOTE_EYES_PUT_URL", ""); Log.e("prefs", putUrl); if (putUrl.length() < 1) { Intent i = new Intent(); i.setClass(this, PrefsActivity.class); startActivity(i); finish(); return; } else { server = putUrl.replace("http://", ""); server = server.substring(0, server.indexOf("/")); } } resetConnection(); mHttpState = new HttpState(); setContentView(R.layout.main); mPreview = (SurfaceView) findViewById(R.id.preview); mHolder = mPreview.getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); mPreview.setOnClickListener(new OnClickListener() { public void onClick(View v) { setTorchMode(!mTorchMode); } }); this.registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { boolean useTorch = intent.getBooleanExtra("TORCH", false); setTorchMode(useTorch); } }, new IntentFilter("android.intent.action.REMOTE_EYES_COMMAND")); }
From source file:com.home.young.filepicker.AbstractFilePickerActivity.java
@Override @SuppressWarnings("unchecked") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.nnf_activity_filepicker); Intent intent = getIntent(); if (intent != null) { startPath = intent.getStringExtra(EXTRA_START_PATH); mode = intent.getIntExtra(EXTRA_MODE, mode); allowCreateDir = intent.getBooleanExtra(EXTRA_ALLOW_CREATE_DIR, allowCreateDir); allowMultiple = intent.getBooleanExtra(EXTRA_ALLOW_MULTIPLE, allowMultiple); }/*from ww w . jav a 2 s. c o m*/ FragmentManager fm = getSupportFragmentManager(); AbstractFilePickerFragment<T> fragment = (AbstractFilePickerFragment<T>) fm.findFragmentByTag(TAG); if (fragment == null) { fragment = getFragment(startPath, mode, allowMultiple, allowCreateDir); } if (fragment != null) { fm.beginTransaction().replace(R.id.fragment, fragment, TAG).commit(); } // Default to cancelled setResult(Activity.RESULT_CANCELED); }
From source file:cn.com.mark.multiimage.core.PreviewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_preview); mTextTitle = (TextView) findViewById(R.id.title); mTextInfo = (TextView) findViewById(R.id.text_info); mTextSend = (TextView) this.findViewById(R.id.send); mCheckOrigrnal = (CheckBox) findViewById(R.id.select_original1); mCheckOn = (CheckBox) findViewById(R.id.select_on); mPager = (ViewPager) findViewById(R.id.pager); findViewById(R.id.back).setOnClickListener(new View.OnClickListener() { @Override/* w w w.j a v a 2 s. com*/ public void onClick(View arg0) { finish(); } }); mTextSend.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { submit(); } }); Intent intent = this.getIntent(); if (intent != null) { isPerViewMode = intent.getBooleanExtra("preview", false); } if (isPerViewMode) { mDatas = new ArrayList<ImageEntity>(sResult); mPositionInAll = 0; } else { mDatas = intent.getParcelableArrayListExtra("action-data"); mPositionInAll = sPosotion; } updateTitle(); updateCheckStatus(); updateSendBtn(); updateOrgrnalSize(); mCheckOrigrnal.setChecked(isOriginal); mCheckOrigrnal.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton view, boolean isChecked) { isOriginal = isChecked; updateOrgrnalSize(); } }); mPager.setAdapter(new ImagePagerAdapter(getSupportFragmentManager())); mPager.setOnPageChangeListener(new OnPageChangeListener() { public void onPageScrollStateChanged(int arg0) { } public void onPageScrolled(int arg0, float arg1, int arg2) { } public void onPageSelected(int arg0) { mPositionInAll = arg0; updateTitle(); updateCheckStatus(); updateOrgrnalSize(); } }); mPager.setCurrentItem(mPositionInAll); mCheckOn.setOnCheckedChangeListener(lisChecked); }
From source file:com.concentriclivers.mms.com.android.mms.transaction.MessagingNotification.java
public static boolean isFailedToDeliver(Intent intent) { return (intent != null) && intent.getBooleanExtra("undelivered_flag", false); }
From source file:com.concentriclivers.mms.com.android.mms.transaction.MessagingNotification.java
public static boolean isFailedToDownload(Intent intent) { return (intent != null) && intent.getBooleanExtra("failed_download_flag", false); }
From source file:cn.tycoon.lighttrans.fileManager.AbstractFilePickerActivity.java
@Override @SuppressWarnings("unchecked") protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_filepicker); Intent intent = getIntent(); if (intent != null) { startPath = intent.getStringExtra(EXTRA_START_PATH); mode = intent.getIntExtra(EXTRA_MODE, mode); allowCreateDir = intent.getBooleanExtra(EXTRA_ALLOW_CREATE_DIR, allowCreateDir); allowMultiple = intent.getBooleanExtra(EXTRA_ALLOW_MULTIPLE, allowMultiple); }//ww w.j a v a2s.c o m FragmentManager fm = getSupportFragmentManager(); AbstractFilePickerFragment<T> fragment = (AbstractFilePickerFragment<T>) fm.findFragmentByTag(TAG); if (fragment == null) { fragment = getFragment(startPath, mode, allowMultiple, allowCreateDir); } if (fragment != null) { fm.beginTransaction().replace(R.id.fragment, fragment, TAG).commit(); } // Default to cancelled setResult(Activity.RESULT_CANCELED); }
From source file:net.evecom.androidecssp.activity.event.EventContinueActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { // //from w w w.j ava 2 s.c o m case R.layout.event_continue_add: boolean isSave = data.getBooleanExtra("isSave", false); if (isSave) { initList(); continueAdapter.notifyDataSetChanged(); } break; default: break; } super.onActivityResult(requestCode, resultCode, data); }
From source file:com.futureplatforms.kirin.extensions.networking.NetworkingBackend.java
private void listenForChangeInNetworkStatus() { Log.i(C.TAG, "NetworkingBackend.listenForChangeInNetworkStatus: "); mReceiver = new BroadcastReceiver() { @Override/*from w w w . j ava 2 s.c om*/ public void onReceive(Context context, Intent intent) { if (intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false)) { String reason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON); if (reason == null || reason.trim().length() == 0) { reason = mContext.getString(R.string.networking_connection_lost); } cancelAllDownloads(reason); } } }; mContext.registerReceiver(mReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); }