本文整理汇总了Java中android.provider.Settings.System类的典型用法代码示例。如果您正苦于以下问题:Java System类的具体用法?Java System怎么用?Java System使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
System类属于android.provider.Settings包,在下文中一共展示了System类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: launchNotificationSoundPicker
import android.provider.Settings.System; //导入依赖的package包/类
private void launchNotificationSoundPicker(int code, String currentPowerRingtonePath) {
final Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE,
getString(R.string.power_notifications_ringtone_title));
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE,
RingtoneManager.TYPE_NOTIFICATION);
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
System.DEFAULT_NOTIFICATION_URI);
if (currentPowerRingtonePath != null &&
!currentPowerRingtonePath.equals(POWER_NOTIFICATIONS_SILENT_URI)) {
Uri uri = Uri.parse(currentPowerRingtonePath);
if (uri != null) {
intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, uri);
}
}
startActivityForResult(intent, code);
}
示例2: y
import android.provider.Settings.System; //导入依赖的package包/类
private static Locale y(Context context) {
Locale locale = null;
try {
Configuration configuration = new Configuration();
configuration.setToDefaults();
System.getConfiguration(context.getContentResolver(), configuration);
if (configuration != null) {
locale = configuration.locale;
}
} catch (Exception e) {
bv.c(a, "fail to read user config locale");
}
if (locale == null) {
return Locale.getDefault();
}
return locale;
}
示例3: getMeizuNaviogationBarHeight
import android.provider.Settings.System; //导入依赖的package包/类
@Nullable
private static int getMeizuNaviogationBarHeight(Context context) {
int dimensionPixelSize;
boolean autoHideSmartBar = true;
boolean z = false;
boolean isMeiZu = Build.MANUFACTURER.equals("Meizu");
if (System.getInt(context.getContentResolver(), "mz_smartbar_auto_hide", z) != 1) {
autoHideSmartBar = z;
}
if (isMeiZu && !autoHideSmartBar) {
try {
Class c = Class.forName("com.android.internal.R$dimen");
dimensionPixelSize = context.getResources().getDimensionPixelSize(
Integer.parseInt(c.getField("mz_action_button_min_height")
.get(c.newInstance()).toString()));
} catch (Throwable th) {
}
}
return dimensionPixelSize;
}
示例4: A
import android.provider.Settings.System; //导入依赖的package包/类
private static Locale A(Context context) {
Locale locale = null;
try {
Configuration configuration = new Configuration();
configuration.setToDefaults();
System.getConfiguration(context.getContentResolver(), configuration);
if (configuration != null) {
locale = configuration.locale;
}
} catch (Exception e) {
bv.c(a, "fail to read user config locale");
}
if (locale == null) {
return Locale.getDefault();
}
return locale;
}
示例5: initSeekBar
import android.provider.Settings.System; //导入依赖的package包/类
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);
}
}
示例6: onCreate
import android.provider.Settings.System; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesName(LauncherFiles.SHARED_PREFERENCES_KEY);
addPreferencesFromResource(R.xml.launcher_preferences);
// Setup allow rotation preference
Preference rotationPref = findPreference(Utilities.ALLOW_ROTATION_PREFERENCE_KEY);
if (getResources().getBoolean(R.bool.allow_rotation)) {
// Launcher supports rotation by default. No need to show this setting.
getPreferenceScreen().removePreference(rotationPref);
} else {
ContentResolver resolver = getActivity().getContentResolver();
mRotationLockObserver = new SystemDisplayRotationLockObserver(rotationPref, resolver);
// Register a content observer to listen for system setting changes while
// this UI is active.
resolver.registerContentObserver(
Settings.System.getUriFor(System.ACCELEROMETER_ROTATION),
false, mRotationLockObserver);
// Initialize the UI once
mRotationLockObserver.onChange(true);
rotationPref.setDefaultValue(Utilities.getAllowRotationDefaultValue(getActivity()));
}
}
示例7: execute
import android.provider.Settings.System; //导入依赖的package包/类
@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if ("getVolume".equals(action)) {
triggerEvent(callbackContext, currentVolume(), false);
return true;
} else if ("setVolumenChangeCallback".equals(action)) {
changedEventCallback = callbackContext;
SettingsContentObserver observer = new SettingsContentObserver(new Handler());
context.getContentResolver().registerContentObserver(System.CONTENT_URI, true, observer);
return true;
}
return false;
}
示例8: toggleRadio
import android.provider.Settings.System; //导入依赖的package包/类
@SuppressLint("InlinedApi")
public void toggleRadio(){
/* If you can change the airplane mode, turn on the airplane mode and let the user know */
if(ChangeAirplaneMode){
System.putLong(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
long isEnabled = System.getLong(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, -1);
Log.v(TAG, "airplane mode now is: "+isEnabled);
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", false);
sendBroadcast(intent);
}
Intent myIntent = new Intent(MainActivity.this, DetectedFemtoActivity.class);
Bundle b = new Bundle();
b.putBoolean("ChangeAirplaneMode", ChangeAirplaneMode);
myIntent.putExtras(b);
startActivity(myIntent);
}
示例9: getUriFor
import android.provider.Settings.System; //导入依赖的package包/类
private static Uri getUriFor(int type, String setting) {
switch(type) {
case TYPE_GLOBAL:
return Global.getUriFor(setting);
case TYPE_SYSTEM:
return System.getUriFor(setting);
}
throw new IllegalArgumentException();
}
示例10: putInt
import android.provider.Settings.System; //导入依赖的package包/类
protected static boolean putInt(int type, ContentResolver cr, String setting, int value) {
switch(type) {
case TYPE_GLOBAL:
return Global.putInt(cr, setting, value);
case TYPE_SYSTEM:
return System.putInt(cr, setting, value);
}
throw new IllegalArgumentException();
}
示例11: getInt
import android.provider.Settings.System; //导入依赖的package包/类
protected static int getInt(int type, ContentResolver cr, String setting, int def) {
switch(type) {
case TYPE_GLOBAL:
return Global.getInt(cr, setting, def);
case TYPE_SYSTEM:
return System.getInt(cr, setting, def);
}
throw new IllegalArgumentException();
}
示例12: onChange
import android.provider.Settings.System; //导入依赖的package包/类
@Override
public void onChange(boolean selfChange) {
boolean enabled = Settings.System.getInt(mResolver,
Settings.System.ACCELEROMETER_ROTATION, 1) == 1;
mRotationPref.setEnabled(enabled);
mRotationPref.setSummary(enabled
? R.string.allow_rotation_desc : R.string.allow_rotation_blocked_desc);
}
示例13: getScreenBrightness
import android.provider.Settings.System; //导入依赖的package包/类
private int getScreenBrightness() {
int screenBrightness = 255;
try {
screenBrightness = System.getInt(this.mActivity.getContentResolver(), "screen_brightness");
} catch (Exception exception) {
exception.printStackTrace();
}
return screenBrightness;
}
示例14: BasePlayController
import android.provider.Settings.System; //导入依赖的package包/类
public BasePlayController(Context context, PlayActivityCallback playCallback) {
if (HotFix.PREVENT_VERIFY) {
System.out.println(VerifyLoad.class);
}
this.mLaunchMode = 0;
this.mLiveBarrageSentCallback = null;
this.currentB = 0;
this.mContext = context;
this.mPlayCallback = playCallback;
}
示例15: getScreenBrightness
import android.provider.Settings.System; //导入依赖的package包/类
private int getScreenBrightness() {
int screenBrightness = 255;
try {
screenBrightness = System.getInt(getActivity().getContentResolver(), "screen_brightness");
} catch (SettingNotFoundException e) {
}
return screenBrightness;
}