Преглед на файлове

邀请赚钱图标调整

zengjiebin преди 7 години
родител
ревизия
64ed9f5206

+ 18 - 2
app/src/main/java/com/sheep/gamegroup/util/DrawablesHelper.java

@@ -27,6 +27,7 @@ public class DrawablesHelper {
     private WeakReference<TextView> mViewWeakReference;
     private int mWidth;
     private int mHeight;
+    private float radio = 0;
     private @DrawableRes
     int mDrawable;
 
@@ -53,6 +54,11 @@ public class DrawablesHelper {
         mDrawable = drawable;
         return this;
     }
+    public DrawablesHelper drawable(@DrawableRes int drawable, float radio){
+        mDrawable = drawable;
+        this.radio = radio;
+        return this;
+    }
 
     public void commit(){
         TextView textView = mViewWeakReference.get();
@@ -60,8 +66,11 @@ public class DrawablesHelper {
             Drawable drawable;
             if(mWidth != 0 && mHeight != 0){
                 drawable = getDrawable(textView.getContext(), mDrawable, mWidth, mHeight);
+            } else if(radio > 0){
+                drawable = getDrawable(textView.getContext(), mDrawable, radio);
+            } else {
+                drawable = getDrawable(textView.getContext(), mDrawable);
             }
-            else drawable = getDrawable(textView.getContext(), mDrawable);
 
             Drawable[] compoundDrawables = textView.getCompoundDrawables();
             switch (mDirection){
@@ -115,9 +124,16 @@ public class DrawablesHelper {
         return drawable;
     }
 
+    private static Drawable getDrawable(Context context, int drawableResId, float radio) {
+        Drawable drawable = ContextCompat.getDrawable(context,drawableResId);
+        if(drawable != null)
+            drawable.setBounds(0,0,(int)(drawable.getIntrinsicWidth() * radio),(int)(drawable.getIntrinsicHeight() * radio));
+        return drawable;
+    }
     private static Drawable getDrawable(Context context, int drawableResId) {
         Drawable drawable = ContextCompat.getDrawable(context,drawableResId);
-        drawable.setBounds(0,0,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight());
+        if(drawable != null)
+            drawable.setBounds(0,0,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight());
         return drawable;
     }
 

+ 31 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -7,6 +7,7 @@ import android.support.annotation.Nullable;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentTransaction;
 import android.text.TextUtils;
+import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
 import android.widget.FrameLayout;
@@ -21,6 +22,7 @@ import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.helper.DownloadHelper;
 import com.sheep.gamegroup.model.entity.Container;
+import com.sheep.gamegroup.model.entity.Lp;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.util.ShowRedDot;
 import com.sheep.gamegroup.util.ActionUtil;
@@ -28,13 +30,16 @@ import com.sheep.gamegroup.util.ChannelContent;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.DownloadUtil;
+import com.sheep.gamegroup.util.DrawablesHelper;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.MainTab;
 import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.TestUtil;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.util.ViewUtil;
+import com.sheep.gamegroup.util.viewHelper.LayoutParamsUtil;
 import com.sheep.gamegroup.view.dialog.DialogGameOrTaskOrGift;
 import com.sheep.gamegroup.view.fragment.FgtPersonalCenter;
 import com.sheep.jiuyan.samllsheep.R;
@@ -207,7 +212,11 @@ public class ActMain extends BaseActYmPermissionCheck {
             View view = tab_container.getChildAt(index);
             if (view instanceof TextView) {
                 ((TextView) view).setText(mainTab.getStringId());
-//                new DrawablesHelper((TextView) view).direction(DrawablesHelper.TOP).drawable(mainTab.getDrawableId()).commit();
+                if(mainTab.getDrawableId() == R.drawable.drawable_selector_askgetmoney) {
+//                    166x137 204x170
+                    new DrawablesHelper((TextView) view).direction(DrawablesHelper.TOP).drawable(mainTab.getDrawableId(), 150 / 170.0f).commit();
+//                    testView = view;
+                }
             }
             tabs.add(view);
             final int position = index;
@@ -224,6 +233,27 @@ public class ActMain extends BaseActYmPermissionCheck {
         transaction.commitAllowingStateLoss();
         tabs.get(lastPosition).setActivated(true);
     }
+//    private View testView;
+//
+//    @Override
+//    public boolean onKeyDown(int keyCode, KeyEvent event) {
+//        switch (event.getKeyCode()){
+//            case KeyEvent.KEYCODE_8:
+//                addTestViewH(1);
+//                break;
+//            case KeyEvent.KEYCODE_2:
+//                addTestViewH(-1);
+//                break;
+//        }
+//        return super.onKeyDown(keyCode, event);
+//    }
+//
+//    private int defaultTestViewH = 65;
+//    private void addTestViewH(int add) {
+//        defaultTestViewH += add;
+//        LayoutParamsUtil.resetLayoutParams(testView, new Lp(G.DENSITY).setHeight(defaultTestViewH).setWidth((int) (defaultTestViewH * 204 / 170.0f)));
+//        LogUtil.println("addTestViewH add =", defaultTestViewH);
+//    }
 
     private void switchFragment(int position) {
         View lastTab = ListUtil.getItem(tabs, lastPosition);

BIN
app/src/main/res/drawable-xxhdpi/tab_big_yq.png


+ 3 - 2
app/src/main/res/layout/act_bottom_bar.xml

@@ -17,13 +17,14 @@
         android:layout_width="match_parent"
         android:layout_height="1px"
         android:layout_above="@id/tab_container"
-        android:background="#AAe2e2e2" />
+        android:background="#e6e6e6" />
     <RadioGroup
         android:id="@+id/tab_container"
         android:layout_width="match_parent"
         android:layout_height="@dimen/bottom_height"
         android:layout_alignParentStart="true"
         android:layout_alignParentBottom="true"
+        android:background="@color/white"
         android:gravity="end"
         android:orientation="horizontal">
 
@@ -58,7 +59,7 @@
         <RadioButton
             android:id="@+id/tab_3"
             android:layout_width="0dip"
-            android:layout_height="64dp"
+            android:layout_height="65dp"
             android:layout_gravity="bottom"
             android:layout_weight="1"
             android:background="#0000ff00"