|
@@ -3,25 +3,25 @@ package com.xplora.xpsettings.Activity;
|
|
|
import android.annotation.SuppressLint;
|
|
|
import android.os.Bundle;
|
|
|
import android.provider.Settings;
|
|
|
+import android.widget.ImageView;
|
|
|
import android.widget.SeekBar;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.xplora.xpsettings.R;
|
|
|
import com.xplora.xpsettings.SettingApplication;
|
|
|
+import com.xplora.xpsettings.Utils.Constant;
|
|
|
+import com.xplora.xpsettings.Utils.ResUtils;
|
|
|
|
|
|
|
|
|
-public class VolumeBrightnessActivity extends BaseActivity implements SeekBar.OnSeekBarChangeListener {
|
|
|
+public class ChangeProgressActivity extends BaseActivity implements SeekBar.OnSeekBarChangeListener {
|
|
|
+ int mViewType;
|
|
|
int initValue;
|
|
|
int lastValue;
|
|
|
- TextView mNumberText;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
- setContentView(R.layout.bright_activity);
|
|
|
-
|
|
|
- //标题
|
|
|
- setWatchTitle(getResources().getStringArray(R.array.settings_title_array)[1]);
|
|
|
+ setContentView(R.layout.activity_change_progress);
|
|
|
|
|
|
initDatas();
|
|
|
initView();
|
|
@@ -36,21 +36,36 @@ public class VolumeBrightnessActivity extends BaseActivity implements SeekBar.On
|
|
|
}
|
|
|
|
|
|
private void initDatas() {
|
|
|
+ mViewType = getIntent().getIntExtra(Constant.INENT_VIEW_TYPE, 0);
|
|
|
initValue = getBrightness() * 100 / 255;
|
|
|
}
|
|
|
|
|
|
@SuppressLint("DefaultLocale")
|
|
|
private void initView() {
|
|
|
- mNumberText = findViewById(R.id.numberText);
|
|
|
+ ImageView imageView = findViewById(R.id.icon);
|
|
|
+ TextView titleText = findViewById(R.id.title);
|
|
|
SeekBar seekBar = findViewById(R.id.seekbar);
|
|
|
+
|
|
|
+ if (imageView != null) {
|
|
|
+ int imageId = ResUtils.getImageId("ic_seekbar_", mViewType);
|
|
|
+ imageView.setImageResource(imageId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (titleText != null) {
|
|
|
+ if (mViewType == 3) {
|
|
|
+ String[] stringList = getResources().getStringArray(R.array.display_title_array);
|
|
|
+ titleText.setText(stringList[0]);
|
|
|
+ } else {
|
|
|
+ String[] stringList = getResources().getStringArray(R.array.volume_title_array);
|
|
|
+ String[] soundModeList = getResources().getStringArray(R.array.soundmode_title_array);
|
|
|
+ String title = stringList[mViewType] + " " + soundModeList[4];
|
|
|
+ titleText.setText(title);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (seekBar != null) {
|
|
|
seekBar.setProgress(initValue);
|
|
|
seekBar.setOnSeekBarChangeListener(this);
|
|
|
}
|
|
|
- if (mNumberText != null) {
|
|
|
- assert seekBar != null;
|
|
|
- mNumberText.setText(String.format("%d%%", seekBar.getProgress()));
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
private int getBrightness() {
|
|
@@ -59,7 +74,7 @@ public class VolumeBrightnessActivity extends BaseActivity implements SeekBar.On
|
|
|
|
|
|
private void setBrightness(int value) {
|
|
|
lastValue = value;
|
|
|
- Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, value * 255 / 100);
|
|
|
+ //Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, value * 255 / 100);
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -69,7 +84,6 @@ public class VolumeBrightnessActivity extends BaseActivity implements SeekBar.On
|
|
|
@Override
|
|
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
|
|
if (seekBar.getId() == R.id.seekbar) {// 设置“与系统默认SeekBar对应的TextView”的值
|
|
|
- mNumberText.setText(progress + "%");
|
|
|
setBrightness(progress);
|
|
|
}
|
|
|
}
|