Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.os.Build;

import android.view.Window;
import android.view.WindowManager;

public class Main {
    public static void BrightnessSetValue(Window window, int value) {
        WindowManager.LayoutParams lp = window.getAttributes();
        if (Build.MODEL != null && Build.MODEL.indexOf("MEIZU MX") > -1) {
            lp.screenBrightness = 0.6f + value * 3 / 100f;
            window.setAttributes(lp);
        } else {
            if (value > 10)
                value = 10;
            if (value < 0)
                value = 0;
            float bright = value;
            bright /= 10.0f;
            lp.screenBrightness = bright;
            window.setAttributes(lp);
        }
    }
}