本文整理汇总了Java中android.provider.Settings.System.putInt方法的典型用法代码示例。如果您正苦于以下问题:Java System.putInt方法的具体用法?Java System.putInt怎么用?Java System.putInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.provider.Settings.System
的用法示例。
在下文中一共展示了System.putInt方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: setAutoBrightness
import android.provider.Settings.System; //导入方法依赖的package包/类
private void setAutoBrightness(boolean value) {
if (value) {
System.putInt(this.mContext.getContentResolver(), "screen_brightness_mode", 1);
} else {
System.putInt(this.mContext.getContentResolver(), "screen_brightness_mode", 0);
}
}
示例3: changeScreenBrightness
import android.provider.Settings.System; //导入方法依赖的package包/类
public void changeScreenBrightness(float brightness)
{
//system setting brightness values ranges between 0 - 255
//We scale up by multiplying by 255
//This change the brightness for over all system settings
System.putInt(mContentResolver, System.SCREEN_BRIGHTNESS, (int) (brightness*255));
//screen brightness values ranges between 0 - 1
//This only changes the brightness for the current window
LayoutParams mLayoutParams = mWindow.getAttributes();
mLayoutParams.screenBrightness = brightness;
mWindow.setAttributes(mLayoutParams);
}
开发者ID:PacktPublishing,项目名称:Android-Sensor-Programming-By-Example,代码行数:13,代码来源:LightSensorActivity.java
示例4: setLightness
import android.provider.Settings.System; //导入方法依赖的package包/类
public static void setLightness(Activity act, int value) {
try {
System.putInt(act.getContentResolver(), System.SCREEN_BRIGHTNESS, value);
WindowManager.LayoutParams lp = act.getWindow().getAttributes();
lp.screenBrightness = (value <= 0 ? 1 : value) / 255f;
act.getWindow().setAttributes(lp);
} catch (Exception e) {
Toast.makeText(act, "Error set lightness", Toast.LENGTH_SHORT).show();
}
}
示例5: setLightness
import android.provider.Settings.System; //导入方法依赖的package包/类
/**
* @param context
* @param value
*/
public void setLightness(Activity act, int value) {
System.putInt(act.getContentResolver(), System.SCREEN_BRIGHTNESS, value);
try {
WindowManager.LayoutParams lp = act.getWindow().getAttributes();
lp.screenBrightness = (value < 0 ? 1 : value) / 255f;
act.getWindow().setAttributes(lp);
//saveBrightness(act,value);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
示例6: setBrightnessLevel
import android.provider.Settings.System; //导入方法依赖的package包/类
private void setBrightnessLevel(int brightness) {
System.putInt(this.mContext.getContentResolver(), "screen_brightness", brightness);
}
示例7: setShowTouches
import android.provider.Settings.System; //导入方法依赖的package包/类
public void setShowTouches(boolean show) {
if (getShowTouches() != show) {
System.putInt(contentResolver, SHOW_TOUCHES_SETTING, show ? 1 : 0);
}
}
示例8: setManualBrightnessMode
import android.provider.Settings.System; //导入方法依赖的package包/类
public void setManualBrightnessMode() {
System.putInt(mContext.getContentResolver(), System.SCREEN_BRIGHTNESS_MODE,
System.SCREEN_BRIGHTNESS_MODE_MANUAL);
}
示例9: setAutoBrightnessMode
import android.provider.Settings.System; //导入方法依赖的package包/类
public void setAutoBrightnessMode() {
System.putInt(mContext.getContentResolver(), System.SCREEN_BRIGHTNESS_MODE,
System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
}
示例10: restoreSystemBrightnessMode
import android.provider.Settings.System; //导入方法依赖的package包/类
public void restoreSystemBrightnessMode() {
System.putInt(mContext.getContentResolver(), System.SCREEN_BRIGHTNESS_MODE,
system_brightness_mode);
}
示例11: setScreenBrightnessStatus
import android.provider.Settings.System; //导入方法依赖的package包/类
public void setScreenBrightnessStatus(int auto_bright, int bright_level) {
System.putInt(getContentResolver(), System.SCREEN_BRIGHTNESS_MODE, auto_bright);
System.putInt(getContentResolver(), System.SCREEN_BRIGHTNESS, bright_level);
}