Java Code Examples for android.provider.Settings

The following examples show how to use android.provider.Settings. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: FaceSlim   Source File: MyApplication.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get Piwik tracker. No sensitive data is collected. Just app version, predicted location,
 * resolution, device model and system version. Location is based on anonymized IP address.
 * @return tracker instance
 */
public synchronized Tracker getTracker() {
    if (mPiwikTracker != null)
        return mPiwikTracker;

    try {
        mPiwikTracker = Piwik.getInstance(this).newTracker("http://indywidualni.org/analytics/piwik.php", 1);
        mPiwikTracker.setUserId(Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID));
        mPiwikTracker.setDispatchTimeout(30000);
        mPiwikTracker.setDispatchInterval(-1);
    } catch (MalformedURLException e) {
        Log.w("Piwik", "url is malformed", e);
        return null;
    }

    return mPiwikTracker;
}
 
Example 2
@Override
public void onChange(boolean selfChange) {
    super.onChange(selfChange);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && mApplication != null && mApplication.getContentResolver() != null
            && mListeners != null && !mListeners.isEmpty()) {
        int show = 0;
        if (OSUtils.isMIUI()) {
            show = Settings.Global.getInt(mApplication.getContentResolver(), IMMERSION_MIUI_NAVIGATION_BAR_HIDE_SHOW, 0);
        } else if (OSUtils.isEMUI()) {
            if (OSUtils.isEMUI3_x() || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
                show = Settings.System.getInt(mApplication.getContentResolver(), IMMERSION_EMUI_NAVIGATION_BAR_HIDE_SHOW, 0);
            } else {
                show = Settings.Global.getInt(mApplication.getContentResolver(), IMMERSION_EMUI_NAVIGATION_BAR_HIDE_SHOW, 0);
            }
        }
        for (OnNavigationBarListener onNavigationBarListener : mListeners) {
            onNavigationBarListener.onNavigationBarChange(show != 1);
        }
    }
}
 
Example 3
Source Project: android_9.0.0_r45   Source File: StorageManagerService.java    License: Apache License 2.0 6 votes vote down vote up
private void handleSystemReady() {
    initIfReadyAndConnected();
    resetIfReadyAndConnected();

    // Start scheduling nominally-daily fstrim operations
    MountServiceIdler.scheduleIdlePass(mContext);

    // Toggle zram-enable system property in response to settings
    mContext.getContentResolver().registerContentObserver(
        Settings.Global.getUriFor(Settings.Global.ZRAM_ENABLED),
        false /*notifyForDescendants*/,
        new ContentObserver(null /* current thread */) {
            @Override
            public void onChange(boolean selfChange) {
                refreshZramSettings();
            }
        });
    refreshZramSettings();
}
 
Example 4
/**
 * Updates the message ringtone for a specific recipient. If that recipient has no channel, this
 * does nothing.
 *
 * This has to update the database, and therefore should be run on a background thread.
 */
@WorkerThread
public static synchronized void updateMessageRingtone(@NonNull Context context, @NonNull Recipient recipient, @Nullable Uri uri) {
  if (!supported() || recipient.getNotificationChannel() == null) {
    return;
  }
  Log.i(TAG, "Updating recipient message ringtone with URI: " + String.valueOf(uri));

  String  newChannelId = generateChannelIdFor(recipient);
  boolean success      = updateExistingChannel(ServiceUtil.getNotificationManager(context),
                                               recipient.getNotificationChannel(),
                                               generateChannelIdFor(recipient),
                                               channel -> channel.setSound(uri == null ? Settings.System.DEFAULT_NOTIFICATION_URI : uri, getRingtoneAudioAttributes()));

  DatabaseFactory.getRecipientDatabase(context).setNotificationChannel(recipient.getId(), success ? newChannelId : null);
  ensureCustomChannelConsistency(context);
}
 
Example 5
Source Project: android-common   Source File: PackageUtil.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 打开已安装应用的详情
 */
public static void goToInstalledAppDetails(Context context, String packageName) {
    Intent intent = new Intent();
    int sdkVersion = Build.VERSION.SDK_INT;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.fromParts("package", packageName, null));
    } else {
        intent.setAction(Intent.ACTION_VIEW);
        intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
        intent.putExtra((sdkVersion == Build.VERSION_CODES.FROYO ? "pkg"
                : "com.android.settings.ApplicationPkgName"), packageName);
    }
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
}
 
Example 6
Source Project: GravityBox   Source File: VolumePreference.java    License: Apache License 2.0 6 votes vote down vote up
private void initSeekBar(SeekBar seekBar, Uri defaultUri) {
    seekBar.setMax(mAudioManager.getStreamMaxVolume(mStreamType));
    mOriginalStreamVolume = mAudioManager.getStreamVolume(mStreamType);
    seekBar.setProgress(mOriginalStreamVolume);
    seekBar.setOnSeekBarChangeListener(this);
    // TODO: removed in MM, find different approach
    mContext.getContentResolver().registerContentObserver(
            System.getUriFor("volume_ring"),
            false, mVolumeObserver);
    if (defaultUri == null) {
        if (mStreamType == AudioManager.STREAM_RING) {
            defaultUri = Settings.System.DEFAULT_RINGTONE_URI;
        } else if (mStreamType == AudioManager.STREAM_NOTIFICATION) {
            defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
        } else {
            defaultUri = Settings.System.DEFAULT_ALARM_ALERT_URI;
        }
    }
    mRingtone = RingtoneManager.getRingtone(mContext, defaultUri);
    if (mRingtone != null) {
        mRingtone.setStreamType(mStreamType);
    }
}
 
Example 7
Source Project: kcanotify   Source File: Rule.java    License: GNU General Public License v3.0 6 votes vote down vote up
private static Intent getIntentDatasaver(String packageName, Context context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
        synchronized (context.getApplicationContext()) {
            if (!cacheIntentDatasaver.containsKey(packageName)) {
                Intent intent = new Intent(
                        Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS,
                        Uri.parse("package:" + packageName));
                if (intent.resolveActivity(context.getPackageManager()) == null)
                    intent = null;
                cacheIntentDatasaver.put(packageName, intent);
            }
            return cacheIntentDatasaver.get(packageName);
        }
    else
        return null;
}
 
Example 8
Source Project: BS-Weather   Source File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 显示对话框
 */
public void showDialog(String title, String info, final int SIGN){
    final AlertDialog.Builder alertDialog  = new AlertDialog.Builder(MainActivity.this);
    alertDialog.setMessage(info);
    alertDialog.setCancelable(false);
    alertDialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (SIGN == SIGN_NO_INTERNET){
                Intent intent = new Intent(Settings.ACTION_SETTINGS);
                startActivity(intent);
                TaskKiller.dropAllAcitivty();
            }

            if (SIGN == SIGN_ALARMS){
                alertDialog.setCancelable(true);
            }

        }
    });
    alertDialog.show();
}
 
Example 9
private void initMoveManager() {
    if (Build.VERSION.SDK_INT < 23) {
        if (Settings.Secure.getInt(this.getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION, 0) == 0) {
            simulateLocationPermission();
        }
    }
    random = new Random();
    try {
        locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
        locationManager.addTestProvider(LocationManager.GPS_PROVIDER, false,
                true, false, false, true,
                true, true, 0, 5);
        locationManager.setTestProviderEnabled(LocationManager.GPS_PROVIDER, true);
    } catch (SecurityException e) {
        simulateLocationPermission();
    }
}
 
Example 10
Source Project: MyHearts   Source File: Device.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressLint("NewApi")
public static String getIdentifiers(Context ctx) {
  StringBuilder sb = new StringBuilder();
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO)
  	sb.append(getPair("serial", Build.SERIAL));
  else
  	sb.append(getPair("serial", "No Serial"));
  sb.append(getPair("android_id", Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID)));
  TelephonyManager tel = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
  sb.append(getPair("sim_country_iso", tel.getSimCountryIso()));
  sb.append(getPair("network_operator_name", tel.getNetworkOperatorName()));
  sb.append(getPair("unique_id", Crypto.md5(sb.toString())));
  ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
  sb.append(getPair("network_type", cm.getActiveNetworkInfo() == null ? "-1" : String.valueOf(cm.getActiveNetworkInfo().getType())));
  return sb.toString();
}
 
Example 11
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    myEditText = (EditText)findViewById(R.id.editText);
    peerEditText = (EditText)findViewById(R.id.editText2);


    String androidID = Settings.Secure.getString(this.getContentResolver(),
            Settings.Secure.ANDROID_ID);

    //app可以单独部署服务器,给予第三方应用更多的灵活性
    //在开发阶段也可以配置成测试环境的地址 "sandbox.voipnode.gobelieve.io", "sandbox.imnode.gobelieve.io"
    String sdkHost = "imnode2.gobelieve.io";
    IMService.getInstance().setHost(sdkHost);
    IMService.getInstance().setIsSync(false);
    IMService.getInstance().registerConnectivityChangeReceiver(getApplicationContext());
    IMService.getInstance().setDeviceID(androidID);
}
 
Example 12
Source Project: PermissMe   Source File: PermissMeUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * The onClickListener that takes you to the app's system settings screen
 *
 * @param activity
 * 		the caller activity used to start the settings intent
 * @return the {@link View.OnClickListener}
 */
public static View.OnClickListener createSettingsClickListener(final Activity activity) {
	return new View.OnClickListener() {
		@Override
		public void onClick(final View v) {
			final Intent intent = new Intent();
			intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
			intent.addCategory(Intent.CATEGORY_DEFAULT);
			intent.setData(Uri.parse("package:" + activity.getPackageName()));
			intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
			intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
			intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
			activity.startActivity(intent);
		}
	};
}
 
Example 13
Source Project: music_player   Source File: MainActivity.java    License: Open Software License 3.0 6 votes vote down vote up
private void setAsRingtone(final Activity context, int position) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.System.canWrite(context)) {
            Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS, Uri.parse("package:" + context.getPackageName()));
            context.startActivity(intent);
        } else {
            File music = new File(MyApplication.getMusicListNow().get(position).getMusicData()); // path is a file to /sdcard/media/ringtone
            ContentValues values = new ContentValues();
            values.put(MediaStore.MediaColumns.DATA, music.getAbsolutePath());
            values.put(MediaStore.MediaColumns.TITLE, MyApplication.getMusicListNow().get(position).getMusicTitle());
            values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mp3");
            values.put(MediaStore.Audio.Media.ARTIST, MyApplication.getMusicListNow().get(position).getMusicArtist());
            values.put(MediaStore.Audio.Media.IS_RINGTONE, true);
            values.put(MediaStore.Audio.Media.IS_NOTIFICATION, false);
            values.put(MediaStore.Audio.Media.IS_ALARM, false);
            values.put(MediaStore.Audio.Media.IS_MUSIC, false);
            //Insert it into the database
            Uri uri = MediaStore.Audio.Media.getContentUriForPath(music.getAbsolutePath());
            context.getContentResolver().delete(uri, MediaStore.MediaColumns.DATA + "=\"" + music.getAbsolutePath() + "\"", null);
            Uri newUri = context.getContentResolver().insert(uri, values);
            RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE, newUri);
            Toast.makeText(context, "已成功设置为来电铃声", Toast.LENGTH_SHORT).show();
            //Snackbar
//            Snackbar.make(mLayout, "已成功设置为来电铃声", Snackbar.LENGTH_LONG).show();
        }
    }
 
Example 14
Source Project: vinci   Source File: VinciActivityDelegate.java    License: Apache License 2.0 6 votes vote down vote up
protected void onCreate(Bundle savedInstanceState) {
    boolean needsOverlayPermission = false;
    if (getReactNativeHost().getUseDeveloperSupport() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        // Get permission to show redbox in dev builds.
        if (!Settings.canDrawOverlays(getContext())) {
            needsOverlayPermission = true;
            Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + getContext().getPackageName()));
            FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE);
            Toast.makeText(getContext(), REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show();
            ((Activity) getContext()).startActivityForResult(serviceIntent, REQUEST_OVERLAY_PERMISSION_CODE);
        }
    }

    if (mMainComponentName != null && !needsOverlayPermission) {
        loadApp(mMainComponentName);
    }
    mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
}
 
Example 15
Source Project: GravityBox   Source File: BatteryStyleController.java    License: Apache License 2.0 6 votes vote down vote up
private void initPreferences(XSharedPreferences prefs) {
    mPrefs = prefs;
    mBatteryStyle = Integer.valueOf(prefs.getString(
            GravityBoxSettings.PREF_KEY_BATTERY_STYLE, "1"));
    mBatteryPercentTextEnabledSb = prefs.getBoolean(
            GravityBoxSettings.PREF_KEY_BATTERY_PERCENT_TEXT_STATUSBAR, false);
    mBatteryPercentTextHeaderHide = prefs.getBoolean(
            GravityBoxSettings.PREF_KEY_BATTERY_PERCENT_TEXT_HEADER_HIDE, false);
    mBatteryPercentTextKgMode = KeyguardMode.valueOf(prefs.getString(
            GravityBoxSettings.PREF_KEY_BATTERY_PERCENT_TEXT_KEYGUARD, "DEFAULT"));
    mMtkPercentTextEnabled = Utils.isMtkDevice() ?
            Settings.Secure.getInt(mContext.getContentResolver(),
                    SETTING_MTK_BATTERY_PERCENTAGE, 0) == 1 : false;
    mBatterySaverIndicationDisabled = prefs.getBoolean(
            GravityBoxSettings.PREF_KEY_BATTERY_SAVER_INDICATION_DISABLE, false);
}
 
Example 16
Source Project: oversec   Source File: OnboardingActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Ln.d("yeah, onResume "+ Settings.canDrawOverlays(this));
    }
}
 
Example 17
Source Project: PermissionX   Source File: PermissionBuilder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Go to your app's Settings page to let user turn on the necessary permissions.
 *
 * @param permissions Permissions which are necessary.
 */
private void forwardToSettings(List<String> permissions) {
    forwardPermissions.clear();
    forwardPermissions.addAll(permissions);
    Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
    Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
    intent.setData(uri);
    getInvisibleFragment().startActivityForResult(intent, InvisibleFragment.FORWARD_TO_SETTINGS);
}
 
Example 18
/**
 * Stops inconsistent failed test from happening in Landscape Wizard
 */
@Override IdsRepository provideIdsRepository(SharedPreferences defaultSharedPreferences,
    ContentResolver contentResolver) {
  return new IdsRepository(
      SecurePreferencesImplementation.getInstance(application.getApplicationContext(),
          defaultSharedPreferences), application,
      Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)) {
    @Override @WorkerThread public synchronized String getGoogleAdvertisingId() {
      return defaultSharedPreferences.getString("googleAdvertisingId", null);
    }
  };
}
 
Example 19
Source Project: Noyze   Source File: HeadsUpVolumePanel.java    License: Apache License 2.0 5 votes vote down vote up
void openMusic() {
    hide();
    if (hasAlbumArt) {
        launchMusicApp();
    } else {
        Intent volumeSettings = new Intent(Settings.ACTION_SOUND_SETTINGS);
        startActivity(volumeSettings);
    }
}
 
Example 20
Source Project: Fairy   Source File: ItemActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void requestPermission() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (!Settings.canDrawOverlays(this)) {
            Toast.makeText(this, getResources().getString(R.string.grand_window_permission), Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse(String.format("package:%s", getPackageName())));
            startActivityForResult(intent, PERMISSION_RESULT_CODE);
        }
    }
}
 
Example 21
Source Project: Noyze   Source File: VolumePanel.java    License: Apache License 2.0 5 votes vote down vote up
/** @return The default {@link android.content.Intent#ACTION_MEDIA_BUTTON} receiver, or null. */
public ComponentName getMediaButtonReceiver() {
    String receiverName = Settings.System.getString(
            getContext().getContentResolver(), Constants.getMediaButtonReceiver());
    if ((null != receiverName) && !receiverName.isEmpty())
        return ComponentName.unflattenFromString(receiverName);
    return null;
}
 
Example 22
Source Project: android_9.0.0_r45   Source File: Sandman.java    License: Apache License 2.0 5 votes vote down vote up
private static boolean isScreenSaverActivatedOnDock(Context context) {
    int def = context.getResources().getBoolean(
            com.android.internal.R.bool.config_dreamsActivatedOnDockByDefault) ? 1 : 0;
    return Settings.Secure.getIntForUser(context.getContentResolver(),
            Settings.Secure.SCREENSAVER_ACTIVATE_ON_DOCK, def,
            UserHandle.USER_CURRENT) != 0;
}
 
Example 23
Source Project: LiveBlurListView   Source File: Utilities.java    License: Apache License 2.0 5 votes vote down vote up
public static boolean isAutoBrightness(ContentResolver aContentResolver) {
    boolean automicBrightness = false;
    try {
        automicBrightness = Settings.System.getInt(aContentResolver,
                Settings.System.SCREEN_BRIGHTNESS_MODE) == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
    } catch (SettingNotFoundException e) {
        e.printStackTrace();
    }
    return automicBrightness;
}
 
Example 24
private void showFilter() {
    if (Build.VERSION.SDK_INT > 22) {
        if (Settings.canDrawOverlays(this)) {
            windowManager.addView(filterView, filterLayoutParams);
        }
    }
    //showPets();
}
 
Example 25
public static boolean checkAccessibility() {
    int accessibilityEnabled = 0;
    final String service = context.getPackageName() + "/" + NavAccessibilityService.class.getCanonicalName();
    boolean accessibilityFound = false;
    try {
        accessibilityEnabled = Settings.Secure.getInt(
                context.getApplicationContext().getContentResolver(),
                android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
    } catch (Settings.SettingNotFoundException e) {
        Log.e("ACBU","Error finding setting, default accessibility to not found: "
                + e.getMessage());
    }

    TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');

    if (accessibilityEnabled == 1) {
        String settingValue = Settings.Secure.getString(
                context.getApplicationContext().getContentResolver(),
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
        if (settingValue != null) {
            TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
            splitter.setString(settingValue);
            while (splitter.hasNext()) {
                String accessabilityService = splitter.next();

                if (accessabilityService.equalsIgnoreCase(service)) {
                    return true;
                }
            }
        }
    } else {
        Log.i("ACBU","***ACCESSIBILIY IS DISABLED***");
    }

    return accessibilityFound;
}
 
Example 26
Source Project: journaldev   Source File: MainActivity.java    License: MIT License 5 votes vote down vote up
private void askForSystemOverlayPermission() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(this)) {

        //If the draw over permission is not available open the settings screen
        //to grant the permission.
        Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
                Uri.parse("package:" + getPackageName()));
        startActivityForResult(intent, DRAW_OVER_OTHER_APP_PERMISSION);
    }
}
 
Example 27
Source Project: Android-skin-support   Source File: WindowManagerActivity.java    License: MIT License 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == 10) {
        if (Settings.canDrawOverlays(this)) {
            startWindowService();
        } else {
            Toast.makeText(WindowManagerActivity.this, "not granted", Toast.LENGTH_SHORT).show();
        }
    }
}
 
Example 28
Source Project: MifareClassicTool   Source File: MainMenu.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create a dialog that send user to NFC settings if NFC is off.
 * Alternatively the user can chose to use the App in editor only
 * mode or exit the App.
 * @return The created alert dialog.
 * @see #runSartUpNode(StartUpNode)
 */
private AlertDialog createNfcEnableDialog() {
    return new AlertDialog.Builder(this)
            .setTitle(R.string.dialog_nfc_not_enabled_title)
            .setMessage(R.string.dialog_nfc_not_enabled)
            .setIcon(android.R.drawable.ic_dialog_info)
            .setPositiveButton(R.string.action_nfc,
                    (dialog, which) -> {
                        // Goto NFC Settings.
                        if (Build.VERSION.SDK_INT >= 16) {
                            startActivity(new Intent(
                                    Settings.ACTION_NFC_SETTINGS));
                        } else {
                            startActivity(new Intent(
                                    Settings.ACTION_WIRELESS_SETTINGS));
                        }
                    })
            .setNeutralButton(R.string.action_editor_only,
                    (dialog, which) -> {
                        // Only use Editor.
                        useAsEditorOnly(true);
                        runSartUpNode(StartUpNode.DonateDialog);
                    })
            .setNegativeButton(R.string.action_exit_app,
                    (dialog, id) -> {
                        // Exit the App.
                        finish();
                    })
            .setOnCancelListener(
                    dialog -> finish())
            .create();
}
 
Example 29
private boolean areSystemAnimationsEnabled()
{
	float duration = Settings.Global.getFloat(
			getContentResolver(),
			Settings.Global.ANIMATOR_DURATION_SCALE, 1);
	float transition = Settings.Global.getFloat(
			getContentResolver(),
			Settings.Global.TRANSITION_ANIMATION_SCALE, 1);
	return duration != 0 && transition != 0;
}
 
Example 30
Source Project: MiPushFramework   Source File: XmsfApp.java    License: GNU General Public License v3.0 5 votes vote down vote up
private HashSet<ComponentName> loadEnabledServices() {
    HashSet<ComponentName> hashSet = new HashSet<>();
    String string = Settings.Secure.getString(getContentResolver()
            , "enabled_notification_listeners");
    if (!(string == null || "".equals(string))) {
        String[] split = string.split(":");
        for (String unflattenFromString : split) {
            ComponentName unflattenFromString2 = ComponentName.unflattenFromString(unflattenFromString);
            if (unflattenFromString2 != null) {
                hashSet.add(unflattenFromString2);
            }
        }
    }
    return hashSet;
}