Commit 5771a8b6d1320981ce02147429b6a663e6291000
1 parent
b6a3c22d
1 判断设备是否绑定
Showing
9 changed files
with
63 additions
and
23 deletions
app/build.gradle
| ... | ... | @@ -14,6 +14,12 @@ android { |
| 14 | 14 | versionName "1.0" |
| 15 | 15 | testInstrumentationRunner "android.test.runner.AndroidJUnitRunner" |
| 16 | 16 | multiDexEnabled true |
| 17 | + | |
| 18 | + javaCompileOptions { | |
| 19 | + annotationProcessorOptions { | |
| 20 | + arguments = [AROUTER_MODULE_NAME: project.getName()] | |
| 21 | + } | |
| 22 | + } | |
| 17 | 23 | } |
| 18 | 24 | buildTypes { |
| 19 | 25 | debug { |
| ... | ... | @@ -60,6 +66,8 @@ android { |
| 60 | 66 | sourceCompatibility = 1.8 |
| 61 | 67 | targetCompatibility = 1.8 |
| 62 | 68 | } |
| 69 | + | |
| 70 | + | |
| 63 | 71 | buildToolsVersion = '29.0.2' |
| 64 | 72 | } |
| 65 | 73 | |
| ... | ... | @@ -80,4 +88,7 @@ dependencies { |
| 80 | 88 | implementation 'com.daimajia.easing:library:2.0@aar' |
| 81 | 89 | implementation 'com.daimajia.androidanimations:library:2.3@aar' |
| 82 | 90 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' |
| 91 | + | |
| 92 | + implementation "com.alibaba:arouter-api:$rootProject.arouterApiVersion" | |
| 93 | + annotationProcessor "com.alibaba:arouter-compiler:$rootProject.arouterCompilerVersion" | |
| 83 | 94 | } | ... | ... |
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/MainActivity.java
| ... | ... | @@ -5,6 +5,7 @@ import android.content.Intent; |
| 5 | 5 | import android.os.Bundle; |
| 6 | 6 | import android.support.v7.app.AppCompatActivity; |
| 7 | 7 | |
| 8 | +import com.alibaba.android.arouter.launcher.ARouter; | |
| 8 | 9 | import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; |
| 9 | 10 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.AllDeviceActivity; |
| 10 | 11 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.BlueToothStep1Activity; |
| ... | ... | @@ -45,6 +46,9 @@ public class MainActivity extends AppCompatActivity { |
| 45 | 46 | // startActivity(new Intent(MainActivity.this, SelectIMFriendActivity.class)); |
| 46 | 47 | // startActivity(new Intent(MainActivity.this, InvitFriendActivity.class)); |
| 47 | 48 | |
| 49 | +// ARouter.getInstance().build("/XiaoJiaSpeaker/UserManagerActivity") | |
| 50 | +// .withString("currentSelectFamilyId", "") | |
| 51 | +// .navigation(this); | |
| 48 | 52 | |
| 49 | 53 | finish(); |
| 50 | 54 | } | ... | ... |
build.gradle
| 1 | 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. |
| 2 | 2 | apply from: "config.gradle" |
| 3 | +apply plugin: 'com.alibaba.arouter' | |
| 3 | 4 | buildscript { |
| 4 | 5 | repositories { |
| 5 | 6 | google() |
| ... | ... | @@ -8,7 +9,7 @@ buildscript { |
| 8 | 9 | } |
| 9 | 10 | dependencies { |
| 10 | 11 | classpath 'com.android.tools.build:gradle:3.5.1' |
| 11 | - | |
| 12 | + classpath "com.alibaba:arouter-register:1.0.2" | |
| 12 | 13 | // NOTE: Do not place your application dependencies here; they belong |
| 13 | 14 | // in the individual module build.gradle files |
| 14 | 15 | } |
| ... | ... | @@ -95,5 +96,9 @@ ext { |
| 95 | 96 | //蓝牙 |
| 96 | 97 | BleLib="2.3.4" |
| 97 | 98 | eventBus = "3.1.1" |
| 99 | + | |
| 100 | + //阿里路由框架 | |
| 101 | + arouterApiVersion = '1.4.0' | |
| 102 | + arouterCompilerVersion = '1.2.1' | |
| 98 | 103 | } |
| 99 | 104 | ... | ... |
config.gradle
module_xiaojiaSoundBox/build.gradle
| ... | ... | @@ -17,7 +17,14 @@ android { |
| 17 | 17 | |
| 18 | 18 | testInstrumentationRunner "android.test.runner.AndroidJUnitRunner" |
| 19 | 19 | consumerProguardFiles 'consumer-rules.pro' |
| 20 | + | |
| 21 | + javaCompileOptions { | |
| 22 | + annotationProcessorOptions { | |
| 23 | + arguments = [AROUTER_MODULE_NAME: project.getName()] | |
| 24 | + } | |
| 25 | + } | |
| 20 | 26 | } |
| 27 | + | |
| 21 | 28 | dataBinding { |
| 22 | 29 | enabled = true |
| 23 | 30 | } |
| ... | ... | @@ -81,5 +88,8 @@ dependencies { |
| 81 | 88 | implementation 'com.daimajia.easing:library:2.0@aar' |
| 82 | 89 | implementation 'com.daimajia.androidanimations:library:2.3@aar' |
| 83 | 90 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' |
| 91 | + | |
| 92 | + implementation "com.alibaba:arouter-api:$rootProject.arouterApiVersion" | |
| 93 | + annotationProcessor "com.alibaba:arouter-compiler:$rootProject.arouterCompilerVersion" | |
| 84 | 94 | api files('libs/pinyin4j-2.5.0.jar') |
| 85 | 95 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectIMFriendView.java
| ... | ... | @@ -54,6 +54,9 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect |
| 54 | 54 | |
| 55 | 55 | public void getIMData(XiaoJiaContactInfo xiaoJiaContactInfo) { |
| 56 | 56 | ImOpenService service = (ImOpenService) ARouter.getInstance().build("/im/cnIMService").navigation(getContext()); |
| 57 | + if (null==service){ | |
| 58 | + return; | |
| 59 | + } | |
| 57 | 60 | service.getFriendList(new ImOpenService.CNValueCallBack<List<FriendListData>>() { |
| 58 | 61 | @Override |
| 59 | 62 | public void onError(int var1, String var2) { | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/UserManagerView.java
| ... | ... | @@ -139,28 +139,30 @@ public class UserManagerView implements MvpView { |
| 139 | 139 | adapter.setOnDeleteClickListener(new UserManagerAdapter.OnDeleteClickListener() { |
| 140 | 140 | @Override |
| 141 | 141 | public void deleteClick(int position, FamilyRoleBean.FamilyRoleListBean bean) { |
| 142 | - deleteDialog = new SelectDialog(getContext(), "移除后,该用户将不再具备管理\n音箱的权限,确定移除吗?", "取消", new SelectDialog.DialogInterface() { | |
| 143 | - @Override | |
| 144 | - public void onClick(SelectDialog dialog) { | |
| 145 | - dialog.dismiss(); | |
| 146 | - } | |
| 147 | - }, "确定", new SelectDialog.DialogInterface() { | |
| 148 | - @Override | |
| 149 | - public void onClick(SelectDialog dialog) { | |
| 150 | - fragment.getPresenter().changeMemberRole(getContext(), bean.getSid() + "", bean.getFamily_id(), null, new UserManagerPresenter.OnResposeListener() { | |
| 151 | - @Override | |
| 152 | - public void onSuccess() { | |
| 153 | - dialog.dismiss(); | |
| 154 | - familyRoleList.remove(position); | |
| 155 | - if (null != adapter) { | |
| 156 | - adapter.notifyDataSetChanged(); | |
| 157 | - } | |
| 142 | + deleteDialog = new SelectDialog(getContext(), "移除后,该用户将不再具备管理\n音箱的权限,确定移除吗?", "取消", new SelectDialog.DialogInterface() { | |
| 143 | + @Override | |
| 144 | + public void onClick(SelectDialog dialog) { | |
| 145 | + dialog.dismiss(); | |
| 146 | + } | |
| 147 | + }, "确定", new SelectDialog.DialogInterface() { | |
| 148 | + @Override | |
| 149 | + public void onClick(SelectDialog dialog) { | |
| 150 | + fragment.getPresenter().changeMemberRole(getContext(), bean.getSid() + "", bean.getFamily_id(), null, new UserManagerPresenter.OnResposeListener() { | |
| 151 | + @Override | |
| 152 | + public void onSuccess() { | |
| 153 | + dialog.dismiss(); | |
| 154 | + familyRoleList.remove(position); | |
| 155 | + if (null != adapter) { | |
| 156 | + adapter.notifyDataSetChanged(); | |
| 158 | 157 | } |
| 159 | - }); | |
| 160 | - } | |
| 161 | - }); | |
| 162 | - deleteDialog.setRightBtnColor(R.color.btn_green); | |
| 163 | - deleteDialog.setTipTextStyle(Typeface.DEFAULT); | |
| 158 | + AlertUtil.showDeftToast(getContext(), "移除成功"); | |
| 159 | + | |
| 160 | + } | |
| 161 | + }); | |
| 162 | + } | |
| 163 | + }); | |
| 164 | + deleteDialog.setRightBtnColor(R.color.btn_green); | |
| 165 | + deleteDialog.setTipTextStyle(Typeface.DEFAULT); | |
| 164 | 166 | if (!deleteDialog.isShowing()) { |
| 165 | 167 | deleteDialog.show(); |
| 166 | 168 | } |
| ... | ... | @@ -257,6 +259,7 @@ public class UserManagerView implements MvpView { |
| 257 | 259 | if (null != adapter) { |
| 258 | 260 | adapter.notifyDataSetChanged(); |
| 259 | 261 | } |
| 262 | + AlertUtil.showDeftToast(getContext(), "保存成功"); | |
| 260 | 263 | } |
| 261 | 264 | } |
| 262 | 265 | }); | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/UserManagerActivity.java
| ... | ... | @@ -6,11 +6,13 @@ import android.support.v7.app.AppCompatActivity; |
| 6 | 6 | import android.os.Bundle; |
| 7 | 7 | import android.text.TextUtils; |
| 8 | 8 | |
| 9 | +import com.alibaba.android.arouter.facade.annotation.Route; | |
| 9 | 10 | import com.clj.fastble.data.BleDevice; |
| 10 | 11 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 11 | 12 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; |
| 12 | 13 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.UserManagerFragment; |
| 13 | 14 | |
| 15 | +@Route(path = "/XiaoJiaSpeaker/UserManagerActivity") | |
| 14 | 16 | public class UserManagerActivity extends AppCompatActivity { |
| 15 | 17 | |
| 16 | 18 | @Override | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/fragment_invit_friend.xml
| ... | ... | @@ -50,6 +50,7 @@ |
| 50 | 50 | android:layout_width="match_parent" |
| 51 | 51 | android:layout_height="0dp" |
| 52 | 52 | android:layout_weight="1" |
| 53 | + android:gravity="center" | |
| 53 | 54 | android:orientation="vertical"> |
| 54 | 55 | |
| 55 | 56 | <FrameLayout |
| ... | ... | @@ -94,6 +95,7 @@ |
| 94 | 95 | android:layout_width="match_parent" |
| 95 | 96 | android:layout_height="0dp" |
| 96 | 97 | android:layout_weight="1" |
| 98 | + android:gravity="center" | |
| 97 | 99 | android:orientation="vertical"> |
| 98 | 100 | |
| 99 | 101 | <TextView | ... | ... |