losion.liu@sikey.com.cn hai 6 meses
pai
achega
ea1e8f4a6c

+ 57 - 46
app/src/main/java/com/xplora/xpsettings/Activity/ChangeProgressActivity.java

@@ -5,6 +5,8 @@ import android.content.Intent;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.util.Log;
+import android.view.View;
+import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.SeekBar;
 import android.widget.TextView;
@@ -14,17 +16,23 @@ import com.xplora.xpsettings.Data.DataManager;
 import com.xplora.xpsettings.Utils.Constant;
 import com.xplora.xpsettings.Utils.ResUtils;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 
-public class ChangeProgressActivity extends BaseActivity implements SeekBar.OnSeekBarChangeListener {
+public class ChangeProgressActivity extends BaseActivity {
     int mViewType = 0;
-
     int curValue = 0;
     int maxValue = 100;
     int minValue = 0;
+    int[] mDisplayArray = {20, 40, 60, 80, 100};
+    int[] mVoiceArray = {0, 30, 60, 100};
 
-    private ImageView mImageView = null;
+    private ImageView mIcon = null;
+    private ImageView mSubButton = null;
+    private ImageView mAddButton = null;
+    private TextView mProgressText = null;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -56,10 +64,19 @@ public class ChangeProgressActivity extends BaseActivity implements SeekBar.OnSe
 
     @SuppressLint("DefaultLocale")
     private void initView() {
-        mImageView = findViewById(R.id.icon);
-        TextView titleText = findViewById(R.id.title);
-        SeekBar seekBar = findViewById(R.id.seekbar);
+        mIcon = findViewById(R.id.icon);
+        mProgressText = findViewById(R.id.progressText);
+        mSubButton = findViewById(R.id.subButton);
+        mAddButton = findViewById(R.id.addButton);
+        mSubButton.setOnClickListener( v -> clickSubButton());
+        mAddButton.setOnClickListener( v -> clickAddButton());
+        initTitle();
+        changeImage();
+        changeProgress();
+    }
 
+    private void initTitle() {
+        TextView titleText = findViewById(R.id.title);
         if (titleText != null) {
             if (mViewType == 3) {
                 String[] stringList = ResUtils.getStringArray("display_title_array_", 4);
@@ -71,64 +88,58 @@ public class ChangeProgressActivity extends BaseActivity implements SeekBar.OnSe
                 titleText.setText(title);
             }
         }
-        if (seekBar != null) {
-            seekBar.setMin(0);
-            seekBar.setMax(maxValue);
-            seekBar.setProgress(curValue);
-            seekBar.setOnSeekBarChangeListener(this);
-        }
-
-        changeImage();
     }
 
     private void changeImage() {
-        if (mImageView == null)
+        if (mIcon == null)
             return;
         if (mViewType == 3) {
             int imageId = ResUtils.getImageId("ic_seekbar_", mViewType);
-            mImageView.setImageResource(imageId);
+            mIcon.setImageResource(imageId);
         } else {
             int index = curValue <= 0 ? 0 : 2;
             int imageId = ResUtils.getImageId("ic_seekbar_", index);
-            mImageView.setImageResource(imageId);
+            mIcon.setImageResource(imageId);
         }
     }
 
-    /*
-     * SeekBar滚动时的回调函数
-     */
-    @SuppressLint("SetTextI18n")
-    @Override
-    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-        if (progress <= minValue) {
-            progress = minValue;
-            seekBar.setProgress(progress);
-        }
-        Log.d(TAG, "onProgressChanged: mViewType:" + mViewType +  " progress: " + progress);
+    private void changeProgress() {
 
-        curValue = progress;
-        if (mViewType == 3) {
-            DataManager.setBrightness(progress);
-        } else {
-            DataManager.setVolume(mViewType, progress);
-        }
-
-        changeImage();
-
-        int value = mViewType == 3 ? curValue : (curValue * 100 / maxValue);
-        Intent intent = new Intent();
-        intent.putExtra(Constant.INTENT_VIEW_TYPE, mViewType);
-        intent.putExtra(Constant.INTENT_RESULT_VALUE, value);
-        setResult(RESULT_OK, intent);
     }
 
-    @Override
-    public void onStartTrackingTouch(SeekBar seekBar) {
+    private void clickSubButton() {
 
     }
 
-    @Override
-    public void onStopTrackingTouch(SeekBar seekBar) {
+    private void clickAddButton() {
 
     }
+
+//    /*
+//     * SeekBar滚动时的回调函数
+//     */
+//    @SuppressLint("SetTextI18n")
+//    @Override
+//    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+//        if (progress <= minValue) {
+//            progress = minValue;
+//            seekBar.setProgress(progress);
+//        }
+//        Log.d(TAG, "onProgressChanged: mViewType:" + mViewType +  " progress: " + progress);
+//
+//        curValue = progress;
+//        if (mViewType == 3) {
+//            DataManager.setBrightness(progress);
+//        } else {
+//            DataManager.setVolume(mViewType, progress);
+//        }
+//
+//        changeImage();
+//
+//        int value = mViewType == 3 ? curValue : (curValue * 100 / maxValue);
+//        Intent intent = new Intent();
+//        intent.putExtra(Constant.INTENT_VIEW_TYPE, mViewType);
+//        intent.putExtra(Constant.INTENT_RESULT_VALUE, value);
+//        setResult(RESULT_OK, intent);
+//    }
 }

BIN=BIN
app/src/main/res/drawable/action_add_disable.png


BIN=BIN
app/src/main/res/drawable/action_add_enable.png


BIN=BIN
app/src/main/res/drawable/action_sub_disable.png


BIN=BIN
app/src/main/res/drawable/action_sub_enable.png


BIN=BIN
app/src/main/res/drawable/bright_0.png


BIN=BIN
app/src/main/res/drawable/bright_100.png


BIN=BIN
app/src/main/res/drawable/bright_20.png


BIN=BIN
app/src/main/res/drawable/bright_40.png


BIN=BIN
app/src/main/res/drawable/bright_60.png


BIN=BIN
app/src/main/res/drawable/voice_0.png


BIN=BIN
app/src/main/res/drawable/voice_100.png


BIN=BIN
app/src/main/res/drawable/voice_30.png


BIN=BIN
app/src/main/res/drawable/voice_60.png


+ 47 - 23
app/src/main/res/layout/activity_change_progress.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:background="@color/black"
@@ -7,33 +7,57 @@
     android:gravity="center_horizontal"
     >
 
-    <ImageView
-        android:id="@+id/icon"
-        android:layout_width="41dp"
-        android:layout_height="41dp"
-        android:layout_marginTop="30dp"/>
-
     <TextView
         android:id="@+id/title"
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="6dp"
-        android:textSize="15sp"
-        android:textColor="#FFFFFFFF"
-        android:fontFamily="Roboto"
+        android:layout_marginTop="10dp"
+        android:textSize="17sp"
+        android:textColor="@color/white"
         android:textStyle="bold"
+        android:textAlignment="center"
         />
 
-    <SeekBar
-        android:id="@+id/seekbar"
+    <ImageView
+        android:id="@+id/icon"
+        android:layout_width="75dp"
+        android:layout_height="75dp"
+        android:background="@drawable/voice_0"
+        android:layout_centerInParent="true" />
+
+    <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="12dp"
-        android:layout_marginStart="10dp"
-        android:layout_marginEnd="10dp"
-        android:maxHeight="13dp"
-        android:thumb="@drawable/seekbar_thumb"
-        android:progressDrawable="@drawable/selector_seekbar_bg"
-        />
+        android:layout_height="37dp"
+        android:layout_marginStart="5dp"
+        android:layout_marginEnd="5dp"
+        android:layout_marginBottom="13dp"
+        android:layout_alignParentBottom="true"
+        >
+
+        <ImageButton
+            android:id="@+id/subButton"
+            android:layout_width="37dp"
+            android:layout_height="match_parent"
+            android:background="@drawable/action_sub_enable"
+            />
+        <TextView
+            android:id="@+id/progressText"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:layout_marginStart="2dp"
+            android:layout_marginEnd="2dp"
+            android:background="@drawable/bg_gray"
+            android:text="234324"
+            android:textColor="@color/sk_green"
+            />
+        <ImageButton
+            android:id="@+id/addButton"
+            android:layout_width="37dp"
+            android:layout_height="match_parent"
+            android:background="@drawable/action_add_enable"
+            />
+    </LinearLayout>
 
-</LinearLayout>
+</RelativeLayout>

+ 1 - 0
app/src/main/res/values/colors.xml

@@ -14,4 +14,5 @@
     <color name="xp_gray">#FF999999</color>
     <color name="xp_item_highlight">#99FFFFFF</color>
     <color name="sk_gray">#303030</color>
+    <color name="sk_green">#08A243</color>
 </resources>