Browse Source

[공통][Common] 체크박스, 카테고리 메인 탭 API 대응

Hasemi 6 years ago
parent
commit
81831316f2

+ 5 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/helper/ActionBarHelper.java

@@ -8,6 +8,7 @@ import android.support.design.widget.AppBarLayout;
 import android.support.design.widget.CoordinatorLayout;
 import android.support.v7.app.ActionBar;
 import android.support.v7.widget.Toolbar;
+import android.graphics.drawable.StateListDrawable;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ProgressBar;
@@ -95,6 +96,10 @@ public class ActionBarHelper extends Helper {
     radioButtons.add(appBarLayout.findViewById(R.id.tab_fourth_category));
     radioButtons.add(appBarLayout.findViewById(R.id.tab_fifth_category));
 
+    for (int i = 0; i < radioButtons.size(); ++i) {
+      ((RadioButton) radioButtons.get(i)).setButtonDrawable(new StateListDrawable());
+    }
+
     builder = new ActionBarBuilder(this, activity);
     setProgressVisible(false);
   }

+ 12 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/CustomSquareArrowCheckBox.java

@@ -2,6 +2,7 @@ package kr.co.zumo.app.lifeplus.view.custom;
 
 import android.content.Context;
 import android.content.res.TypedArray;
+import android.graphics.drawable.StateListDrawable;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 
@@ -36,6 +37,17 @@ public class CustomSquareArrowCheckBox extends CustomCheckBox {
     LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     inflater.inflate(R.layout.custom_square_arrow_check_box, this);
     checkBox = findViewById(R.id.check_box);
+
+    StateListDrawable stateListDrawable = new StateListDrawable();
+//    stateListDrawable.addState(new int[]{android.R.attr.state_checked},
+//      context.getResources().getDrawable(R.drawable.custom_rectangle_radio_on));
+//
+//    stateListDrawable.addState(new int[]{-android.R.attr.state_checked},
+//      context.getResources().getDrawable(R.drawable.custom_rectangle_radio_off));
+    checkBox.setButtonDrawable(stateListDrawable);
+
+
+    checkBox.setButtonDrawable(new StateListDrawable());
     checkBox.setClickable(false);
     checkBox.setOnClickListener(view -> {
       if (null != listener) {

+ 9 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/CustomSquareCheckBox.java

@@ -1,6 +1,7 @@
 package kr.co.zumo.app.lifeplus.view.custom;
 
 import android.content.Context;
+import android.graphics.drawable.StateListDrawable;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 
@@ -36,6 +37,14 @@ public class CustomSquareCheckBox extends CustomCheckBox {
     inflater.inflate(R.layout.custom_square_check_box, this);
 
     checkBox = findViewById(R.id.check_box);
+    StateListDrawable stateListDrawable = new StateListDrawable();
+//    stateListDrawable.addState(new int[]{android.R.attr.state_checked},
+//      context.getResources().getDrawable(R.drawable.custom_rectangle_radio_on));
+//
+//    stateListDrawable.addState(new int[]{-android.R.attr.state_checked},
+//      context.getResources().getDrawable(R.drawable.custom_rectangle_radio_off));
+    checkBox.setButtonDrawable(stateListDrawable);
+
     checkBox.setOnClickListener(view -> {
       if (null != listener) {
         listener.onClick(this);

+ 1 - 1
app/src/main/res/layout/activity_main.xml

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8"?>
 <android.support.design.widget.CoordinatorLayout
-  android:id="@+id/layout_container"
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
+  android:id="@+id/layout_container"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:background="@color/CFFFFFF"

+ 1 - 1
app/src/main/res/layout/custom_square_arrow_check_box.xml

@@ -12,7 +12,7 @@
     android:layout_width="wrap_content"
     android:layout_height="30dp"
     android:background="@drawable/custom_rectangle_radio_selector"
-    android:button="@android:color/transparent"
+    android:button="@null"
     android:lineSpacingExtra="4sp"
     android:paddingStart="17dp"
     android:paddingTop="7dp"

+ 1 - 1
app/src/main/res/layout/custom_square_check_box.xml

@@ -12,7 +12,7 @@
     android:layout_width="wrap_content"
     android:layout_height="30dp"
     android:background="@drawable/custom_rectangle_radio_selector"
-    android:button="@android:color/transparent"
+    android:button="@null"
     android:lineSpacingExtra="4sp"
     android:paddingStart="17dp"
     android:paddingTop="7dp"