Commit 2432748143121728260b2fa9dcb83f7be119324d

Authored by YangShuai
1 parent f4d3a0b7

1 优化二维码占用与联系人邀请角色冲突问题

app/src/main/java/com/cnlive/strike/xiaojiaspeaker/ButtonAnimUtil.java deleted 100644 → 0
1   -package com.cnlive.strike.xiaojiaspeaker;
2   -
3   -import android.animation.Animator;
4   -import android.animation.AnimatorSet;
5   -import android.animation.ObjectAnimator;
6   -import android.os.Build;
7   -import android.os.Handler;
8   -import android.view.View;
9   -import android.view.ViewAnimationUtils;
10   -import android.view.animation.DecelerateInterpolator;
11   -
12   -/**
13   - * 圆形按钮点击特效
14   - *
15   - * @author ShinnyYang
16   - */
17   -public class ButtonAnimUtil {
18   - public static final int DEFAULT_ZOOM_DURATION = 50;//默认缩放动画时间间隔
19   - public static final int SHOW_VIEW_ZOOM_DURATION = 150;//显示控件缩放动画时间间隔
20   - public static final int HIDE_VIEW_ZOOM_DURATION = 100;//隐藏控件缩放动画时间间隔
21   -
22   - //设置控件放大动画
23   - public static void setViewZoomIn(View view) {
24   - try {
25   - AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画
26   - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1, 1.2f);
27   - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1, 1.2f);
28   - animatorSetsuofang.setDuration(DEFAULT_ZOOM_DURATION);
29   - animatorSetsuofang.setInterpolator(new DecelerateInterpolator());
30   - animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始
31   - animatorSetsuofang.start();
32   - } catch (Exception e) {
33   - }
34   - }
35   -
36   - //设置控件缩小动画
37   - public static void setViewZoomOut(View view) {
38   - try {
39   - AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画
40   - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.2f, 1);
41   - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.2f, 1);
42   - animatorSetsuofang.setDuration(DEFAULT_ZOOM_DURATION);
43   - animatorSetsuofang.setInterpolator(new DecelerateInterpolator());
44   - animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始
45   - animatorSetsuofang.start();
46   - } catch (Exception e) {
47   - }
48   - }
49   -
50   - //设置控件缩小动画
51   - public static void setViewDefault(View view) {
52   - try {
53   - AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画
54   - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1f, 1);
55   - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1f, 1);
56   - animatorSetsuofang.setDuration(DEFAULT_ZOOM_DURATION);
57   - animatorSetsuofang.setInterpolator(new DecelerateInterpolator());
58   - animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始
59   - animatorSetsuofang.start();
60   - } catch (Exception e) {
61   - }
62   - }
63   -
64   - //设置控件显示放大动画
65   - public static void setViewShowZoomIn(View view) {
66   - try {
67   - AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画
68   - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0, 1.2f);
69   - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0, 1.2f);
70   - animatorSetsuofang.setDuration(SHOW_VIEW_ZOOM_DURATION);
71   - animatorSetsuofang.setInterpolator(new DecelerateInterpolator());
72   - animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始
73   - animatorSetsuofang.start();
74   - new Handler().postDelayed(new Runnable() {
75   - @Override
76   - public void run() {
77   - if (view == null) {
78   - return;
79   - }
80   - AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画
81   - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.2f, 1);
82   - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.2f, 1);
83   - animatorSetsuofang.setDuration(SHOW_VIEW_ZOOM_DURATION);
84   - animatorSetsuofang.setInterpolator(new DecelerateInterpolator());
85   - animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始
86   - animatorSetsuofang.start();
87   - }
88   - }, SHOW_VIEW_ZOOM_DURATION);
89   - } catch (Exception e) {
90   - }
91   - }
92   -
93   - //设置控件隐藏缩小动画
94   - public static void setViewHideZoomOut(View view) {
95   - try {
96   - AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画
97   - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1, 0);
98   - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1, 0);
99   - animatorSetsuofang.setDuration(HIDE_VIEW_ZOOM_DURATION);
100   - animatorSetsuofang.setInterpolator(new DecelerateInterpolator());
101   - animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始
102   - animatorSetsuofang.start();
103   - } catch (Exception e) {
104   - }
105   - }
106   -
107   - //设置时间显示放大动画
108   - public static void setTimeShowZoomIn(View view) {
109   - try {
110   - ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0, 1.4f);
111   - ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0, 1.4f);
112   - ObjectAnimator scaleX1 = ObjectAnimator.ofFloat(view, "scaleX", 1.4f, 1);
113   - ObjectAnimator scaleY1 = ObjectAnimator.ofFloat(view, "scaleY", 1.4f, 1);
114   - ObjectAnimator scaleX2 = ObjectAnimator.ofFloat(view, "scaleX", 1, 0);
115   - ObjectAnimator scaleY2 = ObjectAnimator.ofFloat(view, "scaleY", 1, 0);
116   - AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画
117   - animatorSetsuofang.setDuration(100);
118   - animatorSetsuofang.setInterpolator(new DecelerateInterpolator());
119   - animatorSetsuofang.play(scaleX).with(scaleY);
120   - animatorSetsuofang.start();
121   - new Handler().postDelayed(new Runnable() {
122   - @Override
123   - public void run() {
124   - if (view == null) {
125   - return;
126   - }
127   - AnimatorSet animatorSetsuofang2 = new AnimatorSet();//组合动画
128   - animatorSetsuofang2.setDuration(100);
129   - animatorSetsuofang2.setInterpolator(new DecelerateInterpolator());
130   - animatorSetsuofang2.play(scaleX1).with(scaleY1);
131   - animatorSetsuofang2.start();
132   - }
133   - }, 100);
134   -
135   - new Handler().postDelayed(new Runnable() {
136   - @Override
137   - public void run() {
138   - if (view == null) {
139   - return;
140   - }
141   - AnimatorSet animatorSetsuofang3 = new AnimatorSet();//组合动画
142   - animatorSetsuofang3.setDuration(10);
143   - animatorSetsuofang3.setInterpolator(new DecelerateInterpolator());
144   - animatorSetsuofang3.play(scaleX2).with(scaleY2);
145   - animatorSetsuofang3.start();
146   - }
147   - }, 300);
148   - } catch (Exception e) {
149   - }
150   - }
151   -
152   -
153   - /**
154   - * 设置控件展开特效
155   - *
156   - * @param view
157   - * @param closeFlag
158   - */
159   - public static void startAnimation(View view, boolean closeFlag) {
160   - try {
161   - //因为CircularReveal动画是api21之后才有的,所以加个判断语句,免得崩溃
162   - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
163   - int cicular_R = view.getHeight() / 2 > view.getWidth() / 2 ? view.getHeight() / 2 : view.getWidth() / 2;
164   - Animator animator = null;
165   - if (!closeFlag) {
166   - animator = ViewAnimationUtils.createCircularReveal(view, (int) view.getWidth() / 2, (int) view.getHeight() / 2, 0, cicular_R);
167   - } else {
168   - animator = ViewAnimationUtils.createCircularReveal(view, (int) view.getWidth() / 2, (int) view.getHeight() / 2, cicular_R, 0);
169   - }
170   - animator.addListener(new Animator.AnimatorListener() {
171   - @Override
172   - public void onAnimationStart(Animator animator) {
173   -
174   - }
175   -
176   - @Override
177   - public void onAnimationEnd(Animator animator) {
178   - if (closeFlag) {
179   - view.setVisibility(View.GONE);
180   - }
181   - }
182   -
183   - @Override
184   - public void onAnimationCancel(Animator animator) {
185   -
186   - }
187   -
188   - @Override
189   - public void onAnimationRepeat(Animator animator) {
190   -
191   - }
192   - });
193   - animator.setDuration(350);
194   - animator.start();
195   - } else {
196   - if (closeFlag) {
197   - view.setVisibility(View.GONE);
198   - }
199   - }
200   -
201   - } catch (Exception e) {
202   - }
203   - }
204   -
205   -}
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/ToolBarTestActivity.java
1 1 package com.cnlive.strike.xiaojiaspeaker;
2 2  
3   -import android.animation.AnimatorSet;
4   -import android.animation.ObjectAnimator;
5 3 import android.databinding.DataBindingUtil;
6 4 import android.os.Build;
7   -import android.os.Handler;
8   -import android.support.design.widget.AppBarLayout;
9   -import android.support.design.widget.CoordinatorLayout;
10   -import android.support.v4.content.ContextCompat;
11   -import android.support.v4.view.animation.FastOutLinearInInterpolator;
12 5 import android.support.v7.app.AppCompatActivity;
13 6 import android.os.Bundle;
14   -import android.util.Log;
15 7 import android.view.View;
16   -import android.view.animation.AccelerateDecelerateInterpolator;
17   -import android.view.animation.Animation;
18 8 import android.view.animation.AnimationUtils;
19   -import android.view.animation.AnticipateInterpolator;
20   -import android.view.animation.BounceInterpolator;
21   -import android.view.animation.CycleInterpolator;
22   -import android.view.animation.LinearInterpolator;
23   -import android.view.animation.OvershootInterpolator;
24   -import android.view.animation.TranslateAnimation;
25   -import android.widget.LinearLayout;
26 9  
27 10 import com.cnlive.strike.speaker.R;
28 11 import com.cnlive.strike.speaker.databinding.ActivityToolBarTest1Binding;
29 12 import com.cnlive.strike.speaker.databinding.ActivityToolBarTestBinding;
30   -import com.cnlive.strike.xiaojiaspeaker.util.utilcode.util.ScreenUtils;
31 13 import com.daimajia.androidanimations.library.Techniques;
32 14 import com.daimajia.androidanimations.library.YoYo;
33 15  
34 16 public class ToolBarTestActivity extends AppCompatActivity {
35   - private ActivityToolBarTestBinding binding;
  17 + private ActivityToolBarTest1Binding binding;
36 18 private String TAG = "ToolBarTestActivity";
37 19 private boolean isFirstSlide = true;
38 20  
39 21 @Override
40 22 protected void onCreate(Bundle savedInstanceState) {
41 23 super.onCreate(savedInstanceState);
42   - binding = DataBindingUtil.setContentView(this, R.layout.activity_tool_bar_test);
  24 + binding = DataBindingUtil.setContentView(this, R.layout.activity_tool_bar_test1);
43 25 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
44   - binding.scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
45   - @Override
46   - public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
47   - binding.llMenu.startAnimation(AnimationUtils.makeOutAnimation(ToolBarTestActivity.this, true));
48   - binding.llMenu.setVisibility(View.INVISIBLE);
49   - }
50   - });
  26 +// binding.scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener() {
  27 +// @Override
  28 +// public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
  29 +// binding.llMenu.startAnimation(AnimationUtils.makeOutAnimation(ToolBarTestActivity.this, true));
  30 +// binding.llMenu.setVisibility(View.INVISIBLE);
  31 +// }
  32 +// });
51 33 }
  34 +
  35 +// binding.ivAdd.setOnClickListener(new View.OnClickListener() {
  36 +// @Override
  37 +// public void onClick(View v) {
  38 +//// ViewAnimUtil.setViewShowZoomIn(binding.ivLife,1.15f);
  39 +//
  40 +// }
  41 +// });
52 42 // LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) binding.ivLife.getLayoutParams();
53 43 // Log.e(TAG, "onCreate: " + params.topMargin);
54   -// YoYo.with(Techniques.Swing)
55   -// .duration(700)
56   -// .repeat(0)
57   -// .playOn(binding.ivLife);
  44 +//
58 45 // binding.appbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
59 46 // @Override
60 47 // public void onOffsetChanged(AppBarLayout appBarLayout, int i) {
... ... @@ -188,7 +175,7 @@ public class ToolBarTestActivity extends AppCompatActivity {
188 175 // new Handler().postDelayed(new Runnable() {
189 176 // @Override
190 177 // public void run() {
191   -// ButtonAnimUtil.setViewShowZoomIn(binding.ivLife);
  178 +// ViewAnimUtil.setViewShowZoomIn(binding.ivLife);
192 179 // YoYo.with(Techniques.Swing)
193 180 // .duration(700)
194 181 // .repeat(0)
... ...
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/ViewAnimUtil.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker;
  2 +
  3 +import android.animation.Animator;
  4 +import android.animation.AnimatorSet;
  5 +import android.animation.ObjectAnimator;
  6 +import android.os.Build;
  7 +import android.os.Handler;
  8 +import android.view.View;
  9 +import android.view.ViewAnimationUtils;
  10 +import android.view.animation.Animation;
  11 +import android.view.animation.BounceInterpolator;
  12 +import android.view.animation.DecelerateInterpolator;
  13 +import android.view.animation.LinearInterpolator;
  14 +import android.view.animation.RotateAnimation;
  15 +
  16 +import com.daimajia.androidanimations.library.Techniques;
  17 +import com.daimajia.androidanimations.library.YoYo;
  18 +
  19 +/**
  20 + * 圆形按钮点击特效
  21 + *
  22 + * @author ShinnyYang
  23 + */
  24 +public class ViewAnimUtil {
  25 +
  26 + //设置控件显示放大动画
  27 + public static void setViewShowZoomIn(View view, float zoomIn) {
  28 + try {
  29 + //放大动画
  30 + AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画
  31 + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1, zoomIn);
  32 + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1, zoomIn);
  33 + //延时播放缩小动画
  34 + ObjectAnimator scaleXBack = ObjectAnimator.ofFloat(view, "scaleX", zoomIn, 1);
  35 + scaleXBack.setStartDelay(500);
  36 + ObjectAnimator scaleYBack = ObjectAnimator.ofFloat(view, "scaleY", zoomIn, 1);
  37 + scaleYBack.setStartDelay(500);
  38 +// ObjectAnimator rotateBack1 = ObjectAnimator.ofFloat(view, "rotation", 30f, 0f).setDuration(100);
  39 +//// //顺时针旋转45°
  40 +// ObjectAnimator rotate = ObjectAnimator.ofFloat(view, "rotation", 30f, 30f).setDuration(100);
  41 +// rotate.setStartDelay(300);
  42 +//// //逆时针旋转45°
  43 +// ObjectAnimator rotateBack = ObjectAnimator.ofFloat(view, "rotation", 30f, 0f).setDuration(100);
  44 +// rotateBack.setStartDelay(300);
  45 + //旋转
  46 + ObjectAnimator rotateBack = ObjectAnimator.ofFloat(view, "rotation", 0, 30, -30, 16, -16, 13, -13, 0);
  47 + rotateBack.setStartDelay(100);
  48 + animatorSetsuofang.play(scaleX).with(scaleY).with(scaleXBack).with(scaleYBack).with(rotateBack);//两个动画同时开始
  49 + animatorSetsuofang.setInterpolator(new DecelerateInterpolator());
  50 + animatorSetsuofang.setDuration(500);
  51 + animatorSetsuofang.start();
  52 +
  53 +// YoYo.with(Techniques.Swing)
  54 +// .duration(1000)
  55 +// .repeat(0)
  56 +// .playOn(view);
  57 + } catch (Exception e) {
  58 + }
  59 + }
  60 +}
... ...
app/src/main/res/layout/activity_tool_bar_test1.xml
... ... @@ -23,250 +23,168 @@
23 23 android:layout_width="match_parent"
24 24 android:layout_height="wrap_content"
25 25 android:fitsSystemWindows="true"
26   -
27 26 app:layout_scrollFlags="scroll|exitUntilCollapsed">
28 27 <!---->
29 28 <LinearLayout
30   - android:id="@+id/ll_menu"
31 29 android:layout_width="match_parent"
32   - android:layout_height="40dp"
33   - android:gravity="center|right"
34   - app:layout_collapseMode="pin">
35   -
  30 + android:layout_height="match_parent"
  31 + android:orientation="vertical">
36 32 <LinearLayout
37   - android:id="@+id/ll_search"
38   - android:layout_width="45dp"
39   - android:layout_height="match_parent"
40   - android:layout_marginTop="5dp"
41   - android:layout_marginBottom="5dp"
42   - android:clickable="true"
43   - android:focusable="true"
44   - android:gravity="center">
45   -
46   - <ImageView
47   - android:layout_width="wrap_content"
48   - android:layout_height="19dp"
49   - android:background="@drawable/icon_mian_search"
50   - android:clickable="false"
51   - android:focusable="false" />
52   - </LinearLayout>
  33 + android:id="@+id/ll_menu"
  34 + android:layout_width="match_parent"
  35 + android:layout_height="40dp"
  36 + android:gravity="center|right"
  37 + app:layout_collapseMode="pin">
  38 +
  39 + <LinearLayout
  40 + android:id="@+id/ll_search"
  41 + android:layout_width="45dp"
  42 + android:layout_height="match_parent"
  43 + android:layout_marginTop="5dp"
  44 + android:layout_marginBottom="5dp"
  45 + android:clickable="true"
  46 + android:focusable="true"
  47 + android:gravity="center">
53 48  
54   - <FrameLayout
55   - android:id="@+id/fl_contact"
56   - android:layout_width="45dp"
57   - android:layout_height="match_parent"
58   - android:layout_marginTop="5dp"
59   - android:layout_marginBottom="5dp"
60   - android:clickable="true"
61   - android:focusable="true">
  49 + <ImageView
  50 + android:layout_width="wrap_content"
  51 + android:layout_height="19dp"
  52 + android:background="@drawable/icon_mian_search"
  53 + android:clickable="false"
  54 + android:focusable="false" />
  55 + </LinearLayout>
62 56  
63 57 <FrameLayout
64   - android:layout_width="wrap_content"
65   - android:layout_height="wrap_content"
66   - android:layout_gravity="center"
67   - android:clickable="false"
68   - android:focusable="false">
  58 + android:id="@+id/fl_contact"
  59 + android:layout_width="45dp"
  60 + android:layout_height="match_parent"
  61 + android:layout_marginTop="5dp"
  62 + android:layout_marginBottom="5dp"
  63 + android:clickable="true"
  64 + android:focusable="true">
  65 +
  66 + <FrameLayout
  67 + android:layout_width="wrap_content"
  68 + android:layout_height="wrap_content"
  69 + android:layout_gravity="center"
  70 + android:clickable="false"
  71 + android:focusable="false">
  72 +
  73 + <ImageView
  74 + android:layout_width="18dp"
  75 + android:layout_height="18dp"
  76 + android:layout_gravity="center"
  77 + android:background="@drawable/icon_mian_contact"
  78 + android:clickable="false"
  79 + android:focusable="false" />
  80 +
  81 + </FrameLayout>
  82 + </FrameLayout>
  83 +
  84 + <LinearLayout
  85 + android:id="@+id/ll_add"
  86 + android:layout_width="45dp"
  87 + android:layout_height="match_parent"
  88 + android:layout_marginTop="5dp"
  89 + android:layout_marginRight="5dp"
  90 + android:layout_marginBottom="5dp"
  91 + android:clickable="true"
  92 + android:focusable="true"
  93 + android:gravity="center">
69 94  
70 95 <ImageView
  96 + android:id="@+id/iv_add"
71 97 android:layout_width="18dp"
72 98 android:layout_height="18dp"
73   - android:layout_gravity="center"
74   - android:background="@drawable/icon_mian_contact"
  99 + android:background="@drawable/icon_mian_add"
75 100 android:clickable="false"
76 101 android:focusable="false" />
77   -
78   - </FrameLayout>
79   - </FrameLayout>
80   -
81   - <LinearLayout
82   - android:id="@+id/ll_add"
83   - android:layout_width="45dp"
84   - android:layout_height="match_parent"
85   - android:layout_marginTop="5dp"
86   - android:layout_marginRight="5dp"
87   - android:layout_marginBottom="5dp"
88   - android:clickable="true"
89   - android:focusable="true"
90   - android:gravity="center">
91   -
92   - <ImageView
93   - android:id="@+id/iv_add"
94   - android:layout_width="18dp"
95   - android:layout_height="18dp"
96   - android:background="@drawable/icon_mian_add"
97   - android:clickable="false"
98   - android:focusable="false" />
  102 + </LinearLayout>
99 103 </LinearLayout>
100   - </LinearLayout>
101   - <!---->
102   - <LinearLayout
103   - android:layout_width="match_parent"
104   - android:layout_height="wrap_content"
105   - android:layout_gravity="bottom"
106   - android:orientation="horizontal"
107   - android:visibility="gone"
108   - app:layout_collapseMode="parallax">
109   -
  104 + <!---->
110 105 <LinearLayout
111   - android:layout_width="0dp"
  106 + android:layout_width="match_parent"
112 107 android:layout_height="wrap_content"
113   - android:layout_weight="1"
114   - android:gravity="center"
115   - android:orientation="vertical">
116   -
117   - <ImageView
118   - android:layout_width="55dp"
119   - android:layout_height="55dp"
120   - android:layout_gravity="center"
121   - android:background="@drawable/icon_mian_life"
122   - android:focusable="false" />
123   -
124   - <TextView
125   - android:layout_width="wrap_content"
126   - android:layout_height="wrap_content"
127   - android:focusable="false"
128   - android:text="生活圈"
129   - android:textColor="@color/color_282828"
130   - android:textSize="13sp" />
131   - </LinearLayout>
  108 + android:layout_gravity="bottom"
  109 + android:orientation="horizontal"
  110 + app:layout_collapseMode="pin">
132 111  
133   - <LinearLayout
134   - android:layout_width="0dp"
135   - android:layout_height="wrap_content"
136   - android:layout_weight="1"
137   - android:gravity="center"
138   - android:orientation="vertical">
139   -
140   - <ImageView
141   - android:layout_width="55dp"
142   - android:layout_height="55dp"
143   - android:layout_gravity="center"
144   - android:background="@drawable/icon_main_subscribe"
145   - android:focusable="false" />
146   -
147   - <TextView
148   - android:layout_width="wrap_content"
  112 + <LinearLayout
  113 + android:layout_width="0dp"
149 114 android:layout_height="wrap_content"
150   - android:focusable="false"
151   - android:text="订阅号"
152   - android:textColor="@color/color_282828"
153   - android:textSize="13sp" />
154   - </LinearLayout>
  115 + android:layout_weight="1"
  116 + android:gravity="center"
  117 + android:orientation="vertical">
155 118  
156   - <LinearLayout
157   - android:layout_width="0dp"
158   - android:layout_height="wrap_content"
159   - android:layout_weight="1"
160   - android:gravity="center"
161   - android:orientation="vertical">
162   -
163   - <ImageView
164   - android:layout_width="55dp"
165   - android:layout_height="55dp"
166   - android:layout_gravity="center"
167   - android:background="@drawable/icon_main_shop"
168   - android:focusable="false" />
169   -
170   - <TextView
171   - android:layout_width="wrap_content"
  119 + <ImageView
  120 + android:layout_width="55dp"
  121 + android:layout_height="55dp"
  122 + android:layout_gravity="center"
  123 + android:background="@drawable/icon_mian_life"
  124 + android:focusable="false" />
  125 +
  126 + <TextView
  127 + android:layout_width="wrap_content"
  128 + android:layout_height="wrap_content"
  129 + android:focusable="false"
  130 + android:text="生活圈"
  131 + android:textColor="@color/color_282828"
  132 + android:textSize="13sp" />
  133 + </LinearLayout>
  134 +
  135 + <LinearLayout
  136 + android:layout_width="0dp"
172 137 android:layout_height="wrap_content"
173   - android:focusable="false"
174   - android:text="优选库"
175   - android:textColor="@color/color_282828"
176   - android:textSize="13sp" />
177   - </LinearLayout>
178   - </LinearLayout>
  138 + android:layout_weight="1"
  139 + android:gravity="center"
  140 + android:orientation="vertical">
179 141  
180   - </android.support.design.widget.CollapsingToolbarLayout>
181   - <!-- -->
182   - <LinearLayout
183   - android:id="@+id/ll_root"
184   - android:layout_width="match_parent"
185   - android:layout_height="match_parent"
186   - android:layout_gravity="bottom"
187   - android:orientation="horizontal"
188   - app:layout_collapseMode="parallax">
  142 + <ImageView
  143 + android:layout_width="55dp"
  144 + android:layout_height="55dp"
  145 + android:layout_gravity="center"
  146 + android:background="@drawable/icon_main_subscribe"
  147 + android:focusable="false" />
189 148  
190   - <LinearLayout
191   - android:id="@+id/ll_life"
192   - android:layout_width="0dp"
193   - android:layout_height="match_parent"
194   - android:layout_weight="1"
195   - android:gravity="center"
196   - android:orientation="vertical">
  149 + <TextView
  150 + android:layout_width="wrap_content"
  151 + android:layout_height="wrap_content"
  152 + android:focusable="false"
  153 + android:text="订阅号"
  154 + android:textColor="@color/color_282828"
  155 + android:textSize="13sp" />
  156 + </LinearLayout>
  157 +
  158 + <LinearLayout
  159 + android:layout_width="0dp"
  160 + android:layout_height="wrap_content"
  161 + android:layout_weight="1"
  162 + android:gravity="center"
  163 + android:orientation="vertical">
197 164  
198   - <ImageView
199   - android:id="@+id/iv_life"
200   - android:layout_width="55dp"
201   - android:layout_height="55dp"
202   - android:layout_gravity="center"
203   - android:background="@drawable/icon_mian_life"
204   - android:focusable="false" />
205   -
206   - <TextView
207   - android:id="@+id/tv_circle"
208   - android:layout_width="wrap_content"
209   - android:layout_height="wrap_content"
210   - android:focusable="false"
211   - android:text="生活圈"
212   - android:textColor="@color/color_282828"
213   - android:textSize="13sp" />
214   - </LinearLayout>
  165 + <ImageView
  166 + android:layout_width="55dp"
  167 + android:layout_height="55dp"
  168 + android:layout_gravity="center"
  169 + android:background="@drawable/icon_main_shop"
  170 + android:focusable="false" />
215 171  
216   - <LinearLayout
217   - android:id="@+id/ll_sub"
218   - android:layout_width="0dp"
219   - android:layout_height="match_parent"
220   - android:layout_weight="1"
221   - android:gravity="center"
  172 + <TextView
  173 + android:layout_width="wrap_content"
  174 + android:layout_height="wrap_content"
  175 + android:focusable="false"
  176 + android:text="优选库"
  177 + android:textColor="@color/color_282828"
  178 + android:textSize="13sp" />
  179 + </LinearLayout>
222 180  
223   - android:orientation="vertical">
  181 + </LinearLayout>
224 182  
225   - <ImageView
226   - android:id="@+id/iv_sub"
227   - android:layout_width="55dp"
228   - android:layout_height="55dp"
229   - android:layout_gravity="center"
230   - android:background="@drawable/icon_main_subscribe"
231   - android:focusable="false" />
232   -
233   - <TextView
234   - android:id="@+id/tv_sub"
235   - android:layout_width="wrap_content"
236   - android:layout_height="wrap_content"
237   - android:focusable="false"
238   - android:text="订阅号"
239   - android:textColor="@color/color_282828"
240   - android:textSize="13sp" />
  183 +<!-- -->
241 184 </LinearLayout>
242 185  
243   - <LinearLayout
244   - android:id="@+id/ll_shop"
245   - android:layout_width="0dp"
246   - android:layout_height="match_parent"
247   - android:layout_weight="1"
248   - android:gravity="center"
249   -
250   - android:orientation="vertical">
251   -
252   - <ImageView
253   - android:id="@+id/iv_shop"
254   - android:layout_width="55dp"
255   - android:layout_height="55dp"
256   - android:layout_gravity="center"
257   - android:background="@drawable/icon_main_shop"
258   - android:focusable="false" />
259   -
260   - <TextView
261   - android:id="@+id/tv_shop"
262   - android:layout_width="wrap_content"
263   - android:layout_height="wrap_content"
264   - android:focusable="false"
265   - android:text="优选库"
266   - android:textColor="@color/color_282828"
267   - android:textSize="13sp" />
268   - </LinearLayout>
269   - </LinearLayout>
  186 + </android.support.design.widget.CollapsingToolbarLayout>
  187 + <!-- -->
270 188 <!-- -->
271 189 </android.support.design.widget.AppBarLayout>
272 190  
... ...
config.gradle
... ... @@ -21,7 +21,7 @@ ext {
21 21 //编译方式
22 22 debug : false,
23 23 //版本号
24   - version: "0.2.12",
  24 + version: "0.2.13",
25 25 //Lib库前缀
26 26 packeg : "com.cnlive.module",
27 27 //Lib库名称
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/SetFriendsRolePresenter.java
... ... @@ -79,6 +79,12 @@ public class SetFriendsRolePresenter extends MvpBasePresenter&lt;SetFriendsRoleView
79 79 });
80 80 }
81 81  
  82 + /**
  83 + * 设置家庭角色
  84 + *
  85 + * @param context
  86 + * @param contactsInvite
  87 + */
82 88 public void invitFamilyMember(Context context, String contactsInvite) {
83 89 if (null == getView()) {
84 90 return;
... ... @@ -103,8 +109,8 @@ public class SetFriendsRolePresenter extends MvpBasePresenter&lt;SetFriendsRoleView
103 109 return;
104 110 }
105 111 QMUITipDialogUtil.dismessDialog();
106   - AlertUtil.showDeftToast(context,"邀请成功");
107   - EventBus.getDefault().post(new EventMsg(EventMsg.INVIT_FRIEND_SUCCESS,null));
  112 + AlertUtil.showDeftToast(context, "邀请成功");
  113 + EventBus.getDefault().post(new EventMsg(EventMsg.INVIT_FRIEND_SUCCESS, null));
108 114 }
109 115 })
110 116 .setFailureCallback(new FailureCallback() {
... ... @@ -116,7 +122,11 @@ public class SetFriendsRolePresenter extends MvpBasePresenter&lt;SetFriendsRoleView
116 122 return;
117 123 }
118 124 QMUITipDialogUtil.dismessDialog();
119   - AlertUtil.showDeftToast(context,s);
  125 + AlertUtil.showDeftToast(context, s);
  126 + //有角色被占用
  127 + if (i == 4313) {
  128 + EventBus.getDefault().post(new EventMsg(EventMsg.HAS_ROLE_USED, null));
  129 + }
120 130 }
121 131 })
122 132  
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/model/message/EventMsg.java
... ... @@ -8,6 +8,7 @@ public class EventMsg {
8 8 public static final int GO_TO_CHINA_LISTEN_PAGE = 4;//邀请好友成功页面
9 9 public static final int HAS_FRIEND_JOIN_FRIMALY = 5;//有好友加入家庭
10 10 public static final int HAS_FRIEND_REMOVE_FRIMALY = 6;//有好友移除家庭
  11 + public static final int HAS_ROLE_USED = 7;//已经有角色被占用了
11 12  
12 13 private int eventType;
13 14 private Object data;
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/InvitFriendFragment.java
... ... @@ -14,6 +14,11 @@ import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo;
14 14 import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentInvitFriendBinding;
15 15 import com.cnlive.strike.xiaojiaspeaker.frame.presenter.InvitFriendPresenter;
16 16 import com.cnlive.strike.xiaojiaspeaker.frame.view.InvitFriendView;
  17 +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg;
  18 +import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil;
  19 +
  20 +import org.greenrobot.eventbus.Subscribe;
  21 +import org.greenrobot.eventbus.ThreadMode;
17 22  
18 23 /**
19 24 * 二维码邀请加入
... ... @@ -63,4 +68,11 @@ public class InvitFriendFragment extends MvpBindingFragment&lt;InvitFriendView, Inv
63 68  
64 69 }
65 70 }
  71 +
  72 + @Override
  73 + public void onDestroy() {
  74 + super.onDestroy();
  75 + }
  76 +
  77 +
66 78 }
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectIMFriendFragment.java
... ... @@ -20,6 +20,7 @@ import org.greenrobot.eventbus.Subscribe;
20 20 import org.greenrobot.eventbus.ThreadMode;
21 21  
22 22 public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendView, SelectIMFriendPresenter, Object, FragmentSelectImFriendBinding> {
  23 + private String currentSelectFamilyId;
23 24  
24 25 public static SelectIMFriendFragment newInstance(String currentSelectFamilyId) {
25 26 SelectIMFriendFragment fragment = new SelectIMFriendFragment();
... ... @@ -48,7 +49,7 @@ public class SelectIMFriendFragment extends MvpBindingFragment&lt;SelectIMFriendVie
48 49 initTopBar();
49 50 if (null != getMvpView()) {
50 51 if (null != getArguments()) {
51   - String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId");
  52 + currentSelectFamilyId = getArguments().getString("currentSelectFamilyId");
52 53 if (!TextUtils.isEmpty(currentSelectFamilyId)) {
53 54 getMvpView().setCurrentSelectFamilyId(currentSelectFamilyId);
54 55 // getMvpView().initView(null);
... ... @@ -89,5 +90,13 @@ public class SelectIMFriendFragment extends MvpBindingFragment&lt;SelectIMFriendVie
89 90 getActivity().finish();
90 91 }
91 92 }
  93 + //已经有角色被占用,重新刷新列表
  94 + else if (EventMsg.HAS_ROLE_USED == msg.getEventType()) {
  95 + if (null != getMvpView()) {
  96 + if (!TextUtils.isEmpty(currentSelectFamilyId)) {
  97 + getPresenter().getFamilyMember(getActivity(), currentSelectFamilyId);
  98 + }
  99 + }
  100 + }
92 101 }
93 102 }
... ...
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SetFriendsRoleFragment.java
... ... @@ -91,5 +91,11 @@ public class SetFriendsRoleFragment extends MvpBindingFragment&lt;SetFriendsRoleVie
91 91 getActivity().finish();
92 92 }
93 93 }
  94 + //已经有角色被占用
  95 + else if (EventMsg.HAS_ROLE_USED == msg.getEventType()) {
  96 + if (null != getMvpView()) {
  97 + getActivity().finish();
  98 + }
  99 + }
94 100 }
95 101 }
... ...