List of usage examples for android.provider Settings ACTION_SETTINGS
String ACTION_SETTINGS
To view the source code for android.provider Settings ACTION_SETTINGS.
Click Source Link
From source file:org.bcsphere.activity.BCPage.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.btnManager: mActivity.managerPopupWindow.showAsDropDown(view, 0, 0); TranslateAnimation animation = new TranslateAnimation(0, 0, 0, (float) (getScreenHeight(mActivity) * (430.0 / 1920.0))); animation.setDuration(200);//w ww . j a v a 2 s.c om animation.setFillAfter(true); parentView.startAnimation(animation); break; case R.id.btnMenu: if (menuPopupWindow == null) { menuPopupWindow = new MenuPopupWindow(mActivity); } if (menuPopupWindow.isShowing()) { menuPopupWindow.dismiss(); return; } menuPopupWindow.showAsDropDown(btnMenu, 0, 20); break; case R.id.btnBack: mWebView.goBack(); break; case R.id.btnClose: Intent intent = new Intent(); intent.setAction("removeApp"); intent.putExtra("removeAppURL", PageManager.getCurrentPager().url); mActivity.sendBroadcast(intent); PageManager.setDeleteUrl(PageManager.getCurrentPager().url); break; case R.id.hintOpenBluetooth: startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS)); break; case R.id.hintOpenNetwork: startActivity(new Intent(Settings.ACTION_SETTINGS)); break; } }
From source file:co.lemonlabs.android.slidingdebugmenu.SlidingDebugMenu.java
@SuppressWarnings("ConstantConditions") @Override/*from w w w. j av a 2s . co m*/ public void onClick(View v) { final int id = v.getId(); Context context = getContext(); if (id == R.id.sdm__settings_developer) { // open dev settings Intent devIntent = new Intent(Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS); ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(devIntent, 0); if (resolveInfo != null) context.startActivity(devIntent); else Toast.makeText(context, "Developer settings not available on device", Toast.LENGTH_SHORT).show(); } else if (id == R.id.sdm__settings_battery) { // try to find an app to handle battery settings Intent batteryIntent = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY); ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(batteryIntent, 0); if (resolveInfo != null) context.startActivity(batteryIntent); else Toast.makeText(context, "No app found to handle power usage intent", Toast.LENGTH_SHORT).show(); } else if (id == R.id.sdm__settings_drawer) { // open android settings context.startActivity(new Intent(Settings.ACTION_SETTINGS)); } else if (id == R.id.sdm__settings_app_info) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.parse("package:" + context.getPackageName())); context.startActivity(intent); } else if (id == R.id.sdm__settings_uninstall) { // open dialog to uninstall app Uri packageURI = Uri.parse("package:" + context.getPackageName()); Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI); context.startActivity(uninstallIntent); } }
From source file:com.android.settingslib.drawer.SettingsDrawerActivity.java
/** * xinsi//from w ww .j av a 2 s.c om * Tile */ public boolean openTile(Tile tile) { closeDrawer(); if (tile == null) { startActivity(new Intent(Settings.ACTION_SETTINGS).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)); return true; } try { updateUserHandlesIfNeeded(tile); int numUserHandles = tile.userHandle.size(); if (numUserHandles > 1) { ProfileSelectDialog.show(getFragmentManager(), tile); return false; } else if (numUserHandles == 1) { // Show menu on top level items. tile.intent.putExtra(EXTRA_SHOW_MENU, true); tile.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivityAsUser(tile.intent, tile.userHandle.get(0)); } else { // Show menu on top level items. tile.intent.putExtra(EXTRA_SHOW_MENU, true); tile.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(tile.intent); } } catch (ActivityNotFoundException e) { Log.w(TAG, "Couldn't find tile " + tile.intent, e); } return true; }
From source file:io.github.marktony.espresso.mvp.addpackage.AddPackageFragment.java
/** * Show message that the network is in error. *//*from w ww . j a va 2 s. com*/ @Override public void showNetworkError() { Snackbar.make(fab, R.string.network_error, Snackbar.LENGTH_SHORT) .setAction(R.string.go_to_settings, new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent().setAction(Settings.ACTION_SETTINGS)); } }).show(); }
From source file:org.openmrs.mobile.activities.dialog.CustomFragmentDialog.java
private View.OnClickListener onClickActionSolver(final OnClickAction action) { return new View.OnClickListener() { //CHECKSTYLE:OFF @Override//from w w w . j av a 2s . c o m public void onClick(View v) { switch (action) { case DISMISS_URL_DIALOG: ((LoginFragment) getActivity().getSupportFragmentManager() .findFragmentById(R.id.loginContentFrame)).hideURLDialog(); dismiss(); break; case LOGIN: ((LoginFragment) getActivity().getSupportFragmentManager() .findFragmentById(R.id.loginContentFrame)).login(true); dismiss(); break; case DISMISS: dismiss(); break; case LOGOUT: ((ACBaseActivity) getActivity()).logout(); dismiss(); break; case FINISH: getActivity().moveTaskToBack(true); android.os.Process.killProcess(android.os.Process.myPid()); System.exit(1); break; case INTERNET: getActivity().startActivity(new Intent(Settings.ACTION_SETTINGS)); dismiss(); break; case UNAUTHORIZED: ((ACBaseActivity) getActivity()).moveUnauthorizedUserToLoginScreen(); dismiss(); break; case END_VISIT: ((VisitDashboardActivity) getActivity()).mPresenter.endVisit(); dismiss(); break; case START_VISIT: doStartVisitAction(); dismiss(); break; case REGISTER_PATIENT: ((AddEditPatientActivity) getActivity()).mPresenter.registerPatient(); dismiss(); break; case CANCEL_REGISTERING: ((AddEditPatientActivity) getActivity()).mPresenter.finishPatientInfoActivity(); dismiss(); break; case DELETE_PATIENT: PatientDashboardActivity activity = (PatientDashboardActivity) getActivity(); activity.mPresenter.deletePatient(); dismiss(); activity.finish(); break; default: break; } } //CHECKSTYLE:ON }; }
From source file:com.jungle.base.utils.MiscUtils.java
public static void openNetworkSetting(Context context) { Intent intent = null;//w w w . j ava 2s. co m if (VersionUtils.getSystemVersion() > Build.VERSION_CODES.HONEYCOMB_MR2) { intent = new Intent(Settings.ACTION_WIFI_SETTINGS); } else { intent = new Intent(Settings.ACTION_SETTINGS); } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:carsharing.starter.automotive.iot.ibm.com.mobilestarterapp.AnalyzeMyDriving.java
private void getAccurateLocation(final GoogleMap googleMap) { final FragmentActivity activity = getActivity(); if (activity == null) { Log.e("getAccurateLocation", "do nothing as getActivity()==null"); if (locationManager != null) { requestLocationUpdates(false); }/*from w w w .ja va2s.c om*/ return; } final ConnectivityManager connectivityManager = (ConnectivityManager) activity .getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); final boolean gpsEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); final boolean networkConnected = networkInfo != null && networkInfo.isConnected(); if (gpsEnabled && networkConnected) { if (!checkCurrentLocation()) { Log.e("Location Data", "Not Working!"); // Toast.makeText(getActivity().getApplicationContext(), "Please activate your location settings and restart the application!", Toast.LENGTH_LONG).show(); getAccurateLocation(mMap); return; } if (mMap != null) { float zoom = mMap.getCameraPosition().zoom; zoom = Math.max(14, zoom); zoom = Math.min(18, zoom); mMap.clear(); final LatLng newLocation = new LatLng(location.getLatitude(), location.getLongitude()); // if (!cameraSet) { mMap.moveCamera(CameraUpdateFactory.newLatLng(newLocation)); mMap.animateCamera(CameraUpdateFactory.zoomTo(zoom), 2000, null); // cameraSet = true; // } mMap.addMarker(new MarkerOptions().position(newLocation).title("Your Location") .icon(BitmapDescriptorFactory.fromResource(R.drawable.models))); } final ActionBar supportActionBar = ((AppCompatActivity) activity).getSupportActionBar(); if (startedDriving) { if (!behaviorDemo) { // get credentials may be failed startedDriving = false; completeReservation(reservationId[0], false); return; } speedMessage = "" + Math.round(location.getSpeed() * 60 * 60 / 16.0934) / 100.0 + " MPH"; supportActionBar.setTitle(speedMessage + " - Data not sent"); tripCount += 1; if (tripCount % 10 == 0) { // renderMapMatchedLocation() } } else if (deviceClient != null) { supportActionBar.setTitle("Press Start Driving when ready."); } if (behaviorDemo) { API.runInAsyncUIThread(new Runnable() { @Override public void run() { if (deviceClient == null && needCredentials) { createDeviceClient(); connectDeviceClient(); } if (userUnlocked) { sendLocation(location); } } }, activity); } } else { if (!gpsEnabled) { Toast.makeText(activity.getApplicationContext(), "Please turn on your GPS", Toast.LENGTH_LONG) .show(); final Intent gpsIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivityForResult(gpsIntent, GPS_INTENT); if (!networkConnected) { networkIntentNeeded = true; } } else if (!networkConnected) { Toast.makeText(activity.getApplicationContext(), "Please turn on Mobile Data or WIFI", Toast.LENGTH_LONG).show(); final Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS); startActivityForResult(settingsIntent, SETTINGS_INTENT); } } }
From source file:com.bionx.res.DashMainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.settings: @SuppressWarnings("unused") final Context context = this; Intent settings_menu = new Intent(Settings.ACTION_SETTINGS); startActivity(settings_menu);//from w w w . jav a2 s . c o m return true; case R.id.info: new AlertDialog.Builder(this).setTitle(R.string.info) .setMessage(Html.fromHtml(getString(R.string.info_msg))).show(); return true; case R.id.preference: @SuppressWarnings("unused") final Context context1 = this; Intent preference = new Intent(getBaseContext(), Preferences.class); startActivity(preference); return true; case R.id.exit: Toast.makeText(getApplicationContext(), "Bionx FTW!", Toast.LENGTH_SHORT).show(); DashMainActivity.this.finish(); } return false; }
From source file:com.tml.sharethem.sender.SHAREthemActivity.java
public void showDataWarningDialog() { if (isFinishing()) return;/*from www . j a va2 s. c o m*/ final AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.AppCompatAlertDialogStyle); builder.setCancelable(false); builder.setMessage(getString(R.string.sender_data_on_warning)); builder.setPositiveButton(getString(R.string.label_settings), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { startActivity(new Intent(Settings.ACTION_SETTINGS)); } }); builder.setNegativeButton(getString(R.string.label_thats_ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { changeApControlCheckedStatus(true); enableAp(); } }); builder.setNeutralButton(getString(R.string.label_dont_ask), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { SharedPreferences prefs = getSharedPreferences(getPackageName(), Context.MODE_PRIVATE); prefs.edit().putBoolean(PREFERENCES_KEY_DATA_WARNING_SKIP, true).apply(); changeApControlCheckedStatus(true); enableAp(); } }); builder.show(); }
From source file:carsharing.starter.automotive.iot.ibm.com.mobilestarterapp.Home.CarBrowse.java
private void getAccurateLocation2(final GoogleMap googleMap) { final FragmentActivity activity = getActivity(); if (activity == null) { return;/*from w ww. ja v a 2s. c om*/ } final ConnectivityManager connectivityManager = (ConnectivityManager) activity .getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER) && (networkInfo != null && networkInfo.isConnected())) { if (simulatedLocation == null) { if (ActivityCompat.checkSelfPermission(activity.getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(activity.getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { return; } locationManager = (LocationManager) activity.getApplicationContext() .getSystemService(Context.LOCATION_SERVICE); final List<String> providers = locationManager.getProviders(true); Location finalLocation = null; for (String provider : providers) { if (ActivityCompat.checkSelfPermission(activity.getApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(activity.getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { return; } final Location suggestedLocation = locationManager.getLastKnownLocation(provider); if (suggestedLocation == null) { continue; } Log.i("Location Provider", "provider=" + suggestedLocation.getProvider() + " time=" + new SimpleDateFormat("yyyy MMM dd HH:mm:ss") .format(suggestedLocation.getTime()) + " accuracy=" + suggestedLocation.getAccuracy() + " lat=" + suggestedLocation.getLatitude() + " lng=" + suggestedLocation.getLongitude()); if (finalLocation == null) { finalLocation = suggestedLocation; } else if (suggestedLocation.getTime() - finalLocation.getTime() > 1000) { // drop more than 1000ms old data finalLocation = suggestedLocation; } else if (suggestedLocation.getAccuracy() < finalLocation.getAccuracy()) { // picks more acculate one finalLocation = suggestedLocation; } } location = finalLocation; } else { location = simulatedLocation; } if (location != null) { final LatLng userLocation = new LatLng(location.getLatitude(), location.getLongitude()); mMap.addMarker(new MarkerOptions().position(userLocation).title("Your Location")); mMap.moveCamera(CameraUpdateFactory.newLatLng(userLocation)); mMap.animateCamera(CameraUpdateFactory.zoomTo(14), 2000, null); getCars(location); } else { Log.e("Location Data", "Not Working!"); // Toast.makeText(getActivity().getApplicationContext(), "Please activate your location settings and restart the application!", Toast.LENGTH_LONG).show(); getAccurateLocation(mMap); } } else { if (!locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { Toast.makeText(activity.getApplicationContext(), "Please turn on your GPS", Toast.LENGTH_LONG) .show(); final Intent gpsIntent = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivityForResult(gpsIntent, GPS_INTENT); if (networkInfo == null) { networkIntentNeeded = true; } } else { if (networkInfo == null) { Toast.makeText(activity.getApplicationContext(), "Please turn on Mobile Data or WIFI", Toast.LENGTH_LONG).show(); final Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS); startActivityForResult(settingsIntent, SETTINGS_INTENT); } } } }