Commit 31caf67a4452b51baf611d1b985729a3c98495d4

Authored by YangShuai
1 parent 3670128a

1 优化选择联系人逻辑

app/src/main/java/com/cnlive/strike/xiaojiaspeaker/ToolBarTestActivity.java
@@ -40,7 +40,15 @@ public class ToolBarTestActivity extends AppCompatActivity { @@ -40,7 +40,15 @@ public class ToolBarTestActivity extends AppCompatActivity {
40 protected void onCreate(Bundle savedInstanceState) { 40 protected void onCreate(Bundle savedInstanceState) {
41 super.onCreate(savedInstanceState); 41 super.onCreate(savedInstanceState);
42 binding = DataBindingUtil.setContentView(this, R.layout.activity_tool_bar_test); 42 binding = DataBindingUtil.setContentView(this, R.layout.activity_tool_bar_test);
43 - 43 + 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 + });
  51 + }
44 // LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) binding.ivLife.getLayoutParams(); 52 // LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) binding.ivLife.getLayoutParams();
45 // Log.e(TAG, "onCreate: " + params.topMargin); 53 // Log.e(TAG, "onCreate: " + params.topMargin);
46 // YoYo.with(Techniques.Swing) 54 // YoYo.with(Techniques.Swing)
app/src/main/res/layout/activity_tool_bar_test.xml
@@ -12,247 +12,326 @@ @@ -12,247 +12,326 @@
12 12
13 <!----> 13 <!---->
14 <!----> 14 <!---->
15 - <LinearLayout  
16 - android:id="@+id/ll_menu" 15 + <FrameLayout
17 android:layout_width="match_parent" 16 android:layout_width="match_parent"
18 - android:layout_height="40dp"  
19 - android:background="@color/btn_green"  
20 - android:gravity="center|right"> 17 + android:layout_height="wrap_content">
21 18
22 <LinearLayout 19 <LinearLayout
23 - android:id="@+id/ll_search"  
24 - android:layout_width="45dp"  
25 - android:layout_height="match_parent"  
26 - android:layout_marginTop="5dp"  
27 - android:layout_marginBottom="5dp"  
28 - android:clickable="true"  
29 - android:focusable="true"  
30 - android:gravity="center">  
31 -  
32 - <ImageView  
33 - android:layout_width="wrap_content"  
34 - android:layout_height="19dp"  
35 - android:background="@drawable/icon_mian_search"  
36 - android:clickable="false"  
37 - android:focusable="false" />  
38 - </LinearLayout>  
39 -  
40 - <FrameLayout  
41 - android:id="@+id/fl_contact"  
42 - android:layout_width="45dp"  
43 - android:layout_height="match_parent"  
44 - android:layout_marginTop="5dp"  
45 - android:layout_marginBottom="5dp"  
46 - android:clickable="true"  
47 - android:focusable="true">  
48 -  
49 - <FrameLayout  
50 - android:layout_width="wrap_content"  
51 - android:layout_height="wrap_content"  
52 - android:layout_gravity="center"  
53 - android:clickable="false"  
54 - android:focusable="false"> 20 + android:id="@+id/ll_root1"
  21 + android:layout_width="match_parent"
  22 + android:layout_height="70dp"
  23 + android:layout_gravity="bottom"
  24 + android:background="#28D092"
  25 + android:orientation="horizontal"
  26 + android:visibility="gone"
  27 + app:layout_collapseMode="parallax">
  28 +
  29 + <LinearLayout
  30 + android:id="@+id/ll_life1"
  31 + android:layout_width="0dp"
  32 + android:layout_height="match_parent"
  33 + android:layout_weight="1"
  34 + android:gravity="center"
  35 + android:orientation="vertical">
55 36
56 <ImageView 37 <ImageView
57 - android:layout_width="18dp"  
58 - android:layout_height="18dp" 38 + android:id="@+id/iv_life1"
  39 + android:layout_width="55dp"
  40 + android:layout_height="55dp"
59 android:layout_gravity="center" 41 android:layout_gravity="center"
60 - android:background="@drawable/icon_mian_contact"  
61 - android:clickable="false" 42 + android:background="@drawable/icon_mian_life"
62 android:focusable="false" /> 43 android:focusable="false" />
  44 + </LinearLayout>
63 45
64 - </FrameLayout>  
65 - </FrameLayout> 46 + <LinearLayout
  47 + android:id="@+id/ll_sub1"
  48 + android:layout_width="0dp"
  49 + android:layout_height="match_parent"
  50 + android:layout_weight="1"
  51 + android:gravity="center"
66 52
67 - <LinearLayout  
68 - android:id="@+id/ll_add"  
69 - android:layout_width="45dp"  
70 - android:layout_height="match_parent"  
71 - android:layout_marginTop="5dp"  
72 - android:layout_marginRight="5dp"  
73 - android:layout_marginBottom="5dp"  
74 - android:clickable="true"  
75 - android:focusable="true"  
76 - android:gravity="center">  
77 -  
78 - <ImageView  
79 - android:id="@+id/iv_add"  
80 - android:layout_width="18dp"  
81 - android:layout_height="18dp"  
82 - android:background="@drawable/icon_mian_add"  
83 - android:clickable="false"  
84 - android:focusable="false" />  
85 - </LinearLayout>  
86 - </LinearLayout>  
87 - <!---->  
88 - <LinearLayout  
89 - android:layout_width="match_parent"  
90 - android:layout_height="wrap_content"  
91 - android:layout_gravity="bottom"  
92 - android:orientation="horizontal"  
93 - android:visibility="gone"  
94 - app:layout_collapseMode="parallax">  
95 -  
96 - <LinearLayout  
97 - android:layout_width="0dp"  
98 - android:layout_height="wrap_content"  
99 - android:layout_weight="1"  
100 - android:gravity="center"  
101 - android:orientation="vertical"> 53 + android:orientation="vertical">
102 54
103 - <ImageView  
104 - android:layout_width="55dp"  
105 - android:layout_height="55dp"  
106 - android:layout_gravity="center"  
107 - android:background="@drawable/icon_mian_life"  
108 - android:focusable="false" /> 55 + <ImageView
  56 + android:id="@+id/iv_sub1"
  57 + android:layout_width="55dp"
  58 + android:layout_height="55dp"
  59 + android:layout_gravity="center"
  60 + android:background="@drawable/icon_main_subscribe"
  61 + android:focusable="false" />
109 62
110 - <TextView  
111 - android:layout_width="wrap_content"  
112 - android:layout_height="wrap_content"  
113 - android:focusable="false"  
114 - android:text="生活圈"  
115 - android:textColor="@color/color_282828"  
116 - android:textSize="13sp" />  
117 - </LinearLayout> 63 + </LinearLayout>
118 64
119 - <LinearLayout  
120 - android:layout_width="0dp"  
121 - android:layout_height="wrap_content"  
122 - android:layout_weight="1"  
123 - android:gravity="center"  
124 - android:orientation="vertical"> 65 + <LinearLayout
  66 + android:id="@+id/ll_shop1"
  67 + android:layout_width="0dp"
  68 + android:layout_height="match_parent"
  69 + android:layout_weight="1"
  70 + android:gravity="center"
  71 + android:orientation="vertical">
125 72
126 - <ImageView  
127 - android:layout_width="55dp"  
128 - android:layout_height="55dp"  
129 - android:layout_gravity="center"  
130 - android:background="@drawable/icon_main_subscribe"  
131 - android:focusable="false" /> 73 + <ImageView
  74 + android:id="@+id/iv_shop1"
  75 + android:layout_width="55dp"
  76 + android:layout_height="55dp"
  77 + android:layout_gravity="center"
  78 + android:background="@drawable/icon_main_shop"
  79 + android:focusable="false" />
132 80
133 - <TextView  
134 - android:layout_width="wrap_content"  
135 - android:layout_height="wrap_content"  
136 - android:focusable="false"  
137 - android:text="订阅号"  
138 - android:textColor="@color/color_282828"  
139 - android:textSize="13sp" /> 81 + </LinearLayout>
140 </LinearLayout> 82 </LinearLayout>
141 83
  84 + <!-- 下边-->
142 <LinearLayout 85 <LinearLayout
143 - android:layout_width="0dp" 86 + android:id="@+id/ll_bottom_view"
  87 + android:layout_width="match_parent"
144 android:layout_height="wrap_content" 88 android:layout_height="wrap_content"
145 - android:layout_weight="1"  
146 - android:gravity="center"  
147 android:orientation="vertical"> 89 android:orientation="vertical">
148 90
149 - <ImageView  
150 - android:layout_width="55dp"  
151 - android:layout_height="55dp"  
152 - android:layout_gravity="center"  
153 - android:background="@drawable/icon_main_shop"  
154 - android:focusable="false" />  
155 -  
156 - <TextView  
157 - android:layout_width="wrap_content"  
158 - android:layout_height="wrap_content"  
159 - android:focusable="false"  
160 - android:text="优选库"  
161 - android:textColor="@color/color_282828"  
162 - android:textSize="13sp" />  
163 - </LinearLayout>  
164 - </LinearLayout>  
165 -  
166 - <!-- -->  
167 - <LinearLayout  
168 - android:id="@+id/ll_root"  
169 - android:layout_width="match_parent"  
170 - android:layout_height="100dp"  
171 - android:layout_gravity="bottom"  
172 - android:background="@color/color_F2F2F2"  
173 - android:orientation="horizontal"  
174 - app:layout_collapseMode="parallax">  
175 -  
176 - <LinearLayout  
177 - android:id="@+id/ll_life"  
178 - android:layout_width="0dp"  
179 - android:layout_height="match_parent"  
180 - android:layout_weight="1"  
181 - android:gravity="center"  
182 - android:orientation="vertical">  
183 -  
184 - <ImageView  
185 - android:id="@+id/iv_life"  
186 - android:layout_width="55dp"  
187 - android:layout_height="55dp"  
188 - android:layout_gravity="center"  
189 - android:background="@drawable/icon_mian_life"  
190 - android:focusable="false" />  
191 -  
192 - <TextView  
193 - android:id="@+id/tv_circle"  
194 - android:layout_width="wrap_content"  
195 - android:layout_height="wrap_content"  
196 - android:focusable="false"  
197 - android:text="生活圈"  
198 - android:textColor="@color/color_282828"  
199 - android:textSize="13sp" />  
200 - </LinearLayout>  
201 -  
202 - <LinearLayout  
203 - android:id="@+id/ll_sub"  
204 - android:layout_width="0dp"  
205 - android:layout_height="match_parent"  
206 - android:layout_weight="1"  
207 - android:gravity="center"  
208 -  
209 - android:orientation="vertical">  
210 -  
211 - <ImageView  
212 - android:id="@+id/iv_sub"  
213 - android:layout_width="55dp"  
214 - android:layout_height="55dp"  
215 - android:layout_gravity="center"  
216 - android:background="@drawable/icon_main_subscribe"  
217 - android:focusable="false" />  
218 -  
219 - <TextView  
220 - android:id="@+id/tv_sub"  
221 - android:layout_width="wrap_content"  
222 - android:layout_height="wrap_content"  
223 - android:focusable="false"  
224 - android:text="订阅号"  
225 - android:textColor="@color/color_282828"  
226 - android:textSize="13sp" />  
227 - </LinearLayout>  
228 -  
229 - <LinearLayout  
230 - android:id="@+id/ll_shop"  
231 - android:layout_width="0dp"  
232 - android:layout_height="match_parent"  
233 - android:layout_weight="1"  
234 - android:gravity="center"  
235 -  
236 - android:orientation="vertical">  
237 -  
238 - <ImageView  
239 - android:id="@+id/iv_shop"  
240 - android:layout_width="55dp"  
241 - android:layout_height="55dp"  
242 - android:layout_gravity="center"  
243 - android:background="@drawable/icon_main_shop"  
244 - android:focusable="false" />  
245 -  
246 - <TextView  
247 - android:id="@+id/tv_shop"  
248 - android:layout_width="wrap_content" 91 + <LinearLayout
  92 + android:id="@+id/ll_menu"
  93 + android:layout_width="match_parent"
  94 + android:layout_height="40dp"
  95 + android:background="@color/btn_green"
  96 + android:gravity="center|right">
  97 +
  98 + <LinearLayout
  99 + android:id="@+id/ll_search"
  100 + android:layout_width="45dp"
  101 + android:layout_height="match_parent"
  102 + android:layout_marginTop="5dp"
  103 + android:layout_marginBottom="5dp"
  104 + android:clickable="true"
  105 + android:focusable="true"
  106 + android:gravity="center">
  107 +
  108 + <ImageView
  109 + android:layout_width="wrap_content"
  110 + android:layout_height="19dp"
  111 + android:background="@drawable/icon_mian_search"
  112 + android:clickable="false"
  113 + android:focusable="false" />
  114 + </LinearLayout>
  115 +
  116 + <FrameLayout
  117 + android:id="@+id/fl_contact"
  118 + android:layout_width="45dp"
  119 + android:layout_height="match_parent"
  120 + android:layout_marginTop="5dp"
  121 + android:layout_marginBottom="5dp"
  122 + android:clickable="true"
  123 + android:focusable="true">
  124 +
  125 + <FrameLayout
  126 + android:layout_width="wrap_content"
  127 + android:layout_height="wrap_content"
  128 + android:layout_gravity="center"
  129 + android:clickable="false"
  130 + android:focusable="false">
  131 +
  132 + <ImageView
  133 + android:layout_width="18dp"
  134 + android:layout_height="18dp"
  135 + android:layout_gravity="center"
  136 + android:background="@drawable/icon_mian_contact"
  137 + android:clickable="false"
  138 + android:focusable="false" />
  139 +
  140 + </FrameLayout>
  141 + </FrameLayout>
  142 +
  143 + <LinearLayout
  144 + android:id="@+id/ll_add"
  145 + android:layout_width="45dp"
  146 + android:layout_height="match_parent"
  147 + android:layout_marginTop="5dp"
  148 + android:layout_marginRight="5dp"
  149 + android:layout_marginBottom="5dp"
  150 + android:clickable="true"
  151 + android:focusable="true"
  152 + android:gravity="center">
  153 +
  154 + <ImageView
  155 + android:id="@+id/iv_add"
  156 + android:layout_width="18dp"
  157 + android:layout_height="18dp"
  158 + android:background="@drawable/icon_mian_add"
  159 + android:clickable="false"
  160 + android:focusable="false" />
  161 + </LinearLayout>
  162 + </LinearLayout>
  163 + <!---->
  164 + <LinearLayout
  165 + android:layout_width="match_parent"
249 android:layout_height="wrap_content" 166 android:layout_height="wrap_content"
250 - android:focusable="false"  
251 - android:text="优选库"  
252 - android:textColor="@color/color_282828"  
253 - android:textSize="13sp" /> 167 + android:layout_gravity="bottom"
  168 + android:orientation="horizontal"
  169 + android:visibility="gone"
  170 + app:layout_collapseMode="parallax">
  171 +
  172 + <LinearLayout
  173 + android:layout_width="0dp"
  174 + android:layout_height="wrap_content"
  175 + android:layout_weight="1"
  176 + android:gravity="center"
  177 + android:orientation="vertical">
  178 +
  179 + <ImageView
  180 + android:layout_width="55dp"
  181 + android:layout_height="55dp"
  182 + android:layout_gravity="center"
  183 + android:background="@drawable/icon_mian_life"
  184 + android:focusable="false" />
  185 +
  186 + <TextView
  187 + android:layout_width="wrap_content"
  188 + android:layout_height="wrap_content"
  189 + android:focusable="false"
  190 + android:text="生活圈"
  191 + android:textColor="@color/color_282828"
  192 + android:textSize="13sp" />
  193 + </LinearLayout>
  194 +
  195 + <LinearLayout
  196 + android:layout_width="0dp"
  197 + android:layout_height="wrap_content"
  198 + android:layout_weight="1"
  199 + android:gravity="center"
  200 + android:orientation="vertical">
  201 +
  202 + <ImageView
  203 + android:layout_width="55dp"
  204 + android:layout_height="55dp"
  205 + android:layout_gravity="center"
  206 + android:background="@drawable/icon_main_subscribe"
  207 + android:focusable="false" />
  208 +
  209 + <TextView
  210 + android:layout_width="wrap_content"
  211 + android:layout_height="wrap_content"
  212 + android:focusable="false"
  213 + android:text="订阅号"
  214 + android:textColor="@color/color_282828"
  215 + android:textSize="13sp" />
  216 + </LinearLayout>
  217 +
  218 + <LinearLayout
  219 + android:layout_width="0dp"
  220 + android:layout_height="wrap_content"
  221 + android:layout_weight="1"
  222 + android:gravity="center"
  223 + android:orientation="vertical">
  224 +
  225 + <ImageView
  226 + android:layout_width="55dp"
  227 + android:layout_height="55dp"
  228 + android:layout_gravity="center"
  229 + android:background="@drawable/icon_main_shop"
  230 + android:focusable="false" />
  231 +
  232 + <TextView
  233 + android:layout_width="wrap_content"
  234 + android:layout_height="wrap_content"
  235 + android:focusable="false"
  236 + android:text="优选库"
  237 + android:textColor="@color/color_282828"
  238 + android:textSize="13sp" />
  239 + </LinearLayout>
  240 + </LinearLayout>
  241 +
  242 + <!-- -->
  243 + <LinearLayout
  244 + android:id="@+id/ll_root"
  245 + android:layout_width="match_parent"
  246 + android:layout_height="100dp"
  247 + android:layout_gravity="bottom"
  248 + android:layout_margin="10dp"
  249 + android:background="#28D092"
  250 + android:orientation="horizontal"
  251 + app:layout_collapseMode="parallax">
  252 +
  253 + <LinearLayout
  254 + android:id="@+id/ll_life"
  255 + android:layout_width="0dp"
  256 + android:layout_height="match_parent"
  257 + android:layout_weight="1"
  258 + android:gravity="center"
  259 + android:orientation="vertical">
  260 +
  261 + <ImageView
  262 + android:id="@+id/iv_life"
  263 + android:layout_width="55dp"
  264 + android:layout_height="55dp"
  265 + android:layout_gravity="center"
  266 + android:background="@drawable/icon_mian_life"
  267 + android:focusable="false" />
  268 +
  269 + <TextView
  270 + android:id="@+id/tv_circle"
  271 + android:layout_width="wrap_content"
  272 + android:layout_height="wrap_content"
  273 + android:focusable="false"
  274 + android:text="生活圈"
  275 + android:textColor="@color/color_282828"
  276 + android:textSize="13sp" />
  277 + </LinearLayout>
  278 +
  279 + <LinearLayout
  280 + android:id="@+id/ll_sub"
  281 + android:layout_width="0dp"
  282 + android:layout_height="match_parent"
  283 + android:layout_weight="1"
  284 + android:gravity="center"
  285 +
  286 + android:orientation="vertical">
  287 +
  288 + <ImageView
  289 + android:id="@+id/iv_sub"
  290 + android:layout_width="55dp"
  291 + android:layout_height="55dp"
  292 + android:layout_gravity="center"
  293 + android:background="@drawable/icon_main_subscribe"
  294 + android:focusable="false" />
  295 +
  296 + <TextView
  297 + android:id="@+id/tv_sub"
  298 + android:layout_width="wrap_content"
  299 + android:layout_height="wrap_content"
  300 + android:focusable="false"
  301 + android:text="订阅号"
  302 + android:textColor="@color/color_282828"
  303 + android:textSize="13sp" />
  304 + </LinearLayout>
  305 +
  306 + <LinearLayout
  307 + android:id="@+id/ll_shop"
  308 + android:layout_width="0dp"
  309 + android:layout_height="match_parent"
  310 + android:layout_weight="1"
  311 + android:gravity="center"
  312 +
  313 + android:orientation="vertical">
  314 +
  315 + <ImageView
  316 + android:id="@+id/iv_shop"
  317 + android:layout_width="55dp"
  318 + android:layout_height="55dp"
  319 + android:layout_gravity="center"
  320 + android:background="@drawable/icon_main_shop"
  321 + android:focusable="false" />
  322 +
  323 + <TextView
  324 + android:id="@+id/tv_shop"
  325 + android:layout_width="wrap_content"
  326 + android:layout_height="wrap_content"
  327 + android:focusable="false"
  328 + android:text="优选库"
  329 + android:textColor="@color/color_282828"
  330 + android:textSize="13sp" />
  331 + </LinearLayout>
  332 + </LinearLayout>
254 </LinearLayout> 333 </LinearLayout>
255 - </LinearLayout> 334 + </FrameLayout>
256 <!-- --> 335 <!-- -->
257 336
258 <android.support.v4.widget.NestedScrollView 337 <android.support.v4.widget.NestedScrollView
module_xiaojiaSoundBox/src/main/AndroidManifest.xml
@@ -17,9 +17,10 @@ @@ -17,9 +17,10 @@
17 <uses-permission android:name="android.permission.INTERNET" /> 17 <uses-permission android:name="android.permission.INTERNET" />
18 18
19 <application> 19 <application>
20 - <activity android:name=".ui.activity.ShareFriendActivity"/> 20 + <activity android:name=".ui.activity.RemoteControlActivity"></activity>
  21 + <activity android:name=".ui.activity.ShareFriendActivity" />
21 <activity android:name=".ui.activity.InvitFriendActivity" /> 22 <activity android:name=".ui.activity.InvitFriendActivity" />
22 - <activity android:name=".ui.activity.DeviceInfoActivity"></activity> 23 + <activity android:name=".ui.activity.DeviceInfoActivity" />
23 <activity android:name=".ui.activity.UserManagerActivity" /> 24 <activity android:name=".ui.activity.UserManagerActivity" />
24 <activity android:name=".ui.activity.ChangeDeviceNameActivity" /> 25 <activity android:name=".ui.activity.ChangeDeviceNameActivity" />
25 <activity android:name=".ui.activity.DeviceDetailActivity" /> 26 <activity android:name=".ui.activity.DeviceDetailActivity" />
@@ -37,7 +38,7 @@ @@ -37,7 +38,7 @@
37 <activity android:name=".ui.activity.SearchDeviceActivity" /> 38 <activity android:name=".ui.activity.SearchDeviceActivity" />
38 <activity android:name=".ui.activity.SpeakerMainActivity" /> 39 <activity android:name=".ui.activity.SpeakerMainActivity" />
39 <activity android:name=".ui.activity.BluetoothConnActivity" /> 40 <activity android:name=".ui.activity.BluetoothConnActivity" />
40 - <activity android:name=".ui.activity.ChangeWifiActivity"/> 41 + <activity android:name=".ui.activity.ChangeWifiActivity" />
41 </application> 42 </application>
42 43
43 </manifest> 44 </manifest>
44 \ No newline at end of file 45 \ No newline at end of file
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/SetFriendsRolePresenter.java
@@ -42,7 +42,7 @@ public class SetFriendsRolePresenter extends MvpBasePresenter&lt;SetFriendsRoleView @@ -42,7 +42,7 @@ public class SetFriendsRolePresenter extends MvpBasePresenter&lt;SetFriendsRoleView
42 bean1.setType("2"); 42 bean1.setType("2");
43 bean1.setContactsInvite(GsonUtil.jsonToList(contactsInvite, InvitFamilyBean1.ContactsInviteBean.class)); 43 bean1.setContactsInvite(GsonUtil.jsonToList(contactsInvite, InvitFamilyBean1.ContactsInviteBean.class));
44 44
45 - CmccRequest.getInstance(ApiServiceCMCC.class) 45 + CmccRequest.getInstance(context,ApiServiceCMCC.class)
46 .invitFamilyMember(bean1) 46 .invitFamilyMember(bean1)
47 .enqueue(new Callback<APIBaseInfo>() { 47 .enqueue(new Callback<APIBaseInfo>() {
48 @Override 48 @Override
@@ -79,19 +79,19 @@ public class SetFriendsRolePresenter extends MvpBasePresenter&lt;SetFriendsRoleView @@ -79,19 +79,19 @@ public class SetFriendsRolePresenter extends MvpBasePresenter&lt;SetFriendsRoleView
79 return; 79 return;
80 } 80 }
81 QMUITipDialogUtil.loadingDialog(context, "请稍后", true); 81 QMUITipDialogUtil.loadingDialog(context, "请稍后", true);
82 -// Map<String, RequestBody> map = new HashMap<>();  
83 -// map.put("type", getRequestString("2"));//联系人邀请  
84 -// map.put("contactsInvite", getRequestString(contactsInvite));  
85 - InvitFamilyBean1 bean1=new InvitFamilyBean1();  
86 - bean1.setType("2");  
87 - bean1.setContactsInvite(GsonUtil.jsonToList(contactsInvite, InvitFamilyBean1.ContactsInviteBean.class));  
88 - String test=GsonUtil.GsonString(bean1);  
89 - RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"),test);  
90 - Logic.create(bean1)  
91 - .action(new Logic.Action<RequestBody , APIBaseInfo>() { 82 + Map<String, String> map = new HashMap<>();
  83 + map.put("type","2");//联系人邀请
  84 + map.put("contactsInvite", contactsInvite);
  85 +// InvitFamilyBean1 bean1=new InvitFamilyBean1();
  86 +// bean1.setType("2");
  87 +// bean1.setContactsInvite(GsonUtil.jsonToList(contactsInvite, InvitFamilyBean1.ContactsInviteBean.class));
  88 +// String test=GsonUtil.GsonString(bean1);
  89 +// RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"),test);
  90 + Logic.create(map)
  91 + .action(new Logic.Action< Map<String, String> , APIBaseInfo>() {
92 @Override 92 @Override
93 - public Disposable action(RequestBody invitFamilyBean1, DataCallback<APIBaseInfo> dataCallback) {  
94 - return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.invitFamilyMember(invitFamilyBean1)).subscribe(context, dataCallback); 93 + public Disposable action(Map<String, String> map , DataCallback<APIBaseInfo> dataCallback) {
  94 + return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.invitFamilyMember(map)).subscribe(context, dataCallback);
95 } 95 }
96 }).<APIBaseInfo>event() 96 }).<APIBaseInfo>event()
97 .setSuccessCallback(new SuccessCallback<APIBaseInfo>() { 97 .setSuccessCallback(new SuccessCallback<APIBaseInfo>() {
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectIMFriendView.java
@@ -75,8 +75,8 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect @@ -75,8 +75,8 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect
75 return; 75 return;
76 } 76 }
77 for (int i = 0; i < var1.size(); i++) { 77 for (int i = 0; i < var1.size(); i++) {
  78 + IMFriendNoLetterInfo noLetterInfo = new IMFriendNoLetterInfo();
78 for (int j = 0; j < hasSelectList.size(); j++) { 79 for (int j = 0; j < hasSelectList.size(); j++) {
79 - IMFriendNoLetterInfo noLetterInfo = new IMFriendNoLetterInfo();  
80 //不可选中 80 //不可选中
81 if (hasSelectList.get(j).equals(var1.get(i).getFriendId())) { 81 if (hasSelectList.get(j).equals(var1.get(i).getFriendId())) {
82 noLetterInfo.setUserName(var1.get(i).getFriendNickName()); 82 noLetterInfo.setUserName(var1.get(i).getFriendNickName());
@@ -88,11 +88,11 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect @@ -88,11 +88,11 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect
88 noLetterInfo.setCantSelect(false); 88 noLetterInfo.setCantSelect(false);
89 noLetterInfo.setId(var1.get(i).getFriendId()); 89 noLetterInfo.setId(var1.get(i).getFriendId());
90 } 90 }
91 - noLetterInfoList.add(noLetterInfo);  
92 - //设置  
93 - initView(noLetterInfoList);  
94 - }  
95 91
  92 + }
  93 + noLetterInfoList.add(noLetterInfo);
  94 + //设置
  95 + initView(noLetterInfoList);
96 } 96 }
97 97
98 98
@@ -104,80 +104,80 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect @@ -104,80 +104,80 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect
104 //设置按钮不可点击 104 //设置按钮不可点击
105 nextBtnCanNotClick(); 105 nextBtnCanNotClick();
106 //假设这个是原有数据 106 //假设这个是原有数据
107 -// this.noLetterInfoList = noLetterInfoList;  
108 -  
109 - this.noLetterInfoList=new ArrayList<>();  
110 - IMFriendNoLetterInfo noLetterInfo = new IMFriendNoLetterInfo();  
111 - noLetterInfo.setUserName("韩亚云");  
112 - noLetterInfo.setCantSelect(true);  
113 - noLetterInfo.setId("352660");  
114 - noLetterInfoList.add(noLetterInfo);  
115 -  
116 - noLetterInfo = new IMFriendNoLetterInfo();  
117 - noLetterInfo.setUserName("杨帅");  
118 - noLetterInfo.setId("352668");  
119 - noLetterInfoList.add(noLetterInfo);  
120 -  
121 - noLetterInfo = new IMFriendNoLetterInfo();  
122 - noLetterInfo.setUserName("杨杨");  
123 - noLetterInfo.setId("352700");  
124 - noLetterInfoList.add(noLetterInfo);  
125 -  
126 - noLetterInfo = new IMFriendNoLetterInfo();  
127 - noLetterInfo.setUserName("杨天");  
128 - noLetterInfo.setId("352782");  
129 - noLetterInfoList.add(noLetterInfo);  
130 -  
131 - noLetterInfo = new IMFriendNoLetterInfo();  
132 - noLetterInfo.setUserName("郭瑞鹏");  
133 - noLetterInfo.setId("352898");  
134 - noLetterInfoList.add(noLetterInfo);  
135 -  
136 - noLetterInfo = new IMFriendNoLetterInfo();  
137 - noLetterInfo.setUserName("殷巧娟");  
138 - noLetterInfo.setId("353001");  
139 - noLetterInfoList.add(noLetterInfo);  
140 -  
141 - noLetterInfo = new IMFriendNoLetterInfo();  
142 - noLetterInfo.setUserName("张晓文");  
143 - noLetterInfo.setId("353036");  
144 - noLetterInfoList.add(noLetterInfo);  
145 -  
146 -  
147 - noLetterInfo = new IMFriendNoLetterInfo();  
148 - noLetterInfo.setUserName("小明");  
149 - noLetterInfo.setId("353360");  
150 - noLetterInfoList.add(noLetterInfo);  
151 -  
152 - noLetterInfo = new IMFriendNoLetterInfo();  
153 - noLetterInfo.setUserName("小红");  
154 - noLetterInfo.setId("353417");  
155 - noLetterInfoList.add(noLetterInfo);  
156 -  
157 - noLetterInfo = new IMFriendNoLetterInfo();  
158 - noLetterInfo.setUserName("小绿");  
159 - noLetterInfo.setId("353557");  
160 - noLetterInfoList.add(noLetterInfo);  
161 -  
162 - noLetterInfo = new IMFriendNoLetterInfo();  
163 - noLetterInfo.setUserName("小黄");  
164 - noLetterInfo.setId("353651");  
165 - noLetterInfoList.add(noLetterInfo);  
166 -  
167 - noLetterInfo = new IMFriendNoLetterInfo();  
168 - noLetterInfo.setUserName("张三");  
169 - noLetterInfo.setId("353728");  
170 - noLetterInfoList.add(noLetterInfo);  
171 -  
172 - noLetterInfo = new IMFriendNoLetterInfo();  
173 - noLetterInfo.setUserName("李四");  
174 - noLetterInfo.setId("353777");  
175 - noLetterInfoList.add(noLetterInfo);  
176 -  
177 - noLetterInfo = new IMFriendNoLetterInfo();  
178 - noLetterInfo.setUserName("王五");  
179 - noLetterInfo.setId("353789");  
180 - noLetterInfoList.add(noLetterInfo); 107 + this.noLetterInfoList = noLetterInfoList;
  108 +
  109 +// this.noLetterInfoList=new ArrayList<>();
  110 +// IMFriendNoLetterInfo noLetterInfo = new IMFriendNoLetterInfo();
  111 +// noLetterInfo.setUserName("韩亚云");
  112 +// noLetterInfo.setCantSelect(true);
  113 +// noLetterInfo.setId("352660");
  114 +// noLetterInfoList.add(noLetterInfo);
  115 +//
  116 +// noLetterInfo = new IMFriendNoLetterInfo();
  117 +// noLetterInfo.setUserName("杨帅");
  118 +// noLetterInfo.setId("352668");
  119 +// noLetterInfoList.add(noLetterInfo);
  120 +//
  121 +// noLetterInfo = new IMFriendNoLetterInfo();
  122 +// noLetterInfo.setUserName("杨杨");
  123 +// noLetterInfo.setId("352700");
  124 +// noLetterInfoList.add(noLetterInfo);
  125 +//
  126 +// noLetterInfo = new IMFriendNoLetterInfo();
  127 +// noLetterInfo.setUserName("杨天");
  128 +// noLetterInfo.setId("352782");
  129 +// noLetterInfoList.add(noLetterInfo);
  130 +//
  131 +// noLetterInfo = new IMFriendNoLetterInfo();
  132 +// noLetterInfo.setUserName("郭瑞鹏");
  133 +// noLetterInfo.setId("352898");
  134 +// noLetterInfoList.add(noLetterInfo);
  135 +//
  136 +// noLetterInfo = new IMFriendNoLetterInfo();
  137 +// noLetterInfo.setUserName("殷巧娟");
  138 +// noLetterInfo.setId("353001");
  139 +// noLetterInfoList.add(noLetterInfo);
  140 +//
  141 +// noLetterInfo = new IMFriendNoLetterInfo();
  142 +// noLetterInfo.setUserName("张晓文");
  143 +// noLetterInfo.setId("353036");
  144 +// noLetterInfoList.add(noLetterInfo);
  145 +//
  146 +//
  147 +// noLetterInfo = new IMFriendNoLetterInfo();
  148 +// noLetterInfo.setUserName("小明");
  149 +// noLetterInfo.setId("353360");
  150 +// noLetterInfoList.add(noLetterInfo);
  151 +//
  152 +// noLetterInfo = new IMFriendNoLetterInfo();
  153 +// noLetterInfo.setUserName("小红");
  154 +// noLetterInfo.setId("353417");
  155 +// noLetterInfoList.add(noLetterInfo);
  156 +//
  157 +// noLetterInfo = new IMFriendNoLetterInfo();
  158 +// noLetterInfo.setUserName("小绿");
  159 +// noLetterInfo.setId("353557");
  160 +// noLetterInfoList.add(noLetterInfo);
  161 +//
  162 +// noLetterInfo = new IMFriendNoLetterInfo();
  163 +// noLetterInfo.setUserName("小黄");
  164 +// noLetterInfo.setId("353651");
  165 +// noLetterInfoList.add(noLetterInfo);
  166 +//
  167 +// noLetterInfo = new IMFriendNoLetterInfo();
  168 +// noLetterInfo.setUserName("张三");
  169 +// noLetterInfo.setId("353728");
  170 +// noLetterInfoList.add(noLetterInfo);
  171 +//
  172 +// noLetterInfo = new IMFriendNoLetterInfo();
  173 +// noLetterInfo.setUserName("李四");
  174 +// noLetterInfo.setId("353777");
  175 +// noLetterInfoList.add(noLetterInfo);
  176 +//
  177 +// noLetterInfo = new IMFriendNoLetterInfo();
  178 +// noLetterInfo.setUserName("王五");
  179 +// noLetterInfo.setId("353789");
  180 +// noLetterInfoList.add(noLetterInfo);
181 181
182 182
183 //对数据进行排序 183 //对数据进行排序
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/ApiServiceXiaoJia.java
@@ -6,6 +6,7 @@ import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; @@ -6,6 +6,7 @@ import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean;
6 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyRoleBean; 6 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyRoleBean;
7 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.InvitFamilyBean1; 7 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.InvitFamilyBean1;
8 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; 8 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean;
  9 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RemoteControlBean;
9 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RoleNetBean; 10 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RoleNetBean;
10 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo; 11 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo;
11 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.XiaoJiaContactInfo; 12 import com.cnlive.strike.xiaojiaspeaker.netWork.bean.XiaoJiaContactInfo;
@@ -149,8 +150,30 @@ public interface ApiServiceXiaoJia { @@ -149,8 +150,30 @@ public interface ApiServiceXiaoJia {
149 * @return 150 * @return
150 */ 151 */
151 @POST("/Daren/sound/familyGroupInviteYD.action") 152 @POST("/Daren/sound/familyGroupInviteYD.action")
152 - @Headers({"Content-Type: application/json","Accept: application/json"})//需要添加头 153 + @Headers({"Content-Type: application/json", "Accept: application/json"})
  154 +//需要添加头
153 // @Multipart 155 // @Multipart
154 - Observable<Result<APIBaseInfo>> invitFamilyMember( @Body RequestBody body); 156 + Observable<Result<APIBaseInfo>> invitFamilyMember(@QueryMap() Map<String, String> map );
  157 +
  158 + /**
  159 + * 获取远程开关状态
  160 + * sid String true sid
  161 + *
  162 + * @param maps
  163 + * @return
  164 + */
  165 + @POST("/Daren/sound/getRemoteControlStatus.action")
  166 + Observable<Result<APIBaseInfo<RemoteControlBean>>> getRemoteControlStatus(@QueryMap() Map<String, String> maps);
  167 +
  168 + /**
  169 + * 设备远程控制开关
  170 + * sid String true sid
  171 + * type String true "0":开启 "1": 关闭
  172 + *
  173 + * @param maps
  174 + * @return
  175 + */
  176 + @POST("/Daren/sound/remoteControlStatus.action")
  177 + Observable<Result<APIBaseInfo>> setRemoteControlStatus(@QueryMap() Map<String, String> maps);
155 } 178 }
156 179
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/CmccRequest.java
1 package com.cnlive.strike.xiaojiaspeaker.netWork; 1 package com.cnlive.strike.xiaojiaspeaker.netWork;
2 2
  3 +import android.app.Activity;
  4 +
  5 +import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo;
3 import com.cnlive.strike.xiaojiaspeaker.netWork.result.ConfigDeviceNetResult; 6 import com.cnlive.strike.xiaojiaspeaker.netWork.result.ConfigDeviceNetResult;
4 7
5 import java.io.IOException; 8 import java.io.IOException;
@@ -26,13 +29,9 @@ public class CmccRequest { @@ -26,13 +29,9 @@ public class CmccRequest {
26 public static final int ERROR_5 = -5;//更新数据失败 29 public static final int ERROR_5 = -5;//更新数据失败
27 public static final int SUCCRSS = 0;//成功 30 public static final int SUCCRSS = 0;//成功
28 31
29 - public static ApiServiceCMCC getInstance(Class<ApiServiceCMCC> mclass) { 32 + public static ApiServiceCMCC getInstance(Activity context, Class<ApiServiceCMCC> mclass) {
30 if (null == retrofit) { 33 if (null == retrofit) {
31 - BasicParamsInterceptor basicParamsInterceptor = new BasicParamsInterceptor.Builder()  
32 - .addQueryParam("loginSid", "10510277") //添加公共参数到 post 请求体  
33 - .addHeaderParam("Content-Type", "application/json;charset=UTF-8")  
34 -// .addQueryParam("version","1") // 添加公共版本号,加在 URL 后面  
35 - .build(); 34 +
36 // 创建Retrofit对象 35 // 创建Retrofit对象
37 retrofit = new Retrofit.Builder() 36 retrofit = new Retrofit.Builder()
38 .baseUrl(CMCC_API_REA_URL)//设置网络请求url,后面一段写在网络请求接口里面 37 .baseUrl(CMCC_API_REA_URL)//设置网络请求url,后面一段写在网络请求接口里面
@@ -47,10 +46,15 @@ public class CmccRequest { @@ -47,10 +46,15 @@ public class CmccRequest {
47 // return chain.proceed(request); 46 // return chain.proceed(request);
48 // } 47 // }
49 // }).build()) 48 // }).build())
50 - .client(new OkHttpClient.Builder().addInterceptor(basicParamsInterceptor).build()) 49 + .client(new OkHttpClient.Builder().addInterceptor(new BasicParamsInterceptor.Builder()
  50 + .addQueryParam("loginSid", XiaoJIaCommInfo.getUserId(context)) //添加公共参数到 post 请求体
  51 + .addHeaderParam("Content-Type", "application/json;charset=UTF-8")
  52 + .build()).build())
51 // .client(new OkHttpClient.Builder().addInterceptor(basicParamsInterceptor)) 53 // .client(new OkHttpClient.Builder().addInterceptor(basicParamsInterceptor))
52 .build(); 54 .build();
53 } 55 }
54 return retrofit.create(mclass); 56 return retrofit.create(mclass);
55 } 57 }
  58 +
  59 +
56 } 60 }
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/RemoteControlBean.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker.netWork.bean;
  2 +
  3 +public class RemoteControlBean {
  4 +
  5 + /**
  6 + * remoteControlStatus : false
  7 + */
  8 +
  9 + private boolean remoteControlStatus;
  10 +
  11 + public boolean isRemoteControlStatus() {
  12 + return remoteControlStatus;
  13 + }
  14 +
  15 + public void setRemoteControlStatus(boolean remoteControlStatus) {
  16 + this.remoteControlStatus = remoteControlStatus;
  17 + }
  18 +}
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/RemoteControlActivity.java 0 → 100644
  1 +package com.cnlive.strike.xiaojiaspeaker.ui.activity;
  2 +
  3 +import android.app.Activity;
  4 +import android.content.Context;
  5 +import android.content.Intent;
  6 +import android.databinding.DataBindingUtil;
  7 +import android.support.v4.content.ContextCompat;
  8 +import android.support.v7.app.AppCompatActivity;
  9 +import android.os.Bundle;
  10 +import android.util.Log;
  11 +import android.view.View;
  12 +import android.widget.CompoundButton;
  13 +
  14 +import com.cnlive.libs.base.logic.Logic;
  15 +import com.cnlive.libs.base.logic.callback.DataCallback;
  16 +import com.cnlive.libs.base.logic.callback.FailureCallback;
  17 +import com.cnlive.libs.base.logic.callback.SuccessCallback;
  18 +import com.cnlive.libs.base.util.StatusBarUtil;
  19 +import com.cnlive.libs.base.util.StatusBarUtil2;
  20 +import com.cnlive.strike.xiaojiaspeaker.R;
  21 +import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo;
  22 +import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityRemoteControlBinding;
  23 +import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia;
  24 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo;
  25 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RemoteControlBean;
  26 +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.RoleNetBean;
  27 +import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest;
  28 +import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil;
  29 +
  30 +import java.util.HashMap;
  31 +import java.util.Map;
  32 +
  33 +import io.reactivex.disposables.Disposable;
  34 +
  35 +/**
  36 + * 远程控制
  37 + */
  38 +public class RemoteControlActivity extends AppCompatActivity {
  39 + private ActivityRemoteControlBinding binding;
  40 + private static final String TAG = "RemoteControlActivity";
  41 +
  42 + @Override
  43 + protected void onCreate(Bundle savedInstanceState) {
  44 + super.onCreate(savedInstanceState);
  45 + binding = DataBindingUtil.setContentView(this, R.layout.activity_remote_control);
  46 + initTopBar();
  47 + initView();
  48 + getRemoteControlStatus(this, XiaoJIaCommInfo.getUserId(this));
  49 + }
  50 +
  51 + private void initView() {
  52 + binding.sbSwitch.setOnClickListener(new View.OnClickListener() {
  53 + @Override
  54 + public void onClick(View v) {
  55 + String type = "1";
  56 + //"0":开启 "1": 关闭
  57 + if (binding.sbSwitch.isChecked()) {
  58 + type = "0";
  59 + }
  60 + setRemoteControlStatus(RemoteControlActivity.this, XiaoJIaCommInfo.getUserId(RemoteControlActivity.this), type);
  61 + }
  62 + });
  63 + }
  64 +
  65 + private void initTopBar() {
  66 + StatusBarUtil.setStatusBarWrite(this);
  67 + StatusBarUtil2.setColor(this, ContextCompat.getColor(this, R.color.white), 0);
  68 + if (null != binding) {
  69 + binding.topbar.setTitle("远程控制管理");
  70 + //设置返回按钮
  71 + binding.topbar.addLeftImageButton(R.drawable.icon_back, R.id.left_back).setOnClickListener(new View.OnClickListener() {
  72 + @Override
  73 + public void onClick(View view) {
  74 + finish();
  75 + }
  76 + });
  77 + }
  78 + }
  79 +
  80 + public static void startActivity(Activity activity) {
  81 + activity.startActivity(new Intent(activity, RemoteControlActivity.class));
  82 + }
  83 +
  84 +
  85 + /**
  86 + * 显示loading
  87 + */
  88 + public void showLoadingView() {
  89 + if (binding.emptyLayout == null) {
  90 + return;
  91 + }
  92 + binding.emptyLayout.show(true);
  93 + }
  94 +
  95 + /**
  96 + * 隐藏loading
  97 + */
  98 + public void hideLoadingView() {
  99 + if (binding.emptyLayout == null) {
  100 + return;
  101 + }
  102 + binding.emptyLayout.hide();
  103 + }
  104 +
  105 + /**
  106 + * 显示重试页面
  107 + *
  108 + * @param errorCode
  109 + * @param listener
  110 + */
  111 + public void showRetryView(int errorCode, View.OnClickListener listener) {
  112 + //显示空视图
  113 + binding.emptyLayout.setVisibility(View.VISIBLE);
  114 +
  115 + if (binding.emptyLayout == null) return;
  116 + String titleText = "";
  117 + String detailText = "";
  118 + if (errorCode == -3) {
  119 + titleText = getString(R.string.msg_failed_network_title);
  120 + detailText = getString(R.string.msg_failed_network_detail);
  121 + } else {
  122 + titleText = getString(R.string.msg_failed_other_title);
  123 + detailText = getString(R.string.msg_failed_other_detail);
  124 + }
  125 + binding.emptyLayout.show(false, titleText, detailText, getString(R.string.retry), R.drawable.wufalianjie, listener);
  126 + }
  127 +
  128 + public void setRemoteBtnState(boolean isOpen) {
  129 + binding.sbSwitch.setChecked(isOpen);
  130 + }
  131 +
  132 + /**
  133 + * 获取按钮状态
  134 + *
  135 + * @param context
  136 + */
  137 + public void getRemoteControlStatus(Context context, String sid) {
  138 + showLoadingView();
  139 + Map<String, String> map = new HashMap<>();
  140 + map.put("sid", sid);
  141 + Logic.create(map)
  142 + .action(new Logic.Action<Map<String, String>, APIBaseInfo<RemoteControlBean>>() {
  143 + @Override
  144 + public Disposable action(Map<String, String> paramsMap, DataCallback<APIBaseInfo<RemoteControlBean>> dataCallback) {
  145 + return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.getRemoteControlStatus(paramsMap)).subscribe(context, dataCallback);
  146 + }
  147 + }).<APIBaseInfo<RemoteControlBean>>event()
  148 + .setSuccessCallback(new SuccessCallback<APIBaseInfo<RemoteControlBean>>() {
  149 + @Override
  150 + public void onSuccess(APIBaseInfo<RemoteControlBean> baseInfo) {
  151 + Log.e(TAG, "onSuccess: ");
  152 + if (null == binding) {
  153 + return;
  154 + }
  155 + hideLoadingView();
  156 + setRemoteBtnState(baseInfo.getData().isRemoteControlStatus());
  157 + }
  158 + })
  159 + .setFailureCallback(new FailureCallback() {
  160 + @Override
  161 + public void onFailure(int i, String s) {
  162 + if (null == binding) {
  163 + return;
  164 + }
  165 + //显示重试
  166 + hideLoadingView();
  167 + showRetryView(i, new View.OnClickListener() {
  168 + @Override
  169 + public void onClick(View view) {
  170 + getRemoteControlStatus(context, sid);
  171 + }
  172 + });
  173 + }
  174 + })
  175 +
  176 + .start();
  177 + }
  178 +
  179 +
  180 + /**
  181 + * 设置远程开关状态
  182 + *
  183 + * @param context
  184 + * @param sid
  185 + * @param type
  186 + */
  187 + public void setRemoteControlStatus(Context context, String sid, String type) {
  188 + QMUITipDialogUtil.loadingDialog(context, "请稍后...", false);
  189 + Map<String, String> map = new HashMap<>();
  190 + map.put("sid", sid);
  191 + map.put("type", type);
  192 + Logic.create(map)
  193 + .action(new Logic.Action<Map<String, String>, APIBaseInfo>() {
  194 + @Override
  195 + public Disposable action(Map<String, String> paramsMap, DataCallback<APIBaseInfo> dataCallback) {
  196 + return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.setRemoteControlStatus(paramsMap)).subscribe(context, dataCallback);
  197 + }
  198 + }).<APIBaseInfo>event()
  199 + .setSuccessCallback(new SuccessCallback<APIBaseInfo>() {
  200 + @Override
  201 + public void onSuccess(APIBaseInfo baseInfo) {
  202 + Log.e(TAG, "onSuccess: ");
  203 + if (null == binding) {
  204 + return;
  205 + }
  206 + QMUITipDialogUtil.dismessDialog();
  207 + }
  208 + })
  209 + .setFailureCallback(new FailureCallback() {
  210 + @Override
  211 + public void onFailure(int i, String s) {
  212 + if (null == binding) {
  213 + return;
  214 + }
  215 + setRemoteBtnState(false);
  216 + //显示重试
  217 + QMUITipDialogUtil.dismessDialog();
  218 + QMUITipDialogUtil.failedDialog(context, s, 1);
  219 + }
  220 + })
  221 +
  222 + .start();
  223 + }
  224 +}
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/AllDeviceFragment.java
@@ -17,6 +17,7 @@ import com.cnlive.strike.xiaojiaspeaker.frame.presenter.AllDeviceFragmentPresent @@ -17,6 +17,7 @@ import com.cnlive.strike.xiaojiaspeaker.frame.presenter.AllDeviceFragmentPresent
17 import com.cnlive.strike.xiaojiaspeaker.frame.view.AllDeviceFragmentView; 17 import com.cnlive.strike.xiaojiaspeaker.frame.view.AllDeviceFragmentView;
18 import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; 18 import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg;
19 import com.cnlive.strike.xiaojiaspeaker.ui.activity.BlueToothStep1Activity; 19 import com.cnlive.strike.xiaojiaspeaker.ui.activity.BlueToothStep1Activity;
  20 +import com.cnlive.strike.xiaojiaspeaker.ui.activity.RemoteControlActivity;
20 import com.cnlive.strike.xiaojiaspeaker.ui.widget.popmenu.PopMenuInfo; 21 import com.cnlive.strike.xiaojiaspeaker.ui.widget.popmenu.PopMenuInfo;
21 import com.cnlive.strike.xiaojiaspeaker.ui.widget.popmenu.PopMenu; 22 import com.cnlive.strike.xiaojiaspeaker.ui.widget.popmenu.PopMenu;
22 import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; 23 import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil;
@@ -92,6 +93,8 @@ public class AllDeviceFragment extends MvpBindingFragment&lt;AllDeviceFragmentView, @@ -92,6 +93,8 @@ public class AllDeviceFragment extends MvpBindingFragment&lt;AllDeviceFragmentView,
92 getActivity().finish(); 93 getActivity().finish();
93 } 94 }
94 }); 95 });
  96 +
  97 +
95 //添加设备按钮 98 //添加设备按钮
96 addButton = binding.topbar.addRightImageButton(R.drawable.icon_item_add, R.id.right_add); 99 addButton = binding.topbar.addRightImageButton(R.drawable.icon_item_add, R.id.right_add);
97 addButton.setOnClickListener(new View.OnClickListener() { 100 addButton.setOnClickListener(new View.OnClickListener() {
@@ -104,6 +107,14 @@ public class AllDeviceFragment extends MvpBindingFragment&lt;AllDeviceFragmentView, @@ -104,6 +107,14 @@ public class AllDeviceFragment extends MvpBindingFragment&lt;AllDeviceFragmentView,
104 } 107 }
105 } 108 }
106 }); 109 });
  110 + //控制
  111 + binding.topbar.addRightImageButton(R.drawable.icon_xiaojia_menu, R.id.right_menu).setOnClickListener(new View.OnClickListener() {
  112 + @Override
  113 + public void onClick(View v) {
  114 + //远程控制
  115 + RemoteControlActivity.startActivity(getActivity());
  116 + }
  117 + });
107 118
108 } 119 }
109 } 120 }
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectIMFriendFragment.java
@@ -50,8 +50,8 @@ public class SelectIMFriendFragment extends MvpBindingFragment&lt;SelectIMFriendVie @@ -50,8 +50,8 @@ public class SelectIMFriendFragment extends MvpBindingFragment&lt;SelectIMFriendVie
50 String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); 50 String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId");
51 if (!TextUtils.isEmpty(currentSelectFamilyId)) { 51 if (!TextUtils.isEmpty(currentSelectFamilyId)) {
52 getMvpView().setCurrentSelectFamilyId(currentSelectFamilyId); 52 getMvpView().setCurrentSelectFamilyId(currentSelectFamilyId);
53 - getMvpView().initView(null);  
54 -// getPresenter().getFamilyMember(getActivity(), currentSelectFamilyId); 53 +// getMvpView().initView(null);
  54 + getPresenter().getFamilyMember(getActivity(), currentSelectFamilyId);
55 } 55 }
56 } 56 }
57 57
module_xiaojiaSoundBox/src/main/res/drawable-hdpi/icon_xiaojia_menu.png 0 → 100644

1.05 KB

module_xiaojiaSoundBox/src/main/res/drawable-xhdpi/icon_xiaojia_menu.png 0 → 100644

1.27 KB

module_xiaojiaSoundBox/src/main/res/drawable-xxhdpi/icon_xiaojia_menu.png 0 → 100644

1.91 KB

module_xiaojiaSoundBox/src/main/res/layout/activity_remote_control.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<layout>
  3 +
  4 + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5 + xmlns:app="http://schemas.android.com/apk/res-auto"
  6 + xmlns:tools="http://schemas.android.com/tools"
  7 + android:layout_width="match_parent"
  8 + android:layout_height="match_parent"
  9 + android:background="@color/color_F2F2F2"
  10 + android:orientation="vertical"
  11 + tools:context=".ui.activity.RemoteControlActivity">
  12 +
  13 + <com.qmuiteam.qmui.widget.QMUITopBar
  14 + android:id="@+id/topbar"
  15 + android:layout_width="match_parent"
  16 + android:layout_height="?attr/qmui_topbar_height" />
  17 +
  18 + <FrameLayout
  19 + android:layout_width="match_parent"
  20 + android:layout_height="match_parent">
  21 +
  22 + <LinearLayout
  23 + android:layout_width="match_parent"
  24 + android:layout_height="match_parent"
  25 + android:orientation="vertical"> <!--远程控制-->
  26 + <LinearLayout
  27 + android:layout_width="match_parent"
  28 + android:layout_height="90dp"
  29 + android:layout_margin="10dp"
  30 + android:background="@drawable/shape_10_radius_white_bg"
  31 + android:clickable="true"
  32 + android:orientation="vertical">
  33 +
  34 + <LinearLayout
  35 + android:layout_width="match_parent"
  36 + android:layout_height="wrap_content"
  37 + android:layout_marginTop="20dp"
  38 + android:gravity="center_vertical">
  39 +
  40 + <TextView
  41 + android:id="@+id/tv_menu_title"
  42 + android:layout_width="0dp"
  43 + android:layout_height="wrap_content"
  44 + android:layout_marginLeft="10dp"
  45 + android:layout_marginRight="10dp"
  46 + android:layout_weight="1"
  47 + android:maxLines="1"
  48 + android:text="远程控制"
  49 + android:textColor="@color/color_282828"
  50 + android:textSize="16sp" />
  51 +
  52 + <com.cnlive.strike.xiaojiaspeaker.ui.widget.switchbutton.SwitchButton
  53 + android:id="@+id/sb_switch"
  54 + android:layout_width="wrap_content"
  55 + android:layout_height="wrap_content"
  56 + android:layout_gravity="right"
  57 + android:layout_marginRight="10dp"
  58 + app:kswBackDrawable="@drawable/miui_back_drawable"
  59 + app:kswThumbDrawable="@drawable/miui_thumb_drawable"
  60 + app:kswThumbHeight="20dp"
  61 + app:kswThumbRangeRatio="2.1"
  62 + app:kswThumbWidth="20dp" />
  63 + </LinearLayout>
  64 +
  65 + <TextView
  66 + android:id="@+id/tv_menu_detail"
  67 + android:layout_width="wrap_content"
  68 + android:layout_height="wrap_content"
  69 + android:layout_centerVertical="true"
  70 + android:layout_marginLeft="10dp"
  71 + android:layout_marginTop="10dp"
  72 + android:layout_marginRight="10dp"
  73 + android:layout_marginBottom="20dp"
  74 + android:layout_toEndOf="@id/iv_right"
  75 + android:layout_toRightOf="@id/tv_menu_title"
  76 + android:gravity="center|right"
  77 + android:maxLines="1"
  78 + android:text="手机可远程控制音箱播放的内容,但仅限听见中国"
  79 + android:textColor="@color/color_C3C3C3"
  80 + android:textSize="14sp" />
  81 +
  82 + </LinearLayout>
  83 +
  84 + <TextView
  85 + android:layout_width="wrap_content"
  86 + android:layout_height="wrap_content"
  87 + android:layout_marginLeft="10dp"
  88 + android:text="若您添加了多台设备,此开关会控制您所有设备的远程播放功能"
  89 + android:textColor="@color/color_282828"
  90 + android:textSize="12sp" />
  91 + </LinearLayout>
  92 +
  93 + <com.cnlive.strike.ui.widget.UIEmptyView
  94 + android:id="@+id/empty_layout"
  95 + android:layout_width="match_parent"
  96 + android:layout_height="match_parent"
  97 + android:background="@color/color_fff"
  98 + android:visibility="gone" />
  99 + </FrameLayout>
  100 +
  101 +
  102 + </LinearLayout>
  103 +</layout>
0 \ No newline at end of file 104 \ No newline at end of file
module_xiaojiaSoundBox/src/main/res/values/ids.xml
@@ -2,5 +2,5 @@ @@ -2,5 +2,5 @@
2 <resources> 2 <resources>
3 <item name="left_back" type="id" /> 3 <item name="left_back" type="id" />
4 <item name="right_add" type="id" /> 4 <item name="right_add" type="id" />
5 - 5 + <item name="right_menu" type="id" />
6 </resources> 6 </resources>