List of usage examples for android.content Intent getBooleanExtra
public boolean getBooleanExtra(String name, boolean defaultValue)
From source file:com.devalladolid.musictoday.MusicService.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (D)/*ww w. j ava 2 s.c o m*/ Log.d(TAG, "Got new intent " + intent + ", startId = " + startId); mServiceStartId = startId; if (intent != null) { final String action = intent.getAction(); if (SHUTDOWN.equals(action)) { mShutdownScheduled = false; releaseServiceUiAndStop(); return START_NOT_STICKY; } handleCommandIntent(intent); } scheduleDelayedShutdown(); if (intent != null && intent.getBooleanExtra(FROM_MEDIA_BUTTON, false)) { MediaButtonIntentReceiver.completeWakefulIntent(intent); } return START_NOT_STICKY; //no sense to use START_STICKY with using startForeground }
From source file:com.owncloud.android.files.services.FileUploader.java
/** * Entry point to add one or several files to the queue of uploads. * * New uploads are added calling to startService(), resulting in a call to * this method. This ensures the service will keep on working although the * caller activity goes away./*from w ww. j a v a 2s .c o m*/ */ @Override public int onStartCommand(Intent intent, int flags, int startId) { Log_OC.d(TAG, "Starting command with id " + startId); if (!intent.hasExtra(KEY_ACCOUNT) || !intent.hasExtra(KEY_UPLOAD_TYPE) || !(intent.hasExtra(KEY_LOCAL_FILE) || intent.hasExtra(KEY_FILE))) { Log_OC.e(TAG, "Not enough information provided in intent"); return Service.START_NOT_STICKY; } int uploadType = intent.getIntExtra(KEY_UPLOAD_TYPE, -1); if (uploadType == -1) { Log_OC.e(TAG, "Incorrect upload type provided"); return Service.START_NOT_STICKY; } Account account = intent.getParcelableExtra(KEY_ACCOUNT); if (!AccountUtils.exists(account, getApplicationContext())) { return Service.START_NOT_STICKY; } String[] localPaths = null, remotePaths = null, mimeTypes = null; OCFile[] files = null; if (uploadType == UPLOAD_SINGLE_FILE) { if (intent.hasExtra(KEY_FILE)) { files = new OCFile[] { intent.getParcelableExtra(KEY_FILE) }; } else { localPaths = new String[] { intent.getStringExtra(KEY_LOCAL_FILE) }; remotePaths = new String[] { intent.getStringExtra(KEY_REMOTE_FILE) }; mimeTypes = new String[] { intent.getStringExtra(KEY_MIME_TYPE) }; } } else { // mUploadType == UPLOAD_MULTIPLE_FILES if (intent.hasExtra(KEY_FILE)) { files = (OCFile[]) intent.getParcelableArrayExtra(KEY_FILE); // TODO // will // this // casting // work // fine? } else { localPaths = intent.getStringArrayExtra(KEY_LOCAL_FILE); remotePaths = intent.getStringArrayExtra(KEY_REMOTE_FILE); mimeTypes = intent.getStringArrayExtra(KEY_MIME_TYPE); } } FileDataStorageManager storageManager = new FileDataStorageManager(account, getContentResolver()); boolean forceOverwrite = intent.getBooleanExtra(KEY_FORCE_OVERWRITE, false); boolean isInstant = intent.getBooleanExtra(KEY_INSTANT_UPLOAD, false); int localAction = intent.getIntExtra(KEY_LOCAL_BEHAVIOUR, LOCAL_BEHAVIOUR_COPY); if (intent.hasExtra(KEY_FILE) && files == null) { Log_OC.e(TAG, "Incorrect array for OCFiles provided in upload intent"); return Service.START_NOT_STICKY; } else if (!intent.hasExtra(KEY_FILE)) { if (localPaths == null) { Log_OC.e(TAG, "Incorrect array for local paths provided in upload intent"); return Service.START_NOT_STICKY; } if (remotePaths == null) { Log_OC.e(TAG, "Incorrect array for remote paths provided in upload intent"); return Service.START_NOT_STICKY; } if (localPaths.length != remotePaths.length) { Log_OC.e(TAG, "Different number of remote paths and local paths!"); return Service.START_NOT_STICKY; } files = new OCFile[localPaths.length]; for (int i = 0; i < localPaths.length; i++) { files[i] = obtainNewOCFileToUpload(remotePaths[i], localPaths[i], ((mimeTypes != null) ? mimeTypes[i] : null)); if (files[i] == null) { // TODO @andomaex add failure Notification return Service.START_NOT_STICKY; } } } OwnCloudVersion ocv = AccountUtils.getServerVersion(account); boolean chunked = FileUploader.chunkedUploadIsSupported(ocv); AbstractList<String> requestedUploads = new Vector<String>(); String uploadKey = null; UploadFileOperation newUpload = null; try { for (int i = 0; i < files.length; i++) { newUpload = new UploadFileOperation(account, files[i], chunked, isInstant, forceOverwrite, localAction, getApplicationContext()); if (isInstant) { newUpload.setRemoteFolderToBeCreated(); } newUpload.addDatatransferProgressListener(this); newUpload.addDatatransferProgressListener((FileUploaderBinder) mBinder); Pair<String, String> putResult = mPendingUploads.putIfAbsent(account, files[i].getRemotePath(), newUpload); uploadKey = putResult.first; requestedUploads.add(uploadKey); } } catch (IllegalArgumentException e) { Log_OC.e(TAG, "Not enough information provided in intent: " + e.getMessage()); return START_NOT_STICKY; } catch (IllegalStateException e) { Log_OC.e(TAG, "Bad information provided in intent: " + e.getMessage()); return START_NOT_STICKY; } catch (Exception e) { Log_OC.e(TAG, "Unexpected exception while processing upload intent", e); return START_NOT_STICKY; } if (requestedUploads.size() > 0) { Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = requestedUploads; mServiceHandler.sendMessage(msg); } return Service.START_NOT_STICKY; }
From source file:com.synox.android.files.services.FileUploader.java
/** * Entry point to add one or several files to the queue of uploads. * * New uploads are added calling to startService(), resulting in a call to * this method. This ensures the service will keep on working although the * caller activity goes away.//from ww w . j a v a 2 s . co m */ @Override public int onStartCommand(Intent intent, int flags, int startId) { Log_OC.d(TAG, "Starting command with id " + startId); if (!intent.hasExtra(KEY_ACCOUNT) || !intent.hasExtra(KEY_UPLOAD_TYPE) || !(intent.hasExtra(KEY_LOCAL_FILE) || intent.hasExtra(KEY_FILE))) { Log_OC.e(TAG, "Not enough information provided in intent"); return Service.START_NOT_STICKY; } int uploadType = intent.getIntExtra(KEY_UPLOAD_TYPE, -1); if (uploadType == -1) { Log_OC.e(TAG, "Incorrect upload type provided"); return Service.START_NOT_STICKY; } Account account = intent.getParcelableExtra(KEY_ACCOUNT); if (!AccountUtils.exists(account, getApplicationContext())) { return Service.START_NOT_STICKY; } String[] localPaths = null, remotePaths = null, mimeTypes = null; OCFile[] files = null; if (uploadType == UPLOAD_SINGLE_FILE) { if (intent.hasExtra(KEY_FILE)) { files = new OCFile[] { intent.getParcelableExtra(KEY_FILE) }; } else { localPaths = new String[] { intent.getStringExtra(KEY_LOCAL_FILE) }; remotePaths = new String[] { intent.getStringExtra(KEY_REMOTE_FILE) }; mimeTypes = new String[] { intent.getStringExtra(KEY_MIME_TYPE) }; } } else { // mUploadType == UPLOAD_MULTIPLE_FILES if (intent.hasExtra(KEY_FILE)) { files = (OCFile[]) intent.getParcelableArrayExtra(KEY_FILE); // TODO // will // this // casting // work // fine? } else { localPaths = intent.getStringArrayExtra(KEY_LOCAL_FILE); remotePaths = intent.getStringArrayExtra(KEY_REMOTE_FILE); mimeTypes = intent.getStringArrayExtra(KEY_MIME_TYPE); } } FileDataStorageManager storageManager = new FileDataStorageManager(account, getContentResolver()); boolean forceOverwrite = intent.getBooleanExtra(KEY_FORCE_OVERWRITE, false); boolean isInstant = intent.getBooleanExtra(KEY_INSTANT_UPLOAD, false); int localAction = intent.getIntExtra(KEY_LOCAL_BEHAVIOUR, LOCAL_BEHAVIOUR_COPY); if (intent.hasExtra(KEY_FILE) && files == null) { Log_OC.e(TAG, "Incorrect array for OCFiles provided in upload intent"); return Service.START_NOT_STICKY; } else if (!intent.hasExtra(KEY_FILE)) { if (localPaths == null) { Log_OC.e(TAG, "Incorrect array for local paths provided in upload intent"); return Service.START_NOT_STICKY; } if (remotePaths == null) { Log_OC.e(TAG, "Incorrect array for remote paths provided in upload intent"); return Service.START_NOT_STICKY; } if (localPaths.length != remotePaths.length) { Log_OC.e(TAG, "Different number of remote paths and local paths!"); return Service.START_NOT_STICKY; } files = new OCFile[localPaths.length]; for (int i = 0; i < localPaths.length; i++) { files[i] = obtainNewOCFileToUpload(remotePaths[i], localPaths[i], ((mimeTypes != null) ? mimeTypes[i] : null), storageManager); if (files[i] == null) { // TODO @andomaex add failure Notification return Service.START_NOT_STICKY; } } } OwnCloudVersion ocv = AccountUtils.getServerVersion(account); boolean chunked = FileUploader.chunkedUploadIsSupported(ocv); AbstractList<String> requestedUploads = new Vector<>(); String uploadKey = null; UploadFileOperation newUpload = null; try { for (OCFile file : files) { uploadKey = buildRemoteName(account, file.getRemotePath()); newUpload = new UploadFileOperation(account, file, chunked, isInstant, forceOverwrite, localAction, getApplicationContext()); if (isInstant) { newUpload.setRemoteFolderToBeCreated(); } // Grants that the file only upload once time mPendingUploads.putIfAbsent(uploadKey, newUpload); newUpload.addDatatransferProgressListener(this); newUpload.addDatatransferProgressListener((FileUploaderBinder) mBinder); requestedUploads.add(uploadKey); } } catch (IllegalArgumentException e) { Log_OC.e(TAG, "Not enough information provided in intent: " + e.getMessage()); return START_NOT_STICKY; } catch (IllegalStateException e) { Log_OC.e(TAG, "Bad information provided in intent: " + e.getMessage()); return START_NOT_STICKY; } catch (Exception e) { Log_OC.e(TAG, "Unexpected exception while processing upload intent", e); return START_NOT_STICKY; } if (requestedUploads.size() > 0) { Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = requestedUploads; mServiceHandler.sendMessage(msg); } Log_OC.i(TAG, "mPendingUploads size:" + mPendingUploads.size()); return Service.START_NOT_STICKY; }
From source file:com.roiland.crm.sm.ui.view.ScOppoInfoFragment.java
/** * /*from ww w .jav a 2 s. co m*/ * @param inflater ? * @param container * @param savedInstanceState * @return ?? * @see android.support.v4.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle) */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.sc_activity_example, container, false); this.crmManager = ((RoilandCRMApplication) getActivity().getApplication()).getCRMManager(); cust_title = (TextView) view.findViewById(R.id.cust_title); newToggleBtn = (ToggleButton) view.findViewById(R.id.toggleButton_new); mFollowInfo = (LinearLayout) view.findViewById(R.id.oppo_followinfo_list); newlayout = (LinearLayout) view.findViewById(R.id.oppo_followinfo_list_layout); mCustominfoTitle = (LinearLayout) view.findViewById(R.id.custominfo); mCarInfoHide = (ImageButton) view.findViewById(R.id.carinfo_hide_btn); mCarInfoMore = (ImageButton) view.findViewById(R.id.carinfo_more_btn); newlayout.setVisibility(View.GONE); newToggleBtn.setVisibility(View.GONE); Intent intent = getActivity().getIntent(); isFromCustManager = intent.getBooleanExtra("fromCustManager", false); mCustFlowCome = intent.getBooleanExtra("CustFlowCome", false); custOrderCome = intent.getBooleanExtra("CustOrderCome", false); addFlag = intent.getBooleanExtra("addFlag", false); orderId = intent.getStringExtra("orderId"); orderStatus = intent.getStringExtra("orderStatus"); setNewListHidden(); mCustomInfo = (LinearLayout) view.findViewById(R.id.custom_info_list); mCarInfo = (LinearLayout) view.findViewById(R.id.car_info_list); if (customerInfoAdapter == null) customerInfoAdapter = new BasicInfoListAdapter(this.getActivity()); customerInfoAdapter.crmManager = this.crmManager; if (carInfoAdapter == null) { carInfoAdapter = new BasicInfoListAdapter(this.getActivity()); carInfoAdapter.crmManager = this.crmManager; } //? newToggleBtn.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { //??? if (isChecked) { newToggleBtnClick = true; newlayout.setVisibility(View.VISIBLE); setNewListdisplay(); newToggleBtn.setBackgroundResource(R.drawable.toggle_sliding2); } else { newToggleBtnClick = false; newlayout.setVisibility(View.GONE); setNewListHidden(); newToggleBtn.setBackgroundResource(R.drawable.toggle_sliding1); } } }); mCarInfoMore = (ImageButton) view.findViewById(R.id.carinfo_more_btn); if (isFromCustManager) { comeFromCustMamager(); displayCarInfo(false); } else { mCustomInfoMore = (ImageButton) view.findViewById(R.id.custominfo_more_btn); mCustomInfoHide = (ImageButton) view.findViewById(R.id.custominfo_hide_btn); //??? mCustomInfoHide.setVisibility(View.GONE); //?? mCustomInfoMore.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (isOldCust) isOldCust = false; custFlag = !custFlag; mCustomInfoHide.setVisibility(View.VISIBLE); mCustomInfoMore.setVisibility(View.GONE); displayCustomerInfo(custFlag); customerInfoAdapter.setEditable(customerInfoAdapter.getEditable()); } }); //???? mCustomInfoHide.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { custFlag = !custFlag; mCustomInfoHide.setVisibility(View.GONE); mCustomInfoMore.setVisibility(View.VISIBLE); displayCustomerInfo(custFlag); customerInfoAdapter.setEditable(customerInfoAdapter.getEditable()); } }); displayCustomerInfo(false); displayCarInfo(false); } // ??? mCarInfoHide.setVisibility(View.GONE); // ?? mCarInfoMore.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { carFlag = !carFlag; mCarInfoHide.setVisibility(View.VISIBLE); mCarInfoMore.setVisibility(View.GONE); displayCarInfo(carFlag); carInfoAdapter.setEditable(carInfoAdapter.getEditable()); } }); // ???? mCarInfoHide.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { carFlag = !carFlag; mCarInfoHide.setVisibility(View.GONE); mCarInfoMore.setVisibility(View.VISIBLE); displayCarInfo(carFlag); carInfoAdapter.setEditable(carInfoAdapter.getEditable()); } }); // if (addFlag) { if (followPlanAdapter == null) { followPlanAdapter = new BasicInfoListAdapter(this.getActivity()); followPlanAdapter.crmManager = this.crmManager; } displayfollowPlanInfo(); setNewListdisplay(); followPlanAdapter.setEditable(true); carInfoAdapter.setEditable(true); customerInfoAdapter.setEditable(true); bottomBar.setVisible(false); newlayout.setVisibility(View.VISIBLE); newToggleBtn.setVisibility(View.VISIBLE); mFollowInfo.setVisibility(View.VISIBLE); newToggleBtnClick = true; } // cust_title.setFocusable(true); cust_title.setFocusableInTouchMode(true); cust_title.requestFocus(); return view; }
From source file:com.onegravity.contactpicker.core.ContactPickerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // check if all custom attributes are defined if (!checkTheming()) { finish();/*from ww w.jav a2 s. co m*/ return; } /* * Check if we have the READ_CONTACTS permission, if not --> terminate. */ try { int pid = android.os.Process.myPid(); PackageManager pckMgr = getPackageManager(); int uid = pckMgr.getApplicationInfo(getComponentName().getPackageName(), PackageManager.GET_META_DATA).uid; enforcePermission(Manifest.permission.READ_CONTACTS, pid, uid, "Contact permission hasn't been granted to this app, terminating."); } catch (PackageManager.NameNotFoundException | SecurityException e) { Log.e(getClass().getSimpleName(), e.getMessage()); finish(); return; } mDefaultTitle = "Select Contacts"; mThemeResId = R.style.Theme_Light; Intent intent = getIntent(); if (savedInstanceState == null) { // /* // * Retrieve default title used if no contacts are selected. // */ // try { // PackageManager pkMgr = getPackageManager(); // ActivityInfo activityInfo = pkMgr.getActivityInfo(getComponentName(), PackageManager.GET_META_DATA); // mDefaultTitle = activityInfo.loadLabel(pkMgr).toString(); // } // catch (PackageManager.NameNotFoundException ignore) { // mDefaultTitle = getTitle().toString(); // } if (intent.hasExtra(EXTRA_PRESELECTED_CONTACTS)) { Collection<Long> preselectedContacts = (Collection<Long>) intent .getSerializableExtra(EXTRA_PRESELECTED_CONTACTS); mSelectedContactIds.addAll(preselectedContacts); } if (intent.hasExtra(EXTRA_PRESELECTED_GROUPS)) { Collection<Long> preselectedGroups = (Collection<Long>) intent .getSerializableExtra(EXTRA_PRESELECTED_GROUPS); mSelectedGroupIds.addAll(preselectedGroups); } // mThemeResId = intent.getIntExtra(EXTRA_THEME, R.style.ContactPicker_Theme_Light); } else { // mDefaultTitle = savedInstanceState.getString("mDefaultTitle"); // // mThemeResId = savedInstanceState.getInt("mThemeResId"); // Retrieve selected contact and group ids. try { mSelectedContactIds = (HashSet<Long>) savedInstanceState.getSerializable(CONTACT_IDS); mSelectedGroupIds = (HashSet<Long>) savedInstanceState.getSerializable(GROUP_IDS); } catch (ClassCastException ignore) { } } /* * Retrieve ContactPictureType. */ String enumName = intent.getStringExtra(EXTRA_CONTACT_BADGE_TYPE); mBadgeType = ContactPictureType.lookup(enumName); /* * Retrieve SelectContactsLimit. */ mSelectContactsLimit = intent.getIntExtra(EXTRA_SELECT_CONTACTS_LIMIT, 0); /* * Retrieve ShowCheckAll. */ mShowCheckAll = mSelectContactsLimit > 0 ? false : intent.getBooleanExtra(EXTRA_SHOW_CHECK_ALL, true); /* * Retrieve OnlyWithPhoneNumbers. */ mOnlyWithPhoneNumbers = intent.getBooleanExtra(EXTRA_ONLY_CONTACTS_WITH_PHONE, false); /* * Retrieve LimitReachedMessage. */ String limitMsg = intent.getStringExtra(EXTRA_LIMIT_REACHED_MESSAGE); if (limitMsg != null) { mLimitReachedMessage = limitMsg; } else { mLimitReachedMessage = getString(R.string.cp_limit_reached, mSelectContactsLimit); } /* * Retrieve ContactDescription. */ enumName = intent.getStringExtra(EXTRA_CONTACT_DESCRIPTION); mDescription = ContactDescription.lookup(enumName); mDescriptionType = intent.getIntExtra(EXTRA_CONTACT_DESCRIPTION_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_HOME); /* * Retrieve ContactSortOrder. */ enumName = intent.getStringExtra(EXTRA_CONTACT_SORT_ORDER); mSortOrder = ContactSortOrder.lookup(enumName); setTheme(mThemeResId); setContentView(R.layout.cp_contact_tab_layout); // initialize TabLayout TabLayout tabLayout = (TabLayout) findViewById(R.id.tabContent); tabLayout.setTabMode(TabLayout.MODE_FIXED); tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); TabLayout.Tab tabContacts = tabLayout.newTab(); tabContacts.setText(R.string.cp_contact_tab_title); tabLayout.addTab(tabContacts); TabLayout.Tab tabGroups = tabLayout.newTab(); tabGroups.setText(R.string.cp_group_tab_title); tabLayout.addTab(tabGroups); // initialize ViewPager final ViewPager viewPager = (ViewPager) findViewById(R.id.tabPager); mAdapter = new PagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount(), mSortOrder, mBadgeType, mDescription, mDescriptionType); viewPager.setAdapter(mAdapter); viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
From source file:com.bluros.music.MusicService.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (D)/*from www .j a v a 2s. c om*/ Log.d(TAG, "Got new intent " + intent + ", startId = " + startId); mServiceStartId = startId; if (intent != null) { final String action = intent.getAction(); if (SHUTDOWN.equals(action)) { mShutdownScheduled = false; releaseServiceUiAndStop(); return START_NOT_STICKY; } handleCommandIntent(intent); } scheduleDelayedShutdown(); if (intent != null && intent.getBooleanExtra(FROM_MEDIA_BUTTON, false)) { MediaButtonIntentReceiver.completeWakefulIntent(intent); } return START_STICKY; }
From source file:com.msopentech.applicationgateway.EnterpriseBrowserActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { try {//from w w w . j a va 2s .com super.onActivityResult(requestCode, resultCode, data); // The data argument can be null if the user simply exited the // activity by clicking back or cancel. if (data == null) { return; } Bundle extras = data.getExtras(); if (extras == null) { return; } switch (requestCode) { case ACTIVITY_SIGN_IN: { if (resultCode != RESULT_CANCELED) { mCustomTabHost.clearAllHistory(); mTraits = (ConnectionTraits) data .getSerializableExtra(EnterpriseBrowserActivity.EXTRAS_TRAITS_KEY); if (mTraits.sessionID == null && mTraits.token == null && mTraits.agent.getAgentId() == null) { // Authentication failed. Have to make user make another attempt while informing of error reason. showSignIn(null, true); } else { mStatusButtonView.setImageResource(R.drawable.connection_green); if (mIsSigninRequired) { mIsSigninRequired = false; } // Switch to agent specific stored data. PersistenceManager.initialize(mTraits.agent.getAgentId()); } } else { if (mTraits == null || mTraits.isError()) { // Will get here if error was received on signIn screen and user pressed 'cancel' there. mIsSigninRequired = true; if (mTraits != null) { mTraits.sessionID = null; mTraits.token = null; } } } break; } case ACTIVITY_ADVANCED_ROUTER_SETTINGS: { String url = data.getStringExtra(CLOUD_CONNECTION_HOST_PREFIX); Boolean useSmartBrowser = data.getBooleanExtra(EXTRAS_SMART_BROWSER_ON, false); if (!CLOUD_CONNECTION_HOST_PREFIX.contentEquals(url) || mUseSmartBrowser != useSmartBrowser) { CLOUD_CONNECTION_HOST_PREFIX = url; CLOUD_BROWSER_URL = CLOUD_CONNECTION_HOST_PREFIX; mUseSmartBrowser = useSmartBrowser; AuthPreferences.storeUseSmartBrowser(mUseSmartBrowser); if (useSmartBrowser) { CLOUD_BROWSER_URL = CLOUD_BROWSER_URL + CLOUD_CONNECTION_HOST_SMARTBROWSER_POSTFIX; } else { CLOUD_BROWSER_URL = CLOUD_BROWSER_URL + CLOUD_CONNECTION_HOST_BROWSER_POSTFIX; } AuthPreferences.storePreferredRouter(url); mStatusButtonView.setImageResource(R.drawable.connection_red); mCustomTabHost.clearAllHistory(); showSignIn(null, false); } Boolean clearCookies = data.getBooleanExtra(EXTRAS_CLEAR_COOKIES_ON, false); if (clearCookies) { CookieManager.getInstance().removeAllCookie(); } break; } case ACTIVITY_BOOKMARKS_AND_HISTORY: { String url = data.getStringExtra(EXTRAS_URL_KEY); if (!TextUtils.isEmpty(url)) { goToUrl(url); } break; } case ACTIVITY_AGENTS: { // Since the agent has changed, we can no longer use the old // history in WebViewClient with the old SessionID. mCustomTabHost.clearAllHistory(); mReloadButtonView.setEnabled(false); ConnectionTraits traits = (ConnectionTraits) data.getSerializableExtra(EXTRAS_TRAITS_KEY); if (traits != null && traits.sessionID != null) { mTraits.sessionID = traits.sessionID; mStatusButtonView.setImageResource(R.drawable.connection_green); // Should never be null if (traits.agent != null) { if (traits.agent.getAgentId() != null) { mTraits.agent.setAgentId(traits.agent.getAgentId()); // Switch to agent specific stored data. PersistenceManager.dropContent(PersistenceManager.ContentType.HISTORY); PersistenceManager.initialize(mTraits.agent.getAgentId()); } if (traits.agent.getDisplayName() != null) { mTraits.agent.setDisplayName(traits.agent.getDisplayName()); } } } break; } case ACTIVITY_CLIENT_STATUS_AND_DIAGNOSTICS: { String browse = data.getStringExtra(EXTRAS_BROWSE_TO_ROUTER_SYSTEM_PAGE_KEY); if (!(browse == null || browse.isEmpty())) mActiveWebView.loadUrl(CLOUD_CONNECTION_HOST_PREFIX + "system"); break; } } } catch (Exception e) { Utility.showAlertDialog(EnterpriseBrowserActivity.class.getSimpleName() + ".onActivityResult(): Failed. " + e.toString(), EnterpriseBrowserActivity.this); } }
From source file:com.igniva.filemanager.activities.MainActivity.java
@Override public void onNewIntent(Intent i) { intent = i;/*from w w w .j a v a 2 s. c om*/ path = i.getStringExtra("path"); if (path != null) { if (new File(path).isDirectory()) { Fragment f = getDFragment(); if ((f.getClass().getName().contains("TabFragment"))) { Main m = ((Main) getFragment().getTab()); m.loadlist(path, false, 0); } else goToMain(path); } else utils.openFile(new File(path), mainActivity); } else if (i.getStringArrayListExtra("failedOps") != null) { ArrayList<BaseFile> failedOps = i.getParcelableArrayListExtra("failedOps"); if (failedOps != null) { mainActivityHelper.showFailedOperationDialog(failedOps, i.getBooleanExtra("move", false), this); } } else if ((openprocesses = i.getBooleanExtra("openprocesses", false))) { android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.content_frame, new ProcessViewer()); // transaction.addToBackStack(null); select = 102; openprocesses = false; //title.setText(utils.getString(con, R.string.process_viewer)); //Commit the transaction transaction.commitAllowingStateLoss(); supportInvalidateOptionsMenu(); } else if (intent.getAction() != null) if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) { // file picker intent mReturnIntent = true; Toast.makeText(this, utils.getString(con, R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(RingtoneManager.ACTION_RINGTONE_PICKER)) { // ringtone picker intent mReturnIntent = true; mRingtonePickerIntent = true; Toast.makeText(this, utils.getString(con, R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { // zip viewer intent Uri uri = intent.getData(); zippath = uri.toString(); openZip(zippath); } }
From source file:com.amaze.filemanager.activities.MainActivity.java
@Override public void onNewIntent(Intent i) { intent = i;//from w ww . j av a 2 s . c o m path = i.getStringExtra("path"); if (path != null) { if (new File(path).isDirectory()) { Fragment f = getDFragment(); if ((f.getClass().getName().contains("TabFragment"))) { Main m = ((Main) getFragment().getTab()); m.loadlist(path, false, 0); } else goToMain(path); } else utils.openFile(new File(path), mainActivity); } else if (i.getStringArrayListExtra("failedOps") != null) { ArrayList<BaseFile> failedOps = i.getParcelableArrayListExtra("failedOps"); if (failedOps != null) { mainActivityHelper.showFailedOperationDialog(failedOps, i.getBooleanExtra("move", false), this); } } else if ((openprocesses = i.getBooleanExtra("openprocesses", false))) { android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.content_frame, new ProcessViewer()); // transaction.addToBackStack(null); select = 102; openprocesses = false; //title.setText(utils.getString(con, R.string.process_viewer)); //Commit the transaction transaction.commitAllowingStateLoss(); supportInvalidateOptionsMenu(); } else if (intent.getAction() != null) if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) { // file picker intent mReturnIntent = true; Toast.makeText(this, utils.getString(con, R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(RingtoneManager.ACTION_RINGTONE_PICKER)) { // ringtone picker intent mReturnIntent = true; mRingtonePickerIntent = true; Toast.makeText(this, utils.getString(con, R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { // zip viewer intent Uri uri = intent.getData(); zippath = uri.toString(); openZip(zippath); } }
From source file:com.koma.music.service.MusicService.java
/** * {@inheritDoc}//from w ww.java2 s. co m */ @Override public int onStartCommand(final Intent intent, final int flags, final int startId) { LogUtils.d(TAG, "Got new intent " + intent + ", startId = " + startId); mServiceStartId = startId; if (intent != null) { final String action = intent.getAction(); if (MusicServiceConstants.SHUTDOWN.equals(action)) { mShutdownScheduled = false; releaseServiceUiAndStop(); return START_NOT_STICKY; } handleCommandIntent(intent); } // Make sure the service will shut down on its own if it was // just started but not bound to and nothing is playing scheduleDelayedShutdown(); if (intent != null && intent.getBooleanExtra(MusicServiceConstants.FROM_MEDIA_BUTTON, false)) { MediaButtonIntentReceiver.completeWakefulIntent(intent); } return START_STICKY; }