List of usage examples for android.content Intent getBooleanExtra
public boolean getBooleanExtra(String name, boolean defaultValue)
From source file:com.google.android.apps.mytracks.io.file.ImportActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); importAll = intent.getBooleanExtra(EXTRA_IMPORT_ALL, false); trackFileFormat = intent.getParcelableExtra(EXTRA_TRACK_FILE_FORMAT); if (trackFileFormat == null) { trackFileFormat = TrackFileFormat.GPX; }/* www . j a va 2 s . c om*/ if (!FileUtils.isExternalStorageAvailable()) { Toast.makeText(this, R.string.external_storage_not_available, Toast.LENGTH_LONG).show(); finish(); return; } if (importAll) { path = FileUtils.buildExternalDirectoryPath(trackFileFormat == TrackFileFormat.KML ? "kml" : "gpx"); if (!FileUtils.isDirectory(new File(path))) { Toast.makeText(this, getString(R.string.import_no_directory, path), Toast.LENGTH_LONG).show(); finish(); return; } } else { String action = intent.getAction(); if (!(Intent.ACTION_ATTACH_DATA.equals(action) || Intent.ACTION_VIEW.equals(action))) { Log.d(TAG, "Invalid action: " + intent); finish(); return; } Uri data = intent.getData(); if (!UriUtils.isFileUri(data)) { Log.d(TAG, "Invalid data: " + intent); finish(); return; } path = data.getPath(); } Object retained = getLastNonConfigurationInstance(); if (retained instanceof ImportAsyncTask) { importAsyncTask = (ImportAsyncTask) retained; importAsyncTask.setActivity(this); } else { importAsyncTask = new ImportAsyncTask(this, importAll, trackFileFormat, path); importAsyncTask.execute(); } }
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java
static void updateNowPlaying(Activity a) { View nowPlayingView = a.findViewById(R.id.nowplaying); if (nowPlayingView == null) { return;//from w w w. j ava 2 s . c o m } boolean withtabs = false; Intent intent = a.getIntent(); if (intent != null) { withtabs = intent.getBooleanExtra("withtabs", false); } //tinha um true == Music... if (MusicUtils.sService != null && MusicUtils.sService.getAudioId() != -1) { TextView title = (TextView) nowPlayingView.findViewById(R.id.title); TextView artist = (TextView) nowPlayingView.findViewById(R.id.artist); title.setText(MusicUtils.sService.getTrackName()); String artistName = MusicUtils.sService.getArtistName(); if (MediaStore.UNKNOWN_STRING.equals(artistName)) { artistName = a.getString(R.string.unknown_artist_name); } artist.setText(artistName); //mNowPlayingView.setOnFocusChangeListener(mFocuser); //mNowPlayingView.setOnClickListener(this); nowPlayingView.setVisibility(View.VISIBLE); nowPlayingView.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Context c = v.getContext(); // c.startActivity(new Intent(c, MediaPlaybackActivity.class)); } }); return; } nowPlayingView.setVisibility(View.GONE); }
From source file:com.example.xyzreader.ui.articlelist.ArticleListFragment.java
@Override public void onStart() { super.onStart(); mRefreshingReceiver = new BroadcastReceiver() { @Override//ww w . j a v a 2 s . c om public void onReceive(Context context, Intent intent) { if (UpdaterService.BROADCAST_ACTION_STATE_CHANGE.equals(intent.getAction())) { boolean updaterIsRefreshing = intent.getBooleanExtra(UpdaterService.EXTRA_REFRESHING, false); if (!updaterIsRefreshing) { mRecyclerView.getAdapter().notifyDataSetChanged(); if (mSwiper != null) { mSwiper.setRefreshing(false); } } } } }; mContext.registerReceiver(mRefreshingReceiver, new IntentFilter(UpdaterService.BROADCAST_ACTION_STATE_CHANGE)); }
From source file:net.evecom.androidecssp.activity.taskresponse.TaskListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.task_list_at); Intent intent = getIntent(); ifmytask = intent.getBooleanExtra("ifmytask", false); if (!ifmytask) { eventInfo = (BaseModel) getData("eventInfo", intent); projectInfo = (BaseModel) getData("projectInfo", intent); findViewById(R.id.task_list_add_at).setVisibility(View.VISIBLE); }/*from w w w . j a v a 2 s.c o m*/ init(); }
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java
static boolean updateButtonBar(Activity a, int highlight) { final TabWidget ll = (TabWidget) a.findViewById(R.id.buttonbar); boolean withtabs = false; Intent intent = a.getIntent(); if (intent != null) { withtabs = intent.getBooleanExtra("withtabs", false); }/*w ww . j av a 2 s .c o m*/ if (highlight == 0 || !withtabs) { ll.setVisibility(View.GONE); return withtabs; } else if (withtabs) { ll.setVisibility(View.VISIBLE); } for (int i = ll.getChildCount() - 1; i >= 0; i--) { View v = ll.getChildAt(i); boolean isActive = (v.getId() == highlight); if (isActive) { ll.setCurrentTab(i); sActiveTabIndex = i; } v.setTag(i); v.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { for (int i = 0; i < ll.getTabCount(); i++) { if (ll.getChildTabViewAt(i) == v) { ll.setCurrentTab(i); processTabClick((Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId()); break; } } } } }); v.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { processTabClick((Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId()); } }); } return withtabs; }
From source file:com.google.android.apps.mytracks.ImportActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); importAll = intent.getBooleanExtra(EXTRA_IMPORT_ALL, false); if (importAll) { path = FileUtils.buildExternalDirectoryPath("gpx"); } else {// www . j a v a 2s .c o m String action = intent.getAction(); if (!(Intent.ACTION_ATTACH_DATA.equals(action) || Intent.ACTION_VIEW.equals(action))) { Log.d(TAG, "Invalid action: " + intent); finish(); return; } data = intent.getData(); /* * DDDD if (!UriUtils.isFileUri(data)) { // TODO Process URL Content (e.g. * for graphhopper.com) Log.d(TAG, "Invalid data: " + intent); finish(); * return; } */ path = getNameFromContentUri(data); } Object retained = getLastNonConfigurationInstance(); if (retained instanceof ImportAsyncTask) { importAsyncTask = (ImportAsyncTask) retained; importAsyncTask.setActivity(this); } else { importAsyncTask = new ImportAsyncTask(this, importAll, path, data); importAsyncTask.execute(); } }
From source file:com.meetingninja.csse.agenda.AgendaActivity.java
@Override public boolean onOptionsItemSelected(final MenuItem item) { // Handle presses on the action bar items // Pass the event to ActionBarDrawerToggle, if it returns // true, then it has handled the app icon touch event // Handle other action bar items... switch (item.getItemId()) { case R.id.action_delete: Intent intent = getIntent(); Boolean isCreated = intent.getBooleanExtra("isCreated", false); finish();/*from ww w. j a v a 2 s. c o m*/ return true; case R.id.collapsible_menu_item: setCollapsible(!this.collapsible); break; case R.id.expand_all_menu_item: manager.expandEverythingBelow(null); break; case R.id.collapse_all_menu_item: manager.collapseChildren(null); break; case R.id.Review: Intent i = new Intent(this, ReviewAgendaActivity.class); i.putExtra(Keys.Agenda.PARCEL, new AgendaParcel(displayedAgenda)); startActivity(i); break; default: return super.onOptionsItemSelected(item); } return true; }
From source file:at.andreasrohner.spartantimelapserec.BackgroundService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent != null && intent.getBooleanExtra("powerSavingCallback", false) && recorder != null && wakeLock != null && settings != null && settings.shouldUsePowerSaveMode() && handlerThread != null && handlerThread.isAlive()) { wakeLock.acquire();//from w w w . ja v a 2 s . co m Handler handler = new Handler(handlerThread.getLooper()); handler.post(new Runnable() { @Override public void run() { recorder.start(); } }); } return super.onStartCommand(intent, flags, startId); }
From source file:com.flowzr.budget.holo.activity.EntityListFragment.java
public void createTransactionFromTemplate(Intent data) { long templateId = data.getLongExtra(SelectTemplateActivity.TEMPATE_ID, -1); int multiplier = data.getIntExtra(SelectTemplateActivity.MULTIPLIER, 1); boolean edit = data.getBooleanExtra(SelectTemplateActivity.EDIT_AFTER_CREATION, false); if (templateId > 0) { long id = duplicateTransaction(templateId, multiplier); Transaction t = db.getTransaction(id); if (t.fromAmount == 0 || edit) { new BlotterOperations(new BlotterFragment(), db, id).asNewFromTemplate().editTransaction(); }/*from w w w.ja v a2s . c o m*/ } }
From source file:am.roadpolice.roadpolice.ViolationInfoActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_violation_info); DialogRateUs.showRateUs(getApplicationContext(), getSupportFragmentManager()); // Customize Action Bar ActionBar actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(0xFF1A237E)); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(Html.fromHtml("<small>" + getString(R.string.title_activity_info) + "</small>")); final Intent intent = getIntent(); // Get Data which is sent from MainActivity. mAutoLogin = intent.getBooleanExtra(EXTRA_AUTO_LOGIN, false); ArrayList<ViolationInfo> violationList = intent.getParcelableArrayListExtra(EXTRA_VIOLATION_INFO_LIST); ViolationInfoAdapter adapter = new ViolationInfoAdapter(getApplicationContext(), violationList); ListView listView = (ListView) findViewById(R.id.listViewViolationInfo); listView.setOnItemClickListener(this); listView.setEmptyView(findViewById(R.id.textViewEmpty)); listView.setAdapter(adapter);/*from ww w . ja va2 s .c o m*/ }