Commit 2b3c696ab85396ebfe5c8672d2ac79571ffcc5cf
1 parent
660977bf
1 对接im数据
Showing
7 changed files
with
296 additions
and
150 deletions
build.gradle
config.gradle
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/SelectIMFriendPresenter.java
| @@ -42,11 +42,10 @@ public class SelectIMFriendPresenter extends MvpBasePresenter<SelectIMFriendView | @@ -42,11 +42,10 @@ public class SelectIMFriendPresenter extends MvpBasePresenter<SelectIMFriendView | ||
| 42 | @Override | 42 | @Override |
| 43 | public void onSuccess(APIBaseInfo<XiaoJiaContactInfo> baseInfo) { | 43 | public void onSuccess(APIBaseInfo<XiaoJiaContactInfo> baseInfo) { |
| 44 | Log.e(TAG, "onSuccess: "); | 44 | Log.e(TAG, "onSuccess: "); |
| 45 | - | ||
| 46 | if (null == getView()) { | 45 | if (null == getView()) { |
| 47 | return; | 46 | return; |
| 48 | } | 47 | } |
| 49 | - | 48 | + getView().getIMData(baseInfo.getData()); |
| 50 | } | 49 | } |
| 51 | }) | 50 | }) |
| 52 | .setFailureCallback(new FailureCallback() { | 51 | .setFailureCallback(new FailureCallback() { |
| @@ -54,12 +53,16 @@ public class SelectIMFriendPresenter extends MvpBasePresenter<SelectIMFriendView | @@ -54,12 +53,16 @@ public class SelectIMFriendPresenter extends MvpBasePresenter<SelectIMFriendView | ||
| 54 | public void onFailure(int i, String s) { | 53 | public void onFailure(int i, String s) { |
| 55 | //显示重试 | 54 | //显示重试 |
| 56 | Log.e(TAG, "onFailure: " + s); | 55 | Log.e(TAG, "onFailure: " + s); |
| 57 | -// getView().showRetryView(i, new View.OnClickListener() { | ||
| 58 | -// @Override | ||
| 59 | -// public void onClick(View view) { | ||
| 60 | -// getSetRoleList(context, sids, familyId); | ||
| 61 | -// } | ||
| 62 | -// }); | 56 | + if (null == getView()) { |
| 57 | + return; | ||
| 58 | + } | ||
| 59 | + getView().hideLoadingView(); | ||
| 60 | + getView().showRetryView(i, new View.OnClickListener() { | ||
| 61 | + @Override | ||
| 62 | + public void onClick(View view) { | ||
| 63 | + getFamilyMember(context, familyId); | ||
| 64 | + } | ||
| 65 | + }); | ||
| 63 | } | 66 | } |
| 64 | }) | 67 | }) |
| 65 | 68 |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectIMFriendView.java
| @@ -12,11 +12,15 @@ import android.view.View; | @@ -12,11 +12,15 @@ import android.view.View; | ||
| 12 | import android.view.WindowManager; | 12 | import android.view.WindowManager; |
| 13 | import android.view.inputmethod.InputMethodManager; | 13 | import android.view.inputmethod.InputMethodManager; |
| 14 | 14 | ||
| 15 | +import com.alibaba.android.arouter.launcher.ARouter; | ||
| 16 | +import com.cnlive.libs.base.arouter.im.FriendListData; | ||
| 17 | +import com.cnlive.libs.base.arouter.im.ImOpenService; | ||
| 15 | import com.cnlive.strike.ui.widget.LetterBarView; | 18 | import com.cnlive.strike.ui.widget.LetterBarView; |
| 16 | import com.cnlive.strike.xiaojiaspeaker.R; | 19 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 17 | import com.cnlive.strike.xiaojiaspeaker.model.IMFriendHasLetterInfo; | 20 | import com.cnlive.strike.xiaojiaspeaker.model.IMFriendHasLetterInfo; |
| 18 | import com.cnlive.strike.xiaojiaspeaker.model.IMFriendNoLetterInfo; | 21 | import com.cnlive.strike.xiaojiaspeaker.model.IMFriendNoLetterInfo; |
| 19 | import com.cnlive.strike.xiaojiaspeaker.model.LetterComparator; | 22 | import com.cnlive.strike.xiaojiaspeaker.model.LetterComparator; |
| 23 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.XiaoJiaContactInfo; | ||
| 20 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.SetFriendsRoleActivity; | 24 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.SetFriendsRoleActivity; |
| 21 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.SelectIMFriendAdapter; | 25 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.SelectIMFriendAdapter; |
| 22 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectIMFriendFragment; | 26 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectIMFriendFragment; |
| @@ -45,82 +49,130 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect | @@ -45,82 +49,130 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect | ||
| 45 | return fragment == null ? null : fragment.getActivity(); | 49 | return fragment == null ? null : fragment.getActivity(); |
| 46 | } | 50 | } |
| 47 | 51 | ||
| 48 | - public void initView() { | ||
| 49 | - //设置按钮不可点击 | ||
| 50 | - nextBtnCanNotClick(); | ||
| 51 | - //假设这个是原有数据 | ||
| 52 | - noLetterInfoList = new ArrayList<>(); | ||
| 53 | - IMFriendNoLetterInfo noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 54 | - noLetterInfo.setUserName("韩亚云"); | ||
| 55 | - noLetterInfo.setCantSelect(true); | ||
| 56 | - noLetterInfo.setId("352660"); | ||
| 57 | - noLetterInfoList.add(noLetterInfo); | ||
| 58 | - | ||
| 59 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 60 | - noLetterInfo.setUserName("杨帅"); | ||
| 61 | - noLetterInfo.setId("352668"); | ||
| 62 | - noLetterInfoList.add(noLetterInfo); | ||
| 63 | - | ||
| 64 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 65 | - noLetterInfo.setUserName("杨杨"); | ||
| 66 | - noLetterInfo.setId("352700"); | ||
| 67 | - noLetterInfoList.add(noLetterInfo); | ||
| 68 | - | ||
| 69 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 70 | - noLetterInfo.setUserName("杨天"); | ||
| 71 | - noLetterInfo.setId("352782"); | ||
| 72 | - noLetterInfoList.add(noLetterInfo); | ||
| 73 | - | ||
| 74 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 75 | - noLetterInfo.setUserName("郭瑞鹏"); | ||
| 76 | - noLetterInfo.setId("352898"); | ||
| 77 | - noLetterInfoList.add(noLetterInfo); | ||
| 78 | - | ||
| 79 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 80 | - noLetterInfo.setUserName("殷巧娟"); | ||
| 81 | - noLetterInfo.setId("353001"); | ||
| 82 | - noLetterInfoList.add(noLetterInfo); | ||
| 83 | - | ||
| 84 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 85 | - noLetterInfo.setUserName("张晓文"); | ||
| 86 | - noLetterInfo.setId("353036"); | ||
| 87 | - noLetterInfoList.add(noLetterInfo); | ||
| 88 | - | ||
| 89 | - | ||
| 90 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 91 | - noLetterInfo.setUserName("小明"); | ||
| 92 | - noLetterInfo.setId("353360"); | ||
| 93 | - noLetterInfoList.add(noLetterInfo); | ||
| 94 | - | ||
| 95 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 96 | - noLetterInfo.setUserName("小红"); | ||
| 97 | - noLetterInfo.setId("353417"); | ||
| 98 | - noLetterInfoList.add(noLetterInfo); | 52 | + public void getIMData(XiaoJiaContactInfo xiaoJiaContactInfo) { |
| 53 | + ImOpenService service = (ImOpenService) ARouter.getInstance().build("/im/cnIMService").navigation(getContext()); | ||
| 54 | + service.getFriendList(new ImOpenService.CNValueCallBack<List<FriendListData>>() { | ||
| 55 | + @Override | ||
| 56 | + public void onError(int var1, String var2) { | ||
| 57 | + hideLoadingView(); | ||
| 58 | + showRetryView(-1, new View.OnClickListener() { | ||
| 59 | + @Override | ||
| 60 | + public void onClick(View view) { | ||
| 61 | + fragment.getPresenter().getFamilyMember(getContext(), currentSelectFamilyId); | ||
| 62 | + } | ||
| 63 | + }); | ||
| 64 | + } | ||
| 99 | 65 | ||
| 100 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 101 | - noLetterInfo.setUserName("小绿"); | ||
| 102 | - noLetterInfo.setId("353557"); | ||
| 103 | - noLetterInfoList.add(noLetterInfo); | 66 | + @Override |
| 67 | + public void onSuccess(List<FriendListData> var1) { | ||
| 68 | + hideLoadingView(); | ||
| 69 | + List<String> hasSelectList = xiaoJiaContactInfo.getSids(); | ||
| 70 | + noLetterInfoList = new ArrayList<>(); | ||
| 71 | + if (null == var1) { | ||
| 72 | + return; | ||
| 73 | + } | ||
| 74 | + for (int i = 0; i < var1.size(); i++) { | ||
| 75 | + for (int j = 0; j < hasSelectList.size(); j++) { | ||
| 76 | + IMFriendNoLetterInfo noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 77 | + //不可选中 | ||
| 78 | + if (hasSelectList.get(j).equals(var1.get(i).getFriendId())) { | ||
| 79 | + noLetterInfo.setUserName(var1.get(i).getFriendNickName()); | ||
| 80 | + noLetterInfo.setCantSelect(true); | ||
| 81 | + noLetterInfo.setId(var1.get(i).getFriendId()); | ||
| 82 | + } else { | ||
| 83 | + //可选中 | ||
| 84 | + noLetterInfo.setUserName(var1.get(i).getFriendNickName()); | ||
| 85 | + noLetterInfo.setCantSelect(false); | ||
| 86 | + noLetterInfo.setId(var1.get(i).getFriendId()); | ||
| 87 | + } | ||
| 88 | + noLetterInfoList.add(noLetterInfo); | ||
| 89 | + //设置 | ||
| 90 | + initView(noLetterInfoList); | ||
| 91 | + } | ||
| 104 | 92 | ||
| 105 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 106 | - noLetterInfo.setUserName("小黄"); | ||
| 107 | - noLetterInfo.setId("353651"); | ||
| 108 | - noLetterInfoList.add(noLetterInfo); | 93 | + } |
| 109 | 94 | ||
| 110 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 111 | - noLetterInfo.setUserName("张三"); | ||
| 112 | - noLetterInfo.setId("353728"); | ||
| 113 | - noLetterInfoList.add(noLetterInfo); | ||
| 114 | 95 | ||
| 115 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 116 | - noLetterInfo.setUserName("李四"); | ||
| 117 | - noLetterInfo.setId("353777"); | ||
| 118 | - noLetterInfoList.add(noLetterInfo); | 96 | + } |
| 97 | + }); | ||
| 98 | + } | ||
| 119 | 99 | ||
| 120 | - noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 121 | - noLetterInfo.setUserName("王五"); | ||
| 122 | - noLetterInfo.setId("353789"); | ||
| 123 | - noLetterInfoList.add(noLetterInfo); | 100 | + public void initView(List<IMFriendNoLetterInfo> noLetterInfoList) { |
| 101 | + //设置按钮不可点击 | ||
| 102 | + nextBtnCanNotClick(); | ||
| 103 | + //假设这个是原有数据 | ||
| 104 | + this.noLetterInfoList = noLetterInfoList; | ||
| 105 | +// IMFriendNoLetterInfo noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 106 | +// noLetterInfo.setUserName("韩亚云"); | ||
| 107 | +// noLetterInfo.setCantSelect(true); | ||
| 108 | +// noLetterInfo.setId("352660"); | ||
| 109 | +// noLetterInfoList.add(noLetterInfo); | ||
| 110 | +// | ||
| 111 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 112 | +// noLetterInfo.setUserName("杨帅"); | ||
| 113 | +// noLetterInfo.setId("352668"); | ||
| 114 | +// noLetterInfoList.add(noLetterInfo); | ||
| 115 | +// | ||
| 116 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 117 | +// noLetterInfo.setUserName("杨杨"); | ||
| 118 | +// noLetterInfo.setId("352700"); | ||
| 119 | +// noLetterInfoList.add(noLetterInfo); | ||
| 120 | +// | ||
| 121 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 122 | +// noLetterInfo.setUserName("杨天"); | ||
| 123 | +// noLetterInfo.setId("352782"); | ||
| 124 | +// noLetterInfoList.add(noLetterInfo); | ||
| 125 | +// | ||
| 126 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 127 | +// noLetterInfo.setUserName("郭瑞鹏"); | ||
| 128 | +// noLetterInfo.setId("352898"); | ||
| 129 | +// noLetterInfoList.add(noLetterInfo); | ||
| 130 | +// | ||
| 131 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 132 | +// noLetterInfo.setUserName("殷巧娟"); | ||
| 133 | +// noLetterInfo.setId("353001"); | ||
| 134 | +// noLetterInfoList.add(noLetterInfo); | ||
| 135 | +// | ||
| 136 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 137 | +// noLetterInfo.setUserName("张晓文"); | ||
| 138 | +// noLetterInfo.setId("353036"); | ||
| 139 | +// noLetterInfoList.add(noLetterInfo); | ||
| 140 | +// | ||
| 141 | +// | ||
| 142 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 143 | +// noLetterInfo.setUserName("小明"); | ||
| 144 | +// noLetterInfo.setId("353360"); | ||
| 145 | +// noLetterInfoList.add(noLetterInfo); | ||
| 146 | +// | ||
| 147 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 148 | +// noLetterInfo.setUserName("小红"); | ||
| 149 | +// noLetterInfo.setId("353417"); | ||
| 150 | +// noLetterInfoList.add(noLetterInfo); | ||
| 151 | +// | ||
| 152 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 153 | +// noLetterInfo.setUserName("小绿"); | ||
| 154 | +// noLetterInfo.setId("353557"); | ||
| 155 | +// noLetterInfoList.add(noLetterInfo); | ||
| 156 | +// | ||
| 157 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 158 | +// noLetterInfo.setUserName("小黄"); | ||
| 159 | +// noLetterInfo.setId("353651"); | ||
| 160 | +// noLetterInfoList.add(noLetterInfo); | ||
| 161 | +// | ||
| 162 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 163 | +// noLetterInfo.setUserName("张三"); | ||
| 164 | +// noLetterInfo.setId("353728"); | ||
| 165 | +// noLetterInfoList.add(noLetterInfo); | ||
| 166 | +// | ||
| 167 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 168 | +// noLetterInfo.setUserName("李四"); | ||
| 169 | +// noLetterInfo.setId("353777"); | ||
| 170 | +// noLetterInfoList.add(noLetterInfo); | ||
| 171 | +// | ||
| 172 | +// noLetterInfo = new IMFriendNoLetterInfo(); | ||
| 173 | +// noLetterInfo.setUserName("王五"); | ||
| 174 | +// noLetterInfo.setId("353789"); | ||
| 175 | +// noLetterInfoList.add(noLetterInfo); | ||
| 124 | //对数据进行排序 | 176 | //对数据进行排序 |
| 125 | Collections.sort(noLetterInfoList, new LetterComparator()); | 177 | Collections.sort(noLetterInfoList, new LetterComparator()); |
| 126 | 178 | ||
| @@ -288,4 +340,47 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect | @@ -288,4 +340,47 @@ public class SelectIMFriendView implements MvpView, LetterBarView.OnLetterSelect | ||
| 288 | } | 340 | } |
| 289 | } | 341 | } |
| 290 | } | 342 | } |
| 343 | + | ||
| 344 | + /** | ||
| 345 | + * 显示loading | ||
| 346 | + */ | ||
| 347 | + public void showLoadingView() { | ||
| 348 | + if (fragment.binding.emptyLayout == null) { | ||
| 349 | + return; | ||
| 350 | + } | ||
| 351 | + fragment.binding.emptyLayout.show(true); | ||
| 352 | + } | ||
| 353 | + | ||
| 354 | + /** | ||
| 355 | + * 隐藏loading | ||
| 356 | + */ | ||
| 357 | + public void hideLoadingView() { | ||
| 358 | + if (fragment.binding.emptyLayout == null) { | ||
| 359 | + return; | ||
| 360 | + } | ||
| 361 | + fragment.binding.emptyLayout.hide(); | ||
| 362 | + } | ||
| 363 | + | ||
| 364 | + /** | ||
| 365 | + * 显示重试页面 | ||
| 366 | + * | ||
| 367 | + * @param errorCode | ||
| 368 | + * @param listener | ||
| 369 | + */ | ||
| 370 | + public void showRetryView(int errorCode, View.OnClickListener listener) { | ||
| 371 | + //显示空视图 | ||
| 372 | + fragment.binding.emptyLayout.setVisibility(View.VISIBLE); | ||
| 373 | + | ||
| 374 | + if (fragment.binding.emptyLayout == null) return; | ||
| 375 | + String titleText = ""; | ||
| 376 | + String detailText = ""; | ||
| 377 | + if (errorCode == -3) { | ||
| 378 | + titleText = getContext().getString(R.string.msg_failed_network_title); | ||
| 379 | + detailText = getContext().getString(R.string.msg_failed_network_detail); | ||
| 380 | + } else { | ||
| 381 | + titleText = getContext().getString(R.string.msg_failed_other_title); | ||
| 382 | + detailText = getContext().getString(R.string.msg_failed_other_detail); | ||
| 383 | + } | ||
| 384 | + fragment.binding.emptyLayout.show(false, titleText, detailText, getContext().getString(R.string.retry), R.drawable.wufalianjie, listener); | ||
| 385 | + } | ||
| 291 | } | 386 | } |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/AllDeviceActivity.java
| @@ -7,11 +7,14 @@ import android.databinding.DataBindingUtil; | @@ -7,11 +7,14 @@ import android.databinding.DataBindingUtil; | ||
| 7 | import android.support.v4.content.ContextCompat; | 7 | import android.support.v4.content.ContextCompat; |
| 8 | import android.support.v7.app.AppCompatActivity; | 8 | import android.support.v7.app.AppCompatActivity; |
| 9 | import android.os.Bundle; | 9 | import android.os.Bundle; |
| 10 | +import android.text.TextUtils; | ||
| 10 | import android.view.View; | 11 | import android.view.View; |
| 11 | 12 | ||
| 13 | +import com.cnlive.libs.base.util.AlertUtil; | ||
| 12 | import com.cnlive.libs.base.util.StatusBarUtil; | 14 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 13 | import com.cnlive.libs.base.util.StatusBarUtil2; | 15 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 14 | import com.cnlive.strike.xiaojiaspeaker.R; | 16 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | ||
| 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityAllDeviceBinding; | 18 | import com.cnlive.strike.xiaojiaspeaker.databinding.ActivityAllDeviceBinding; |
| 16 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.AllDeviceFragment; | 19 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.AllDeviceFragment; |
| 17 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.InvitFriendFragment; | 20 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.InvitFriendFragment; |
| @@ -30,11 +33,32 @@ public class AllDeviceActivity extends AppCompatActivity { | @@ -30,11 +33,32 @@ public class AllDeviceActivity extends AppCompatActivity { | ||
| 30 | protected void onCreate(Bundle savedInstanceState) { | 33 | protected void onCreate(Bundle savedInstanceState) { |
| 31 | super.onCreate(savedInstanceState); | 34 | super.onCreate(savedInstanceState); |
| 32 | binding = DataBindingUtil.setContentView(this, R.layout.activity_all_device); | 35 | binding = DataBindingUtil.setContentView(this, R.layout.activity_all_device); |
| 36 | + if (null != getIntent().getExtras()) { | ||
| 37 | + String uid = getIntent().getExtras().getString("uid"); | ||
| 38 | + String userIcon = getIntent().getExtras().getString("userIcon"); | ||
| 39 | + String nickName = getIntent().getExtras().getString("nickName"); | ||
| 40 | + String phone = getIntent().getExtras().getString("phone"); | ||
| 41 | + if (!TextUtils.isEmpty(uid) && TextUtils.isEmpty(userIcon) && !TextUtils.isEmpty(nickName) && !TextUtils.isEmpty(phone)) { | ||
| 42 | + XiaoJIaCommInfo.setUserId(this, uid); | ||
| 43 | + XiaoJIaCommInfo.setUserPhone(this, phone); | ||
| 44 | + XiaoJIaCommInfo.setUserIcon(this, userIcon); | ||
| 45 | + XiaoJIaCommInfo.setUserNickName(this, nickName); | ||
| 46 | + } else { | ||
| 47 | + AlertUtil.showDeftToast(this, "参数异常"); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + } | ||
| 33 | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, AllDeviceFragment.newInstance()).commitAllowingStateLoss(); | 51 | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, AllDeviceFragment.newInstance()).commitAllowingStateLoss(); |
| 34 | 52 | ||
| 35 | } | 53 | } |
| 36 | - public static void startActivity(Activity activity) { | ||
| 37 | - activity.startActivity(new Intent(activity, AllDeviceActivity.class)); | 54 | + |
| 55 | + public static void startActivity(Activity activity, String uid, String userIcon, String nickName, String phone) { | ||
| 56 | + Intent intent = new Intent(activity, AllDeviceActivity.class); | ||
| 57 | + intent.putExtra("uid", uid); | ||
| 58 | + intent.putExtra("userIcon", userIcon); | ||
| 59 | + intent.putExtra("nickName", nickName); | ||
| 60 | + intent.putExtra("phone", phone); | ||
| 61 | + activity.startActivity(intent); | ||
| 38 | } | 62 | } |
| 39 | 63 | ||
| 40 | } | 64 | } |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectIMFriendFragment.java
| @@ -6,6 +6,9 @@ import android.support.v4.content.ContextCompat; | @@ -6,6 +6,9 @@ import android.support.v4.content.ContextCompat; | ||
| 6 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
| 7 | import android.view.View; | 7 | import android.view.View; |
| 8 | 8 | ||
| 9 | +import com.alibaba.android.arouter.launcher.ARouter; | ||
| 10 | +import com.cnlive.libs.base.arouter.im.FriendListData; | ||
| 11 | +import com.cnlive.libs.base.arouter.im.ImOpenService; | ||
| 9 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | 12 | import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; |
| 10 | import com.cnlive.libs.base.util.StatusBarUtil; | 13 | import com.cnlive.libs.base.util.StatusBarUtil; |
| 11 | import com.cnlive.libs.base.util.StatusBarUtil2; | 14 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| @@ -14,6 +17,8 @@ import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectImFriendBindin | @@ -14,6 +17,8 @@ import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectImFriendBindin | ||
| 14 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectIMFriendPresenter; | 17 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectIMFriendPresenter; |
| 15 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectIMFriendView; | 18 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectIMFriendView; |
| 16 | 19 | ||
| 20 | +import java.util.List; | ||
| 21 | + | ||
| 17 | public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendView, SelectIMFriendPresenter, Object, FragmentSelectImFriendBinding> { | 22 | public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendView, SelectIMFriendPresenter, Object, FragmentSelectImFriendBinding> { |
| 18 | 23 | ||
| 19 | public static SelectIMFriendFragment newInstance(String currentSelectFamilyId) { | 24 | public static SelectIMFriendFragment newInstance(String currentSelectFamilyId) { |
| @@ -44,7 +49,6 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie | @@ -44,7 +49,6 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie | ||
| 44 | if (null != getArguments()) { | 49 | if (null != getArguments()) { |
| 45 | String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); | 50 | String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); |
| 46 | if (!TextUtils.isEmpty(currentSelectFamilyId)) { | 51 | if (!TextUtils.isEmpty(currentSelectFamilyId)) { |
| 47 | - getMvpView().initView(); | ||
| 48 | getPresenter().getFamilyMember(getActivity(), currentSelectFamilyId); | 52 | getPresenter().getFamilyMember(getActivity(), currentSelectFamilyId); |
| 49 | } | 53 | } |
| 50 | } | 54 | } |
| @@ -52,6 +56,7 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie | @@ -52,6 +56,7 @@ public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendVie | ||
| 52 | } | 56 | } |
| 53 | } | 57 | } |
| 54 | 58 | ||
| 59 | + | ||
| 55 | private void initTopBar() { | 60 | private void initTopBar() { |
| 56 | 61 | ||
| 57 | if (null != binding) { | 62 | if (null != binding) { |
module_xiaojiaSoundBox/src/main/res/layout/fragment_select_im_friend.xml
| @@ -12,81 +12,100 @@ | @@ -12,81 +12,100 @@ | ||
| 12 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 13 | android:layout_height="?attr/qmui_topbar_height" /> | 13 | android:layout_height="?attr/qmui_topbar_height" /> |
| 14 | 14 | ||
| 15 | - <LinearLayout | ||
| 16 | - android:id="@+id/ll_search" | 15 | + <FrameLayout |
| 17 | android:layout_width="match_parent" | 16 | android:layout_width="match_parent" |
| 18 | - android:layout_height="40dp" | ||
| 19 | - android:layout_margin="10dp" | ||
| 20 | - android:background="@drawable/shape_10_radius_white_bg" | ||
| 21 | - android:gravity="center_vertical"> | ||
| 22 | - | ||
| 23 | - <ImageView | ||
| 24 | - android:layout_width="14dp" | ||
| 25 | - android:layout_height="14dp" | ||
| 26 | - android:layout_centerVertical="true" | ||
| 27 | - android:layout_marginLeft="10dp" | ||
| 28 | - android:src="@drawable/icon_search" /> | 17 | + android:layout_height="match_parent"> |
| 29 | 18 | ||
| 30 | - <EditText | ||
| 31 | - android:id="@+id/et_query" | ||
| 32 | - android:layout_width="0dp" | 19 | + <LinearLayout |
| 20 | + android:layout_width="match_parent" | ||
| 33 | android:layout_height="match_parent" | 21 | android:layout_height="match_parent" |
| 34 | - android:layout_marginLeft="10dp" | ||
| 35 | - android:layout_weight="1" | ||
| 36 | - android:background="@null" | ||
| 37 | - android:clickable="true" | ||
| 38 | - android:focusable="false" | ||
| 39 | - android:focusableInTouchMode="false" | ||
| 40 | - android:hint="请输入搜索内容" | ||
| 41 | - android:textColorHint="#D8D8D8" | ||
| 42 | - android:textSize="12sp" /> | 22 | + android:orientation="vertical"> |
| 43 | 23 | ||
| 44 | - <ImageView | ||
| 45 | - android:id="@+id/iv_delete" | ||
| 46 | - android:layout_width="15dp" | ||
| 47 | - android:layout_height="15dp" | ||
| 48 | - android:layout_centerVertical="true" | ||
| 49 | - android:layout_marginLeft="5dp" | ||
| 50 | - android:layout_marginRight="10dp" | ||
| 51 | - android:background="@drawable/ic_delete" | ||
| 52 | - android:visibility="gone" /> | ||
| 53 | - </LinearLayout> | 24 | + <LinearLayout |
| 25 | + android:id="@+id/ll_search" | ||
| 26 | + android:layout_width="match_parent" | ||
| 27 | + android:layout_height="40dp" | ||
| 28 | + android:layout_margin="10dp" | ||
| 29 | + android:background="@drawable/shape_10_radius_white_bg" | ||
| 30 | + android:gravity="center_vertical"> | ||
| 54 | 31 | ||
| 55 | - <FrameLayout | ||
| 56 | - android:layout_width="match_parent" | ||
| 57 | - android:layout_height="0dp" | ||
| 58 | - android:layout_weight="1"> | 32 | + <ImageView |
| 33 | + android:layout_width="14dp" | ||
| 34 | + android:layout_height="14dp" | ||
| 35 | + android:layout_centerVertical="true" | ||
| 36 | + android:layout_marginLeft="10dp" | ||
| 37 | + android:src="@drawable/icon_search" /> | ||
| 59 | 38 | ||
| 60 | - <android.support.v7.widget.RecyclerView | ||
| 61 | - android:id="@+id/rv_friends" | ||
| 62 | - android:layout_width="match_parent" | ||
| 63 | - android:layout_height="match_parent" /> | 39 | + <EditText |
| 40 | + android:id="@+id/et_query" | ||
| 41 | + android:layout_width="0dp" | ||
| 42 | + android:layout_height="match_parent" | ||
| 43 | + android:layout_marginLeft="10dp" | ||
| 44 | + android:layout_weight="1" | ||
| 45 | + android:background="@null" | ||
| 46 | + android:clickable="true" | ||
| 47 | + android:focusable="false" | ||
| 48 | + android:focusableInTouchMode="false" | ||
| 49 | + android:hint="请输入搜索内容" | ||
| 50 | + android:textColorHint="#D8D8D8" | ||
| 51 | + android:textSize="12sp" /> | ||
| 64 | 52 | ||
| 65 | - <com.cnlive.strike.ui.widget.LetterBarView | ||
| 66 | - android:id="@+id/letterBarView" | 53 | + <ImageView |
| 54 | + android:id="@+id/iv_delete" | ||
| 55 | + android:layout_width="15dp" | ||
| 56 | + android:layout_height="15dp" | ||
| 57 | + android:layout_centerVertical="true" | ||
| 58 | + android:layout_marginLeft="5dp" | ||
| 59 | + android:layout_marginRight="10dp" | ||
| 60 | + android:background="@drawable/ic_delete" | ||
| 61 | + android:visibility="gone" /> | ||
| 62 | + </LinearLayout> | ||
| 63 | + | ||
| 64 | + <FrameLayout | ||
| 65 | + android:layout_width="match_parent" | ||
| 66 | + android:layout_height="0dp" | ||
| 67 | + android:layout_weight="1"> | ||
| 68 | + | ||
| 69 | + <android.support.v7.widget.RecyclerView | ||
| 70 | + android:id="@+id/rv_friends" | ||
| 71 | + android:layout_width="match_parent" | ||
| 72 | + android:layout_height="match_parent" /> | ||
| 73 | + | ||
| 74 | + <com.cnlive.strike.ui.widget.LetterBarView | ||
| 75 | + android:id="@+id/letterBarView" | ||
| 76 | + android:layout_width="match_parent" | ||
| 77 | + android:layout_height="match_parent" | ||
| 78 | + android:layout_alignParentRight="true" | ||
| 79 | + android:layout_gravity="right" | ||
| 80 | + letterBar:lbLetterBarBackground="@drawable/bg_letterbar" | ||
| 81 | + letterBar:lbLetterBarTextColor="@drawable/selector_letterbar_text" | ||
| 82 | + letterBar:lbOverlayBackground="@drawable/bg_overlay" | ||
| 83 | + letterBar:lbOverlayTextColor="#FFF" | ||
| 84 | + letterBar:lbOverlayTextSize="40sp" /> | ||
| 85 | + </FrameLayout> | ||
| 86 | + | ||
| 87 | + <Button | ||
| 88 | + android:id="@+id/btn_next" | ||
| 89 | + android:layout_width="match_parent" | ||
| 90 | + android:layout_height="45dp" | ||
| 91 | + android:layout_marginLeft="30dp" | ||
| 92 | + android:layout_marginTop="10dp" | ||
| 93 | + android:layout_marginRight="30dp" | ||
| 94 | + android:layout_marginBottom="10dp" | ||
| 95 | + android:background="@drawable/selector_btn_green" | ||
| 96 | + android:text="下一步" | ||
| 97 | + android:textColor="@color/white" | ||
| 98 | + android:textSize="17sp" | ||
| 99 | + android:textStyle="bold" /> | ||
| 100 | + </LinearLayout> | ||
| 101 | + <!-- --> | ||
| 102 | + <com.cnlive.strike.ui.widget.UIEmptyView | ||
| 103 | + android:id="@+id/empty_layout" | ||
| 67 | android:layout_width="match_parent" | 104 | android:layout_width="match_parent" |
| 68 | android:layout_height="match_parent" | 105 | android:layout_height="match_parent" |
| 69 | - android:layout_alignParentRight="true" | ||
| 70 | - android:layout_gravity="right" | ||
| 71 | - letterBar:lbLetterBarBackground="@drawable/bg_letterbar" | ||
| 72 | - letterBar:lbLetterBarTextColor="@drawable/selector_letterbar_text" | ||
| 73 | - letterBar:lbOverlayBackground="@drawable/bg_overlay" | ||
| 74 | - letterBar:lbOverlayTextColor="#FFF" | ||
| 75 | - letterBar:lbOverlayTextSize="40sp" /> | 106 | + android:background="@color/color_fff" |
| 107 | + android:visibility="gone" /> | ||
| 108 | + <!-- --> | ||
| 76 | </FrameLayout> | 109 | </FrameLayout> |
| 77 | - | ||
| 78 | - <Button | ||
| 79 | - android:id="@+id/btn_next" | ||
| 80 | - android:layout_width="match_parent" | ||
| 81 | - android:layout_height="45dp" | ||
| 82 | - android:layout_marginLeft="30dp" | ||
| 83 | - android:layout_marginTop="10dp" | ||
| 84 | - android:layout_marginRight="30dp" | ||
| 85 | - android:layout_marginBottom="10dp" | ||
| 86 | - android:background="@drawable/selector_btn_green" | ||
| 87 | - android:text="下一步" | ||
| 88 | - android:textColor="@color/white" | ||
| 89 | - android:textSize="17sp" | ||
| 90 | - android:textStyle="bold" /> | ||
| 91 | </LinearLayout> | 110 | </LinearLayout> |
| 92 | </layout> | 111 | </layout> |
| 93 | \ No newline at end of file | 112 | \ No newline at end of file |