List of usage examples for android.content Intent getLongExtra
public long getLongExtra(String name, long defaultValue)
From source file:org.thoughtcrime.securesms.ShareActivity.java
private void handleResolvedMedia(Intent intent, boolean animate) { long threadId = intent.getLongExtra(EXTRA_THREAD_ID, -1); int distributionType = intent.getIntExtra(EXTRA_DISTRIBUTION_TYPE, -1); Address address = null;/*from w ww . j a va2 s. co m*/ if (intent.hasExtra(EXTRA_ADDRESS_MARSHALLED)) { Parcel parcel = Parcel.obtain(); byte[] marshalled = intent.getByteArrayExtra(EXTRA_ADDRESS_MARSHALLED); parcel.unmarshall(marshalled, 0, marshalled.length); parcel.setDataPosition(0); address = parcel.readParcelable(getClassLoader()); parcel.recycle(); } boolean hasResolvedDestination = threadId != -1 && address != null && distributionType != -1; if (!hasResolvedDestination && animate) { ViewUtil.fadeIn(contactsFragment.getView(), 300); ViewUtil.fadeOut(progressWheel, 300); } else if (!hasResolvedDestination) { contactsFragment.getView().setVisibility(View.VISIBLE); progressWheel.setVisibility(View.GONE); } else { createConversation(threadId, address, distributionType); } }
From source file:com.perfilyev.vkmessengerlite.MessagingService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Timber.d("onStartCommand(): %s", intent); if (intent != null) { final String action = intent.getAction(); if (ACTION_REPLY.equals(action)) { handleActionReply(intent.getLongExtra(EXTRA_PEER_ID, -1), getMessage(intent)); }//from w w w . j av a 2 s . c o m } return START_STICKY; }
From source file:com.shafiq.myfeedle.core.SelectFriends.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // allow posting to multiple services if an account is defined // allow selecting which accounts to use // get existing comments, allow liking|unliking those comments setContentView(R.layout.friends);//from w w w. j ava 2s.co m if (!getPackageName().toLowerCase().contains(PRO)) { AdView adView = new AdView(this, AdSize.BANNER, MyfeedleTokens.GOOGLE_AD_ID); ((LinearLayout) findViewById(R.id.ad)).addView(adView); adView.loadAd(new AdRequest()); } Intent intent = getIntent(); if ((intent != null) && intent.hasExtra(Accounts.SID)) { mAccountId = intent.getLongExtra(Accounts.SID, Myfeedle.INVALID_ACCOUNT_ID); String[] tags = intent.getStringArrayExtra(Stags); if (tags != null) { for (String tag : tags) mSelectedFriends.add(tag); } } else finish(); mHttpClient = MyfeedleHttpClient.getThreadSafeClient(getApplicationContext()); registerForContextMenu(getListView()); setResult(RESULT_CANCELED); }
From source file:info.wncwaterfalls.app.FullScreenImageActivity.java
protected void onCreate(Bundle savedInstanceState) { setTheme(R.style.Theme_AppCompat);/*from w w w . j a va 2 s . c om*/ super.onCreate(savedInstanceState); mDb = new AttrDatabase(getApplicationContext()); setContentView(R.layout.activity_full_screen_image); Intent intent = getIntent(); mImgFileName = intent.getStringExtra("info.wncwaterfalls.app.IMAGE_FN"); mWaterfallName = intent.getStringExtra("info.wncwaterfalls.app.WF_NAME"); mWaterfallId = intent.getLongExtra("info.wncwaterfalls.app.WF_ID", 0); // Set title setTitle(mWaterfallName); actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); }
From source file:android.support.v17.leanback.app.BrowseSupportFragmentTestActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); BrowseTestSupportFragment.NUM_ROWS = intent.getIntExtra(EXTRA_NUM_ROWS, BrowseTestSupportFragment.DEFAULT_NUM_ROWS); BrowseTestSupportFragment.REPEAT_PER_ROW = intent.getIntExtra(EXTRA_REPEAT_PER_ROW, BrowseTestSupportFragment.DEFAULT_REPEAT_PER_ROW); BrowseTestSupportFragment.LOAD_DATA_DELAY = intent.getLongExtra(EXTRA_LOAD_DATA_DELAY, BrowseTestSupportFragment.DEFAULT_LOAD_DATA_DELAY); BrowseTestSupportFragment.TEST_ENTRANCE_TRANSITION = intent.getBooleanExtra(EXTRA_TEST_ENTRANCE_TRANSITION, BrowseTestSupportFragment.DEFAULT_TEST_ENTRANCE_TRANSITION); setContentView(R.layout.browse);// ww w. j av a2 s.co m FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.main_frame, new BrowseTestSupportFragment()); if (intent.getBooleanExtra(EXTRA_ADD_TO_BACKSTACK, false)) { ft.addToBackStack(null); } ft.commit(); }
From source file:com.ferdi2005.secondgram.AutoMessageReplyReceiver.java
@Override public void onReceive(Context context, Intent intent) { ApplicationLoader.postInitApplication(); Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); if (remoteInput == null) { return;// ww w .ja va 2s.co m } CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY); if (text == null || text.length() == 0) { return; } long dialog_id = intent.getLongExtra("dialog_id", 0); int max_id = intent.getIntExtra("max_id", 0); if (dialog_id == 0 || max_id == 0) { return; } SendMessagesHelper.getInstance().sendMessage(text.toString(), dialog_id, null, null, true, null, null, null); MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, true, false); }
From source file:org.cafemember.messenger.AutoMessageReplyReceiver.java
@Override public void onReceive(Context context, Intent intent) { ApplicationLoader.postInitApplication(); Bundle remoteInput = RemoteInput.getResultsFromIntent(intent); if (remoteInput == null) { return;//w w w . j av a2s. co m } CharSequence text = remoteInput.getCharSequence(NotificationsController.EXTRA_VOICE_REPLY); if (text == null || text.length() == 0) { return; } long dialog_id = intent.getLongExtra("dialog_id", 0); int max_id = intent.getIntExtra("max_id", 0); if (dialog_id == 0 || max_id == 0) { return; } SendMessagesHelper.getInstance().sendMessage(text.toString(), dialog_id, null, null, true, false, null, null, null); MessagesController.getInstance().markDialogAsRead(dialog_id, max_id, max_id, 0, true, false); }
From source file:org.traccar.manager.MainFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_DEVICE && resultCode == RESULT_SUCCESS) { long deviceId = data.getLongExtra(DevicesFragment.EXTRA_DEVICE_ID, 0); String deviceStatus = data.getStringExtra(DevicesFragment.EXTRA_DEVICE_STATUS); Position position = positions.get(deviceId); if (position != null) { map.moveCamera(//from w w w . j a va 2 s . c o m CameraUpdateFactory.newLatLng(new LatLng(position.getLatitude(), position.getLongitude()))); map.animateCamera(CameraUpdateFactory.zoomTo(15)); Marker deviceStatusMarker = markers.get(deviceId); //markers.get(deviceId).showInfoWindow(); // Set color based on device being online/offline switch (deviceStatus) { case "online": deviceStatusMarker .setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); deviceStatusMarker.setTitle("Online"); break; case "offline": // Never coming here as code can't figure between nonreachable and offline deviceStatusMarker .setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)); deviceStatusMarker.setTitle("Offline"); break; default: deviceStatusMarker .setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW)); deviceStatusMarker.setTitle("Offline"); break; } //show the marker deviceStatusMarker.showInfoWindow(); } } }
From source file:org.strongswan.android.ui.activity.MainActivity.java
/** * Start the VPN profile referred to by the given intent. Displays an error * if the profile doesn't exist./*from ww w . j av a 2s . com*/ * * @param intent Intent that caused us to start this */ private void startVpnProfile1(Intent intent) { long profileId = intent.getLongExtra(EXTRA_VPN_PROFILE_ID, 0); if (profileId <= 0) { /* invalid invocation */ return; } //?? VpnProfileDataSource dataSource = new VpnProfileDataSource(this); dataSource.open(); //?? VpnProfile profile = dataSource.getVpnProfile(profileId); //? dataSource.close(); if (profile != null) { // onVpnProfileSelected(profile); } else { Toast.makeText(this, R.string.profile_not_found, Toast.LENGTH_LONG).show(); } }
From source file:com.todoroo.astrid.ui.HideUntilControlSet.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_HIDE_UNTIL) { if (resultCode == Activity.RESULT_OK) { setCustomDate(data.getLongExtra(TimePickerActivity.EXTRA_TIMESTAMP, 0L)); }// www .j a va 2 s .com } else { super.onActivityResult(requestCode, resultCode, data); } }