Commit 3c0738f5e6759ada7b7910bdf3bd1afa022954fb
1 parent
ce1517b5
1 完成配网流程
Showing
72 changed files
with
3868 additions
and
177 deletions
app/build.gradle
| ... | ... | @@ -19,6 +19,8 @@ android { |
| 19 | 19 | debug { |
| 20 | 20 | applicationIdSuffix ".debug" |
| 21 | 21 | resValue("string", "app_name", "网++ 内测") |
| 22 | + buildConfigField("boolean", "VERSION_AS_DEBUG", "true") | |
| 23 | + buildConfigField("int", "SPECIAL_GROUP_MEMBER_LIMIT", "3") | |
| 22 | 24 | buildConfigField("String", "APP_ID", stringValue("802_jhbqccxw08")) |
| 23 | 25 | buildConfigField("String", "APP_KEY", stringValue("9c5619e9be747bb3b925dd215ca5923d86f12c09b9394f")) |
| 24 | 26 | buildConfigField("String", "APP_SCERET", stringValue("1e6380cb347255e777f72b5aa60f41daa68443a132aaea")) |
| ... | ... | @@ -75,4 +77,7 @@ dependencies { |
| 75 | 77 | implementation "com.qmuiteam:qmui:$rootProject.qmui" |
| 76 | 78 | implementation "com.cnlive.libs:base:$rootProject.libBase" |
| 77 | 79 | androidTestImplementation 'junit:junit:4.12' |
| 80 | + implementation 'com.daimajia.easing:library:2.0@aar' | |
| 81 | + implementation 'com.daimajia.androidanimations:library:2.3@aar' | |
| 82 | + implementation 'com.android.support.constraint:constraint-layout:1.1.3' | |
| 78 | 83 | } | ... | ... |
app/src/main/AndroidManifest.xml
| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | android:label="@string/app_name" |
| 9 | 9 | android:roundIcon="@mipmap/ic_launcher_round" |
| 10 | 10 | android:supportsRtl="true" |
| 11 | + android:networkSecurityConfig="@xml/network_security_config" | |
| 11 | 12 | android:theme="@style/AppTheme"> |
| 12 | 13 | <activity android:name="com.cnlive.strike.xiaojiaspeaker.ToolBarTestActivity"></activity> |
| 13 | 14 | <activity android:name="com.cnlive.strike.xiaojiaspeaker.MainActivity"> | ... | ... |
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/ButtonAnimUtil.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker; | |
| 2 | + | |
| 3 | +import android.animation.Animator; | |
| 4 | +import android.animation.AnimatorSet; | |
| 5 | +import android.animation.ObjectAnimator; | |
| 6 | +import android.os.Build; | |
| 7 | +import android.os.Handler; | |
| 8 | +import android.view.View; | |
| 9 | +import android.view.ViewAnimationUtils; | |
| 10 | +import android.view.animation.DecelerateInterpolator; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 圆形按钮点击特效 | |
| 14 | + * | |
| 15 | + * @author ShinnyYang | |
| 16 | + */ | |
| 17 | +public class ButtonAnimUtil { | |
| 18 | + public static final int DEFAULT_ZOOM_DURATION = 50;//默认缩放动画时间间隔 | |
| 19 | + public static final int SHOW_VIEW_ZOOM_DURATION = 150;//显示控件缩放动画时间间隔 | |
| 20 | + public static final int HIDE_VIEW_ZOOM_DURATION = 100;//隐藏控件缩放动画时间间隔 | |
| 21 | + | |
| 22 | + //设置控件放大动画 | |
| 23 | + public static void setViewZoomIn(View view) { | |
| 24 | + try { | |
| 25 | + AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画 | |
| 26 | + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1, 1.2f); | |
| 27 | + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1, 1.2f); | |
| 28 | + animatorSetsuofang.setDuration(DEFAULT_ZOOM_DURATION); | |
| 29 | + animatorSetsuofang.setInterpolator(new DecelerateInterpolator()); | |
| 30 | + animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始 | |
| 31 | + animatorSetsuofang.start(); | |
| 32 | + } catch (Exception e) { | |
| 33 | + } | |
| 34 | + } | |
| 35 | + | |
| 36 | + //设置控件缩小动画 | |
| 37 | + public static void setViewZoomOut(View view) { | |
| 38 | + try { | |
| 39 | + AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画 | |
| 40 | + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.2f, 1); | |
| 41 | + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.2f, 1); | |
| 42 | + animatorSetsuofang.setDuration(DEFAULT_ZOOM_DURATION); | |
| 43 | + animatorSetsuofang.setInterpolator(new DecelerateInterpolator()); | |
| 44 | + animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始 | |
| 45 | + animatorSetsuofang.start(); | |
| 46 | + } catch (Exception e) { | |
| 47 | + } | |
| 48 | + } | |
| 49 | + | |
| 50 | + //设置控件缩小动画 | |
| 51 | + public static void setViewDefault(View view) { | |
| 52 | + try { | |
| 53 | + AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画 | |
| 54 | + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1f, 1); | |
| 55 | + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1f, 1); | |
| 56 | + animatorSetsuofang.setDuration(DEFAULT_ZOOM_DURATION); | |
| 57 | + animatorSetsuofang.setInterpolator(new DecelerateInterpolator()); | |
| 58 | + animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始 | |
| 59 | + animatorSetsuofang.start(); | |
| 60 | + } catch (Exception e) { | |
| 61 | + } | |
| 62 | + } | |
| 63 | + | |
| 64 | + //设置控件显示放大动画 | |
| 65 | + public static void setViewShowZoomIn(View view) { | |
| 66 | + try { | |
| 67 | + AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画 | |
| 68 | + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0, 1.2f); | |
| 69 | + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0, 1.2f); | |
| 70 | + animatorSetsuofang.setDuration(SHOW_VIEW_ZOOM_DURATION); | |
| 71 | + animatorSetsuofang.setInterpolator(new DecelerateInterpolator()); | |
| 72 | + animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始 | |
| 73 | + animatorSetsuofang.start(); | |
| 74 | + new Handler().postDelayed(new Runnable() { | |
| 75 | + @Override | |
| 76 | + public void run() { | |
| 77 | + if (view == null) { | |
| 78 | + return; | |
| 79 | + } | |
| 80 | + AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画 | |
| 81 | + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1.2f, 1); | |
| 82 | + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1.2f, 1); | |
| 83 | + animatorSetsuofang.setDuration(SHOW_VIEW_ZOOM_DURATION); | |
| 84 | + animatorSetsuofang.setInterpolator(new DecelerateInterpolator()); | |
| 85 | + animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始 | |
| 86 | + animatorSetsuofang.start(); | |
| 87 | + } | |
| 88 | + }, SHOW_VIEW_ZOOM_DURATION); | |
| 89 | + } catch (Exception e) { | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + //设置控件隐藏缩小动画 | |
| 94 | + public static void setViewHideZoomOut(View view) { | |
| 95 | + try { | |
| 96 | + AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画 | |
| 97 | + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1, 0); | |
| 98 | + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1, 0); | |
| 99 | + animatorSetsuofang.setDuration(HIDE_VIEW_ZOOM_DURATION); | |
| 100 | + animatorSetsuofang.setInterpolator(new DecelerateInterpolator()); | |
| 101 | + animatorSetsuofang.play(scaleX).with(scaleY);//两个动画同时开始 | |
| 102 | + animatorSetsuofang.start(); | |
| 103 | + } catch (Exception e) { | |
| 104 | + } | |
| 105 | + } | |
| 106 | + | |
| 107 | + //设置时间显示放大动画 | |
| 108 | + public static void setTimeShowZoomIn(View view) { | |
| 109 | + try { | |
| 110 | + ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 0, 1.4f); | |
| 111 | + ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 0, 1.4f); | |
| 112 | + ObjectAnimator scaleX1 = ObjectAnimator.ofFloat(view, "scaleX", 1.4f, 1); | |
| 113 | + ObjectAnimator scaleY1 = ObjectAnimator.ofFloat(view, "scaleY", 1.4f, 1); | |
| 114 | + ObjectAnimator scaleX2 = ObjectAnimator.ofFloat(view, "scaleX", 1, 0); | |
| 115 | + ObjectAnimator scaleY2 = ObjectAnimator.ofFloat(view, "scaleY", 1, 0); | |
| 116 | + AnimatorSet animatorSetsuofang = new AnimatorSet();//组合动画 | |
| 117 | + animatorSetsuofang.setDuration(100); | |
| 118 | + animatorSetsuofang.setInterpolator(new DecelerateInterpolator()); | |
| 119 | + animatorSetsuofang.play(scaleX).with(scaleY); | |
| 120 | + animatorSetsuofang.start(); | |
| 121 | + new Handler().postDelayed(new Runnable() { | |
| 122 | + @Override | |
| 123 | + public void run() { | |
| 124 | + if (view == null) { | |
| 125 | + return; | |
| 126 | + } | |
| 127 | + AnimatorSet animatorSetsuofang2 = new AnimatorSet();//组合动画 | |
| 128 | + animatorSetsuofang2.setDuration(100); | |
| 129 | + animatorSetsuofang2.setInterpolator(new DecelerateInterpolator()); | |
| 130 | + animatorSetsuofang2.play(scaleX1).with(scaleY1); | |
| 131 | + animatorSetsuofang2.start(); | |
| 132 | + } | |
| 133 | + }, 100); | |
| 134 | + | |
| 135 | + new Handler().postDelayed(new Runnable() { | |
| 136 | + @Override | |
| 137 | + public void run() { | |
| 138 | + if (view == null) { | |
| 139 | + return; | |
| 140 | + } | |
| 141 | + AnimatorSet animatorSetsuofang3 = new AnimatorSet();//组合动画 | |
| 142 | + animatorSetsuofang3.setDuration(10); | |
| 143 | + animatorSetsuofang3.setInterpolator(new DecelerateInterpolator()); | |
| 144 | + animatorSetsuofang3.play(scaleX2).with(scaleY2); | |
| 145 | + animatorSetsuofang3.start(); | |
| 146 | + } | |
| 147 | + }, 300); | |
| 148 | + } catch (Exception e) { | |
| 149 | + } | |
| 150 | + } | |
| 151 | + | |
| 152 | + | |
| 153 | + /** | |
| 154 | + * 设置控件展开特效 | |
| 155 | + * | |
| 156 | + * @param view | |
| 157 | + * @param closeFlag | |
| 158 | + */ | |
| 159 | + public static void startAnimation(View view, boolean closeFlag) { | |
| 160 | + try { | |
| 161 | + //因为CircularReveal动画是api21之后才有的,所以加个判断语句,免得崩溃 | |
| 162 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | |
| 163 | + int cicular_R = view.getHeight() / 2 > view.getWidth() / 2 ? view.getHeight() / 2 : view.getWidth() / 2; | |
| 164 | + Animator animator = null; | |
| 165 | + if (!closeFlag) { | |
| 166 | + animator = ViewAnimationUtils.createCircularReveal(view, (int) view.getWidth() / 2, (int) view.getHeight() / 2, 0, cicular_R); | |
| 167 | + } else { | |
| 168 | + animator = ViewAnimationUtils.createCircularReveal(view, (int) view.getWidth() / 2, (int) view.getHeight() / 2, cicular_R, 0); | |
| 169 | + } | |
| 170 | + animator.addListener(new Animator.AnimatorListener() { | |
| 171 | + @Override | |
| 172 | + public void onAnimationStart(Animator animator) { | |
| 173 | + | |
| 174 | + } | |
| 175 | + | |
| 176 | + @Override | |
| 177 | + public void onAnimationEnd(Animator animator) { | |
| 178 | + if (closeFlag) { | |
| 179 | + view.setVisibility(View.GONE); | |
| 180 | + } | |
| 181 | + } | |
| 182 | + | |
| 183 | + @Override | |
| 184 | + public void onAnimationCancel(Animator animator) { | |
| 185 | + | |
| 186 | + } | |
| 187 | + | |
| 188 | + @Override | |
| 189 | + public void onAnimationRepeat(Animator animator) { | |
| 190 | + | |
| 191 | + } | |
| 192 | + }); | |
| 193 | + animator.setDuration(350); | |
| 194 | + animator.start(); | |
| 195 | + } else { | |
| 196 | + if (closeFlag) { | |
| 197 | + view.setVisibility(View.GONE); | |
| 198 | + } | |
| 199 | + } | |
| 200 | + | |
| 201 | + } catch (Exception e) { | |
| 202 | + } | |
| 203 | + } | |
| 204 | + | |
| 205 | +} | ... | ... |
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/MainActivity.java
| ... | ... | @@ -13,6 +13,7 @@ import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceInstructionActivity; |
| 13 | 13 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceManagerActivity; |
| 14 | 14 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.FirmwareUpdateActivity; |
| 15 | 15 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.SearchDeviceActivity; |
| 16 | +import com.cnlive.strike.xiaojiaspeaker.ui.activity.SelectIMFriendActivity; | |
| 16 | 17 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.SelectWifiActivity; |
| 17 | 18 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.SpeakerMainActivity; |
| 18 | 19 | |
| ... | ... | @@ -31,7 +32,8 @@ public class MainActivity extends AppCompatActivity { |
| 31 | 32 | // startActivity(new Intent(MainActivity.this, DeviceManagerActivity.class)); |
| 32 | 33 | // startActivity(new Intent(MainActivity.this, FirmwareUpdateActivity.class)); |
| 33 | 34 | // startActivity(new Intent(MainActivity.this, SelectWifiActivity.class)); |
| 34 | - | |
| 35 | +// startActivity(new Intent(MainActivity.this, ToolBarTestActivity.class)); | |
| 36 | +// startActivity(new Intent(MainActivity.this, SelectIMFriendActivity.class)); | |
| 35 | 37 | finish(); |
| 36 | 38 | } |
| 37 | 39 | ... | ... |
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/MyApp.java
| ... | ... | @@ -11,8 +11,12 @@ public class MyApp extends Application { |
| 11 | 11 | public void onCreate() { |
| 12 | 12 | super.onCreate(); |
| 13 | 13 | String userId = ""; |
| 14 | - AppConfig.init(getApplicationContext(), BuildConfig.APP_ID, BuildConfig.APP_KEY, BuildConfig.APP_SCERET, | |
| 15 | - 0, BuildConfig.DEBUG, "", "", | |
| 16 | - userId, "", "", "", ""); | |
| 14 | + AppConfig.init(this, BuildConfig.APP_ID, BuildConfig.APP_KEY, | |
| 15 | + BuildConfig.APP_SCERET, BuildConfig.SPECIAL_GROUP_MEMBER_LIMIT, | |
| 16 | + BuildConfig.VERSION_AS_DEBUG, "","", | |
| 17 | + "", "", | |
| 18 | + "","", "", | |
| 19 | + "", "","", | |
| 20 | + BuildConfig.BAIDU_MAP_APP_KEY, ""); | |
| 17 | 21 | } |
| 18 | 22 | } | ... | ... |
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/ToolBarTestActivity.java
| 1 | 1 | package com.cnlive.strike.xiaojiaspeaker; |
| 2 | 2 | |
| 3 | +import android.animation.AnimatorSet; | |
| 4 | +import android.animation.ObjectAnimator; | |
| 3 | 5 | import android.databinding.DataBindingUtil; |
| 6 | +import android.os.Build; | |
| 7 | +import android.os.Handler; | |
| 4 | 8 | import android.support.design.widget.AppBarLayout; |
| 9 | +import android.support.design.widget.CoordinatorLayout; | |
| 5 | 10 | import android.support.v4.content.ContextCompat; |
| 11 | +import android.support.v4.view.animation.FastOutLinearInInterpolator; | |
| 6 | 12 | import android.support.v7.app.AppCompatActivity; |
| 7 | 13 | import android.os.Bundle; |
| 8 | 14 | import android.util.Log; |
| 15 | +import android.view.View; | |
| 16 | +import android.view.animation.AccelerateDecelerateInterpolator; | |
| 17 | +import android.view.animation.Animation; | |
| 18 | +import android.view.animation.AnimationUtils; | |
| 19 | +import android.view.animation.AnticipateInterpolator; | |
| 20 | +import android.view.animation.BounceInterpolator; | |
| 21 | +import android.view.animation.CycleInterpolator; | |
| 22 | +import android.view.animation.LinearInterpolator; | |
| 23 | +import android.view.animation.OvershootInterpolator; | |
| 24 | +import android.view.animation.TranslateAnimation; | |
| 25 | +import android.widget.LinearLayout; | |
| 9 | 26 | |
| 10 | 27 | import com.cnlive.strike.speaker.R; |
| 28 | +import com.cnlive.strike.speaker.databinding.ActivityToolBarTest1Binding; | |
| 11 | 29 | import com.cnlive.strike.speaker.databinding.ActivityToolBarTestBinding; |
| 30 | +import com.cnlive.strike.xiaojiaspeaker.util.utilcode.util.ScreenUtils; | |
| 31 | +import com.daimajia.androidanimations.library.Techniques; | |
| 32 | +import com.daimajia.androidanimations.library.YoYo; | |
| 12 | 33 | |
| 13 | 34 | public class ToolBarTestActivity extends AppCompatActivity { |
| 14 | 35 | private ActivityToolBarTestBinding binding; |
| 15 | 36 | private String TAG = "ToolBarTestActivity"; |
| 37 | + private boolean isFirstSlide = true; | |
| 16 | 38 | |
| 17 | 39 | @Override |
| 18 | 40 | protected void onCreate(Bundle savedInstanceState) { |
| 19 | 41 | super.onCreate(savedInstanceState); |
| 20 | 42 | binding = DataBindingUtil.setContentView(this, R.layout.activity_tool_bar_test); |
| 43 | + LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) binding.ivLife.getLayoutParams(); | |
| 44 | + Log.e(TAG, "onCreate: " + params.topMargin); | |
| 45 | + YoYo.with(Techniques.Swing) | |
| 46 | + .duration(700) | |
| 47 | + .repeat(0) | |
| 48 | + .playOn(binding.ivLife); | |
| 49 | + binding.appbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { | |
| 50 | + @Override | |
| 51 | + public void onOffsetChanged(AppBarLayout appBarLayout, int i) { | |
| 52 | + Log.e(TAG, "onOffsetChanged: " + i + "getTotalScrollRange:" + appBarLayout.getTotalScrollRange()); | |
| 53 | + if (isFirstSlide) { | |
| 54 | + if (i != 0) { | |
| 55 | + binding.tvCircle.setVisibility(View.GONE); | |
| 56 | + binding.tvSub.setVisibility(View.GONE); | |
| 57 | + binding.tvShop.setVisibility(View.GONE); | |
| 58 | + binding.llMenu.startAnimation(AnimationUtils.makeOutAnimation(ToolBarTestActivity.this, true)); | |
| 59 | + binding.llMenu.setVisibility(View.INVISIBLE); | |
| 60 | + | |
| 61 | + ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llLife, "scaleY", 1f, 0.8f); | |
| 62 | + // 正式开始启动执行动画 | |
| 63 | + ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llLife, "scaleX", 1f, 0.8f); | |
| 64 | + // 正式开始启动执行动画 | |
| 65 | + AnimatorSet animatorSet = new AnimatorSet(); | |
| 66 | + animatorSet.play(anim).with(anim1); | |
| 67 | + animatorSet.setDuration(500); | |
| 68 | + animatorSet.start(); | |
| 69 | + | |
| 70 | + | |
| 71 | + ObjectAnimator translationX = ObjectAnimator.ofFloat(binding.llLife, "translationY", 50, -50); | |
| 72 | + translationX.setDuration(300); | |
| 73 | + translationX.setInterpolator(new FastOutLinearInInterpolator()); | |
| 74 | + translationX.start(); | |
| 75 | + new Handler().postDelayed(new Runnable() { | |
| 76 | + @Override | |
| 77 | + public void run() { | |
| 78 | + ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llSub, "scaleY", 1f, 0.8f); | |
| 79 | + // 正式开始启动执行动画 | |
| 80 | + ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llSub, "scaleX", 1f, 0.8f); | |
| 81 | + // 正式开始启动执行动画 | |
| 82 | + AnimatorSet animatorSet = new AnimatorSet(); | |
| 83 | + animatorSet.play(anim).with(anim1); | |
| 84 | + animatorSet.setDuration(500); | |
| 85 | + animatorSet.start(); | |
| 86 | + | |
| 87 | + ObjectAnimator translationX1 = ObjectAnimator.ofFloat(binding.llSub, "translationY", 50, -50); | |
| 88 | + translationX1.setDuration(300); | |
| 89 | + translationX1.setInterpolator(new FastOutLinearInInterpolator()); | |
| 90 | + translationX1.start(); | |
| 91 | + new Handler().postDelayed(new Runnable() { | |
| 92 | + @Override | |
| 93 | + public void run() { | |
| 94 | + ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llShop, "scaleY", 1f, 0.8f); | |
| 95 | + // 正式开始启动执行动画 | |
| 96 | + ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llShop, "scaleX", 1f, 0.8f); | |
| 97 | + // 正式开始启动执行动画 | |
| 98 | + AnimatorSet animatorSet = new AnimatorSet(); | |
| 99 | + animatorSet.play(anim).with(anim1); | |
| 100 | + animatorSet.setDuration(500); | |
| 101 | + animatorSet.start(); | |
| 102 | + | |
| 103 | + ObjectAnimator translationX2 = ObjectAnimator.ofFloat(binding.llShop, "translationY", 50, -50); | |
| 104 | + translationX2.setDuration(300); | |
| 105 | + translationX2.setInterpolator(new FastOutLinearInInterpolator()); | |
| 106 | + translationX2.start(); | |
| 107 | + | |
| 108 | + } | |
| 109 | + }, 50); | |
| 110 | + } | |
| 111 | + }, 50); | |
| 112 | + | |
| 113 | + | |
| 114 | + } | |
| 115 | + } | |
| 116 | + if (i != 0) { | |
| 117 | + isFirstSlide = false; | |
| 118 | + if (i == -appBarLayout.getTotalScrollRange()) { | |
| 119 | + setMargin(100); | |
| 120 | + } | |
| 121 | + } else { | |
| 122 | + if (!isFirstSlide) { | |
| 123 | + setMargin(0); | |
| 124 | + } | |
| 125 | + isFirstSlide = true; | |
| 126 | + binding.tvCircle.setVisibility(View.VISIBLE); | |
| 127 | + binding.tvSub.setVisibility(View.VISIBLE); | |
| 128 | + binding.tvShop.setVisibility(View.VISIBLE); | |
| 129 | + binding.llMenu.setVisibility(View.VISIBLE); | |
| 130 | + binding.ivLife.setVisibility(View.VISIBLE); | |
| 131 | + | |
| 132 | + ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llShop, "scaleY", 0.8f, 1f); | |
| 133 | + // 正式开始启动执行动画 | |
| 134 | + ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llShop, "scaleX", 0.8f, 1f); | |
| 135 | + // 正式开始启动执行动画 | |
| 136 | + AnimatorSet animatorSet = new AnimatorSet(); | |
| 137 | + animatorSet.play(anim).with(anim1); | |
| 138 | + animatorSet.setDuration(500); | |
| 139 | + animatorSet.start(); | |
| 140 | + | |
| 141 | + ObjectAnimator translationX = ObjectAnimator.ofFloat(binding.llShop, "translationY", 100, 0); | |
| 142 | + translationX.setDuration(300); | |
| 143 | + translationX.setInterpolator(new FastOutLinearInInterpolator()); | |
| 144 | + translationX.start(); | |
| 145 | + new Handler().postDelayed(new Runnable() { | |
| 146 | + @Override | |
| 147 | + public void run() { | |
| 148 | + ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llSub, "scaleY", 0.8f, 1f); | |
| 149 | + // 正式开始启动执行动画 | |
| 150 | + ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llSub, "scaleX", 0.8f, 1f); | |
| 151 | + // 正式开始启动执行动画 | |
| 152 | + AnimatorSet animatorSet = new AnimatorSet(); | |
| 153 | + animatorSet.play(anim).with(anim1); | |
| 154 | + animatorSet.setDuration(500); | |
| 155 | + animatorSet.start(); | |
| 156 | + | |
| 157 | + ObjectAnimator translationX1 = ObjectAnimator.ofFloat(binding.llSub, "translationY", 100, 0); | |
| 158 | + translationX1.setDuration(300); | |
| 159 | + translationX1.setInterpolator(new FastOutLinearInInterpolator()); | |
| 160 | + translationX1.start(); | |
| 161 | + new Handler().postDelayed(new Runnable() { | |
| 162 | + @Override | |
| 163 | + public void run() { | |
| 164 | + ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llLife, "scaleY", 0.8f, 1f); | |
| 165 | + // 正式开始启动执行动画 | |
| 166 | + ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llLife, "scaleX", 0.8f, 1f); | |
| 167 | + // 正式开始启动执行动画 | |
| 168 | + AnimatorSet animatorSet = new AnimatorSet(); | |
| 169 | + animatorSet.play(anim).with(anim1); | |
| 170 | + animatorSet.setDuration(500); | |
| 171 | + animatorSet.start(); | |
| 172 | + | |
| 173 | + | |
| 174 | + ObjectAnimator translationX2 = ObjectAnimator.ofFloat(binding.llLife, "translationY", 100, 0); | |
| 175 | + translationX2.setDuration(300); | |
| 176 | + translationX2.setInterpolator(new FastOutLinearInInterpolator()); | |
| 177 | + translationX2.start(); | |
| 178 | + //设置缩放动画 | |
| 179 | + new Handler().postDelayed(new Runnable() { | |
| 180 | + @Override | |
| 181 | + public void run() { | |
| 182 | + ButtonAnimUtil.setViewShowZoomIn(binding.ivLife); | |
| 183 | + YoYo.with(Techniques.Swing) | |
| 184 | + .duration(700) | |
| 185 | + .repeat(0) | |
| 186 | + .playOn(binding.ivLife); | |
| 187 | + } | |
| 188 | + }, 500); | |
| 189 | + } | |
| 190 | + }, 50); | |
| 191 | + } | |
| 192 | + }, 50); | |
| 193 | +// | |
| 194 | + } | |
| 195 | + | |
| 196 | + } | |
| 197 | + }); | |
| 198 | + } | |
| 199 | + | |
| 200 | + private void setMargin(int topmargin) { | |
| 201 | + LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) binding.llLife.getLayoutParams(); | |
| 202 | + params.topMargin = topmargin; | |
| 203 | + binding.llLife.setLayoutParams(params); | |
| 204 | + LinearLayout.LayoutParams params2 = (LinearLayout.LayoutParams) binding.llSub.getLayoutParams(); | |
| 205 | + params2.topMargin = topmargin; | |
| 206 | + binding.llSub.setLayoutParams(params2); | |
| 207 | + LinearLayout.LayoutParams params3 = (LinearLayout.LayoutParams) binding.llShop.getLayoutParams(); | |
| 208 | + params3.topMargin = topmargin; | |
| 209 | + binding.llShop.setLayoutParams(params3); | |
| 21 | 210 | } |
| 22 | 211 | } | ... | ... |
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/Util.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker; | |
| 2 | + | |
| 3 | +import android.content.res.Resources; | |
| 4 | +import android.graphics.RectF; | |
| 5 | +import android.os.Build; | |
| 6 | +import android.view.Gravity; | |
| 7 | +import android.view.View; | |
| 8 | +import android.view.ViewTreeObserver; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * utils | |
| 12 | + */ | |
| 13 | +final class Util { | |
| 14 | + | |
| 15 | + public static RectF calculateRectOnScreen(View view) { | |
| 16 | + int[] location = new int[2]; | |
| 17 | + view.getLocationOnScreen(location); | |
| 18 | + return new RectF(location[0], location[1], location[0] + view.getMeasuredWidth(), location[1] + view.getMeasuredHeight()); | |
| 19 | + } | |
| 20 | + | |
| 21 | + public static RectF calculateRectInWindow(View view) { | |
| 22 | + int[] location = new int[2]; | |
| 23 | + view.getLocationInWindow(location); | |
| 24 | + return new RectF(location[0], location[1], location[0] + view.getMeasuredWidth(), location[1] + view.getMeasuredHeight()); | |
| 25 | + } | |
| 26 | + | |
| 27 | + public static float pxToDp(float px) { | |
| 28 | + return px / Resources.getSystem().getDisplayMetrics().density; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public static float dpToPx(float dp) { | |
| 32 | + return dp * Resources.getSystem().getDisplayMetrics().density; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public static int gravityToArrowDirection(int gravity) { | |
| 36 | + switch (gravity) { | |
| 37 | + case Gravity.START: | |
| 38 | + return Gravity.END; | |
| 39 | + case Gravity.TOP: | |
| 40 | + return Gravity.BOTTOM; | |
| 41 | + case Gravity.END: | |
| 42 | + return Gravity.START; | |
| 43 | + case Gravity.BOTTOM: | |
| 44 | + return Gravity.TOP; | |
| 45 | + default: | |
| 46 | + return gravity; | |
| 47 | + } | |
| 48 | + } | |
| 49 | + | |
| 50 | + public static void removeOnGlobalLayoutListener(View view, ViewTreeObserver.OnGlobalLayoutListener listener) { | |
| 51 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { | |
| 52 | + view.getViewTreeObserver().removeOnGlobalLayoutListener(listener); | |
| 53 | + } else { | |
| 54 | + view.getViewTreeObserver().removeGlobalOnLayoutListener(listener); | |
| 55 | + } | |
| 56 | + } | |
| 57 | +} | ... | ... |
app/src/main/res/drawable-hdpi/icon_main_shop.webp
0 → 100644
No preview for this file type
app/src/main/res/drawable-hdpi/icon_main_subscribe.webp
0 → 100644
No preview for this file type
app/src/main/res/drawable-hdpi/icon_mian_add.webp
0 → 100644
No preview for this file type
app/src/main/res/drawable-hdpi/icon_mian_contact.webp
0 → 100644
No preview for this file type
app/src/main/res/drawable-hdpi/icon_mian_life.webp
0 → 100644
No preview for this file type
app/src/main/res/drawable-hdpi/icon_mian_search.webp
0 → 100644
No preview for this file type
app/src/main/res/drawable-hdpi/mian_bg.png
0 → 100644
54 KB
app/src/main/res/layout/activity_tool_bar_test.xml
| ... | ... | @@ -10,10 +10,360 @@ |
| 10 | 10 | tools:context="com.cnlive.strike.xiaojiaspeaker.ToolBarTestActivity" |
| 11 | 11 | tools:ignore="MissingDefaultResource"> |
| 12 | 12 | |
| 13 | - <android.support.design.chip.Chip | |
| 14 | - android:layout_width="wrap_content" | |
| 15 | - android:layout_height="wrap_content" | |
| 16 | - android:text="text" /> | |
| 13 | + <android.support.design.widget.AppBarLayout | |
| 14 | + android:id="@+id/appbar" | |
| 15 | + android:layout_width="match_parent" | |
| 16 | + android:layout_height="150dp" | |
| 17 | + android:background="@drawable/mian_bg" | |
| 18 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | |
| 17 | 19 | |
| 20 | + <!----> | |
| 21 | + <android.support.design.widget.CollapsingToolbarLayout | |
| 22 | + android:id="@+id/ctb" | |
| 23 | + android:layout_width="match_parent" | |
| 24 | + android:layout_height="wrap_content" | |
| 25 | + android:fitsSystemWindows="true" | |
| 26 | + | |
| 27 | + app:layout_scrollFlags="scroll|exitUntilCollapsed"> | |
| 28 | + <!----> | |
| 29 | + <LinearLayout | |
| 30 | + android:id="@+id/ll_menu" | |
| 31 | + android:layout_width="match_parent" | |
| 32 | + android:layout_height="40dp" | |
| 33 | + android:gravity="center|right" | |
| 34 | + app:layout_collapseMode="pin"> | |
| 35 | + | |
| 36 | + <LinearLayout | |
| 37 | + android:id="@+id/ll_search" | |
| 38 | + android:layout_width="45dp" | |
| 39 | + android:layout_height="match_parent" | |
| 40 | + android:layout_marginTop="5dp" | |
| 41 | + android:layout_marginBottom="5dp" | |
| 42 | + android:clickable="true" | |
| 43 | + android:focusable="true" | |
| 44 | + android:gravity="center"> | |
| 45 | + | |
| 46 | + <ImageView | |
| 47 | + android:layout_width="wrap_content" | |
| 48 | + android:layout_height="19dp" | |
| 49 | + android:background="@drawable/icon_mian_search" | |
| 50 | + android:clickable="false" | |
| 51 | + android:focusable="false" /> | |
| 52 | + </LinearLayout> | |
| 53 | + | |
| 54 | + <FrameLayout | |
| 55 | + android:id="@+id/fl_contact" | |
| 56 | + android:layout_width="45dp" | |
| 57 | + android:layout_height="match_parent" | |
| 58 | + android:layout_marginTop="5dp" | |
| 59 | + android:layout_marginBottom="5dp" | |
| 60 | + android:clickable="true" | |
| 61 | + android:focusable="true"> | |
| 62 | + | |
| 63 | + <FrameLayout | |
| 64 | + android:layout_width="wrap_content" | |
| 65 | + android:layout_height="wrap_content" | |
| 66 | + android:layout_gravity="center" | |
| 67 | + android:clickable="false" | |
| 68 | + android:focusable="false"> | |
| 69 | + | |
| 70 | + <ImageView | |
| 71 | + android:layout_width="18dp" | |
| 72 | + android:layout_height="18dp" | |
| 73 | + android:layout_gravity="center" | |
| 74 | + android:background="@drawable/icon_mian_contact" | |
| 75 | + android:clickable="false" | |
| 76 | + android:focusable="false" /> | |
| 77 | + | |
| 78 | + </FrameLayout> | |
| 79 | + </FrameLayout> | |
| 80 | + | |
| 81 | + <LinearLayout | |
| 82 | + android:id="@+id/ll_add" | |
| 83 | + android:layout_width="45dp" | |
| 84 | + android:layout_height="match_parent" | |
| 85 | + android:layout_marginTop="5dp" | |
| 86 | + android:layout_marginRight="5dp" | |
| 87 | + android:layout_marginBottom="5dp" | |
| 88 | + android:clickable="true" | |
| 89 | + android:focusable="true" | |
| 90 | + android:gravity="center"> | |
| 91 | + | |
| 92 | + <ImageView | |
| 93 | + android:id="@+id/iv_add" | |
| 94 | + android:layout_width="18dp" | |
| 95 | + android:layout_height="18dp" | |
| 96 | + android:background="@drawable/icon_mian_add" | |
| 97 | + android:clickable="false" | |
| 98 | + android:focusable="false" /> | |
| 99 | + </LinearLayout> | |
| 100 | + </LinearLayout> | |
| 101 | + <!----> | |
| 102 | + <LinearLayout | |
| 103 | + android:layout_width="match_parent" | |
| 104 | + android:layout_height="wrap_content" | |
| 105 | + android:layout_gravity="bottom" | |
| 106 | + android:orientation="horizontal" | |
| 107 | + android:visibility="gone" | |
| 108 | + app:layout_collapseMode="parallax"> | |
| 109 | + | |
| 110 | + <LinearLayout | |
| 111 | + android:layout_width="0dp" | |
| 112 | + android:layout_height="wrap_content" | |
| 113 | + android:layout_weight="1" | |
| 114 | + android:gravity="center" | |
| 115 | + android:orientation="vertical"> | |
| 116 | + | |
| 117 | + <ImageView | |
| 118 | + android:layout_width="55dp" | |
| 119 | + android:layout_height="55dp" | |
| 120 | + android:layout_gravity="center" | |
| 121 | + android:background="@drawable/icon_mian_life" | |
| 122 | + android:focusable="false" /> | |
| 123 | + | |
| 124 | + <TextView | |
| 125 | + android:layout_width="wrap_content" | |
| 126 | + android:layout_height="wrap_content" | |
| 127 | + android:focusable="false" | |
| 128 | + android:text="生活圈" | |
| 129 | + android:textColor="@color/color_282828" | |
| 130 | + android:textSize="13sp" /> | |
| 131 | + </LinearLayout> | |
| 132 | + | |
| 133 | + <LinearLayout | |
| 134 | + android:layout_width="0dp" | |
| 135 | + android:layout_height="wrap_content" | |
| 136 | + android:layout_weight="1" | |
| 137 | + android:gravity="center" | |
| 138 | + android:orientation="vertical"> | |
| 139 | + | |
| 140 | + <ImageView | |
| 141 | + android:layout_width="55dp" | |
| 142 | + android:layout_height="55dp" | |
| 143 | + android:layout_gravity="center" | |
| 144 | + android:background="@drawable/icon_main_subscribe" | |
| 145 | + android:focusable="false" /> | |
| 146 | + | |
| 147 | + <TextView | |
| 148 | + android:layout_width="wrap_content" | |
| 149 | + android:layout_height="wrap_content" | |
| 150 | + android:focusable="false" | |
| 151 | + android:text="订阅号" | |
| 152 | + android:textColor="@color/color_282828" | |
| 153 | + android:textSize="13sp" /> | |
| 154 | + </LinearLayout> | |
| 155 | + | |
| 156 | + <LinearLayout | |
| 157 | + android:layout_width="0dp" | |
| 158 | + android:layout_height="wrap_content" | |
| 159 | + android:layout_weight="1" | |
| 160 | + android:gravity="center" | |
| 161 | + android:orientation="vertical"> | |
| 162 | + | |
| 163 | + <ImageView | |
| 164 | + android:layout_width="55dp" | |
| 165 | + android:layout_height="55dp" | |
| 166 | + android:layout_gravity="center" | |
| 167 | + android:background="@drawable/icon_main_shop" | |
| 168 | + android:focusable="false" /> | |
| 169 | + | |
| 170 | + <TextView | |
| 171 | + android:layout_width="wrap_content" | |
| 172 | + android:layout_height="wrap_content" | |
| 173 | + android:focusable="false" | |
| 174 | + android:text="优选库" | |
| 175 | + android:textColor="@color/color_282828" | |
| 176 | + android:textSize="13sp" /> | |
| 177 | + </LinearLayout> | |
| 178 | + </LinearLayout> | |
| 179 | + | |
| 180 | + </android.support.design.widget.CollapsingToolbarLayout> | |
| 181 | + <!-- --> | |
| 182 | + <LinearLayout | |
| 183 | + android:id="@+id/ll_root" | |
| 184 | + android:layout_width="match_parent" | |
| 185 | + android:layout_height="match_parent" | |
| 186 | + android:layout_gravity="bottom" | |
| 187 | + android:orientation="horizontal" | |
| 188 | + app:layout_collapseMode="parallax"> | |
| 189 | + | |
| 190 | + <LinearLayout | |
| 191 | + android:id="@+id/ll_life" | |
| 192 | + android:layout_width="0dp" | |
| 193 | + android:layout_height="match_parent" | |
| 194 | + android:layout_weight="1" | |
| 195 | + android:gravity="center" | |
| 196 | + android:orientation="vertical"> | |
| 197 | + | |
| 198 | + <ImageView | |
| 199 | + android:id="@+id/iv_life" | |
| 200 | + android:layout_width="55dp" | |
| 201 | + android:layout_height="55dp" | |
| 202 | + android:layout_gravity="center" | |
| 203 | + android:background="@drawable/icon_mian_life" | |
| 204 | + android:focusable="false" /> | |
| 205 | + | |
| 206 | + <TextView | |
| 207 | + android:id="@+id/tv_circle" | |
| 208 | + android:layout_width="wrap_content" | |
| 209 | + android:layout_height="wrap_content" | |
| 210 | + android:focusable="false" | |
| 211 | + android:text="生活圈" | |
| 212 | + android:textColor="@color/color_282828" | |
| 213 | + android:textSize="13sp" /> | |
| 214 | + </LinearLayout> | |
| 215 | + | |
| 216 | + <LinearLayout | |
| 217 | + android:id="@+id/ll_sub" | |
| 218 | + android:layout_width="0dp" | |
| 219 | + android:layout_height="match_parent" | |
| 220 | + android:layout_weight="1" | |
| 221 | + android:gravity="center" | |
| 222 | + | |
| 223 | + android:orientation="vertical"> | |
| 224 | + | |
| 225 | + <ImageView | |
| 226 | + android:id="@+id/iv_sub" | |
| 227 | + android:layout_width="55dp" | |
| 228 | + android:layout_height="55dp" | |
| 229 | + android:layout_gravity="center" | |
| 230 | + android:background="@drawable/icon_main_subscribe" | |
| 231 | + android:focusable="false" /> | |
| 232 | + | |
| 233 | + <TextView | |
| 234 | + android:id="@+id/tv_sub" | |
| 235 | + android:layout_width="wrap_content" | |
| 236 | + android:layout_height="wrap_content" | |
| 237 | + android:focusable="false" | |
| 238 | + android:text="订阅号" | |
| 239 | + android:textColor="@color/color_282828" | |
| 240 | + android:textSize="13sp" /> | |
| 241 | + </LinearLayout> | |
| 242 | + | |
| 243 | + <LinearLayout | |
| 244 | + android:id="@+id/ll_shop" | |
| 245 | + android:layout_width="0dp" | |
| 246 | + android:layout_height="match_parent" | |
| 247 | + android:layout_weight="1" | |
| 248 | + android:gravity="center" | |
| 249 | + | |
| 250 | + android:orientation="vertical"> | |
| 251 | + | |
| 252 | + <ImageView | |
| 253 | + android:id="@+id/iv_shop" | |
| 254 | + android:layout_width="55dp" | |
| 255 | + android:layout_height="55dp" | |
| 256 | + android:layout_gravity="center" | |
| 257 | + android:background="@drawable/icon_main_shop" | |
| 258 | + android:focusable="false" /> | |
| 259 | + | |
| 260 | + <TextView | |
| 261 | + android:id="@+id/tv_shop" | |
| 262 | + android:layout_width="wrap_content" | |
| 263 | + android:layout_height="wrap_content" | |
| 264 | + android:focusable="false" | |
| 265 | + android:text="优选库" | |
| 266 | + android:textColor="@color/color_282828" | |
| 267 | + android:textSize="13sp" /> | |
| 268 | + </LinearLayout> | |
| 269 | + </LinearLayout> | |
| 270 | + <!-- --> | |
| 271 | + </android.support.design.widget.AppBarLayout> | |
| 272 | + | |
| 273 | + <android.support.v4.widget.NestedScrollView | |
| 274 | + android:layout_width="match_parent" | |
| 275 | + android:layout_height="match_parent" | |
| 276 | + app:layout_behavior="@string/appbar_scrolling_view_behavior"> | |
| 277 | + | |
| 278 | + <LinearLayout | |
| 279 | + android:layout_width="match_parent" | |
| 280 | + android:layout_height="wrap_content" | |
| 281 | + android:orientation="vertical"> | |
| 282 | + | |
| 283 | + <TextView | |
| 284 | + android:layout_width="wrap_content" | |
| 285 | + android:layout_height="wrap_content" | |
| 286 | + android:layout_margin="20dp" | |
| 287 | + android:text="123456" /> | |
| 288 | + | |
| 289 | + <TextView | |
| 290 | + android:layout_width="wrap_content" | |
| 291 | + android:layout_height="wrap_content" | |
| 292 | + android:layout_margin="20dp" | |
| 293 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 294 | + | |
| 295 | + <TextView | |
| 296 | + android:layout_width="wrap_content" | |
| 297 | + android:layout_height="wrap_content" | |
| 298 | + android:layout_margin="20dp" | |
| 299 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 300 | + | |
| 301 | + <TextView | |
| 302 | + android:layout_width="wrap_content" | |
| 303 | + android:layout_height="wrap_content" | |
| 304 | + android:layout_margin="20dp" | |
| 305 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 306 | + | |
| 307 | + <TextView | |
| 308 | + android:layout_width="wrap_content" | |
| 309 | + android:layout_height="wrap_content" | |
| 310 | + android:layout_margin="20dp" | |
| 311 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 312 | + | |
| 313 | + <TextView | |
| 314 | + android:layout_width="wrap_content" | |
| 315 | + android:layout_height="wrap_content" | |
| 316 | + android:layout_margin="20dp" | |
| 317 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 318 | + | |
| 319 | + <TextView | |
| 320 | + android:layout_width="wrap_content" | |
| 321 | + android:layout_height="wrap_content" | |
| 322 | + android:layout_margin="20dp" | |
| 323 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 324 | + | |
| 325 | + <TextView | |
| 326 | + android:layout_width="wrap_content" | |
| 327 | + android:layout_height="wrap_content" | |
| 328 | + android:layout_margin="20dp" | |
| 329 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 330 | + | |
| 331 | + <TextView | |
| 332 | + android:layout_width="wrap_content" | |
| 333 | + android:layout_height="wrap_content" | |
| 334 | + android:layout_margin="20dp" | |
| 335 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 336 | + | |
| 337 | + <TextView | |
| 338 | + android:layout_width="wrap_content" | |
| 339 | + android:layout_height="wrap_content" | |
| 340 | + android:layout_margin="20dp" | |
| 341 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 342 | + | |
| 343 | + <TextView | |
| 344 | + android:layout_width="wrap_content" | |
| 345 | + android:layout_height="wrap_content" | |
| 346 | + android:layout_margin="20dp" | |
| 347 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 348 | + | |
| 349 | + <TextView | |
| 350 | + android:layout_width="wrap_content" | |
| 351 | + android:layout_height="wrap_content" | |
| 352 | + android:layout_margin="20dp" | |
| 353 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 354 | + | |
| 355 | + <TextView | |
| 356 | + android:layout_width="wrap_content" | |
| 357 | + android:layout_height="wrap_content" | |
| 358 | + android:layout_margin="20dp" | |
| 359 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 360 | + | |
| 361 | + <TextView | |
| 362 | + android:layout_width="wrap_content" | |
| 363 | + android:layout_height="wrap_content" | |
| 364 | + android:layout_margin="20dp" | |
| 365 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 366 | + </LinearLayout> | |
| 367 | + </android.support.v4.widget.NestedScrollView> | |
| 18 | 368 | </android.support.design.widget.CoordinatorLayout> |
| 19 | 369 | </layout> |
| 20 | 370 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_tool_bar_test1.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:orientation="vertical" | |
| 10 | + tools:context="com.cnlive.strike.xiaojiaspeaker.ToolBarTestActivity" | |
| 11 | + tools:ignore="MissingDefaultResource"> | |
| 12 | + | |
| 13 | + <LinearLayout | |
| 14 | + android:layout_width="match_parent" | |
| 15 | + android:layout_height="wrap_content" | |
| 16 | + android:background="@color/colorPrimary" | |
| 17 | + android:orientation="vertical"> | |
| 18 | + <!----> | |
| 19 | + <LinearLayout | |
| 20 | + android:id="@+id/ll_menu" | |
| 21 | + android:layout_width="match_parent" | |
| 22 | + android:layout_height="40dp" | |
| 23 | + android:gravity="center|right" | |
| 24 | + app:layout_collapseMode="pin"> | |
| 25 | + | |
| 26 | + <LinearLayout | |
| 27 | + android:id="@+id/ll_search" | |
| 28 | + android:layout_width="45dp" | |
| 29 | + android:layout_height="match_parent" | |
| 30 | + android:layout_marginTop="5dp" | |
| 31 | + android:layout_marginBottom="5dp" | |
| 32 | + android:clickable="true" | |
| 33 | + android:focusable="true" | |
| 34 | + android:gravity="center"> | |
| 35 | + | |
| 36 | + <ImageView | |
| 37 | + android:layout_width="wrap_content" | |
| 38 | + android:layout_height="19dp" | |
| 39 | + android:background="@drawable/icon_mian_search" | |
| 40 | + android:clickable="false" | |
| 41 | + android:focusable="false" /> | |
| 42 | + </LinearLayout> | |
| 43 | + | |
| 44 | + <FrameLayout | |
| 45 | + android:id="@+id/fl_contact" | |
| 46 | + android:layout_width="45dp" | |
| 47 | + android:layout_height="match_parent" | |
| 48 | + android:layout_marginTop="5dp" | |
| 49 | + android:layout_marginBottom="5dp" | |
| 50 | + android:clickable="true" | |
| 51 | + android:focusable="true"> | |
| 52 | + | |
| 53 | + <FrameLayout | |
| 54 | + android:layout_width="wrap_content" | |
| 55 | + android:layout_height="wrap_content" | |
| 56 | + android:layout_gravity="center" | |
| 57 | + android:clickable="false" | |
| 58 | + android:focusable="false"> | |
| 59 | + | |
| 60 | + <ImageView | |
| 61 | + android:layout_width="18dp" | |
| 62 | + android:layout_height="18dp" | |
| 63 | + android:layout_gravity="center" | |
| 64 | + android:background="@drawable/icon_mian_contact" | |
| 65 | + android:clickable="false" | |
| 66 | + android:focusable="false" /> | |
| 67 | + | |
| 68 | + </FrameLayout> | |
| 69 | + </FrameLayout> | |
| 70 | + | |
| 71 | + <LinearLayout | |
| 72 | + android:id="@+id/ll_add" | |
| 73 | + android:layout_width="45dp" | |
| 74 | + android:layout_height="match_parent" | |
| 75 | + android:layout_marginTop="5dp" | |
| 76 | + android:layout_marginRight="5dp" | |
| 77 | + android:layout_marginBottom="5dp" | |
| 78 | + android:clickable="true" | |
| 79 | + android:focusable="true" | |
| 80 | + android:gravity="center"> | |
| 81 | + | |
| 82 | + <ImageView | |
| 83 | + android:id="@+id/iv_add" | |
| 84 | + android:layout_width="18dp" | |
| 85 | + android:layout_height="18dp" | |
| 86 | + android:background="@drawable/icon_mian_add" | |
| 87 | + android:clickable="false" | |
| 88 | + android:focusable="false" /> | |
| 89 | + </LinearLayout> | |
| 90 | + </LinearLayout> | |
| 91 | + <!-- --> | |
| 92 | + <LinearLayout | |
| 93 | + android:id="@+id/ll_root" | |
| 94 | + android:layout_width="match_parent" | |
| 95 | + android:layout_height="wrap_content" | |
| 96 | + android:layout_margin="10dp" | |
| 97 | + android:gravity="bottom" | |
| 98 | + android:minHeight="100dp" | |
| 99 | + android:orientation="horizontal" | |
| 100 | + app:layout_collapseMode="parallax"> | |
| 101 | + | |
| 102 | + <LinearLayout | |
| 103 | + android:id="@+id/ll_life" | |
| 104 | + android:layout_width="0dp" | |
| 105 | + android:layout_height="wrap_content" | |
| 106 | + android:layout_weight="1" | |
| 107 | + android:gravity="center" | |
| 108 | + android:orientation="vertical"> | |
| 109 | + | |
| 110 | + <ImageView | |
| 111 | + android:id="@+id/iv_life" | |
| 112 | + android:layout_width="55dp" | |
| 113 | + android:layout_height="55dp" | |
| 114 | + android:layout_gravity="center" | |
| 115 | + android:background="@drawable/icon_mian_life" | |
| 116 | + android:focusable="false" /> | |
| 117 | + | |
| 118 | + <TextView | |
| 119 | + android:id="@+id/tv_circle" | |
| 120 | + android:layout_width="wrap_content" | |
| 121 | + android:layout_height="wrap_content" | |
| 122 | + android:focusable="false" | |
| 123 | + android:text="生活圈" | |
| 124 | + android:textColor="@color/color_282828" | |
| 125 | + android:textSize="13sp" /> | |
| 126 | + </LinearLayout> | |
| 127 | + | |
| 128 | + <LinearLayout | |
| 129 | + android:id="@+id/ll_sub" | |
| 130 | + android:layout_width="0dp" | |
| 131 | + android:layout_height="wrap_content" | |
| 132 | + android:layout_weight="1" | |
| 133 | + android:gravity="center" | |
| 134 | + | |
| 135 | + android:orientation="vertical"> | |
| 136 | + | |
| 137 | + <ImageView | |
| 138 | + android:id="@+id/iv_sub" | |
| 139 | + android:layout_width="55dp" | |
| 140 | + android:layout_height="55dp" | |
| 141 | + android:layout_gravity="center" | |
| 142 | + android:background="@drawable/icon_main_subscribe" | |
| 143 | + android:focusable="false" /> | |
| 144 | + | |
| 145 | + <TextView | |
| 146 | + android:id="@+id/tv_sub" | |
| 147 | + android:layout_width="wrap_content" | |
| 148 | + android:layout_height="wrap_content" | |
| 149 | + android:focusable="false" | |
| 150 | + android:text="订阅号" | |
| 151 | + android:textColor="@color/color_282828" | |
| 152 | + android:textSize="13sp" /> | |
| 153 | + </LinearLayout> | |
| 154 | + | |
| 155 | + <LinearLayout | |
| 156 | + android:id="@+id/ll_shop" | |
| 157 | + android:layout_width="0dp" | |
| 158 | + android:layout_height="wrap_content" | |
| 159 | + android:layout_weight="1" | |
| 160 | + android:gravity="center" | |
| 161 | + | |
| 162 | + android:orientation="vertical"> | |
| 163 | + | |
| 164 | + <ImageView | |
| 165 | + android:id="@+id/iv_shop" | |
| 166 | + android:layout_width="55dp" | |
| 167 | + android:layout_height="55dp" | |
| 168 | + android:layout_gravity="center" | |
| 169 | + android:background="@drawable/icon_main_shop" | |
| 170 | + android:focusable="false" /> | |
| 171 | + | |
| 172 | + <TextView | |
| 173 | + android:id="@+id/tv_shop" | |
| 174 | + android:layout_width="wrap_content" | |
| 175 | + android:layout_height="wrap_content" | |
| 176 | + android:focusable="false" | |
| 177 | + android:text="优选库" | |
| 178 | + android:textColor="@color/color_282828" | |
| 179 | + android:textSize="13sp" /> | |
| 180 | + </LinearLayout> | |
| 181 | + </LinearLayout> | |
| 182 | + <!-- --> | |
| 183 | + </LinearLayout> | |
| 184 | + | |
| 185 | + <!-- --> | |
| 186 | + | |
| 187 | + <android.support.v4.widget.NestedScrollView | |
| 188 | + android:id="@+id/scroll" | |
| 189 | + android:layout_width="match_parent" | |
| 190 | + android:layout_height="match_parent" | |
| 191 | + app:layout_behavior="@string/appbar_scrolling_view_behavior"> | |
| 192 | + | |
| 193 | + <LinearLayout | |
| 194 | + android:layout_width="match_parent" | |
| 195 | + android:layout_height="wrap_content" | |
| 196 | + android:orientation="vertical"> | |
| 197 | + | |
| 198 | + <TextView | |
| 199 | + android:layout_width="wrap_content" | |
| 200 | + android:layout_height="wrap_content" | |
| 201 | + android:layout_margin="20dp" | |
| 202 | + android:text="123456" /> | |
| 203 | + | |
| 204 | + <TextView | |
| 205 | + android:layout_width="wrap_content" | |
| 206 | + android:layout_height="wrap_content" | |
| 207 | + android:layout_margin="20dp" | |
| 208 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 209 | + | |
| 210 | + <TextView | |
| 211 | + android:layout_width="wrap_content" | |
| 212 | + android:layout_height="wrap_content" | |
| 213 | + android:layout_margin="20dp" | |
| 214 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 215 | + | |
| 216 | + <TextView | |
| 217 | + android:layout_width="wrap_content" | |
| 218 | + android:layout_height="wrap_content" | |
| 219 | + android:layout_margin="20dp" | |
| 220 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 221 | + | |
| 222 | + <TextView | |
| 223 | + android:layout_width="wrap_content" | |
| 224 | + android:layout_height="wrap_content" | |
| 225 | + android:layout_margin="20dp" | |
| 226 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 227 | + | |
| 228 | + <TextView | |
| 229 | + android:layout_width="wrap_content" | |
| 230 | + android:layout_height="wrap_content" | |
| 231 | + android:layout_margin="20dp" | |
| 232 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 233 | + | |
| 234 | + <TextView | |
| 235 | + android:layout_width="wrap_content" | |
| 236 | + android:layout_height="wrap_content" | |
| 237 | + android:layout_margin="20dp" | |
| 238 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 239 | + | |
| 240 | + <TextView | |
| 241 | + android:layout_width="wrap_content" | |
| 242 | + android:layout_height="wrap_content" | |
| 243 | + android:layout_margin="20dp" | |
| 244 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 245 | + | |
| 246 | + <TextView | |
| 247 | + android:layout_width="wrap_content" | |
| 248 | + android:layout_height="wrap_content" | |
| 249 | + android:layout_margin="20dp" | |
| 250 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 251 | + | |
| 252 | + <TextView | |
| 253 | + android:layout_width="wrap_content" | |
| 254 | + android:layout_height="wrap_content" | |
| 255 | + android:layout_margin="20dp" | |
| 256 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 257 | + | |
| 258 | + <TextView | |
| 259 | + android:layout_width="wrap_content" | |
| 260 | + android:layout_height="wrap_content" | |
| 261 | + android:layout_margin="20dp" | |
| 262 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 263 | + | |
| 264 | + <TextView | |
| 265 | + android:layout_width="wrap_content" | |
| 266 | + android:layout_height="wrap_content" | |
| 267 | + android:layout_margin="20dp" | |
| 268 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 269 | + | |
| 270 | + <TextView | |
| 271 | + android:layout_width="wrap_content" | |
| 272 | + android:layout_height="wrap_content" | |
| 273 | + android:layout_margin="20dp" | |
| 274 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 275 | + | |
| 276 | + <TextView | |
| 277 | + android:layout_width="wrap_content" | |
| 278 | + android:layout_height="wrap_content" | |
| 279 | + android:layout_margin="20dp" | |
| 280 | + android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> | |
| 281 | + </LinearLayout> | |
| 282 | + </android.support.v4.widget.NestedScrollView> | |
| 283 | + </LinearLayout> | |
| 284 | +</layout> | |
| 0 | 285 | \ No newline at end of file | ... | ... |
app/src/main/res/xml/network_security_config.xml
0 → 100644
build.gradle
| ... | ... | @@ -62,15 +62,15 @@ ext { |
| 62 | 62 | recyclerviewV7 = '28.0.0' |
| 63 | 63 | cardviewV7 = '28.0.0' |
| 64 | 64 | |
| 65 | - appArch = '1.0.3' | |
| 65 | + appArch = '1.0.6' | |
| 66 | 66 | //qmui |
| 67 | 67 | qmui = '1.1.5' |
| 68 | 68 | |
| 69 | - libBase = '1.0.9' | |
| 70 | - libNetwork = '1.1.0' | |
| 69 | + libBase = '1.5.3' | |
| 70 | + libNetwork = '1.1.5' | |
| 71 | 71 | libLargeImage = '1.0.1' |
| 72 | 72 | libEmoj = '1.9.8' |
| 73 | - libMenu = '1.0.4' | |
| 73 | + libMenu = '1.0.6' | |
| 74 | 74 | libAnalytics = '1.1.0' |
| 75 | 75 | |
| 76 | 76 | //glide | ... | ... |
module_xiaojiaSoundBox/build.gradle
| ... | ... | @@ -44,7 +44,7 @@ android { |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | dependencies { |
| 47 | - implementation fileTree(dir: 'libs', include: ['*.jar']) | |
| 47 | + implementation fileTree(include: ['*.jar'], dir: 'libs') | |
| 48 | 48 | implementation "com.android.support:support-v4:$rootProject.supportV4" |
| 49 | 49 | implementation "com.android.support:appcompat-v7:$rootProject.appcompatV7" |
| 50 | 50 | implementation "com.android.support:design:$rootProject.design" |
| ... | ... | @@ -57,21 +57,29 @@ dependencies { |
| 57 | 57 | |
| 58 | 58 | // 蓝牙相关 |
| 59 | 59 | implementation 'com.clj.fastble:FastBleLib:2.3.4' |
| 60 | -// https://github.com/Blankj/AndroidUtilCode/blob/master/lib/utilcode/README-CN.md | |
| 61 | -// implementation 'com.blankj:utilcode:1.25.9' | |
| 60 | + | |
| 61 | + // https://github.com/Blankj/AndroidUtilCode/blob/master/lib/utilcode/README-CN.md | |
| 62 | + | |
| 63 | + // implementation 'com.blankj:utilcode:1.25.9' | |
| 64 | + | |
| 62 | 65 | //glide |
| 63 | 66 | implementation "com.github.bumptech.glide:glide:$rootProject.glide" |
| 64 | 67 | implementation "jp.wasabeef:glide-transformations:$rootProject.glideTransformations" |
| 65 | -// loading动画 | |
| 68 | + | |
| 69 | + // loading动画 | |
| 66 | 70 | implementation "com.wang.avi:library:$rootProject.avi" |
| 67 | 71 | |
| 68 | -// implementation 'com.android.support.constraint:constraint-layout:1.1.3' | |
| 72 | + // implementation 'com.android.support.constraint:constraint-layout:1.1.3' | |
| 69 | 73 | implementation "com.scwang.smartrefresh:SmartRefreshLayout:$rootProject.SmartRefreshLayout" |
| 70 | 74 | implementation "com.scwang.smartrefresh:SmartRefreshHeader:$rootProject.SmartRefreshHeader" |
| 75 | + | |
| 71 | 76 | // implementation 'com.android.support.constraint:constraint-layout:1.1.3' |
| 77 | + | |
| 72 | 78 | // 动画库 |
| 79 | + | |
| 73 | 80 | // implementation 'com.android.support:support-compat:25.1.1' |
| 74 | 81 | implementation 'com.daimajia.easing:library:2.0@aar' |
| 75 | 82 | implementation 'com.daimajia.androidanimations:library:2.3@aar' |
| 76 | 83 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' |
| 84 | + implementation files('libs/pinyin4j-2.5.0.jar') | |
| 77 | 85 | } | ... | ... |
module_xiaojiaSoundBox/libs/pinyin4j-2.5.0.jar
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/AndroidManifest.xml
| ... | ... | @@ -17,7 +17,8 @@ |
| 17 | 17 | <uses-permission android:name="android.permission.INTERNET" /> |
| 18 | 18 | |
| 19 | 19 | <application> |
| 20 | - <activity android:name=".ui.activity.FirmwareUpdateActivity"></activity> | |
| 20 | + <activity android:name=".ui.activity.SelectIMFriendActivity"></activity> | |
| 21 | + <activity android:name=".ui.activity.FirmwareUpdateActivity" /> | |
| 21 | 22 | <activity android:name=".ui.activity.DeviceManagerActivity" /> |
| 22 | 23 | <activity android:name=".ui.activity.DeviceInstructionActivity" /> |
| 23 | 24 | <activity android:name=".ui.activity.AllDeviceActivity" /> | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/commonInfo/CommInfo.java
| ... | ... | @@ -20,10 +20,21 @@ public class CommInfo { |
| 20 | 20 | private static final String KEY_TOKEN = "xiaojia_token"; |
| 21 | 21 | //家庭云id |
| 22 | 22 | private static final String KEY_FAMILY_ID = "xiaojia_family_id"; |
| 23 | - | |
| 23 | + //移动id | |
| 24 | + private static final String KEY_CMCC_ID = "xiaojia_cmcc_id"; | |
| 24 | 25 | // |
| 25 | 26 | private static final int MyCurrentMode = Context.MODE_MULTI_PROCESS; |
| 26 | 27 | |
| 28 | + public static void setCMCCId(Context context, String cmccId) { | |
| 29 | + MySpHelper.getInstance(context, MyCurrentMode).putString(KEY_CMCC_ID, cmccId); | |
| 30 | + } | |
| 31 | + | |
| 32 | + public static String getCMCCId(Context context) { | |
| 33 | + return MySpHelper.getInstance(context, MyCurrentMode).getString(KEY_CMCC_ID, ""); | |
| 34 | + } | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 27 | 38 | public static void setFamilyId(Context context, String familyId) { |
| 28 | 39 | MySpHelper.getInstance(context, MyCurrentMode).putString(KEY_FAMILY_ID, familyId); |
| 29 | 40 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/AllDeviceFragmentPresenter.java
| 1 | 1 | package com.cnlive.strike.xiaojiaspeaker.frame.presenter; |
| 2 | 2 | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.content.Context; | |
| 5 | +import android.util.Log; | |
| 6 | +import android.view.View; | |
| 7 | + | |
| 8 | +import com.cnlive.libs.base.logic.Logic; | |
| 9 | +import com.cnlive.libs.base.logic.callback.DataCallback; | |
| 10 | +import com.cnlive.libs.base.logic.callback.FailureCallback; | |
| 11 | +import com.cnlive.libs.base.logic.callback.SuccessCallback; | |
| 3 | 12 | import com.cnlive.strike.xiaojiaspeaker.frame.view.AllDeviceFragmentView; |
| 13 | +import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; | |
| 14 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; | |
| 15 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | |
| 16 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.SubscriptionBaseInfo; | |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest; | |
| 18 | +import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; | |
| 4 | 19 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 5 | 20 | |
| 21 | +import java.util.HashMap; | |
| 22 | +import java.util.Map; | |
| 23 | + | |
| 24 | +import io.reactivex.disposables.Disposable; | |
| 25 | + | |
| 6 | 26 | public class AllDeviceFragmentPresenter extends MvpBasePresenter<AllDeviceFragmentView> { |
| 27 | + | |
| 28 | + private String TAG = "AllDeviceFragmentPresenter"; | |
| 29 | + | |
| 30 | + public void getFamilyList(Context context, String sid, String phone) { | |
| 31 | + if (null == getView()) { | |
| 32 | + return; | |
| 33 | + } | |
| 34 | + getView().showLoadingView(); | |
| 35 | + Map<String, String> map = new HashMap<>(); | |
| 36 | + map.put("sid", sid); | |
| 37 | + map.put("phone", phone); | |
| 38 | + Logic.create(map) | |
| 39 | + .action(new Logic.Action<Map<String, String>, SubscriptionBaseInfo<FamilyListBean>>() { | |
| 40 | + @Override | |
| 41 | + public Disposable action(Map<String, String> paramsMap, DataCallback<SubscriptionBaseInfo<FamilyListBean>> dataCallback) { | |
| 42 | + return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.getFamilyList(paramsMap)).subscribe(context, dataCallback); | |
| 43 | + } | |
| 44 | + }).<SubscriptionBaseInfo<FamilyListBean>>event() | |
| 45 | + .setSuccessCallback(new SuccessCallback<SubscriptionBaseInfo<FamilyListBean>>() { | |
| 46 | + @Override | |
| 47 | + public void onSuccess(SubscriptionBaseInfo<FamilyListBean> baseInfo) { | |
| 48 | + if (null == getView()) { | |
| 49 | + return; | |
| 50 | + } | |
| 51 | + getView().hideLoadingView(); | |
| 52 | + getView().initAllDeviceList(baseInfo.getData()); | |
| 53 | + } | |
| 54 | + }) | |
| 55 | + .setFailureCallback(new FailureCallback() { | |
| 56 | + @Override | |
| 57 | + public void onFailure(int i, String s) { | |
| 58 | + //显示重试 | |
| 59 | + getView().showRetryView(i, new View.OnClickListener() { | |
| 60 | + @Override | |
| 61 | + public void onClick(View view) { | |
| 62 | + getFamilyList(context, sid, phone); | |
| 63 | + } | |
| 64 | + }); | |
| 65 | + } | |
| 66 | + }) | |
| 67 | + | |
| 68 | + .start(); | |
| 69 | + } | |
| 70 | + | |
| 71 | + | |
| 72 | + public void queryConfigDeviceNetResult(Activity context, String familyId) { | |
| 73 | + if (null == getView()) { | |
| 74 | + return; | |
| 75 | + } | |
| 76 | + Log.e(TAG, "familyId: " + familyId); | |
| 77 | + Map<String, String> map = new HashMap<>(); | |
| 78 | + map.put("familyId", familyId); | |
| 79 | + Logic.create(map) | |
| 80 | + .action(new Logic.Action<Map<String, String>, SubscriptionBaseInfo<NetworkResultBean>>() { | |
| 81 | + @Override | |
| 82 | + public Disposable action(Map<String, String> paramsMap, DataCallback<SubscriptionBaseInfo<NetworkResultBean>> dataCallback) { | |
| 83 | + return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.getNetworkResult(paramsMap)).subscribe(context, dataCallback); | |
| 84 | + } | |
| 85 | + }).<SubscriptionBaseInfo<NetworkResultBean>>event() | |
| 86 | + .setSuccessCallback(new SuccessCallback<SubscriptionBaseInfo<NetworkResultBean>>() { | |
| 87 | + @Override | |
| 88 | + public void onSuccess(SubscriptionBaseInfo<NetworkResultBean> baseInfo) { | |
| 89 | + if (null == getView()) { | |
| 90 | + return; | |
| 91 | + } | |
| 92 | + Log.e(TAG, "onSuccess: "); | |
| 93 | + } | |
| 94 | + }) | |
| 95 | + .setFailureCallback(new FailureCallback() { | |
| 96 | + @Override | |
| 97 | + public void onFailure(int i, String s) { | |
| 98 | + //显示重试 | |
| 99 | + Log.e(TAG, "onFailure: "); | |
| 100 | + QMUITipDialogUtil.dismessDialog(); | |
| 101 | + } | |
| 102 | + }) | |
| 103 | + | |
| 104 | + .start(); | |
| 105 | + } | |
| 7 | 106 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/SelectIMFriendPresenter.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.frame.presenter; | |
| 2 | + | |
| 3 | +import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectIMFriendView; | |
| 4 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | |
| 5 | + | |
| 6 | +public class SelectIMFriendPresenter extends MvpBasePresenter<SelectIMFriendView> { | |
| 7 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/SelectWifiFragmentPresenter.java
| 1 | 1 | package com.cnlive.strike.xiaojiaspeaker.frame.presenter; |
| 2 | 2 | |
| 3 | 3 | import android.app.Activity; |
| 4 | -import android.content.Context; | |
| 5 | 4 | import android.util.Log; |
| 5 | +import android.view.View; | |
| 6 | 6 | |
| 7 | 7 | import com.cnlive.libs.base.logic.Logic; |
| 8 | 8 | import com.cnlive.libs.base.logic.callback.DataCallback; |
| ... | ... | @@ -11,22 +11,22 @@ import com.cnlive.libs.base.logic.callback.SuccessCallback; |
| 11 | 11 | import com.cnlive.libs.base.util.AlertUtil; |
| 12 | 12 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; |
| 13 | 13 | import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceCMCC; |
| 14 | +import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; | |
| 14 | 15 | import com.cnlive.strike.xiaojiaspeaker.netWork.CmccRequest; |
| 15 | -import com.cnlive.strike.xiaojiaspeaker.netWork.SubscriptionRequest; | |
| 16 | -import com.cnlive.strike.xiaojiaspeaker.netWork.bean.BaseInfo; | |
| 17 | 16 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.ConfigDeviceNetParam; |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; | |
| 18 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | |
| 19 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.SubscriptionBaseInfo; | |
| 18 | 20 | import com.cnlive.strike.xiaojiaspeaker.netWork.result.ConfigDeviceNetResult; |
| 21 | +import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest; | |
| 19 | 22 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.ConnBluetoothSuccessActivity; |
| 20 | 23 | import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; |
| 21 | 24 | import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; |
| 22 | 25 | |
| 23 | -import org.greenrobot.eventbus.EventBus; | |
| 24 | - | |
| 26 | +import java.util.HashMap; | |
| 25 | 27 | import java.util.Map; |
| 26 | 28 | |
| 27 | 29 | import io.reactivex.disposables.Disposable; |
| 28 | -import okhttp3.MediaType; | |
| 29 | -import okhttp3.RequestBody; | |
| 30 | 30 | import retrofit2.Call; |
| 31 | 31 | import retrofit2.Callback; |
| 32 | 32 | import retrofit2.Response; |
| ... | ... | @@ -34,42 +34,80 @@ import retrofit2.Response; |
| 34 | 34 | public class SelectWifiFragmentPresenter extends MvpBasePresenter<SelectWifiFragmentView> { |
| 35 | 35 | private String TAG = "SelectWifiFragmentPresenter"; |
| 36 | 36 | |
| 37 | - /** | |
| 38 | - * 查询配网情况 | |
| 39 | - * | |
| 40 | - * @param context | |
| 41 | - * @param param | |
| 42 | - */ | |
| 43 | - public void queryConfigDeviceNetResult(Activity context, ConfigDeviceNetParam param) { | |
| 44 | - CmccRequest.getInstance(ApiServiceCMCC.class) | |
| 45 | - .queryDeviceConfigNet(param) | |
| 46 | - .enqueue(new Callback<ConfigDeviceNetResult>() { | |
| 37 | + | |
| 38 | + public void queryConfigDeviceNetResult(Activity context, String familyId) { | |
| 39 | + if (null == getView()) { | |
| 40 | + return; | |
| 41 | + } | |
| 42 | + Log.e(TAG, "familyId: " + familyId); | |
| 43 | + Map<String, String> map = new HashMap<>(); | |
| 44 | + map.put("familyId", familyId); | |
| 45 | + Logic.create(map) | |
| 46 | + .action(new Logic.Action<Map<String, String>, SubscriptionBaseInfo<NetworkResultBean>>() { | |
| 47 | 47 | @Override |
| 48 | - public void onResponse(Call<ConfigDeviceNetResult> call, Response<ConfigDeviceNetResult> response) { | |
| 48 | + public Disposable action(Map<String, String> paramsMap, DataCallback<SubscriptionBaseInfo<NetworkResultBean>> dataCallback) { | |
| 49 | + return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.getNetworkResult(paramsMap)).subscribe(context, dataCallback); | |
| 50 | + } | |
| 51 | + }).<SubscriptionBaseInfo<NetworkResultBean>>event() | |
| 52 | + .setSuccessCallback(new SuccessCallback<SubscriptionBaseInfo<NetworkResultBean>>() { | |
| 53 | + @Override | |
| 54 | + public void onSuccess(SubscriptionBaseInfo<NetworkResultBean> baseInfo) { | |
| 49 | 55 | if (null == getView()) { |
| 50 | 56 | return; |
| 51 | 57 | } |
| 52 | 58 | QMUITipDialogUtil.dismessDialog(); |
| 53 | - ConfigDeviceNetResult result = response.body(); | |
| 54 | - //响应成功 | |
| 55 | - if (CmccRequest.SUCCRSS == result.getResult()) { | |
| 56 | - Log.e(TAG, "onResponse: "); | |
| 57 | - if ("success".equals(result.getData().getResult())) { | |
| 58 | - context.finish(); | |
| 59 | - ConnBluetoothSuccessActivity.startActivity(context); | |
| 60 | - } else { | |
| 61 | - AlertUtil.showDeftToast(context, "配网失败,请稍后重试"); | |
| 62 | - } | |
| 63 | - } else { | |
| 64 | - //响应失败 | |
| 65 | - AlertUtil.showDeftToast(context, "配网失败,请稍后重试"); | |
| 66 | - } | |
| 59 | + Log.e(TAG, "onSuccess: "+baseInfo.getMessage()); | |
| 67 | 60 | } |
| 68 | - | |
| 61 | + }) | |
| 62 | + .setFailureCallback(new FailureCallback() { | |
| 69 | 63 | @Override |
| 70 | - public void onFailure(Call<ConfigDeviceNetResult> call, Throwable t) { | |
| 64 | + public void onFailure(int i, String s) { | |
| 65 | + //显示重试 | |
| 66 | + Log.e(TAG, "onFailure: "+s); | |
| 71 | 67 | QMUITipDialogUtil.dismessDialog(); |
| 72 | 68 | } |
| 73 | - }); | |
| 69 | + }) | |
| 70 | + | |
| 71 | + .start(); | |
| 74 | 72 | } |
| 73 | + | |
| 74 | + | |
| 75 | +// /** | |
| 76 | +// * 查询配网情况(这个是调用移动的接口) | |
| 77 | +// * | |
| 78 | +// * @param context | |
| 79 | +// * @param param | |
| 80 | +// */ | |
| 81 | +// public void queryConfigDeviceNetResult(Activity context, ConfigDeviceNetParam param) { | |
| 82 | +// CmccRequest.getInstance(ApiServiceCMCC.class) | |
| 83 | +// .queryDeviceConfigNet(param) | |
| 84 | +// .enqueue(new Callback<ConfigDeviceNetResult>() { | |
| 85 | +// @Override | |
| 86 | +// public void onResponse(Call<ConfigDeviceNetResult> call, Response<ConfigDeviceNetResult> response) { | |
| 87 | +// if (null == getView()) { | |
| 88 | +// return; | |
| 89 | +// } | |
| 90 | +// QMUITipDialogUtil.dismessDialog(); | |
| 91 | +// ConfigDeviceNetResult result = response.body(); | |
| 92 | +// //响应成功 | |
| 93 | +// if (CmccRequest.SUCCRSS == result.getResult()) { | |
| 94 | +// Log.e(TAG, "onResponse: "); | |
| 95 | +// if ("success".equals(result.getData().getResult())) { | |
| 96 | +// context.finish(); | |
| 97 | +// ConnBluetoothSuccessActivity.startActivity(context); | |
| 98 | +// } else { | |
| 99 | +// AlertUtil.showDeftToast(context, "配网失败,请稍后重试"); | |
| 100 | +// } | |
| 101 | +// } else { | |
| 102 | +// //响应失败 | |
| 103 | +// AlertUtil.showDeftToast(context, "配网失败,请稍后重试"); | |
| 104 | +// } | |
| 105 | +// } | |
| 106 | +// | |
| 107 | +// @Override | |
| 108 | +// public void onFailure(Call<ConfigDeviceNetResult> call, Throwable t) { | |
| 109 | +// QMUITipDialogUtil.dismessDialog(); | |
| 110 | +// } | |
| 111 | +// }); | |
| 112 | +// } | |
| 75 | 113 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/AllDeviceFragmentView.java
| ... | ... | @@ -10,7 +10,9 @@ import android.view.LayoutInflater; |
| 10 | 10 | import android.view.View; |
| 11 | 11 | |
| 12 | 12 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 13 | +import com.cnlive.strike.xiaojiaspeaker.commonInfo.CommInfo; | |
| 13 | 14 | import com.cnlive.strike.xiaojiaspeaker.model.AllDeviceInfo; |
| 15 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; | |
| 14 | 16 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.BlueToothStep1Activity; |
| 15 | 17 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceManagerActivity; |
| 16 | 18 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.AllDeviceAdapter; |
| ... | ... | @@ -26,10 +28,11 @@ import java.util.List; |
| 26 | 28 | public class AllDeviceFragmentView implements MvpView { |
| 27 | 29 | private AllDeviceFragment fragment; |
| 28 | 30 | private AllDeviceAdapter adapter; |
| 29 | - private List<AllDeviceInfo> allDeviceInfoList; | |
| 31 | + private List<FamilyListBean.UsersBeanX.DeviceListBean> allDeviceInfoList; | |
| 30 | 32 | private List<PopMenuInfo> popMenuInfoList = null; |
| 31 | 33 | private PopMenu mPopMenu; |
| 32 | 34 | private String TAG = "AllDeviceFragmentView"; |
| 35 | + private FamilyListBean familyListBean; | |
| 33 | 36 | |
| 34 | 37 | public AllDeviceFragmentView(AllDeviceFragment fragment) { |
| 35 | 38 | this.fragment = fragment; |
| ... | ... | @@ -41,9 +44,31 @@ public class AllDeviceFragmentView implements MvpView { |
| 41 | 44 | |
| 42 | 45 | public void initView() { |
| 43 | 46 | initPopView(); |
| 44 | - AllDeviceInfo allDeviceInfo = new AllDeviceInfo(); | |
| 45 | - allDeviceInfoList = new ArrayList<>(); | |
| 46 | - allDeviceInfoList.add(allDeviceInfo); | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void initAllDeviceList(FamilyListBean familyListBean) { | |
| 50 | + | |
| 51 | + this.familyListBean = familyListBean; | |
| 52 | + this.allDeviceInfoList = new ArrayList<>(); | |
| 53 | + if (null != familyListBean && null != familyListBean.getUsers()) { | |
| 54 | + for (FamilyListBean.UsersBeanX usersBean : familyListBean.getUsers()) { | |
| 55 | + //存储自己为主人的家庭 | |
| 56 | + if (usersBean.getIsMaster() == FamilyListBean.THE_HOST) { | |
| 57 | + Log.e(TAG, "getId: " + usersBean.getUserId()); | |
| 58 | + Log.e(TAG, "getToken: " + usersBean.getToken()); | |
| 59 | + //存储家庭id | |
| 60 | + CommInfo.setFamilyId(getContext(), usersBean.getId()); | |
| 61 | + //存储移动id(用于配网) | |
| 62 | + CommInfo.setCMCCId(getContext(), usersBean.getUserId()); | |
| 63 | + //存储移动token | |
| 64 | + CommInfo.setToken(getContext(), usersBean.getToken()); | |
| 65 | + } | |
| 66 | + //存储移动id | |
| 67 | + if (null != usersBean.getDeviceList()) { | |
| 68 | + this.allDeviceInfoList.addAll(usersBean.getDeviceList()); | |
| 69 | + } | |
| 70 | + } | |
| 71 | + } | |
| 47 | 72 | adapter = new AllDeviceAdapter(getContext(), allDeviceInfoList); |
| 48 | 73 | fragment.binding.rvAllDevice.setLayoutManager(new LinearLayoutManager(getContext())); |
| 49 | 74 | fragment.binding.rvAllDevice.setAdapter(adapter); |
| ... | ... | @@ -55,7 +80,7 @@ public class AllDeviceFragmentView implements MvpView { |
| 55 | 80 | }); |
| 56 | 81 | adapter.setOnItemClickListener(new AllDeviceAdapter.OnItemClickListener() { |
| 57 | 82 | @Override |
| 58 | - public void onItemClick(int position, AllDeviceInfo AllDeviceInfo) { | |
| 83 | + public void onItemClick(int position, FamilyListBean.UsersBeanX.DeviceListBean AllDeviceInfo) { | |
| 59 | 84 | DeviceManagerActivity.startActivity(fragment.getActivity()); |
| 60 | 85 | } |
| 61 | 86 | }); |
| ... | ... | @@ -119,4 +144,47 @@ public class AllDeviceFragmentView implements MvpView { |
| 119 | 144 | mPopMenu.show(view); |
| 120 | 145 | } |
| 121 | 146 | } |
| 147 | + | |
| 148 | + /** | |
| 149 | + * 显示loading | |
| 150 | + */ | |
| 151 | + public void showLoadingView() { | |
| 152 | + if (fragment.binding.emptyLayout == null) { | |
| 153 | + return; | |
| 154 | + } | |
| 155 | + fragment.binding.emptyLayout.show(true); | |
| 156 | + } | |
| 157 | + | |
| 158 | + /** | |
| 159 | + * 隐藏loading | |
| 160 | + */ | |
| 161 | + public void hideLoadingView() { | |
| 162 | + if (fragment.binding.emptyLayout == null) { | |
| 163 | + return; | |
| 164 | + } | |
| 165 | + fragment.binding.emptyLayout.hide(); | |
| 166 | + } | |
| 167 | + | |
| 168 | + /** | |
| 169 | + * 显示重试页面 | |
| 170 | + * | |
| 171 | + * @param errorCode | |
| 172 | + * @param listener | |
| 173 | + */ | |
| 174 | + public void showRetryView(int errorCode, View.OnClickListener listener) { | |
| 175 | + //显示空视图 | |
| 176 | + fragment.binding.emptyLayout.setVisibility(View.VISIBLE); | |
| 177 | + | |
| 178 | + if (fragment.binding.emptyLayout == null) return; | |
| 179 | + String titleText = ""; | |
| 180 | + String detailText = ""; | |
| 181 | + if (errorCode == -3) { | |
| 182 | + titleText = getContext().getString(R.string.msg_failed_network_title); | |
| 183 | + detailText = getContext().getString(R.string.msg_failed_network_detail); | |
| 184 | + } else { | |
| 185 | + titleText = getContext().getString(R.string.msg_failed_other_title); | |
| 186 | + detailText = getContext().getString(R.string.msg_failed_other_detail); | |
| 187 | + } | |
| 188 | + fragment.binding.emptyLayout.show(false, titleText, detailText, getContext().getString(R.string.retry), R.drawable.wufalianjie, listener); | |
| 189 | + } | |
| 122 | 190 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SearchDevicefragmentView.java
| ... | ... | @@ -187,7 +187,7 @@ public class SearchDevicefragmentView implements MvpView { |
| 187 | 187 | // 扫描到一个符合扫描规则的BLE设备(主线程) |
| 188 | 188 | @Override |
| 189 | 189 | public void onScanning(BleDevice bleDevice) { |
| 190 | - if (TextUtils.isEmpty(bleDevice.getName()) || bleDevice.getName().indexOf("HEMU-") == -1) { | |
| 190 | + if (TextUtils.isEmpty(bleDevice.getName()) || bleDevice.getName().indexOf("XIAOJIA-") == -1) { | |
| 191 | 191 | return; |
| 192 | 192 | } |
| 193 | 193 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectIMFriendView.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.frame.view; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.support.v7.widget.LinearLayoutManager; | |
| 5 | + | |
| 6 | +import com.cnlive.strike.xiaojiaspeaker.model.IMFriendHasLetterInfo; | |
| 7 | +import com.cnlive.strike.xiaojiaspeaker.model.IMFriendNoLetterInfo; | |
| 8 | +import com.cnlive.strike.xiaojiaspeaker.ui.adapter.SelectIMFriendAdapter; | |
| 9 | +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectIMFriendFragment; | |
| 10 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 11 | + | |
| 12 | +import java.util.ArrayList; | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +public class SelectIMFriendView implements MvpView { | |
| 16 | + private SelectIMFriendFragment fragment; | |
| 17 | + private SelectIMFriendAdapter adapter; | |
| 18 | + private List<IMFriendNoLetterInfo> noLetterInfoList; | |
| 19 | + | |
| 20 | + private List<IMFriendHasLetterInfo> imFriendInfoList; | |
| 21 | + | |
| 22 | + public SelectIMFriendView(SelectIMFriendFragment fragment) { | |
| 23 | + this.fragment = fragment; | |
| 24 | + } | |
| 25 | + | |
| 26 | + public Activity getContext() { | |
| 27 | + return fragment == null ? null : fragment.getActivity(); | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void initView() { | |
| 31 | + //假设这个是原有数据 | |
| 32 | + noLetterInfoList = new ArrayList<>(); | |
| 33 | + IMFriendNoLetterInfo noLetterInfo = new IMFriendNoLetterInfo(); | |
| 34 | + noLetterInfo.setUserName("韩亚云"); | |
| 35 | + noLetterInfo.setSelect(true); | |
| 36 | + noLetterInfo.setId("123"); | |
| 37 | + noLetterInfoList.add(noLetterInfo); | |
| 38 | + | |
| 39 | + noLetterInfo = new IMFriendNoLetterInfo(); | |
| 40 | + noLetterInfo.setUserName("杨帅"); | |
| 41 | + noLetterInfo.setSelect(false); | |
| 42 | + noLetterInfo.setId("12345"); | |
| 43 | + noLetterInfoList.add(noLetterInfo); | |
| 44 | + | |
| 45 | + noLetterInfo = new IMFriendNoLetterInfo(); | |
| 46 | + noLetterInfo.setUserName("杨杨"); | |
| 47 | + noLetterInfo.setSelect(false); | |
| 48 | + noLetterInfo.setId("12345"); | |
| 49 | + noLetterInfoList.add(noLetterInfo); | |
| 50 | + | |
| 51 | + noLetterInfo = new IMFriendNoLetterInfo(); | |
| 52 | + noLetterInfo.setUserName("杨天"); | |
| 53 | + noLetterInfo.setSelect(false); | |
| 54 | + noLetterInfo.setId("12345"); | |
| 55 | + noLetterInfoList.add(noLetterInfo); | |
| 56 | + | |
| 57 | + noLetterInfo = new IMFriendNoLetterInfo(); | |
| 58 | + noLetterInfo.setUserName("郭瑞鹏"); | |
| 59 | + noLetterInfo.setSelect(false); | |
| 60 | + noLetterInfo.setId("123456"); | |
| 61 | + noLetterInfoList.add(noLetterInfo); | |
| 62 | + | |
| 63 | + noLetterInfo = new IMFriendNoLetterInfo(); | |
| 64 | + noLetterInfo.setUserName("殷巧娟"); | |
| 65 | + noLetterInfo.setSelect(false); | |
| 66 | + noLetterInfo.setId("1234567"); | |
| 67 | + noLetterInfoList.add(noLetterInfo); | |
| 68 | + | |
| 69 | + noLetterInfo = new IMFriendNoLetterInfo(); | |
| 70 | + noLetterInfo.setUserName("张晓文"); | |
| 71 | + noLetterInfo.setSelect(false); | |
| 72 | + noLetterInfo.setId("12345"); | |
| 73 | + noLetterInfoList.add(noLetterInfo); | |
| 74 | + | |
| 75 | + //开始循环遍历索引 | |
| 76 | + String lastIndexStr = ""; | |
| 77 | + //设置新的的带有索引的数据 | |
| 78 | + imFriendInfoList = new ArrayList<>(); | |
| 79 | + for (int i = 0; i < noLetterInfoList.size(); i++) { | |
| 80 | + IMFriendHasLetterInfo hasLetterInfo = null; | |
| 81 | + if (!lastIndexStr.equals(noLetterInfoList.get(i).getLetter())) { | |
| 82 | + //添加索引 | |
| 83 | + lastIndexStr = noLetterInfoList.get(i).getLetter(); | |
| 84 | + //设置索引数据 | |
| 85 | + hasLetterInfo = new IMFriendHasLetterInfo(); | |
| 86 | + hasLetterInfo.setLetter(noLetterInfoList.get(i).getLetter()); | |
| 87 | + //设置item类型 | |
| 88 | + hasLetterInfo.setType(IMFriendHasLetterInfo.LETTER_INDEX); | |
| 89 | + //添加数据 | |
| 90 | + imFriendInfoList.add(hasLetterInfo); | |
| 91 | + } | |
| 92 | + //添加普通数据 | |
| 93 | + hasLetterInfo = new IMFriendHasLetterInfo(); | |
| 94 | + hasLetterInfo.setId(noLetterInfoList.get(i).getId()); | |
| 95 | + hasLetterInfo.setType(IMFriendHasLetterInfo.USER_INFO); | |
| 96 | + hasLetterInfo.setSelect(noLetterInfoList.get(i).isSelect()); | |
| 97 | + hasLetterInfo.setUserIcon(noLetterInfoList.get(i).getUserIcon()); | |
| 98 | + hasLetterInfo.setUserName(noLetterInfoList.get(i).getUserName()); | |
| 99 | + imFriendInfoList.add(hasLetterInfo); | |
| 100 | + } | |
| 101 | + | |
| 102 | + for (int i = 0; i < imFriendInfoList.size(); i++) { | |
| 103 | + if (!lastIndexStr.equals(imFriendInfoList.get(i).getLetter())) { | |
| 104 | + lastIndexStr = imFriendInfoList.get(i).getLetter(); | |
| 105 | + //添加索引 | |
| 106 | +// imFriendInfo = new IMFriendHasLetterInfo(); | |
| 107 | + } | |
| 108 | + } | |
| 109 | + adapter = new SelectIMFriendAdapter(getContext(), imFriendInfoList); | |
| 110 | + fragment.binding.rvFriends.setLayoutManager(new LinearLayoutManager(getContext())); | |
| 111 | + fragment.binding.rvFriends.setAdapter(adapter); | |
| 112 | + | |
| 113 | + } | |
| 114 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/SelectWifiFragmentView.java
| ... | ... | @@ -4,6 +4,7 @@ import android.app.Activity; |
| 4 | 4 | import android.bluetooth.BluetoothGatt; |
| 5 | 5 | import android.graphics.Typeface; |
| 6 | 6 | import android.net.wifi.ScanResult; |
| 7 | +import android.os.Handler; | |
| 7 | 8 | import android.support.annotation.NonNull; |
| 8 | 9 | import android.support.v4.content.ContextCompat; |
| 9 | 10 | import android.support.v7.widget.LinearLayoutManager; |
| ... | ... | @@ -19,6 +20,7 @@ import com.clj.fastble.data.BleDevice; |
| 19 | 20 | import com.clj.fastble.exception.BleException; |
| 20 | 21 | import com.cnlive.libs.base.util.AlertUtil; |
| 21 | 22 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 23 | +import com.cnlive.strike.xiaojiaspeaker.commonInfo.CommInfo; | |
| 22 | 24 | import com.cnlive.strike.xiaojiaspeaker.constants.BlufiConstants; |
| 23 | 25 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.ConfigDeviceNetParam; |
| 24 | 26 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.WifiRecycleAdapter; |
| ... | ... | @@ -26,6 +28,7 @@ import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; |
| 26 | 28 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.TipDialog; |
| 27 | 29 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.WifiPwdDialog; |
| 28 | 30 | import com.cnlive.strike.xiaojiaspeaker.util.BlueToothUtil; |
| 31 | +import com.cnlive.strike.xiaojiaspeaker.util.CommonUtils; | |
| 29 | 32 | import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; |
| 30 | 33 | import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; |
| 31 | 34 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| ... | ... | @@ -33,7 +36,6 @@ import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 33 | 36 | import java.io.UnsupportedEncodingException; |
| 34 | 37 | import java.util.ArrayList; |
| 35 | 38 | import java.util.List; |
| 36 | -import java.util.logging.Handler; | |
| 37 | 39 | |
| 38 | 40 | public class SelectWifiFragmentView implements MvpView { |
| 39 | 41 | private SelectWifiFragment fragment; |
| ... | ... | @@ -46,6 +48,9 @@ public class SelectWifiFragmentView implements MvpView { |
| 46 | 48 | private String SSID; |
| 47 | 49 | private BleDevice bleDevice; |
| 48 | 50 | private Handler failHandler; |
| 51 | + private String familyId; | |
| 52 | + private String cmccId;//移动id | |
| 53 | + private final int DELAY_TIME = 10;//延时查询10秒 | |
| 49 | 54 | |
| 50 | 55 | public SelectWifiFragmentView(SelectWifiFragment fragment) { |
| 51 | 56 | this.fragment = fragment; |
| ... | ... | @@ -57,6 +62,8 @@ public class SelectWifiFragmentView implements MvpView { |
| 57 | 62 | } |
| 58 | 63 | |
| 59 | 64 | public void initWifiList(final BleDevice bleDevice) { |
| 65 | + this.familyId = CommInfo.getFamilyId(getContext()); | |
| 66 | + this.cmccId = CommInfo.getCMCCId(getContext()); | |
| 60 | 67 | this.bleDevice = bleDevice; |
| 61 | 68 | showLoading(); |
| 62 | 69 | initWifiPwdDialog(); |
| ... | ... | @@ -71,6 +78,10 @@ public class SelectWifiFragmentView implements MvpView { |
| 71 | 78 | public void onItemClick(int position, ScanResult scanResult) { |
| 72 | 79 | String encryptionType = scanResult.capabilities; |
| 73 | 80 | SSID = scanResult.SSID; |
| 81 | + if (TextUtils.isEmpty(cmccId) || TextUtils.isEmpty(familyId)) { | |
| 82 | + AlertUtil.showDeftToast(getContext(), "参数异常,请稍后重试!"); | |
| 83 | + return; | |
| 84 | + } | |
| 74 | 85 | //判断是否需要输入密码 |
| 75 | 86 | if (!encryptionType.contains("WEP") && !encryptionType.contains("PSK") && !encryptionType.contains("EAP")) { |
| 76 | 87 | Log.e(TAG, "onItemClick: 不需要密码"); |
| ... | ... | @@ -200,13 +211,12 @@ public class SelectWifiFragmentView implements MvpView { |
| 200 | 211 | new BleNotifyCallback() { |
| 201 | 212 | @Override |
| 202 | 213 | public void onNotifySuccess() { |
| 203 | - | |
| 204 | 214 | // 打开通知操作成功 |
| 205 | 215 | BleManager.getInstance().write( |
| 206 | 216 | bleDevice, |
| 207 | 217 | BlufiConstants.UUID_WIFI_SERVICE.toString(), |
| 208 | 218 | BlufiConstants.UUID_WRITE_CHARACTERISTIC.toString(), |
| 209 | - (BlueToothUtil.getSSIDAndPwd(wifiSSID, wifiPwd, "he:28850150e8bd4c830314819939361b77")).getBytes(), | |
| 219 | + (BlueToothUtil.getSSIDAndPwd(wifiSSID, wifiPwd, cmccId)).getBytes(), | |
| 210 | 220 | new BleWriteCallback() { |
| 211 | 221 | @Override |
| 212 | 222 | public void onWriteSuccess(int current, int total, byte[] justWrite) { |
| ... | ... | @@ -246,7 +256,13 @@ public class SelectWifiFragmentView implements MvpView { |
| 246 | 256 | if (null == getContext()) { |
| 247 | 257 | return; |
| 248 | 258 | } |
| 249 | - queryDeviceConfigNet(getContext()); | |
| 259 | + //查询配网结果(延时查询) | |
| 260 | + new Handler().postDelayed(new Runnable() { | |
| 261 | + @Override | |
| 262 | + public void run() { | |
| 263 | + fragment.getPresenter().queryConfigDeviceNetResult(getContext(), familyId); | |
| 264 | + } | |
| 265 | + }, DELAY_TIME*1000); | |
| 250 | 266 | } else if (result.indexOf(BlufiConstants.WIFI_LINK_FAIL) != -1) { |
| 251 | 267 | if (null != errorDialog) { |
| 252 | 268 | if (!TextUtils.isEmpty(SSID)) { |
| ... | ... | @@ -279,15 +295,15 @@ public class SelectWifiFragmentView implements MvpView { |
| 279 | 295 | } |
| 280 | 296 | |
| 281 | 297 | |
| 282 | - private void queryDeviceConfigNet(Activity activity) { | |
| 283 | - ConfigDeviceNetParam param = new ConfigDeviceNetParam(); | |
| 284 | - param.setAction("mc/getWifiResult"); | |
| 285 | - ConfigDeviceNetParam.DataBean dataBean = new ConfigDeviceNetParam.DataBean(); | |
| 286 | - dataBean.setFrom("he:28850150e8bd4c830314819939361b77"); | |
| 287 | - dataBean.setMyid("he:28850150e8bd4c830314819939361b77"); | |
| 288 | - dataBean.setToken("6fdff0f39ec659c94dd12cdc32937e9d"); | |
| 289 | - param.setData(dataBean); | |
| 290 | - fragment.getPresenter().queryConfigDeviceNetResult(activity, param); | |
| 291 | - } | |
| 298 | +// private void queryDeviceConfigNet(Activity activity, String fromId) { | |
| 299 | +// ConfigDeviceNetParam param = new ConfigDeviceNetParam(); | |
| 300 | +// param.setAction("mc/getWifiResult"); | |
| 301 | +// ConfigDeviceNetParam.DataBean dataBean = new ConfigDeviceNetParam.DataBean(); | |
| 302 | +// dataBean.setFrom("he:28850150e8bd4c830314819939361b77"); | |
| 303 | +// dataBean.setMyid("he:28850150e8bd4c830314819939361b77"); | |
| 304 | +// dataBean.setToken("6fdff0f39ec659c94dd12cdc32937e9d"); | |
| 305 | +// param.setData(dataBean); | |
| 306 | +// fragment.getPresenter().queryConfigDeviceNetResult(activity, param); | |
| 307 | +// } | |
| 292 | 308 | } |
| 293 | 309 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/model/DeviceManagerMenu.java
| ... | ... | @@ -14,6 +14,7 @@ public class DeviceManagerMenu { |
| 14 | 14 | |
| 15 | 15 | private String menuTitle; |
| 16 | 16 | private String menuDetail; |
| 17 | + private String tag;//标志 | |
| 17 | 18 | private int type; |
| 18 | 19 | private boolean swithSelect; |
| 19 | 20 | |
| ... | ... | @@ -26,6 +27,14 @@ public class DeviceManagerMenu { |
| 26 | 27 | this.type = type; |
| 27 | 28 | } |
| 28 | 29 | |
| 30 | + public String getTag() { | |
| 31 | + return tag; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setTag(String tag) { | |
| 35 | + this.tag = tag; | |
| 36 | + } | |
| 37 | + | |
| 29 | 38 | public int getType() { |
| 30 | 39 | return type; |
| 31 | 40 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/model/IMFriendHasLetterInfo.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.model; | |
| 2 | + | |
| 3 | +import android.text.TextUtils; | |
| 4 | + | |
| 5 | +import com.cnlive.strike.xiaojiaspeaker.util.PinyinUtil; | |
| 6 | +import com.cnlive.strike.xiaojiaspeaker.util.search.SearchUtil; | |
| 7 | + | |
| 8 | +import java.util.Locale; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 选择好友列表实体(有索引) | |
| 12 | + */ | |
| 13 | +public class IMFriendHasLetterInfo { | |
| 14 | + public static final int USER_INFO = 0;//联系人 | |
| 15 | + public static final int LETTER_INDEX = 1;//索引 | |
| 16 | + | |
| 17 | + private int type; | |
| 18 | + private String Id; | |
| 19 | + private String userIcon; | |
| 20 | + private String userName; | |
| 21 | + private boolean isSelect; | |
| 22 | + private String letter; | |
| 23 | + | |
| 24 | + public void setLetter(String letter) { | |
| 25 | + this.letter = letter; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public int getType() { | |
| 29 | + return type; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setType(int type) { | |
| 33 | + this.type = type; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public String getLetter() { | |
| 37 | + return letter; | |
| 38 | + } | |
| 39 | + | |
| 40 | + | |
| 41 | + private void setLetterContent(String nickName) { | |
| 42 | + if (TextUtils.isEmpty(nickName)) { | |
| 43 | + this.letter = "#"; | |
| 44 | + } else { | |
| 45 | + String pinYin = PinyinUtil.getPinyin(nickName).toUpperCase(Locale.getDefault()); | |
| 46 | + if (TextUtils.isEmpty(pinYin)) { | |
| 47 | + this.letter = "#"; | |
| 48 | + } else { | |
| 49 | + this.letter = SearchUtil.isAllEnglish(pinYin.substring(0, 1)) ? pinYin : "#"; | |
| 50 | + } | |
| 51 | + } | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getId() { | |
| 55 | + return Id; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setId(String id) { | |
| 59 | + Id = id; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getUserIcon() { | |
| 63 | + return userIcon; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setUserIcon(String userIcon) { | |
| 67 | + this.userIcon = userIcon; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getUserName() { | |
| 71 | + return userName; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setUserName(String userName) { | |
| 75 | + this.userName = userName; | |
| 76 | + setLetterContent(userName); | |
| 77 | + } | |
| 78 | + | |
| 79 | + public boolean isSelect() { | |
| 80 | + return isSelect; | |
| 81 | + } | |
| 82 | + | |
| 83 | + public void setSelect(boolean select) { | |
| 84 | + isSelect = select; | |
| 85 | + } | |
| 86 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/model/IMFriendNoLetterInfo.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.model; | |
| 2 | + | |
| 3 | +import android.text.TextUtils; | |
| 4 | + | |
| 5 | +import com.cnlive.strike.xiaojiaspeaker.util.PinyinUtil; | |
| 6 | +import com.cnlive.strike.xiaojiaspeaker.util.search.SearchUtil; | |
| 7 | + | |
| 8 | +import java.util.Locale; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 选择好友列表实体(有索引) | |
| 12 | + */ | |
| 13 | +public class IMFriendNoLetterInfo { | |
| 14 | + private int type; | |
| 15 | + private String Id; | |
| 16 | + private String userIcon; | |
| 17 | + private String userName; | |
| 18 | + private boolean isSelect; | |
| 19 | + private String letter; | |
| 20 | + | |
| 21 | + public int getType() { | |
| 22 | + return type; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setType(int type) { | |
| 26 | + this.type = type; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public String getLetter() { | |
| 30 | + return letter; | |
| 31 | + } | |
| 32 | + | |
| 33 | + | |
| 34 | + private void setLetterContent(String nickName) { | |
| 35 | + if (TextUtils.isEmpty(nickName)) { | |
| 36 | + this.letter = "#"; | |
| 37 | + } else { | |
| 38 | + String pinYin = PinyinUtil.getPinyin(nickName).toUpperCase(Locale.getDefault()); | |
| 39 | + if (TextUtils.isEmpty(pinYin)) { | |
| 40 | + this.letter = "#"; | |
| 41 | + } else { | |
| 42 | + this.letter = SearchUtil.isAllEnglish(pinYin.substring(0, 1)) ? pinYin : "#"; | |
| 43 | + } | |
| 44 | + } | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String getId() { | |
| 48 | + return Id; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setId(String id) { | |
| 52 | + Id = id; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public String getUserIcon() { | |
| 56 | + return userIcon; | |
| 57 | + } | |
| 58 | + | |
| 59 | + public void setUserIcon(String userIcon) { | |
| 60 | + this.userIcon = userIcon; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public String getUserName() { | |
| 64 | + return userName; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public void setUserName(String userName) { | |
| 68 | + this.userName = userName; | |
| 69 | + setLetterContent(userName); | |
| 70 | + } | |
| 71 | + | |
| 72 | + public boolean isSelect() { | |
| 73 | + return isSelect; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setSelect(boolean select) { | |
| 77 | + isSelect = select; | |
| 78 | + } | |
| 79 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/ApiServiceCMCC.java
| 1 | 1 | package com.cnlive.strike.xiaojiaspeaker.netWork; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -import com.cnlive.strike.xiaojiaspeaker.netWork.bean.BaseInfo; | |
| 5 | 4 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.ConfigDeviceNetParam; |
| 6 | 5 | import com.cnlive.strike.xiaojiaspeaker.netWork.result.ConfigDeviceNetResult; |
| 7 | 6 | |
| 8 | -import java.util.Map; | |
| 9 | - | |
| 10 | -import io.reactivex.Observable; | |
| 11 | -import okhttp3.RequestBody; | |
| 12 | 7 | import retrofit2.Call; |
| 13 | -import retrofit2.adapter.rxjava2.Result; | |
| 14 | 8 | import retrofit2.http.Body; |
| 15 | 9 | import retrofit2.http.POST; |
| 16 | -import retrofit2.http.Query; | |
| 17 | -import retrofit2.http.QueryMap; | |
| 18 | 10 | |
| 19 | 11 | /** |
| 20 | 12 | * 移动官方接口 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/ApiServiceXIaoJia.java deleted
100644 → 0
| 1 | -package com.cnlive.strike.xiaojiaspeaker.netWork; | |
| 2 | - | |
| 3 | - | |
| 4 | -import java.util.Map; | |
| 5 | - | |
| 6 | -import io.reactivex.Observable; | |
| 7 | -import retrofit2.adapter.rxjava2.Result; | |
| 8 | -import retrofit2.http.GET; | |
| 9 | -import retrofit2.http.POST; | |
| 10 | -import retrofit2.http.QueryMap; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * 达人有关的接口 | |
| 14 | - */ | |
| 15 | -public interface ApiServiceXIaoJia { | |
| 16 | - | |
| 17 | -} | |
| 18 | - |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/ApiServiceXiaoJia.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.netWork; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; | |
| 5 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | |
| 6 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.SubscriptionBaseInfo; | |
| 7 | + | |
| 8 | +import java.util.Map; | |
| 9 | + | |
| 10 | +import io.reactivex.Observable; | |
| 11 | +import retrofit2.adapter.rxjava2.Result; | |
| 12 | +import retrofit2.http.POST; | |
| 13 | +import retrofit2.http.QueryMap; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 小家音响的接口 | |
| 17 | + */ | |
| 18 | +public interface ApiServiceXiaoJia { | |
| 19 | + /** | |
| 20 | + * 获取家庭id | |
| 21 | + * sid Integer true sid | |
| 22 | + * phone String true 用户手机号 | |
| 23 | + * | |
| 24 | + * @param maps | |
| 25 | + * @return | |
| 26 | + */ | |
| 27 | + @POST("Daren/sound/getFamilyList.action") | |
| 28 | + Observable<Result<SubscriptionBaseInfo<FamilyListBean>>> getFamilyList(@QueryMap() Map<String, String> maps); | |
| 29 | + | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 获取配网结果 | |
| 33 | + * familyId String true 家庭id | |
| 34 | + * networkId String true 配网Id(from) | |
| 35 | + * | |
| 36 | + * @param maps | |
| 37 | + * @return | |
| 38 | + */ | |
| 39 | + @POST("/Daren/sound/getNetworkResult.action") | |
| 40 | + Observable<Result<SubscriptionBaseInfo<NetworkResultBean>>> getNetworkResult(@QueryMap() Map<String, String> maps); | |
| 41 | +} | |
| 42 | + | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/FamilyListBean.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.netWork.bean; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * 家庭id | |
| 7 | + */ | |
| 8 | +public class FamilyListBean { | |
| 9 | + public static final int THE_HOST = 0;//主人 | |
| 10 | + public static final int THE_MEMBER = 1;//成员 | |
| 11 | + | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * users : [{"id":"bfafb2af39d8488896727505bddf6e79","phone":"13585544805","token":"f32892dd79d5c560decd86b8ece61ca8","userId":"12:3f2e8e64833ebee51a49a0d0000616d2","name":"123456","img":"http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png","deviceList":[{"detail":{"insurance":-1,"users":[{"inrange":false,"manager":true,"headimg":"","name":"135****4805","userid":"12:3f2e8e64833ebee51a49a0d0000616d2"}],"phone":"","appId":"zI3YjQ4MGFiMmM2N","hall":0,"rvnotify":0,"is4GOn":false,"isChildLockOn":false,"isEarLightOn":false,"moment":{"maxid":0},"timbre":"NANNAN","device_type":"storybox","index_config":"app.homepage.0","net":"4G","hasAlarm":false,"online":false,"lock_status":0,"name":"布丁","battery":100,"autodefense":false,"power":false,"growplan":{},"custom":{"netType":[],"nickName":"布丁","devLogo":""},"fangchenmi":[],"power_supply":false,"chatlevel":0,"simFlow":0,"pcode":"","mtdetect":1,"wifissid":"","guard_times":[{"start":"09:00","end":"17:00"}],"sound":{"notifyvoice":"","nodisturb":false},"briefCode":"","volume":75,"ipcdetect":false,"msginfo":{"maxid":0},"tips":"点击完善宝宝信息","devices":[],"isdefense":false,"nightmode":{"state":"1","timerang":[{"start":"22:00","end":"07:00"}]},"mcid":"400011F000000002","face_track":{"user_push":"1","face_track":"2"},"playinfo":{}},"phone":"","power_supply":false,"appId":"zI3YjQ4MGFiMmM2N","manager":true,"isChildLockOn":false,"is4GOn":false,"isEarLightOn":false,"device_type":"storybox","simFlow":0,"pcode":"","online":false,"name":"布丁","briefCode":"","battery":100,"volume":75,"power":false,"isdefense":false,"mcid":"400011F000000002"}],"isMaster":0}] | |
| 15 | + * phone : 13585544805 | |
| 16 | + */ | |
| 17 | + | |
| 18 | + private String phone; | |
| 19 | + private List<UsersBeanX> users; | |
| 20 | + | |
| 21 | + public String getPhone() { | |
| 22 | + return phone; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setPhone(String phone) { | |
| 26 | + this.phone = phone; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public List<UsersBeanX> getUsers() { | |
| 30 | + return users; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setUsers(List<UsersBeanX> users) { | |
| 34 | + this.users = users; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public static class UsersBeanX { | |
| 38 | + /** | |
| 39 | + * id : bfafb2af39d8488896727505bddf6e79 | |
| 40 | + * phone : 13585544805 | |
| 41 | + * token : f32892dd79d5c560decd86b8ece61ca8 | |
| 42 | + * userId : 12:3f2e8e64833ebee51a49a0d0000616d2 | |
| 43 | + * name : 123456 | |
| 44 | + * img : http://wjj.ys1.cnliveimg.com/769/img/2018/0416/head_c.png | |
| 45 | + * deviceList : [{"detail":{"insurance":-1,"users":[{"inrange":false,"manager":true,"headimg":"","name":"135****4805","userid":"12:3f2e8e64833ebee51a49a0d0000616d2"}],"phone":"","appId":"zI3YjQ4MGFiMmM2N","hall":0,"rvnotify":0,"is4GOn":false,"isChildLockOn":false,"isEarLightOn":false,"moment":{"maxid":0},"timbre":"NANNAN","device_type":"storybox","index_config":"app.homepage.0","net":"4G","hasAlarm":false,"online":false,"lock_status":0,"name":"布丁","battery":100,"autodefense":false,"power":false,"growplan":{},"custom":{"netType":[],"nickName":"布丁","devLogo":""},"fangchenmi":[],"power_supply":false,"chatlevel":0,"simFlow":0,"pcode":"","mtdetect":1,"wifissid":"","guard_times":[{"start":"09:00","end":"17:00"}],"sound":{"notifyvoice":"","nodisturb":false},"briefCode":"","volume":75,"ipcdetect":false,"msginfo":{"maxid":0},"tips":"点击完善宝宝信息","devices":[],"isdefense":false,"nightmode":{"state":"1","timerang":[{"start":"22:00","end":"07:00"}]},"mcid":"400011F000000002","face_track":{"user_push":"1","face_track":"2"},"playinfo":{}},"phone":"","power_supply":false,"appId":"zI3YjQ4MGFiMmM2N","manager":true,"isChildLockOn":false,"is4GOn":false,"isEarLightOn":false,"device_type":"storybox","simFlow":0,"pcode":"","online":false,"name":"布丁","briefCode":"","battery":100,"volume":75,"power":false,"isdefense":false,"mcid":"400011F000000002"}] | |
| 46 | + * isMaster : 0 | |
| 47 | + */ | |
| 48 | + | |
| 49 | + private String id; | |
| 50 | + private String phone; | |
| 51 | + private String token; | |
| 52 | + private String userId; | |
| 53 | + private String name; | |
| 54 | + private String img; | |
| 55 | + private int isMaster; | |
| 56 | + private List<DeviceListBean> deviceList; | |
| 57 | + | |
| 58 | + public String getId() { | |
| 59 | + return id; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setId(String id) { | |
| 63 | + this.id = id; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public String getPhone() { | |
| 67 | + return phone; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setPhone(String phone) { | |
| 71 | + this.phone = phone; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public String getToken() { | |
| 75 | + return token; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public void setToken(String token) { | |
| 79 | + this.token = token; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public String getUserId() { | |
| 83 | + return userId; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public void setUserId(String userId) { | |
| 87 | + this.userId = userId; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public String getName() { | |
| 91 | + return name; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public void setName(String name) { | |
| 95 | + this.name = name; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public String getImg() { | |
| 99 | + return img; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public void setImg(String img) { | |
| 103 | + this.img = img; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public int getIsMaster() { | |
| 107 | + return isMaster; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public void setIsMaster(int isMaster) { | |
| 111 | + this.isMaster = isMaster; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public List<DeviceListBean> getDeviceList() { | |
| 115 | + return deviceList; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public void setDeviceList(List<DeviceListBean> deviceList) { | |
| 119 | + this.deviceList = deviceList; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public static class DeviceListBean { | |
| 123 | + /** | |
| 124 | + * detail : {"insurance":-1,"users":[{"inrange":false,"manager":true,"headimg":"","name":"135****4805","userid":"12:3f2e8e64833ebee51a49a0d0000616d2"}],"phone":"","appId":"zI3YjQ4MGFiMmM2N","hall":0,"rvnotify":0,"is4GOn":false,"isChildLockOn":false,"isEarLightOn":false,"moment":{"maxid":0},"timbre":"NANNAN","device_type":"storybox","index_config":"app.homepage.0","net":"4G","hasAlarm":false,"online":false,"lock_status":0,"name":"布丁","battery":100,"autodefense":false,"power":false,"growplan":{},"custom":{"netType":[],"nickName":"布丁","devLogo":""},"fangchenmi":[],"power_supply":false,"chatlevel":0,"simFlow":0,"pcode":"","mtdetect":1,"wifissid":"","guard_times":[{"start":"09:00","end":"17:00"}],"sound":{"notifyvoice":"","nodisturb":false},"briefCode":"","volume":75,"ipcdetect":false,"msginfo":{"maxid":0},"tips":"点击完善宝宝信息","devices":[],"isdefense":false,"nightmode":{"state":"1","timerang":[{"start":"22:00","end":"07:00"}]},"mcid":"400011F000000002","face_track":{"user_push":"1","face_track":"2"},"playinfo":{}} | |
| 125 | + * phone : | |
| 126 | + * power_supply : false | |
| 127 | + * appId : zI3YjQ4MGFiMmM2N | |
| 128 | + * manager : true | |
| 129 | + * isChildLockOn : false | |
| 130 | + * is4GOn : false | |
| 131 | + * isEarLightOn : false | |
| 132 | + * device_type : storybox | |
| 133 | + * simFlow : 0 | |
| 134 | + * pcode : | |
| 135 | + * online : false | |
| 136 | + * name : 布丁 | |
| 137 | + * briefCode : | |
| 138 | + * battery : 100 | |
| 139 | + * volume : 75 | |
| 140 | + * power : false | |
| 141 | + * isdefense : false | |
| 142 | + * mcid : 400011F000000002 | |
| 143 | + */ | |
| 144 | + | |
| 145 | + private DetailBean detail; | |
| 146 | + private String phone; | |
| 147 | + private boolean power_supply; | |
| 148 | + private String appId; | |
| 149 | + private boolean manager; | |
| 150 | + private boolean isChildLockOn; | |
| 151 | + private boolean is4GOn; | |
| 152 | + private boolean isEarLightOn; | |
| 153 | + private String device_type; | |
| 154 | + private int simFlow; | |
| 155 | + private String pcode; | |
| 156 | + private boolean online; | |
| 157 | + private String name; | |
| 158 | + private String briefCode; | |
| 159 | + private int battery; | |
| 160 | + private int volume; | |
| 161 | + private boolean power; | |
| 162 | + private boolean isdefense; | |
| 163 | + private String mcid; | |
| 164 | + | |
| 165 | + public DetailBean getDetail() { | |
| 166 | + return detail; | |
| 167 | + } | |
| 168 | + | |
| 169 | + public void setDetail(DetailBean detail) { | |
| 170 | + this.detail = detail; | |
| 171 | + } | |
| 172 | + | |
| 173 | + public String getPhone() { | |
| 174 | + return phone; | |
| 175 | + } | |
| 176 | + | |
| 177 | + public void setPhone(String phone) { | |
| 178 | + this.phone = phone; | |
| 179 | + } | |
| 180 | + | |
| 181 | + public boolean isPower_supply() { | |
| 182 | + return power_supply; | |
| 183 | + } | |
| 184 | + | |
| 185 | + public void setPower_supply(boolean power_supply) { | |
| 186 | + this.power_supply = power_supply; | |
| 187 | + } | |
| 188 | + | |
| 189 | + public String getAppId() { | |
| 190 | + return appId; | |
| 191 | + } | |
| 192 | + | |
| 193 | + public void setAppId(String appId) { | |
| 194 | + this.appId = appId; | |
| 195 | + } | |
| 196 | + | |
| 197 | + public boolean isManager() { | |
| 198 | + return manager; | |
| 199 | + } | |
| 200 | + | |
| 201 | + public void setManager(boolean manager) { | |
| 202 | + this.manager = manager; | |
| 203 | + } | |
| 204 | + | |
| 205 | + public boolean isIsChildLockOn() { | |
| 206 | + return isChildLockOn; | |
| 207 | + } | |
| 208 | + | |
| 209 | + public void setIsChildLockOn(boolean isChildLockOn) { | |
| 210 | + this.isChildLockOn = isChildLockOn; | |
| 211 | + } | |
| 212 | + | |
| 213 | + public boolean isIs4GOn() { | |
| 214 | + return is4GOn; | |
| 215 | + } | |
| 216 | + | |
| 217 | + public void setIs4GOn(boolean is4GOn) { | |
| 218 | + this.is4GOn = is4GOn; | |
| 219 | + } | |
| 220 | + | |
| 221 | + public boolean isIsEarLightOn() { | |
| 222 | + return isEarLightOn; | |
| 223 | + } | |
| 224 | + | |
| 225 | + public void setIsEarLightOn(boolean isEarLightOn) { | |
| 226 | + this.isEarLightOn = isEarLightOn; | |
| 227 | + } | |
| 228 | + | |
| 229 | + public String getDevice_type() { | |
| 230 | + return device_type; | |
| 231 | + } | |
| 232 | + | |
| 233 | + public void setDevice_type(String device_type) { | |
| 234 | + this.device_type = device_type; | |
| 235 | + } | |
| 236 | + | |
| 237 | + public int getSimFlow() { | |
| 238 | + return simFlow; | |
| 239 | + } | |
| 240 | + | |
| 241 | + public void setSimFlow(int simFlow) { | |
| 242 | + this.simFlow = simFlow; | |
| 243 | + } | |
| 244 | + | |
| 245 | + public String getPcode() { | |
| 246 | + return pcode; | |
| 247 | + } | |
| 248 | + | |
| 249 | + public void setPcode(String pcode) { | |
| 250 | + this.pcode = pcode; | |
| 251 | + } | |
| 252 | + | |
| 253 | + public boolean isOnline() { | |
| 254 | + return online; | |
| 255 | + } | |
| 256 | + | |
| 257 | + public void setOnline(boolean online) { | |
| 258 | + this.online = online; | |
| 259 | + } | |
| 260 | + | |
| 261 | + public String getName() { | |
| 262 | + return name; | |
| 263 | + } | |
| 264 | + | |
| 265 | + public void setName(String name) { | |
| 266 | + this.name = name; | |
| 267 | + } | |
| 268 | + | |
| 269 | + public String getBriefCode() { | |
| 270 | + return briefCode; | |
| 271 | + } | |
| 272 | + | |
| 273 | + public void setBriefCode(String briefCode) { | |
| 274 | + this.briefCode = briefCode; | |
| 275 | + } | |
| 276 | + | |
| 277 | + public int getBattery() { | |
| 278 | + return battery; | |
| 279 | + } | |
| 280 | + | |
| 281 | + public void setBattery(int battery) { | |
| 282 | + this.battery = battery; | |
| 283 | + } | |
| 284 | + | |
| 285 | + public int getVolume() { | |
| 286 | + return volume; | |
| 287 | + } | |
| 288 | + | |
| 289 | + public void setVolume(int volume) { | |
| 290 | + this.volume = volume; | |
| 291 | + } | |
| 292 | + | |
| 293 | + public boolean isPower() { | |
| 294 | + return power; | |
| 295 | + } | |
| 296 | + | |
| 297 | + public void setPower(boolean power) { | |
| 298 | + this.power = power; | |
| 299 | + } | |
| 300 | + | |
| 301 | + public boolean isIsdefense() { | |
| 302 | + return isdefense; | |
| 303 | + } | |
| 304 | + | |
| 305 | + public void setIsdefense(boolean isdefense) { | |
| 306 | + this.isdefense = isdefense; | |
| 307 | + } | |
| 308 | + | |
| 309 | + public String getMcid() { | |
| 310 | + return mcid; | |
| 311 | + } | |
| 312 | + | |
| 313 | + public void setMcid(String mcid) { | |
| 314 | + this.mcid = mcid; | |
| 315 | + } | |
| 316 | + | |
| 317 | + public static class DetailBean { | |
| 318 | + /** | |
| 319 | + * insurance : -1 | |
| 320 | + * users : [{"inrange":false,"manager":true,"headimg":"","name":"135****4805","userid":"12:3f2e8e64833ebee51a49a0d0000616d2"}] | |
| 321 | + * phone : | |
| 322 | + * appId : zI3YjQ4MGFiMmM2N | |
| 323 | + * hall : 0 | |
| 324 | + * rvnotify : 0 | |
| 325 | + * is4GOn : false | |
| 326 | + * isChildLockOn : false | |
| 327 | + * isEarLightOn : false | |
| 328 | + * moment : {"maxid":0} | |
| 329 | + * timbre : NANNAN | |
| 330 | + * device_type : storybox | |
| 331 | + * index_config : app.homepage.0 | |
| 332 | + * net : 4G | |
| 333 | + * hasAlarm : false | |
| 334 | + * online : false | |
| 335 | + * lock_status : 0 | |
| 336 | + * name : 布丁 | |
| 337 | + * battery : 100 | |
| 338 | + * autodefense : false | |
| 339 | + * power : false | |
| 340 | + * growplan : {} | |
| 341 | + * custom : {"netType":[],"nickName":"布丁","devLogo":""} | |
| 342 | + * fangchenmi : [] | |
| 343 | + * power_supply : false | |
| 344 | + * chatlevel : 0 | |
| 345 | + * simFlow : 0 | |
| 346 | + * pcode : | |
| 347 | + * mtdetect : 1 | |
| 348 | + * wifissid : | |
| 349 | + * guard_times : [{"start":"09:00","end":"17:00"}] | |
| 350 | + * sound : {"notifyvoice":"","nodisturb":false} | |
| 351 | + * briefCode : | |
| 352 | + * volume : 75 | |
| 353 | + * ipcdetect : false | |
| 354 | + * msginfo : {"maxid":0} | |
| 355 | + * tips : 点击完善宝宝信息 | |
| 356 | + * devices : [] | |
| 357 | + * isdefense : false | |
| 358 | + * nightmode : {"state":"1","timerang":[{"start":"22:00","end":"07:00"}]} | |
| 359 | + * mcid : 400011F000000002 | |
| 360 | + * face_track : {"user_push":"1","face_track":"2"} | |
| 361 | + * playinfo : {} | |
| 362 | + */ | |
| 363 | + | |
| 364 | + private int insurance; | |
| 365 | + private String phone; | |
| 366 | + private String appId; | |
| 367 | + private int hall; | |
| 368 | + private int rvnotify; | |
| 369 | + private boolean is4GOn; | |
| 370 | + private boolean isChildLockOn; | |
| 371 | + private boolean isEarLightOn; | |
| 372 | + private MomentBean moment; | |
| 373 | + private String timbre; | |
| 374 | + private String device_type; | |
| 375 | + private String index_config; | |
| 376 | + private String net; | |
| 377 | + private boolean hasAlarm; | |
| 378 | + private boolean online; | |
| 379 | + private int lock_status; | |
| 380 | + private String name; | |
| 381 | + private int battery; | |
| 382 | + private boolean autodefense; | |
| 383 | + private boolean power; | |
| 384 | + private GrowplanBean growplan; | |
| 385 | + private CustomBean custom; | |
| 386 | + private boolean power_supply; | |
| 387 | + private int chatlevel; | |
| 388 | + private int simFlow; | |
| 389 | + private String pcode; | |
| 390 | + private int mtdetect; | |
| 391 | + private String wifissid; | |
| 392 | + private SoundBean sound; | |
| 393 | + private String briefCode; | |
| 394 | + private int volume; | |
| 395 | + private boolean ipcdetect; | |
| 396 | + private MsginfoBean msginfo; | |
| 397 | + private String tips; | |
| 398 | + private boolean isdefense; | |
| 399 | + private NightmodeBean nightmode; | |
| 400 | + private String mcid; | |
| 401 | + private FaceTrackBean face_track; | |
| 402 | + private PlayinfoBean playinfo; | |
| 403 | + private List<UsersBean> users; | |
| 404 | + private List<?> fangchenmi; | |
| 405 | + private List<GuardTimesBean> guard_times; | |
| 406 | + private List<?> devices; | |
| 407 | + | |
| 408 | + public int getInsurance() { | |
| 409 | + return insurance; | |
| 410 | + } | |
| 411 | + | |
| 412 | + public void setInsurance(int insurance) { | |
| 413 | + this.insurance = insurance; | |
| 414 | + } | |
| 415 | + | |
| 416 | + public String getPhone() { | |
| 417 | + return phone; | |
| 418 | + } | |
| 419 | + | |
| 420 | + public void setPhone(String phone) { | |
| 421 | + this.phone = phone; | |
| 422 | + } | |
| 423 | + | |
| 424 | + public String getAppId() { | |
| 425 | + return appId; | |
| 426 | + } | |
| 427 | + | |
| 428 | + public void setAppId(String appId) { | |
| 429 | + this.appId = appId; | |
| 430 | + } | |
| 431 | + | |
| 432 | + public int getHall() { | |
| 433 | + return hall; | |
| 434 | + } | |
| 435 | + | |
| 436 | + public void setHall(int hall) { | |
| 437 | + this.hall = hall; | |
| 438 | + } | |
| 439 | + | |
| 440 | + public int getRvnotify() { | |
| 441 | + return rvnotify; | |
| 442 | + } | |
| 443 | + | |
| 444 | + public void setRvnotify(int rvnotify) { | |
| 445 | + this.rvnotify = rvnotify; | |
| 446 | + } | |
| 447 | + | |
| 448 | + public boolean isIs4GOn() { | |
| 449 | + return is4GOn; | |
| 450 | + } | |
| 451 | + | |
| 452 | + public void setIs4GOn(boolean is4GOn) { | |
| 453 | + this.is4GOn = is4GOn; | |
| 454 | + } | |
| 455 | + | |
| 456 | + public boolean isIsChildLockOn() { | |
| 457 | + return isChildLockOn; | |
| 458 | + } | |
| 459 | + | |
| 460 | + public void setIsChildLockOn(boolean isChildLockOn) { | |
| 461 | + this.isChildLockOn = isChildLockOn; | |
| 462 | + } | |
| 463 | + | |
| 464 | + public boolean isIsEarLightOn() { | |
| 465 | + return isEarLightOn; | |
| 466 | + } | |
| 467 | + | |
| 468 | + public void setIsEarLightOn(boolean isEarLightOn) { | |
| 469 | + this.isEarLightOn = isEarLightOn; | |
| 470 | + } | |
| 471 | + | |
| 472 | + public MomentBean getMoment() { | |
| 473 | + return moment; | |
| 474 | + } | |
| 475 | + | |
| 476 | + public void setMoment(MomentBean moment) { | |
| 477 | + this.moment = moment; | |
| 478 | + } | |
| 479 | + | |
| 480 | + public String getTimbre() { | |
| 481 | + return timbre; | |
| 482 | + } | |
| 483 | + | |
| 484 | + public void setTimbre(String timbre) { | |
| 485 | + this.timbre = timbre; | |
| 486 | + } | |
| 487 | + | |
| 488 | + public String getDevice_type() { | |
| 489 | + return device_type; | |
| 490 | + } | |
| 491 | + | |
| 492 | + public void setDevice_type(String device_type) { | |
| 493 | + this.device_type = device_type; | |
| 494 | + } | |
| 495 | + | |
| 496 | + public String getIndex_config() { | |
| 497 | + return index_config; | |
| 498 | + } | |
| 499 | + | |
| 500 | + public void setIndex_config(String index_config) { | |
| 501 | + this.index_config = index_config; | |
| 502 | + } | |
| 503 | + | |
| 504 | + public String getNet() { | |
| 505 | + return net; | |
| 506 | + } | |
| 507 | + | |
| 508 | + public void setNet(String net) { | |
| 509 | + this.net = net; | |
| 510 | + } | |
| 511 | + | |
| 512 | + public boolean isHasAlarm() { | |
| 513 | + return hasAlarm; | |
| 514 | + } | |
| 515 | + | |
| 516 | + public void setHasAlarm(boolean hasAlarm) { | |
| 517 | + this.hasAlarm = hasAlarm; | |
| 518 | + } | |
| 519 | + | |
| 520 | + public boolean isOnline() { | |
| 521 | + return online; | |
| 522 | + } | |
| 523 | + | |
| 524 | + public void setOnline(boolean online) { | |
| 525 | + this.online = online; | |
| 526 | + } | |
| 527 | + | |
| 528 | + public int getLock_status() { | |
| 529 | + return lock_status; | |
| 530 | + } | |
| 531 | + | |
| 532 | + public void setLock_status(int lock_status) { | |
| 533 | + this.lock_status = lock_status; | |
| 534 | + } | |
| 535 | + | |
| 536 | + public String getName() { | |
| 537 | + return name; | |
| 538 | + } | |
| 539 | + | |
| 540 | + public void setName(String name) { | |
| 541 | + this.name = name; | |
| 542 | + } | |
| 543 | + | |
| 544 | + public int getBattery() { | |
| 545 | + return battery; | |
| 546 | + } | |
| 547 | + | |
| 548 | + public void setBattery(int battery) { | |
| 549 | + this.battery = battery; | |
| 550 | + } | |
| 551 | + | |
| 552 | + public boolean isAutodefense() { | |
| 553 | + return autodefense; | |
| 554 | + } | |
| 555 | + | |
| 556 | + public void setAutodefense(boolean autodefense) { | |
| 557 | + this.autodefense = autodefense; | |
| 558 | + } | |
| 559 | + | |
| 560 | + public boolean isPower() { | |
| 561 | + return power; | |
| 562 | + } | |
| 563 | + | |
| 564 | + public void setPower(boolean power) { | |
| 565 | + this.power = power; | |
| 566 | + } | |
| 567 | + | |
| 568 | + public GrowplanBean getGrowplan() { | |
| 569 | + return growplan; | |
| 570 | + } | |
| 571 | + | |
| 572 | + public void setGrowplan(GrowplanBean growplan) { | |
| 573 | + this.growplan = growplan; | |
| 574 | + } | |
| 575 | + | |
| 576 | + public CustomBean getCustom() { | |
| 577 | + return custom; | |
| 578 | + } | |
| 579 | + | |
| 580 | + public void setCustom(CustomBean custom) { | |
| 581 | + this.custom = custom; | |
| 582 | + } | |
| 583 | + | |
| 584 | + public boolean isPower_supply() { | |
| 585 | + return power_supply; | |
| 586 | + } | |
| 587 | + | |
| 588 | + public void setPower_supply(boolean power_supply) { | |
| 589 | + this.power_supply = power_supply; | |
| 590 | + } | |
| 591 | + | |
| 592 | + public int getChatlevel() { | |
| 593 | + return chatlevel; | |
| 594 | + } | |
| 595 | + | |
| 596 | + public void setChatlevel(int chatlevel) { | |
| 597 | + this.chatlevel = chatlevel; | |
| 598 | + } | |
| 599 | + | |
| 600 | + public int getSimFlow() { | |
| 601 | + return simFlow; | |
| 602 | + } | |
| 603 | + | |
| 604 | + public void setSimFlow(int simFlow) { | |
| 605 | + this.simFlow = simFlow; | |
| 606 | + } | |
| 607 | + | |
| 608 | + public String getPcode() { | |
| 609 | + return pcode; | |
| 610 | + } | |
| 611 | + | |
| 612 | + public void setPcode(String pcode) { | |
| 613 | + this.pcode = pcode; | |
| 614 | + } | |
| 615 | + | |
| 616 | + public int getMtdetect() { | |
| 617 | + return mtdetect; | |
| 618 | + } | |
| 619 | + | |
| 620 | + public void setMtdetect(int mtdetect) { | |
| 621 | + this.mtdetect = mtdetect; | |
| 622 | + } | |
| 623 | + | |
| 624 | + public String getWifissid() { | |
| 625 | + return wifissid; | |
| 626 | + } | |
| 627 | + | |
| 628 | + public void setWifissid(String wifissid) { | |
| 629 | + this.wifissid = wifissid; | |
| 630 | + } | |
| 631 | + | |
| 632 | + public SoundBean getSound() { | |
| 633 | + return sound; | |
| 634 | + } | |
| 635 | + | |
| 636 | + public void setSound(SoundBean sound) { | |
| 637 | + this.sound = sound; | |
| 638 | + } | |
| 639 | + | |
| 640 | + public String getBriefCode() { | |
| 641 | + return briefCode; | |
| 642 | + } | |
| 643 | + | |
| 644 | + public void setBriefCode(String briefCode) { | |
| 645 | + this.briefCode = briefCode; | |
| 646 | + } | |
| 647 | + | |
| 648 | + public int getVolume() { | |
| 649 | + return volume; | |
| 650 | + } | |
| 651 | + | |
| 652 | + public void setVolume(int volume) { | |
| 653 | + this.volume = volume; | |
| 654 | + } | |
| 655 | + | |
| 656 | + public boolean isIpcdetect() { | |
| 657 | + return ipcdetect; | |
| 658 | + } | |
| 659 | + | |
| 660 | + public void setIpcdetect(boolean ipcdetect) { | |
| 661 | + this.ipcdetect = ipcdetect; | |
| 662 | + } | |
| 663 | + | |
| 664 | + public MsginfoBean getMsginfo() { | |
| 665 | + return msginfo; | |
| 666 | + } | |
| 667 | + | |
| 668 | + public void setMsginfo(MsginfoBean msginfo) { | |
| 669 | + this.msginfo = msginfo; | |
| 670 | + } | |
| 671 | + | |
| 672 | + public String getTips() { | |
| 673 | + return tips; | |
| 674 | + } | |
| 675 | + | |
| 676 | + public void setTips(String tips) { | |
| 677 | + this.tips = tips; | |
| 678 | + } | |
| 679 | + | |
| 680 | + public boolean isIsdefense() { | |
| 681 | + return isdefense; | |
| 682 | + } | |
| 683 | + | |
| 684 | + public void setIsdefense(boolean isdefense) { | |
| 685 | + this.isdefense = isdefense; | |
| 686 | + } | |
| 687 | + | |
| 688 | + public NightmodeBean getNightmode() { | |
| 689 | + return nightmode; | |
| 690 | + } | |
| 691 | + | |
| 692 | + public void setNightmode(NightmodeBean nightmode) { | |
| 693 | + this.nightmode = nightmode; | |
| 694 | + } | |
| 695 | + | |
| 696 | + public String getMcid() { | |
| 697 | + return mcid; | |
| 698 | + } | |
| 699 | + | |
| 700 | + public void setMcid(String mcid) { | |
| 701 | + this.mcid = mcid; | |
| 702 | + } | |
| 703 | + | |
| 704 | + public FaceTrackBean getFace_track() { | |
| 705 | + return face_track; | |
| 706 | + } | |
| 707 | + | |
| 708 | + public void setFace_track(FaceTrackBean face_track) { | |
| 709 | + this.face_track = face_track; | |
| 710 | + } | |
| 711 | + | |
| 712 | + public PlayinfoBean getPlayinfo() { | |
| 713 | + return playinfo; | |
| 714 | + } | |
| 715 | + | |
| 716 | + public void setPlayinfo(PlayinfoBean playinfo) { | |
| 717 | + this.playinfo = playinfo; | |
| 718 | + } | |
| 719 | + | |
| 720 | + public List<UsersBean> getUsers() { | |
| 721 | + return users; | |
| 722 | + } | |
| 723 | + | |
| 724 | + public void setUsers(List<UsersBean> users) { | |
| 725 | + this.users = users; | |
| 726 | + } | |
| 727 | + | |
| 728 | + public List<?> getFangchenmi() { | |
| 729 | + return fangchenmi; | |
| 730 | + } | |
| 731 | + | |
| 732 | + public void setFangchenmi(List<?> fangchenmi) { | |
| 733 | + this.fangchenmi = fangchenmi; | |
| 734 | + } | |
| 735 | + | |
| 736 | + public List<GuardTimesBean> getGuard_times() { | |
| 737 | + return guard_times; | |
| 738 | + } | |
| 739 | + | |
| 740 | + public void setGuard_times(List<GuardTimesBean> guard_times) { | |
| 741 | + this.guard_times = guard_times; | |
| 742 | + } | |
| 743 | + | |
| 744 | + public List<?> getDevices() { | |
| 745 | + return devices; | |
| 746 | + } | |
| 747 | + | |
| 748 | + public void setDevices(List<?> devices) { | |
| 749 | + this.devices = devices; | |
| 750 | + } | |
| 751 | + | |
| 752 | + public static class MomentBean { | |
| 753 | + } | |
| 754 | + | |
| 755 | + public static class GrowplanBean { | |
| 756 | + } | |
| 757 | + | |
| 758 | + public static class CustomBean { | |
| 759 | + /** | |
| 760 | + * netType : [] | |
| 761 | + * nickName : 布丁 | |
| 762 | + * devLogo : | |
| 763 | + */ | |
| 764 | + | |
| 765 | + private String nickName; | |
| 766 | + private String devLogo; | |
| 767 | + private List<?> netType; | |
| 768 | + | |
| 769 | + public String getNickName() { | |
| 770 | + return nickName; | |
| 771 | + } | |
| 772 | + | |
| 773 | + public void setNickName(String nickName) { | |
| 774 | + this.nickName = nickName; | |
| 775 | + } | |
| 776 | + | |
| 777 | + public String getDevLogo() { | |
| 778 | + return devLogo; | |
| 779 | + } | |
| 780 | + | |
| 781 | + public void setDevLogo(String devLogo) { | |
| 782 | + this.devLogo = devLogo; | |
| 783 | + } | |
| 784 | + | |
| 785 | + public List<?> getNetType() { | |
| 786 | + return netType; | |
| 787 | + } | |
| 788 | + | |
| 789 | + public void setNetType(List<?> netType) { | |
| 790 | + this.netType = netType; | |
| 791 | + } | |
| 792 | + } | |
| 793 | + | |
| 794 | + public static class SoundBean { | |
| 795 | + /** | |
| 796 | + * notifyvoice : | |
| 797 | + * nodisturb : false | |
| 798 | + */ | |
| 799 | + | |
| 800 | + private String notifyvoice; | |
| 801 | + private boolean nodisturb; | |
| 802 | + | |
| 803 | + public String getNotifyvoice() { | |
| 804 | + return notifyvoice; | |
| 805 | + } | |
| 806 | + | |
| 807 | + public void setNotifyvoice(String notifyvoice) { | |
| 808 | + this.notifyvoice = notifyvoice; | |
| 809 | + } | |
| 810 | + | |
| 811 | + public boolean isNodisturb() { | |
| 812 | + return nodisturb; | |
| 813 | + } | |
| 814 | + | |
| 815 | + public void setNodisturb(boolean nodisturb) { | |
| 816 | + this.nodisturb = nodisturb; | |
| 817 | + } | |
| 818 | + } | |
| 819 | + | |
| 820 | + public static class MsginfoBean { | |
| 821 | + /** | |
| 822 | + * maxid : 0 | |
| 823 | + */ | |
| 824 | + | |
| 825 | + private int maxid; | |
| 826 | + | |
| 827 | + public int getMaxid() { | |
| 828 | + return maxid; | |
| 829 | + } | |
| 830 | + | |
| 831 | + public void setMaxid(int maxid) { | |
| 832 | + this.maxid = maxid; | |
| 833 | + } | |
| 834 | + } | |
| 835 | + | |
| 836 | + public static class NightmodeBean { | |
| 837 | + /** | |
| 838 | + * state : 1 | |
| 839 | + * timerang : [{"start":"22:00","end":"07:00"}] | |
| 840 | + */ | |
| 841 | + | |
| 842 | + private String state; | |
| 843 | + private List<TimerangBean> timerang; | |
| 844 | + | |
| 845 | + public String getState() { | |
| 846 | + return state; | |
| 847 | + } | |
| 848 | + | |
| 849 | + public void setState(String state) { | |
| 850 | + this.state = state; | |
| 851 | + } | |
| 852 | + | |
| 853 | + public List<TimerangBean> getTimerang() { | |
| 854 | + return timerang; | |
| 855 | + } | |
| 856 | + | |
| 857 | + public void setTimerang(List<TimerangBean> timerang) { | |
| 858 | + this.timerang = timerang; | |
| 859 | + } | |
| 860 | + | |
| 861 | + public static class TimerangBean { | |
| 862 | + /** | |
| 863 | + * start : 22:00 | |
| 864 | + * end : 07:00 | |
| 865 | + */ | |
| 866 | + | |
| 867 | + private String start; | |
| 868 | + private String end; | |
| 869 | + | |
| 870 | + public String getStart() { | |
| 871 | + return start; | |
| 872 | + } | |
| 873 | + | |
| 874 | + public void setStart(String start) { | |
| 875 | + this.start = start; | |
| 876 | + } | |
| 877 | + | |
| 878 | + public String getEnd() { | |
| 879 | + return end; | |
| 880 | + } | |
| 881 | + | |
| 882 | + public void setEnd(String end) { | |
| 883 | + this.end = end; | |
| 884 | + } | |
| 885 | + } | |
| 886 | + } | |
| 887 | + | |
| 888 | + public static class FaceTrackBean { | |
| 889 | + } | |
| 890 | + | |
| 891 | + public static class PlayinfoBean { | |
| 892 | + } | |
| 893 | + | |
| 894 | + public static class UsersBean { | |
| 895 | + /** | |
| 896 | + * inrange : false | |
| 897 | + * manager : true | |
| 898 | + * headimg : | |
| 899 | + * name : 135****4805 | |
| 900 | + * userid : 12:3f2e8e64833ebee51a49a0d0000616d2 | |
| 901 | + */ | |
| 902 | + | |
| 903 | + private boolean inrange; | |
| 904 | + private boolean manager; | |
| 905 | + private String headimg; | |
| 906 | + private String name; | |
| 907 | + private String userid; | |
| 908 | + | |
| 909 | + public boolean isInrange() { | |
| 910 | + return inrange; | |
| 911 | + } | |
| 912 | + | |
| 913 | + public void setInrange(boolean inrange) { | |
| 914 | + this.inrange = inrange; | |
| 915 | + } | |
| 916 | + | |
| 917 | + public boolean isManager() { | |
| 918 | + return manager; | |
| 919 | + } | |
| 920 | + | |
| 921 | + public void setManager(boolean manager) { | |
| 922 | + this.manager = manager; | |
| 923 | + } | |
| 924 | + | |
| 925 | + public String getHeadimg() { | |
| 926 | + return headimg; | |
| 927 | + } | |
| 928 | + | |
| 929 | + public void setHeadimg(String headimg) { | |
| 930 | + this.headimg = headimg; | |
| 931 | + } | |
| 932 | + | |
| 933 | + public String getName() { | |
| 934 | + return name; | |
| 935 | + } | |
| 936 | + | |
| 937 | + public void setName(String name) { | |
| 938 | + this.name = name; | |
| 939 | + } | |
| 940 | + | |
| 941 | + public String getUserid() { | |
| 942 | + return userid; | |
| 943 | + } | |
| 944 | + | |
| 945 | + public void setUserid(String userid) { | |
| 946 | + this.userid = userid; | |
| 947 | + } | |
| 948 | + } | |
| 949 | + | |
| 950 | + public static class GuardTimesBean { | |
| 951 | + /** | |
| 952 | + * start : 09:00 | |
| 953 | + * end : 17:00 | |
| 954 | + */ | |
| 955 | + | |
| 956 | + private String start; | |
| 957 | + private String end; | |
| 958 | + | |
| 959 | + public String getStart() { | |
| 960 | + return start; | |
| 961 | + } | |
| 962 | + | |
| 963 | + public void setStart(String start) { | |
| 964 | + this.start = start; | |
| 965 | + } | |
| 966 | + | |
| 967 | + public String getEnd() { | |
| 968 | + return end; | |
| 969 | + } | |
| 970 | + | |
| 971 | + public void setEnd(String end) { | |
| 972 | + this.end = end; | |
| 973 | + } | |
| 974 | + } | |
| 975 | + } | |
| 976 | + } | |
| 977 | + } | |
| 978 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/NetworkResultBean.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.netWork.bean; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 配网结果查询 | |
| 5 | + */ | |
| 6 | +public class NetworkResultBean { | |
| 7 | + | |
| 8 | + /** | |
| 9 | + * mainctl : 4000119C000011AE | |
| 10 | + * token : d0142d37f08a636f8cebded765504109 | |
| 11 | + * pid : he:28850150e8bd4c830314819939361b77 | |
| 12 | + * agentId : UxN2JkZTg3OTYzMT | |
| 13 | + * timestamp : 1568723674453 | |
| 14 | + * result : success | |
| 15 | + * isFirstBinded : false | |
| 16 | + * isBinded : true | |
| 17 | + * bindtel : +86 132****5668 | |
| 18 | + */ | |
| 19 | + | |
| 20 | + private String mainctl; | |
| 21 | + private String token; | |
| 22 | + private String pid; | |
| 23 | + private String agentId; | |
| 24 | + private long timestamp; | |
| 25 | + private String result; | |
| 26 | + private boolean isFirstBinded; | |
| 27 | + private boolean isBinded; | |
| 28 | + private String bindtel; | |
| 29 | + | |
| 30 | + public String getMainctl() { | |
| 31 | + return mainctl; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public void setMainctl(String mainctl) { | |
| 35 | + this.mainctl = mainctl; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public String getToken() { | |
| 39 | + return token; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setToken(String token) { | |
| 43 | + this.token = token; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getPid() { | |
| 47 | + return pid; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setPid(String pid) { | |
| 51 | + this.pid = pid; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getAgentId() { | |
| 55 | + return agentId; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setAgentId(String agentId) { | |
| 59 | + this.agentId = agentId; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public long getTimestamp() { | |
| 63 | + return timestamp; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setTimestamp(long timestamp) { | |
| 67 | + this.timestamp = timestamp; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getResult() { | |
| 71 | + return result; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setResult(String result) { | |
| 75 | + this.result = result; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public boolean isIsFirstBinded() { | |
| 79 | + return isFirstBinded; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setIsFirstBinded(boolean isFirstBinded) { | |
| 83 | + this.isFirstBinded = isFirstBinded; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public boolean isIsBinded() { | |
| 87 | + return isBinded; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setIsBinded(boolean isBinded) { | |
| 91 | + this.isBinded = isBinded; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getBindtel() { | |
| 95 | + return bindtel; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setBindtel(String bindtel) { | |
| 99 | + this.bindtel = bindtel; | |
| 100 | + } | |
| 101 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/BaseInfo.java renamed to module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/bean/SubscriptionBaseInfo.java
| 1 | 1 | package com.cnlive.strike.xiaojiaspeaker.netWork.bean; |
| 2 | 2 | |
| 3 | 3 | import com.cnlive.libs.data.network.model.IBaseInfo; |
| 4 | -import com.cnlive.strike.xiaojiaspeaker.netWork.ApiSubscriber; | |
| 5 | 4 | |
| 6 | - | |
| 7 | -public class BaseInfo<T> implements IBaseInfo { | |
| 8 | - //TODO 接口错误信息 需要自定义 | |
| 9 | - private String errorCode = ApiSubscriber.getSuccessCode(); | |
| 5 | +/** | |
| 6 | + * Created by Lynn on 2019/3/27. | |
| 7 | + */ | |
| 8 | +public class SubscriptionBaseInfo<T> implements IBaseInfo { | |
| 9 | + private String errorCode = "0"; | |
| 10 | 10 | private String errorMessage = ""; |
| 11 | 11 | |
| 12 | - //TODO 接口内容数据 需要自定义 | |
| 13 | 12 | private T data; |
| 14 | 13 | |
| 15 | 14 | public void setCode(String status_code) { |
| ... | ... | @@ -34,7 +33,6 @@ public class BaseInfo<T> implements IBaseInfo { |
| 34 | 33 | this.data = data; |
| 35 | 34 | } |
| 36 | 35 | |
| 37 | - @Override | |
| 38 | 36 | public T getData() { |
| 39 | 37 | return data; |
| 40 | 38 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/SubscriptionRequest.java renamed to module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/result/SubscriptionRequest.java
| 1 | -package com.cnlive.strike.xiaojiaspeaker.netWork; | |
| 1 | +package com.cnlive.strike.xiaojiaspeaker.netWork.result; | |
| 2 | 2 | |
| 3 | 3 | import android.content.Context; |
| 4 | 4 | |
| ... | ... | @@ -9,7 +9,7 @@ import com.cnlive.libs.data.network.Subscriber; |
| 9 | 9 | import com.cnlive.libs.data.network.interceptor.NetPPEncryptInterceptor; |
| 10 | 10 | import com.cnlive.libs.data.network.interceptor.NetPPPayEncryptInterceptor; |
| 11 | 11 | import com.cnlive.libs.data.network.interceptor.SignEncryptInterceptor; |
| 12 | -import com.cnlive.strike.xiaojiaspeaker.netWork.bean.BaseInfo; | |
| 12 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.SubscriptionBaseInfo; | |
| 13 | 13 | |
| 14 | 14 | import io.reactivex.android.schedulers.AndroidSchedulers; |
| 15 | 15 | import io.reactivex.disposables.Disposable; |
| ... | ... | @@ -21,23 +21,18 @@ import static com.cnlive.libs.base.logic.Config.SUCCESS; |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Created by Lynn on 2019/3/27. |
| 24 | - * modify by ShinnyYang | |
| 25 | 24 | */ |
| 26 | -public class SubscriptionRequest<Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> { | |
| 25 | +public class SubscriptionRequest<Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends SubscriptionBaseInfo> { | |
| 27 | 26 | private static final String SP_CMS_URL_DEBUT = "http://cmstest.cnlive.com:8768/"; |
| 28 | 27 | private static final String SP_CMS_URL = "http://cms.cnlive.com:8768/"; |
| 29 | - private static final int OKHTTP_KEEP_ALIVE_DURATION_SECONDS = 10; | |
| 30 | - //OPEN API 接口域名 | |
| 31 | - private static final String OPEN_URL = "https://api.cnlive.com/"; | |
| 28 | + | |
| 32 | 29 | //网++ 接口域名 |
| 33 | 30 | public static final String SP_BASE_URL = "https://apiwjj.cnlive.com/"; |
| 34 | 31 | //网++ 测试环境 接口域名 |
| 35 | 32 | public static final String SP_DEBUG_URL = "http://apiwjjtest.cnlive.com/"; |
| 36 | 33 | //OPEN API 接口域名 |
| 34 | + private static final String SP_OPEN_URL = "https://api.cnlive.com/"; | |
| 37 | 35 | private Observable observable; |
| 38 | - //移动官方接口 | |
| 39 | - public static final String CMCC_API_DEBUG_URL = "http://storybox.roobo.net/"; | |
| 40 | - public static final String CMCC_API_REA_URL = "https://storybox-api.roobo.com/rtoy/"; | |
| 41 | 36 | |
| 42 | 37 | private static <T> String baseCMSEndpoint() { |
| 43 | 38 | return AppConfig.isDebug() ? SP_CMS_URL_DEBUT : SP_CMS_URL; |
| ... | ... | @@ -48,54 +43,30 @@ public class SubscriptionRequest<Observable extends io.reactivex.Observable<Resu |
| 48 | 43 | } |
| 49 | 44 | |
| 50 | 45 | private static <T> String serviceEndpoint(Class<T> clazz) { |
| 51 | - //中国移动直接用正式环境 | |
| 52 | - if (clazz == ApiServiceCMCC.class) { | |
| 53 | - return CMCC_API_REA_URL; | |
| 54 | - } | |
| 55 | -// else if (clazz == ApiServiceCMCC.class) { | |
| 56 | -// return BAIDU_TRACE_URL; | |
| 57 | -// } else { | |
| 58 | - return baseEndpoint(); | |
| 59 | -// } | |
| 46 | +// if (clazz == SubscriptionCmsService.class) | |
| 47 | +// return baseCMSEndpoint(); | |
| 48 | +// else if (clazz == ApiSpOpenService.class) | |
| 49 | +// return SP_OPEN_URL; | |
| 50 | +// else | |
| 51 | + return baseEndpoint(); | |
| 60 | 52 | } |
| 61 | 53 | |
| 62 | - public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 54 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends SubscriptionBaseInfo> | |
| 63 | 55 | SubscriptionRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { |
| 64 | 56 | return service(clazz, api, new SignEncryptInterceptor()); |
| 65 | 57 | } |
| 66 | 58 | |
| 67 | - public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 68 | - SubscriptionRequest<Observable, BaseData> cmccService(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { | |
| 69 | - return service(clazz, api, new SignEncryptInterceptor()); | |
| 70 | - } | |
| 71 | - | |
| 72 | - public static <Service> Service service(Class<Service> clazz) { | |
| 73 | - return service(clazz, new SignEncryptInterceptor()); | |
| 74 | - } | |
| 75 | - | |
| 76 | - | |
| 77 | - private static <Service> Service service(Class<Service> clazz, Interceptor... interceptor) { | |
| 78 | - return service(clazz, false, interceptor); | |
| 79 | - } | |
| 80 | - | |
| 81 | - private static <Service> Service service(Class<Service> clazz, boolean decode, Interceptor... interceptor) { | |
| 82 | - return ApiBuild.service(clazz, null) | |
| 83 | - .setEndpoint(serviceEndpoint(clazz)) | |
| 84 | - .addInterceptor(interceptor) | |
| 85 | - .service(decode, OKHTTP_KEEP_ALIVE_DURATION_SECONDS); | |
| 86 | - } | |
| 87 | - | |
| 88 | - public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 59 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends SubscriptionBaseInfo> | |
| 89 | 60 | SubscriptionRequest<Observable, BaseData> serviceEncrypt(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { |
| 90 | 61 | return service(clazz, api, new NetPPEncryptInterceptor()); |
| 91 | 62 | } |
| 92 | 63 | |
| 93 | - public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 64 | + public static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends SubscriptionBaseInfo> | |
| 94 | 65 | SubscriptionRequest<Observable, BaseData> servicePayEncrypt(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api) { |
| 95 | 66 | return service(clazz, api, new NetPPPayEncryptInterceptor()); |
| 96 | 67 | } |
| 97 | 68 | |
| 98 | - private static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 69 | + private static <Service, Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends SubscriptionBaseInfo> | |
| 99 | 70 | SubscriptionRequest<Observable, BaseData> service(Class<Service> clazz, ApiBuild.Api<Service, Observable, BaseData> api, Interceptor... interceptor) { |
| 100 | 71 | |
| 101 | 72 | SubscriptionRequest<Observable, BaseData> request = new SubscriptionRequest<Observable, BaseData>(); |
| ... | ... | @@ -108,21 +79,17 @@ public class SubscriptionRequest<Observable extends io.reactivex.Observable<Resu |
| 108 | 79 | return request; |
| 109 | 80 | } |
| 110 | 81 | |
| 111 | - public Disposable subscribe(Context context, final DataCallback<BaseData> callback) { | |
| 82 | + public Disposable subscribe(Context context, DataCallback<BaseData> callback) { | |
| 112 | 83 | Subscriber<BaseData> subscriber = new Subscriber<BaseData>(context) { |
| 113 | 84 | @Override |
| 114 | 85 | public void onCompleted(String s, String s1, BaseData data) { |
| 115 | - if (callback == null) { | |
| 116 | - return; | |
| 117 | - } | |
| 86 | + if (callback == null) return; | |
| 118 | 87 | callback.callback(SUCCESS, "", data); |
| 119 | 88 | } |
| 120 | 89 | |
| 121 | 90 | @Override |
| 122 | 91 | public void onError(String code, String message) { |
| 123 | - if (callback == null) { | |
| 124 | - return; | |
| 125 | - } | |
| 92 | + if (callback == null) return; | |
| 126 | 93 | int errorCode = -1; |
| 127 | 94 | try { |
| 128 | 95 | errorCode = Integer.valueOf(code); |
| ... | ... | @@ -139,12 +106,5 @@ public class SubscriptionRequest<Observable extends io.reactivex.Observable<Resu |
| 139 | 106 | .subscribe(subscriber.next, subscriber.error, subscriber.complete, subscriber.subscribe); |
| 140 | 107 | } |
| 141 | 108 | |
| 142 | - public static <Observable extends io.reactivex.Observable<Result<BaseData>>, BaseData extends BaseInfo> | |
| 143 | - Disposable subscribe(Observable observable, Subscriber<BaseData> subscriber) { | |
| 144 | - return observable.take(1) | |
| 145 | - .subscribeOn(Schedulers.io()) | |
| 146 | - .observeOn(AndroidSchedulers.mainThread()) | |
| 147 | - .subscribe(subscriber.next, subscriber.error, subscriber.complete, subscriber.subscribe); | |
| 148 | - } | |
| 149 | -/***************************************************************************************/ | |
| 109 | + | |
| 150 | 110 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/SelectIMFriendActivity.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.ui.activity; | |
| 2 | + | |
| 3 | +import android.support.v7.app.AppCompatActivity; | |
| 4 | +import android.os.Bundle; | |
| 5 | + | |
| 6 | +import com.cnlive.strike.xiaojiaspeaker.R; | |
| 7 | +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SearchDevicefragment; | |
| 8 | +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectIMFriendFragment; | |
| 9 | + | |
| 10 | +public class SelectIMFriendActivity extends AppCompatActivity { | |
| 11 | + | |
| 12 | + @Override | |
| 13 | + protected void onCreate(Bundle savedInstanceState) { | |
| 14 | + super.onCreate(savedInstanceState); | |
| 15 | + setContentView(R.layout.activity_select_imfriend); | |
| 16 | + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, SelectIMFriendFragment.newInstance()).commit(); | |
| 17 | + | |
| 18 | + } | |
| 19 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/adapter/AllDeviceAdapter.java
| ... | ... | @@ -14,18 +14,19 @@ import com.cnlive.strike.application.GlideApp; |
| 14 | 14 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 15 | 15 | import com.cnlive.strike.xiaojiaspeaker.databinding.ListItemAllDeviceBinding; |
| 16 | 16 | import com.cnlive.strike.xiaojiaspeaker.model.AllDeviceInfo; |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; | |
| 17 | 18 | |
| 18 | 19 | import java.util.List; |
| 19 | 20 | |
| 20 | 21 | public class AllDeviceAdapter extends RecyclerView.Adapter { |
| 21 | 22 | private Context context; |
| 22 | - private List<AllDeviceInfo> allDeviceInfos; | |
| 23 | + private List<FamilyListBean.UsersBeanX.DeviceListBean> allDeviceInfos; | |
| 23 | 24 | private OnItemClickListener onItemClickListener; |
| 24 | 25 | private OnAddClickListener onAddClickListener; |
| 25 | 26 | private String TAG = "AllDeviceAdapter"; |
| 26 | 27 | |
| 27 | 28 | |
| 28 | - public AllDeviceAdapter(Context context, List<AllDeviceInfo> allDeviceInfos) { | |
| 29 | + public AllDeviceAdapter(Context context, List<FamilyListBean.UsersBeanX.DeviceListBean> allDeviceInfos) { | |
| 29 | 30 | this.context = context; |
| 30 | 31 | this.allDeviceInfos = allDeviceInfos; |
| 31 | 32 | } |
| ... | ... | @@ -63,6 +64,14 @@ public class AllDeviceAdapter extends RecyclerView.Adapter { |
| 63 | 64 | .placeholder(ContextCompat.getDrawable(context, R.drawable.icon_xiaojia)) |
| 64 | 65 | .dontAnimate() |
| 65 | 66 | .into(binding.ivBluetoothDeviceIcon); |
| 67 | + //设置设备名称 | |
| 68 | + binding.tvDeviceName.setText(allDeviceInfos.get(i).getName()); | |
| 69 | + //判断设备是否在线 | |
| 70 | + if (allDeviceInfos.get(i).isOnline()) { | |
| 71 | + binding.tvDeviceState.setText("已启用"); | |
| 72 | + } else { | |
| 73 | + binding.tvDeviceState.setText("未启用"); | |
| 74 | + } | |
| 66 | 75 | } |
| 67 | 76 | |
| 68 | 77 | } |
| ... | ... | @@ -102,7 +111,7 @@ public class AllDeviceAdapter extends RecyclerView.Adapter { |
| 102 | 111 | } |
| 103 | 112 | |
| 104 | 113 | public interface OnItemClickListener { |
| 105 | - void onItemClick(int position, AllDeviceInfo AllDeviceInfo); | |
| 114 | + void onItemClick(int position, FamilyListBean.UsersBeanX.DeviceListBean AllDeviceInfo); | |
| 106 | 115 | } |
| 107 | 116 | |
| 108 | 117 | public interface OnAddClickListener { | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/adapter/SelectIMFriendAdapter.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.ui.adapter; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.databinding.DataBindingUtil; | |
| 5 | +import android.support.annotation.NonNull; | |
| 6 | +import android.support.v7.widget.RecyclerView; | |
| 7 | +import android.view.LayoutInflater; | |
| 8 | +import android.view.ViewGroup; | |
| 9 | + | |
| 10 | +import com.cnlive.strike.application.GlideApp; | |
| 11 | +import com.cnlive.strike.xiaojiaspeaker.R; | |
| 12 | +import com.cnlive.strike.xiaojiaspeaker.databinding.ItemListContactLetterGuideBinding; | |
| 13 | +import com.cnlive.strike.xiaojiaspeaker.databinding.ItemListSelectImContactBinding; | |
| 14 | +import com.cnlive.strike.xiaojiaspeaker.model.IMFriendHasLetterInfo; | |
| 15 | + | |
| 16 | +import java.util.HashMap; | |
| 17 | +import java.util.List; | |
| 18 | + | |
| 19 | +public class SelectIMFriendAdapter extends RecyclerView.Adapter { | |
| 20 | + private Context context; | |
| 21 | + private List<IMFriendHasLetterInfo> imFriendInfoList; | |
| 22 | + private HashMap<String, Boolean> hasSelectMap; | |
| 23 | + | |
| 24 | + public SelectIMFriendAdapter(Context context, List<IMFriendHasLetterInfo> imFriendInfoList) { | |
| 25 | + this.context = context; | |
| 26 | + this.imFriendInfoList = imFriendInfoList; | |
| 27 | + hasSelectMap = new HashMap<>(); | |
| 28 | + for (int i = 0; i < imFriendInfoList.size(); i++) { | |
| 29 | + if (imFriendInfoList.get(i).isSelect()) { | |
| 30 | + hasSelectMap.put(imFriendInfoList.get(i).getId(), true); | |
| 31 | + } else { | |
| 32 | + hasSelectMap.put(imFriendInfoList.get(i).getId(), false); | |
| 33 | + } | |
| 34 | + } | |
| 35 | + } | |
| 36 | + | |
| 37 | + @NonNull | |
| 38 | + @Override | |
| 39 | + public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int type) { | |
| 40 | + LayoutInflater inflater = LayoutInflater.from(context); | |
| 41 | + switch (type) { | |
| 42 | + case IMFriendHasLetterInfo.USER_INFO: | |
| 43 | + ItemListSelectImContactBinding binding = DataBindingUtil.inflate(inflater, R.layout.item_list_select_im_contact, viewGroup, false); | |
| 44 | + return new MyViewHolder(binding); | |
| 45 | + case IMFriendHasLetterInfo.LETTER_INDEX: | |
| 46 | + ItemListContactLetterGuideBinding letterGuideBinding = DataBindingUtil.inflate(inflater, R.layout.item_list_contact_letter_guide, viewGroup, false); | |
| 47 | + return new MyViewLetterHolder(letterGuideBinding); | |
| 48 | + } | |
| 49 | + return null; | |
| 50 | + } | |
| 51 | + | |
| 52 | + @Override | |
| 53 | + public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { | |
| 54 | + switch (getItemViewType(position)) { | |
| 55 | + case IMFriendHasLetterInfo.USER_INFO: | |
| 56 | + ItemListSelectImContactBinding binding = ((MyViewHolder) viewHolder).getBinding(); | |
| 57 | + //设置联系人头像 | |
| 58 | + GlideApp.with(context).load(imFriendInfoList.get(position).getUserIcon()).placeholder(R.drawable.touxiang_round).into(binding.ivIcon); | |
| 59 | + //设置联系人名称 | |
| 60 | + binding.tvName.setText(imFriendInfoList.get(position).getUserName()); | |
| 61 | + //设置是否选中 | |
| 62 | + binding.checkBox.setChecked(imFriendInfoList.get(position).isSelect()); | |
| 63 | + break; | |
| 64 | + case IMFriendHasLetterInfo.LETTER_INDEX: | |
| 65 | + ItemListContactLetterGuideBinding letterGuideBinding = ((MyViewLetterHolder) viewHolder).getBinding(); | |
| 66 | + if (imFriendInfoList.get(position).getLetter().length() >= 2) { | |
| 67 | + letterGuideBinding.tvLetter.setText(imFriendInfoList.get(position).getLetter().substring(0, 1)); | |
| 68 | + } | |
| 69 | + break; | |
| 70 | + } | |
| 71 | + | |
| 72 | + } | |
| 73 | + | |
| 74 | + @Override | |
| 75 | + public int getItemViewType(int position) { | |
| 76 | + return imFriendInfoList.get(position).getType(); | |
| 77 | + } | |
| 78 | + | |
| 79 | + @Override | |
| 80 | + public int getItemCount() { | |
| 81 | + return imFriendInfoList.size(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + private class MyViewHolder extends RecyclerView.ViewHolder { | |
| 85 | + public ItemListSelectImContactBinding getBinding() { | |
| 86 | + return binding; | |
| 87 | + } | |
| 88 | + | |
| 89 | + private ItemListSelectImContactBinding binding; | |
| 90 | + | |
| 91 | + public MyViewHolder(ItemListSelectImContactBinding binding) { | |
| 92 | + super(binding.getRoot()); | |
| 93 | + this.binding = binding; | |
| 94 | + } | |
| 95 | + } | |
| 96 | + | |
| 97 | + private class MyViewLetterHolder extends RecyclerView.ViewHolder { | |
| 98 | + public ItemListContactLetterGuideBinding getBinding() { | |
| 99 | + return binding; | |
| 100 | + } | |
| 101 | + | |
| 102 | + private ItemListContactLetterGuideBinding binding; | |
| 103 | + | |
| 104 | + public MyViewLetterHolder(ItemListContactLetterGuideBinding binding) { | |
| 105 | + super(binding.getRoot()); | |
| 106 | + this.binding = binding; | |
| 107 | + } | |
| 108 | + } | |
| 109 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/AllDeviceFragment.java
| ... | ... | @@ -47,6 +47,7 @@ public class AllDeviceFragment extends MvpBindingFragment<AllDeviceFragmentView, |
| 47 | 47 | initTopBar(); |
| 48 | 48 | if (null != getMvpView()) { |
| 49 | 49 | getMvpView().initView(); |
| 50 | + getPresenter().getFamilyList(getActivity(),"123456","13585544805"); | |
| 50 | 51 | } |
| 51 | 52 | } |
| 52 | 53 | |
| ... | ... | @@ -59,6 +60,7 @@ public class AllDeviceFragment extends MvpBindingFragment<AllDeviceFragmentView, |
| 59 | 60 | binding.topbar.addLeftImageButton(R.drawable.icon_back, R.id.left_back).setOnClickListener(new View.OnClickListener() { |
| 60 | 61 | @Override |
| 61 | 62 | public void onClick(View view) { |
| 63 | + | |
| 62 | 64 | } |
| 63 | 65 | }); |
| 64 | 66 | //添加设备按钮 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SearchDevicefragment.java
| ... | ... | @@ -83,6 +83,9 @@ public class SearchDevicefragment extends MvpBindingFragment<SearchDevicefragmen |
| 83 | 83 | @Override |
| 84 | 84 | public void onDestroy() { |
| 85 | 85 | super.onDestroy(); |
| 86 | - BleManager.getInstance().cancelScan(); | |
| 86 | + try { | |
| 87 | + BleManager.getInstance().cancelScan(); | |
| 88 | + } catch (Exception e) { | |
| 89 | + } | |
| 87 | 90 | } |
| 88 | 91 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/SelectIMFriendFragment.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.ui.fragment; | |
| 2 | + | |
| 3 | +import android.os.Bundle; | |
| 4 | +import android.support.annotation.Nullable; | |
| 5 | +import android.support.v4.content.ContextCompat; | |
| 6 | +import android.view.View; | |
| 7 | + | |
| 8 | +import com.cnlive.libs.base.frame.fragment.MvpBindingFragment; | |
| 9 | +import com.cnlive.libs.base.util.StatusBarUtil; | |
| 10 | +import com.cnlive.libs.base.util.StatusBarUtil2; | |
| 11 | +import com.cnlive.strike.xiaojiaspeaker.R; | |
| 12 | +import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectImFriendBinding; | |
| 13 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectIMFriendPresenter; | |
| 14 | +import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectIMFriendView; | |
| 15 | + | |
| 16 | +public class SelectIMFriendFragment extends MvpBindingFragment<SelectIMFriendView, SelectIMFriendPresenter, Object, FragmentSelectImFriendBinding> { | |
| 17 | + public static SelectIMFriendFragment newInstance() { | |
| 18 | + SelectIMFriendFragment fragment = new SelectIMFriendFragment(); | |
| 19 | + return fragment; | |
| 20 | + } | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + protected int getLayoutId() { | |
| 24 | + return R.layout.fragment_select_im_friend; | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public void onActivityCreated(@Nullable Bundle savedInstanceState) { | |
| 29 | + super.onActivityCreated(savedInstanceState); | |
| 30 | + StatusBarUtil.setStatusBarWrite(getActivity()); | |
| 31 | + StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0); | |
| 32 | + } | |
| 33 | + | |
| 34 | + @Override | |
| 35 | + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
| 36 | + super.onViewCreated(view, savedInstanceState); | |
| 37 | + initTopBar(); | |
| 38 | + if (null != getMvpView()) { | |
| 39 | + getMvpView().initView(); | |
| 40 | + } | |
| 41 | + } | |
| 42 | + | |
| 43 | + private void initTopBar() { | |
| 44 | + | |
| 45 | + if (null != binding) { | |
| 46 | + binding.topbar.setTitle("选择好友").setTextColor(ContextCompat.getColor(getActivity(), R.color.color_282828)); | |
| 47 | + //设置返回按钮 | |
| 48 | + binding.topbar.addLeftImageButton(R.drawable.icon_back, R.id.left_back).setOnClickListener(new View.OnClickListener() { | |
| 49 | + @Override | |
| 50 | + public void onClick(View view) { | |
| 51 | + if (null != getActivity()) { | |
| 52 | + getActivity().finish(); | |
| 53 | + } | |
| 54 | + } | |
| 55 | + }); | |
| 56 | + } | |
| 57 | + } | |
| 58 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/util/CommonUtils.java
0 → 100644
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/util/PinyinUtil.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.util; | |
| 2 | + | |
| 3 | +import net.sourceforge.pinyin4j.PinyinHelper; | |
| 4 | +import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType; | |
| 5 | +import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; | |
| 6 | +import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 拼音工具类 | |
| 10 | + * | |
| 11 | + * @author Liu Wenzhu | |
| 12 | + */ | |
| 13 | +public class PinyinUtil { | |
| 14 | + private static HanyuPinyinOutputFormat outputFormat; | |
| 15 | + | |
| 16 | + static { | |
| 17 | + outputFormat = new HanyuPinyinOutputFormat(); // 设置格式 | |
| 18 | + outputFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE); // 没有音标 | |
| 19 | + outputFormat.setCaseType(HanyuPinyinCaseType.UPPERCASE); // 输出拼音为大写字母 | |
| 20 | + } | |
| 21 | + | |
| 22 | + private PinyinUtil() { | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 将字符串的第一个汉字转化为拼音 <br> | |
| 27 | + * 若该字符串的第一个字为英文字母,则原样返回 | |
| 28 | + * | |
| 29 | + * @param str 欲要将首字转换为拼音的字符串 | |
| 30 | + * @return String 拼音/英文 | |
| 31 | + */ | |
| 32 | + public static String getPinyin(String str) { | |
| 33 | + // 去除中英文标点及空格 | |
| 34 | + str = str.trim().replaceAll("\\p{P}", "").trim(); | |
| 35 | + String[] strs = null; | |
| 36 | + try { | |
| 37 | + strs = PinyinHelper.toHanyuPinyinStringArray(str.charAt(0), outputFormat); | |
| 38 | + } catch (Exception e) { | |
| 39 | + } | |
| 40 | + if (strs != null) { | |
| 41 | + str = strs[0]; | |
| 42 | + } | |
| 43 | + return str; | |
| 44 | + } | |
| 45 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/util/search/CharacterParser.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.util.search; | |
| 2 | + | |
| 3 | +public class CharacterParser { | |
| 4 | + private static int[] pyvalue = new int[]{-20319, -20317, -20304, -20295, | |
| 5 | + -20292, -20283, -20265, -20257, -20242, -20230, -20051, -20036, | |
| 6 | + -20032, -20026, -20002, -19990, -19986, -19982, -19976, -19805, | |
| 7 | + -19784, -19775, -19774, -19763, -19756, -19751, -19746, -19741, | |
| 8 | + -19739, -19728, -19725, -19715, -19540, -19531, -19525, -19515, | |
| 9 | + -19500, -19484, -19479, -19467, -19289, -19288, -19281, -19275, | |
| 10 | + -19270, -19263, -19261, -19249, -19243, -19242, -19238, -19235, | |
| 11 | + -19227, -19224, -19218, -19212, -19038, -19023, -19018, -19006, | |
| 12 | + -19003, -18996, -18977, -18961, -18952, -18783, -18774, -18773, | |
| 13 | + -18763, -18756, -18741, -18735, -18731, -18722, -18710, -18697, | |
| 14 | + -18696, -18526, -18518, -18501, -18490, -18478, -18463, -18448, | |
| 15 | + -18447, -18446, -18239, -18237, -18231, -18220, -18211, -18201, | |
| 16 | + -18184, -18183, -18181, -18012, -17997, -17988, -17970, -17964, | |
| 17 | + -17961, -17950, -17947, -17931, -17928, -17922, -17759, -17752, | |
| 18 | + -17733, -17730, -17721, -17703, -17701, -17697, -17692, -17683, | |
| 19 | + -17676, -17496, -17487, -17482, -17468, -17454, -17433, -17427, | |
| 20 | + -17417, -17202, -17185, -16983, -16970, -16942, -16915, -16733, | |
| 21 | + -16708, -16706, -16689, -16664, -16657, -16647, -16474, -16470, | |
| 22 | + -16465, -16459, -16452, -16448, -16433, -16429, -16427, -16423, | |
| 23 | + -16419, -16412, -16407, -16403, -16401, -16393, -16220, -16216, | |
| 24 | + -16212, -16205, -16202, -16187, -16180, -16171, -16169, -16158, | |
| 25 | + -16155, -15959, -15958, -15944, -15933, -15920, -15915, -15903, | |
| 26 | + -15889, -15878, -15707, -15701, -15681, -15667, -15661, -15659, | |
| 27 | + -15652, -15640, -15631, -15625, -15454, -15448, -15436, -15435, | |
| 28 | + -15419, -15416, -15408, -15394, -15385, -15377, -15375, -15369, | |
| 29 | + -15363, -15362, -15183, -15180, -15165, -15158, -15153, -15150, | |
| 30 | + -15149, -15144, -15143, -15141, -15140, -15139, -15128, -15121, | |
| 31 | + -15119, -15117, -15110, -15109, -14941, -14937, -14933, -14930, | |
| 32 | + -14929, -14928, -14926, -14922, -14921, -14914, -14908, -14902, | |
| 33 | + -14894, -14889, -14882, -14873, -14871, -14857, -14678, -14674, | |
| 34 | + -14670, -14668, -14663, -14654, -14645, -14630, -14594, -14429, | |
| 35 | + -14407, -14399, -14384, -14379, -14368, -14355, -14353, -14345, | |
| 36 | + -14170, -14159, -14151, -14149, -14145, -14140, -14137, -14135, | |
| 37 | + -14125, -14123, -14122, -14112, -14109, -14099, -14097, -14094, | |
| 38 | + -14092, -14090, -14087, -14083, -13917, -13914, -13910, -13907, | |
| 39 | + -13906, -13905, -13896, -13894, -13878, -13870, -13859, -13847, | |
| 40 | + -13831, -13658, -13611, -13601, -13406, -13404, -13400, -13398, | |
| 41 | + -13395, -13391, -13387, -13383, -13367, -13359, -13356, -13343, | |
| 42 | + -13340, -13329, -13326, -13318, -13147, -13138, -13120, -13107, | |
| 43 | + -13096, -13095, -13091, -13076, -13068, -13063, -13060, -12888, | |
| 44 | + -12875, -12871, -12860, -12858, -12852, -12849, -12838, -12831, | |
| 45 | + -12829, -12812, -12802, -12607, -12597, -12594, -12585, -12556, | |
| 46 | + -12359, -12346, -12320, -12300, -12120, -12099, -12089, -12074, | |
| 47 | + -12067, -12058, -12039, -11867, -11861, -11847, -11831, -11798, | |
| 48 | + -11781, -11604, -11589, -11536, -11358, -11340, -11339, -11324, | |
| 49 | + -11303, -11097, -11077, -11067, -11055, -11052, -11045, -11041, | |
| 50 | + -11038, -11024, -11020, -11019, -11018, -11014, -10838, -10832, | |
| 51 | + -10815, -10800, -10790, -10780, -10764, -10587, -10544, -10533, | |
| 52 | + -10519, -10331, -10329, -10328, -10322, -10315, -10309, -10307, | |
| 53 | + -10296, -10281, -10274, -10270, -10262, -10260, -10256, -10254}; | |
| 54 | + public static String[] pystr = new String[]{"a", "ai", "an", "ang", "ao", | |
| 55 | + "ba", "bai", "ban", "bang", "bao", "bei", "ben", "beng", "bi", | |
| 56 | + "bian", "biao", "bie", "bin", "bing", "bo", "bu", "ca", "cai", | |
| 57 | + "can", "cang", "cao", "ce", "ceng", "cha", "chai", "chan", "chang", | |
| 58 | + "chao", "che", "chen", "cheng", "chi", "chong", "chou", "chu", | |
| 59 | + "chuai", "chuan", "chuang", "chui", "chun", "chuo", "ci", "cong", | |
| 60 | + "cou", "cu", "cuan", "cui", "cun", "cuo", "da", "dai", "dan", | |
| 61 | + "dang", "dao", "de", "deng", "di", "dian", "diao", "die", "ding", | |
| 62 | + "diu", "dong", "dou", "du", "duan", "dui", "dun", "duo", "e", "en", | |
| 63 | + "er", "fa", "fan", "fang", "fei", "fen", "feng", "fo", "fou", "fu", | |
| 64 | + "ga", "gai", "gan", "gang", "gao", "ge", "gei", "gen", "geng", | |
| 65 | + "gong", "gou", "gu", "gua", "guai", "guan", "guang", "gui", "gun", | |
| 66 | + "guo", "ha", "hai", "han", "hang", "hao", "he", "hei", "hen", | |
| 67 | + "heng", "hong", "hou", "hu", "hua", "huai", "huan", "huang", "hui", | |
| 68 | + "hun", "huo", "ji", "jia", "jian", "jiang", "jiao", "jie", "jin", | |
| 69 | + "jing", "jiong", "jiu", "ju", "juan", "jue", "jun", "ka", "kai", | |
| 70 | + "kan", "kang", "kao", "ke", "ken", "keng", "kong", "kou", "ku", | |
| 71 | + "kua", "kuai", "kuan", "kuang", "kui", "kun", "kuo", "la", "lai", | |
| 72 | + "lan", "lang", "lao", "le", "lei", "leng", "li", "lia", "lian", | |
| 73 | + "liang", "liao", "lie", "lin", "ling", "liu", "long", "lou", "lu", | |
| 74 | + "lv", "luan", "lue", "lun", "luo", "ma", "mai", "man", "mang", | |
| 75 | + "mao", "me", "mei", "men", "meng", "mi", "mian", "miao", "mie", | |
| 76 | + "min", "ming", "miu", "mo", "mou", "mu", "na", "nai", "nan", | |
| 77 | + "nang", "nao", "ne", "nei", "nen", "neng", "ni", "nian", "niang", | |
| 78 | + "niao", "nie", "nin", "ning", "niu", "nong", "nu", "nv", "nuan", | |
| 79 | + "nue", "nuo", "o", "ou", "pa", "pai", "pan", "pang", "pao", "pei", | |
| 80 | + "pen", "peng", "pi", "pian", "piao", "pie", "pin", "ping", "po", | |
| 81 | + "pu", "qi", "qia", "qian", "qiang", "qiao", "qie", "qin", "qing", | |
| 82 | + "qiong", "qiu", "qu", "quan", "que", "qun", "ran", "rang", "rao", | |
| 83 | + "re", "ren", "reng", "ri", "rong", "rou", "ru", "ruan", "rui", | |
| 84 | + "run", "ruo", "sa", "sai", "san", "sang", "sao", "se", "sen", | |
| 85 | + "seng", "sha", "shai", "shan", "shang", "shao", "she", "shen", | |
| 86 | + "sheng", "shi", "shou", "shu", "shua", "shuai", "shuan", "shuang", | |
| 87 | + "shui", "shun", "shuo", "si", "song", "sou", "su", "suan", "sui", | |
| 88 | + "sun", "suo", "ta", "tai", "tan", "tang", "tao", "te", "teng", | |
| 89 | + "ti", "tian", "tiao", "tie", "ting", "tong", "tou", "tu", "tuan", | |
| 90 | + "tui", "tun", "tuo", "wa", "wai", "wan", "wang", "wei", "wen", | |
| 91 | + "weng", "wo", "wu", "xi", "xia", "xian", "xiang", "xiao", "xie", | |
| 92 | + "xin", "xing", "xiong", "xiu", "xu", "xuan", "xue", "xun", "ya", | |
| 93 | + "yan", "yang", "yao", "ye", "yi", "yin", "ying", "yo", "yong", | |
| 94 | + "you", "yu", "yuan", "yue", "yun", "za", "zai", "zan", "zang", | |
| 95 | + "zao", "ze", "zei", "zen", "zeng", "zha", "zhai", "zhan", "zhang", | |
| 96 | + "zhao", "zhe", "zhen", "zheng", "zhi", "zhong", "zhou", "zhu", | |
| 97 | + "zhua", "zhuai", "zhuan", "zhuang", "zhui", "zhun", "zhuo", "zi", | |
| 98 | + "zong", "zou", "zu", "zuan", "zui", "zun", "zuo"}; | |
| 99 | + private StringBuilder buffer; | |
| 100 | + private String resource; | |
| 101 | + private static CharacterParser characterParser = new CharacterParser(); | |
| 102 | + | |
| 103 | + public static CharacterParser getInstance() { | |
| 104 | + return characterParser; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public String getResource() { | |
| 108 | + return resource; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void setResource(String resource) { | |
| 112 | + this.resource = resource; | |
| 113 | + } | |
| 114 | + | |
| 115 | + /** | |
| 116 | + * 汉字转成ASCII码 | |
| 117 | + * | |
| 118 | + * @param chs | |
| 119 | + * @return | |
| 120 | + */ | |
| 121 | + private int getChsAscii(String chs) { | |
| 122 | + int asc = 0; | |
| 123 | + try { | |
| 124 | + byte[] bytes = chs.getBytes("gb2312"); | |
| 125 | + if (bytes == null || bytes.length > 2 || bytes.length <= 0) { | |
| 126 | + throw new RuntimeException("illegal resource string"); | |
| 127 | + } | |
| 128 | + if (bytes.length == 1) { | |
| 129 | + asc = bytes[0]; | |
| 130 | + } | |
| 131 | + if (bytes.length == 2) { | |
| 132 | + int hightByte = 256 + bytes[0]; | |
| 133 | + int lowByte = 256 + bytes[1]; | |
| 134 | + asc = (256 * hightByte + lowByte) - 256 * 256; | |
| 135 | + } | |
| 136 | + } catch (Exception e) { | |
| 137 | + System.out | |
| 138 | + .println("ERROR:ChineseSpelling.class-getChsAscii(String chs)" | |
| 139 | + + e); | |
| 140 | + } | |
| 141 | + return asc; | |
| 142 | + } | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * 单字解析 | |
| 146 | + **/ | |
| 147 | + public String convert(String str) { | |
| 148 | + String result = null; | |
| 149 | + int ascii = getChsAscii(str); | |
| 150 | + if (ascii > 0 && ascii < 160) { | |
| 151 | + result = String.valueOf((char) ascii); | |
| 152 | + } else { | |
| 153 | + for (int i = (pyvalue.length - 1); i >= 0; i--) { | |
| 154 | + if (pyvalue[i] <= ascii) { | |
| 155 | + result = pystr[i]; | |
| 156 | + break; | |
| 157 | + } | |
| 158 | + } | |
| 159 | + } | |
| 160 | + return result; | |
| 161 | + } | |
| 162 | + | |
| 163 | + /** | |
| 164 | + * 词组解析 | |
| 165 | + * | |
| 166 | + * @param chs | |
| 167 | + * @return | |
| 168 | + */ | |
| 169 | + public String getSelling(String chs) { | |
| 170 | + String key, value; | |
| 171 | + buffer = new StringBuilder(); | |
| 172 | + for (int i = 0; i < chs.length(); i++) { | |
| 173 | + key = chs.substring(i, i + 1); | |
| 174 | + if (key.getBytes().length >= 2) { | |
| 175 | + value = (String) convert(key); | |
| 176 | + if (value == null) { | |
| 177 | + value = "unknown"; | |
| 178 | + } | |
| 179 | + } else { | |
| 180 | + value = key; | |
| 181 | + } | |
| 182 | + buffer.append(value); | |
| 183 | + } | |
| 184 | + return buffer.toString(); | |
| 185 | + } | |
| 186 | + | |
| 187 | + public String getSpelling() { | |
| 188 | + return this.getSelling(this.getResource()); | |
| 189 | + } | |
| 190 | + | |
| 191 | +} | |
| 0 | 192 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/util/search/FirstLetterUtil.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.util.search; | |
| 2 | + | |
| 3 | +public class FirstLetterUtil { | |
| 4 | + private static int BEGIN = 45217; | |
| 5 | + private static int END = 63486; | |
| 6 | + // 按照声母表示,这个表是在GB2312中的出现的第一个汉字,也就是说“啊”是代表首字母a的第一个汉字。 | |
| 7 | + // i, u, v都不做声母, 自定规则跟随前面的字母 | |
| 8 | + private static char[] chartable = {'啊', '芭', '擦', '搭', '蛾', '发', '噶', '哈', | |
| 9 | + '哈', '击', '喀', '垃', '妈', '拿', '哦', '啪', '期', '然', '撒', '塌', '塌', | |
| 10 | + '塌', '挖', '昔', '压', '匝',}; | |
| 11 | + // 二十六个字母区间对应二十七个端点 | |
| 12 | + // GB2312码汉字区间十进制表示 | |
| 13 | + private static int[] table = new int[27]; | |
| 14 | + // 对应首字母区间表 | |
| 15 | + private static char[] initialtable = {'a', 'b', 'c', 'd', 'e', 'f', 'g', | |
| 16 | + 'h', 'h', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', | |
| 17 | + 't', 't', 'w', 'x', 'y', 'z',}; | |
| 18 | + | |
| 19 | + // 初始化 | |
| 20 | + static { | |
| 21 | + for (int i = 0; i < 26; i++) { | |
| 22 | + table[i] = gbValue(chartable[i]);// 得到GB2312码的首字母区间端点表,十进制。 | |
| 23 | + } | |
| 24 | + table[26] = END;// 区间表结尾 | |
| 25 | + } | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 根据一个包含汉字的字符串返回一个汉字拼音首字母的字符串 最重要的一个方法,思路如下:一个个字符读入、判断、输出 | |
| 29 | + */ | |
| 30 | + public static String getFirstLetter(String sourceStr) { | |
| 31 | + String result = ""; | |
| 32 | + String str = sourceStr.toLowerCase(); | |
| 33 | + int StrLength = str.length(); | |
| 34 | + int i; | |
| 35 | + try { | |
| 36 | + for (i = 0; i < StrLength; i++) { | |
| 37 | + result += Char2Initial(str.charAt(i)); | |
| 38 | + } | |
| 39 | + } catch (Exception e) { | |
| 40 | + result = ""; | |
| 41 | + } | |
| 42 | + return result; | |
| 43 | + } | |
| 44 | + | |
| 45 | + /** | |
| 46 | + * 输入字符,得到他的声母,英文字母返回对应的大写字母,其他非简体汉字返回 '0' | |
| 47 | + */ | |
| 48 | + private static char Char2Initial(char ch) { | |
| 49 | + // 对英文字母的处理:小写字母转换为大写,大写的直接返回 | |
| 50 | + if (ch >= 'a' && ch <= 'z') { | |
| 51 | + return ch; | |
| 52 | + } | |
| 53 | + if (ch >= 'A' && ch <= 'Z') { | |
| 54 | + | |
| 55 | + return ch; | |
| 56 | + } | |
| 57 | + // 对非英文字母的处理:转化为首字母,然后判断是否在码表范围内, | |
| 58 | + // 若不是,则直接返回。 | |
| 59 | + // 若是,则在码表内的进行判断。 | |
| 60 | + int gb = gbValue(ch);// 汉字转换首字母 | |
| 61 | + | |
| 62 | + if ((gb < BEGIN) || (gb > END))// 在码表区间之前,直接返回 | |
| 63 | + { | |
| 64 | + return ch; | |
| 65 | + } | |
| 66 | + | |
| 67 | + int i; | |
| 68 | + for (i = 0; i < 26; i++) {// 判断匹配码表区间,匹配到就break,判断区间形如“[,)” | |
| 69 | + if ((gb >= table[i]) && (gb < table[i + 1])) { | |
| 70 | + break; | |
| 71 | + } | |
| 72 | + } | |
| 73 | + | |
| 74 | + if (gb == END) {// 补上GB2312区间最右端 | |
| 75 | + i = 25; | |
| 76 | + } | |
| 77 | + return initialtable[i]; // 在码表区间中,返回首字母 | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * 取出汉字的编码 cn 汉字 | |
| 82 | + */ | |
| 83 | + private static int gbValue(char ch) {// 将一个汉字(GB2312)转换为十进制表示。 | |
| 84 | + String str = new String(); | |
| 85 | + str += ch; | |
| 86 | + try { | |
| 87 | + byte[] bytes = str.getBytes("GB2312"); | |
| 88 | + if (bytes.length < 2) { | |
| 89 | + return 0; | |
| 90 | + } | |
| 91 | + return (bytes[0] << 8 & 0xff00) + (bytes[1] & 0xff); | |
| 92 | + } catch (Exception e) { | |
| 93 | + return 0; | |
| 94 | + } | |
| 95 | + } | |
| 96 | + | |
| 97 | + | |
| 98 | +} | |
| 0 | 99 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/util/search/SearchData.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.util.search; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * author gujun | |
| 7 | + * date: 2019/4/2 | |
| 8 | + * desc: | |
| 9 | + */ | |
| 10 | +public class SearchData implements Serializable { | |
| 11 | + | |
| 12 | + private String searchContent; | |
| 13 | + private int spannableNickStartIndex; | |
| 14 | + private int spannableNickEndIndex; | |
| 15 | + | |
| 16 | + public String getSearchContent() { | |
| 17 | + return searchContent; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void setSearchContent(String searchContent) { | |
| 21 | + this.searchContent = searchContent; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public int getSpannableNickStartIndex() { | |
| 25 | + return spannableNickStartIndex; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setSpannableNickStartIndex(int spannableNickStartIndex) { | |
| 29 | + this.spannableNickStartIndex = spannableNickStartIndex; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public int getSpannableNickEndIndex() { | |
| 33 | + return spannableNickEndIndex; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public void setSpannableNickEndIndex(int spannableNickEndIndex) { | |
| 37 | + this.spannableNickEndIndex = spannableNickEndIndex; | |
| 38 | + } | |
| 39 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/util/search/SearchUtil.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.util.search; | |
| 2 | + | |
| 3 | +import android.text.TextUtils; | |
| 4 | + | |
| 5 | +import java.util.ArrayList; | |
| 6 | +import java.util.List; | |
| 7 | +import java.util.regex.Matcher; | |
| 8 | +import java.util.regex.Pattern; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Created by gujun on 2018/1/9. | |
| 12 | + */ | |
| 13 | + | |
| 14 | +public class SearchUtil { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * 获取联系人模糊查询列表 | |
| 18 | + * | |
| 19 | + * @param filter 过滤条件 | |
| 20 | + * @param list 原始列表 | |
| 21 | + * @return | |
| 22 | + */ | |
| 23 | + public static <T extends SearchData> List<T> getFilterContactList(CharSequence filter, List<T> list) { | |
| 24 | + if (list == null || list.size() <= 0) return null; | |
| 25 | + List<T> filterList = new ArrayList<>(); | |
| 26 | + | |
| 27 | + for (T contactInfo : list) { | |
| 28 | + if (!TextUtils.isEmpty(filter)) { | |
| 29 | + if (contains(contactInfo, filter.toString())) { | |
| 30 | + filterList.add(contactInfo); | |
| 31 | + } | |
| 32 | + } else { | |
| 33 | + contactInfo.setSpannableNickEndIndex(0); | |
| 34 | + contactInfo.setSpannableNickStartIndex(0); | |
| 35 | + filterList.add(contactInfo); | |
| 36 | + } | |
| 37 | + } | |
| 38 | + return filterList; | |
| 39 | + } | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 判断某个联系人昵称是否包含查询字段 | |
| 43 | + * | |
| 44 | + * @param searchData | |
| 45 | + * @param filter | |
| 46 | + * @return | |
| 47 | + */ | |
| 48 | + private static boolean contains(SearchData searchData, String filter) { | |
| 49 | + String name = searchData.getSearchContent(); | |
| 50 | + if (TextUtils.isEmpty(name) | |
| 51 | + && TextUtils.isEmpty(name)) { | |
| 52 | + return false; | |
| 53 | + } | |
| 54 | + | |
| 55 | + int startIndex = 0; | |
| 56 | + int endIndex = 0; | |
| 57 | + boolean flag = false; | |
| 58 | + | |
| 59 | + if (!isAllEnglish(filter)) { | |
| 60 | + // 只要不全是英文就字符串对比 | |
| 61 | + if (name.contains(filter)) { | |
| 62 | + flag = true; | |
| 63 | + startIndex = name.indexOf(filter); | |
| 64 | + endIndex = startIndex + filter.length(); | |
| 65 | + } | |
| 66 | + } else { | |
| 67 | + String key = ""; | |
| 68 | + String searchPinYin = ""; | |
| 69 | + if (!flag) { | |
| 70 | + CharacterParser finder = CharacterParser.getInstance(); | |
| 71 | + // 先将输入的字符串转换为拼音 | |
| 72 | + finder.setResource(filter); | |
| 73 | + searchPinYin = finder.getSpelling(); | |
| 74 | + //处理通配符 | |
| 75 | + key = processingWildcards(searchPinYin); | |
| 76 | + | |
| 77 | + // 简拼匹配,如果输入在字符串长度大于6就不按首字母匹配了 | |
| 78 | + if (key.length() < 6) { | |
| 79 | + String firstLetters = FirstLetterUtil | |
| 80 | + .getFirstLetter(name); | |
| 81 | + // 不区分大小写 | |
| 82 | + Pattern firstLetterPattern = Pattern.compile(key, | |
| 83 | + Pattern.CASE_INSENSITIVE); | |
| 84 | + Matcher firstLetterMatcher = firstLetterPattern.matcher(firstLetters); | |
| 85 | + flag = firstLetterMatcher.find(); | |
| 86 | + if (flag) { | |
| 87 | + startIndex = firstLetterMatcher.start(); | |
| 88 | + endIndex = firstLetterMatcher.end(); | |
| 89 | + } | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + if (!flag && key.length() > 1) { | |
| 94 | + //key.length() > 1代表:仅有一个字母时必须匹配首字母,不能使用全拼 | |
| 95 | + // 全拼匹配 | |
| 96 | + CharacterParser finder = CharacterParser.getInstance(); | |
| 97 | + finder.setResource(name); | |
| 98 | + // 不区分大小写 | |
| 99 | + Pattern pattern = Pattern | |
| 100 | + .compile(key, Pattern.CASE_INSENSITIVE); | |
| 101 | + Matcher matcher = pattern.matcher(finder.getSpelling()); | |
| 102 | + flag = matcher.find(); | |
| 103 | + if (flag) { | |
| 104 | + int matcherStart = matcher.start(); | |
| 105 | + int matcherEnd = matcher.end(); | |
| 106 | + if (matcherStart < matcherEnd) { | |
| 107 | + int scanPinYinCount = 0; | |
| 108 | + char nickNameChar[] = name.toCharArray(); | |
| 109 | + for (int i = 0; i < nickNameChar.length; i++) { | |
| 110 | + CharacterParser finderNick = CharacterParser.getInstance(); | |
| 111 | + finderNick.setResource(String.valueOf(nickNameChar[i])); | |
| 112 | + String nickNamePinYin = finderNick.getSpelling(); | |
| 113 | + if (matcherStart >= scanPinYinCount && matcherStart < scanPinYinCount + nickNamePinYin.length()) { | |
| 114 | + startIndex = i; | |
| 115 | + } | |
| 116 | + if (matcherEnd > scanPinYinCount && matcherEnd <= scanPinYinCount + nickNamePinYin.length()) { | |
| 117 | + endIndex = i + 1; | |
| 118 | + } | |
| 119 | + scanPinYinCount += nickNamePinYin.length(); | |
| 120 | + } | |
| 121 | + } | |
| 122 | + } | |
| 123 | + } | |
| 124 | + } | |
| 125 | + | |
| 126 | + if (flag) { | |
| 127 | + searchData.setSpannableNickStartIndex(startIndex); | |
| 128 | + searchData.setSpannableNickEndIndex(endIndex); | |
| 129 | + } | |
| 130 | + | |
| 131 | + return flag; | |
| 132 | + } | |
| 133 | + | |
| 134 | + /** | |
| 135 | + * 处理转义字符包括 * . ? + $ ^ [ ] ( ) { } | \ | |
| 136 | + * | |
| 137 | + * @param searchPinYin | |
| 138 | + * @return | |
| 139 | + */ | |
| 140 | + private static String processingWildcards(String searchPinYin) { | |
| 141 | + String key = ""; | |
| 142 | + // 处理通配符问题 | |
| 143 | + if (searchPinYin.contains("*") || | |
| 144 | + searchPinYin.contains(".") || | |
| 145 | + searchPinYin.contains("?") || | |
| 146 | + searchPinYin.contains("+") || | |
| 147 | + searchPinYin.contains("$") || | |
| 148 | + searchPinYin.contains("^") || | |
| 149 | + searchPinYin.contains("[") || | |
| 150 | + searchPinYin.contains("]") || | |
| 151 | + searchPinYin.contains("(") || | |
| 152 | + searchPinYin.contains(")") || | |
| 153 | + searchPinYin.contains("{") || | |
| 154 | + searchPinYin.contains("}") || | |
| 155 | + searchPinYin.contains("|") || | |
| 156 | + searchPinYin.contains("\\")) { | |
| 157 | + char[] chars = searchPinYin.toCharArray(); | |
| 158 | + for (int k = 0; k < chars.length; k++) { | |
| 159 | + if (chars[k] == '*') { | |
| 160 | + key = key + "\\*"; | |
| 161 | + } else if (chars[k] == '(') { | |
| 162 | + key = key + "\\("; | |
| 163 | + } else if (chars[k] == ')') { | |
| 164 | + key = key + "\\)"; | |
| 165 | + } else if (chars[k] == '?') { | |
| 166 | + key = key + "\\?"; | |
| 167 | + } else if (chars[k] == '.') { | |
| 168 | + key = key + "\\."; | |
| 169 | + } else if (chars[k] == '+') { | |
| 170 | + key = key + "\\+"; | |
| 171 | + } else if (chars[k] == '$') { | |
| 172 | + key = key + "\\$"; | |
| 173 | + } else if (chars[k] == '^') { | |
| 174 | + key = key + "\\^"; | |
| 175 | + } else if (chars[k] == '[') { | |
| 176 | + key = key + "\\["; | |
| 177 | + } else if (chars[k] == ']') { | |
| 178 | + key = key + "\\]"; | |
| 179 | + } else if (chars[k] == '{') { | |
| 180 | + key = key + "\\{"; | |
| 181 | + } else if (chars[k] == '}') { | |
| 182 | + key = key + "\\}"; | |
| 183 | + } else if (chars[k] == '|') { | |
| 184 | + key = key + "\\|"; | |
| 185 | + } else if (chars[k] == '\\') { | |
| 186 | + key = key + "\\\\"; | |
| 187 | + } else { | |
| 188 | + key = key + String.valueOf(chars[k]); | |
| 189 | + } | |
| 190 | + } | |
| 191 | + } else { | |
| 192 | + key = searchPinYin; | |
| 193 | + } | |
| 194 | + return key; | |
| 195 | + } | |
| 196 | + | |
| 197 | + /** | |
| 198 | + * 是否全是英文 | |
| 199 | + * | |
| 200 | + * @param str | |
| 201 | + * @return | |
| 202 | + */ | |
| 203 | + public static boolean isAllEnglish(String str) { | |
| 204 | + Pattern p = Pattern.compile("[a-zA-Z]"); | |
| 205 | + Matcher m = p.matcher(str); | |
| 206 | + if (m.find()) { | |
| 207 | + return true; | |
| 208 | + } | |
| 209 | + return false; | |
| 210 | + } | |
| 211 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/res/drawable-hdpi/ic_delete.webp
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/res/drawable-hdpi/icon_search.webp
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/res/drawable-hdpi/touxiang_round.webp
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/res/drawable-xhdpi/ic_delete.webp
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/res/drawable-xhdpi/icon_search.webp
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/res/drawable-xhdpi/touxiang_round.webp
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/res/drawable-xxhdpi/ic_delete.webp
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/res/drawable-xxhdpi/icon_search.webp
0 → 100644
No preview for this file type
module_xiaojiaSoundBox/src/main/res/drawable/bg_letterbar.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
| 3 | + | |
| 4 | + <item android:drawable="@drawable/bg_letterbar_pressed" android:state_pressed="true" /> | |
| 5 | + <item android:drawable="@drawable/bg_letterbar_pressed" android:state_selected="true" /> | |
| 6 | + <item android:drawable="@drawable/bg_letterbar_pressed" android:state_focused="true" /> | |
| 7 | + <item android:drawable="@drawable/bg_letterbar_unpressed" /> | |
| 8 | + | |
| 9 | +</selector> | ... | ... |
module_xiaojiaSoundBox/src/main/res/drawable/bg_letterbar_pressed.xml
0 → 100644
module_xiaojiaSoundBox/src/main/res/drawable/bg_letterbar_unpressed.xml
0 → 100644
module_xiaojiaSoundBox/src/main/res/drawable/bg_overlay.xml
0 → 100644
module_xiaojiaSoundBox/src/main/res/drawable/selector_letterbar_text.xml
0 → 100644
module_xiaojiaSoundBox/src/main/res/layout/activity_select_imfriend.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layout> | |
| 3 | + | |
| 4 | + <RelativeLayout 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 | + tools:context=".ui.activity.SelectWifiActivity"> | |
| 10 | + | |
| 11 | + <RelativeLayout | |
| 12 | + android:id="@+id/fragment_container" | |
| 13 | + android:layout_width="match_parent" | |
| 14 | + android:layout_height="match_parent"></RelativeLayout> | |
| 15 | + </RelativeLayout> | |
| 16 | +</layout> | |
| 0 | 17 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/dialog_wifi_pwd.xml
| ... | ... | @@ -44,7 +44,6 @@ |
| 44 | 44 | android:layout_marginRight="20dp" |
| 45 | 45 | android:layout_marginBottom="20dp" |
| 46 | 46 | android:layout_weight="1" |
| 47 | - android:digits="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@." | |
| 48 | 47 | android:gravity="left|center_vertical" |
| 49 | 48 | android:hint="请输入WIFI密码" |
| 50 | 49 | android:inputType="textWebPassword" | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/fragment_all_device.xml
| ... | ... | @@ -12,10 +12,23 @@ |
| 12 | 12 | android:layout_width="match_parent" |
| 13 | 13 | android:layout_height="?attr/qmui_topbar_height" /> |
| 14 | 14 | |
| 15 | - <android.support.v7.widget.RecyclerView | |
| 16 | - android:id="@+id/rv_all_device" | |
| 15 | + <FrameLayout | |
| 17 | 16 | android:layout_width="match_parent" |
| 18 | - android:layout_height="match_parent" | |
| 19 | - android:paddingTop="10dp" /> | |
| 17 | + android:layout_height="match_parent"> | |
| 18 | + | |
| 19 | + <android.support.v7.widget.RecyclerView | |
| 20 | + android:id="@+id/rv_all_device" | |
| 21 | + android:layout_width="match_parent" | |
| 22 | + android:layout_height="match_parent" | |
| 23 | + android:paddingTop="10dp" /> | |
| 24 | + | |
| 25 | + <com.cnlive.strike.ui.widget.UIEmptyView | |
| 26 | + android:id="@+id/empty_layout" | |
| 27 | + android:layout_width="match_parent" | |
| 28 | + android:layout_height="match_parent" | |
| 29 | + android:background="@color/color_fff" | |
| 30 | + android:visibility="gone" /> | |
| 31 | + </FrameLayout> | |
| 32 | + | |
| 20 | 33 | </LinearLayout> |
| 21 | 34 | </layout> |
| 22 | 35 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/fragment_select_im_friend.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layout xmlns:letterBar="http://schemas.android.com/apk/res-auto"> | |
| 3 | + | |
| 4 | + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 5 | + android:layout_width="match_parent" | |
| 6 | + android:layout_height="match_parent" | |
| 7 | + android:background="@color/color_F2F2F2" | |
| 8 | + android:orientation="vertical"> | |
| 9 | + | |
| 10 | + <com.qmuiteam.qmui.widget.QMUITopBar | |
| 11 | + android:id="@+id/topbar" | |
| 12 | + android:layout_width="match_parent" | |
| 13 | + android:layout_height="?attr/qmui_topbar_height" /> | |
| 14 | + | |
| 15 | + <LinearLayout | |
| 16 | + android:id="@+id/ll_search" | |
| 17 | + 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" /> | |
| 29 | + | |
| 30 | + <EditText | |
| 31 | + android:id="@+id/et_query" | |
| 32 | + android:layout_width="0dp" | |
| 33 | + 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" /> | |
| 43 | + | |
| 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> | |
| 54 | + | |
| 55 | + <FrameLayout | |
| 56 | + android:layout_width="match_parent" | |
| 57 | + android:layout_height="0dp" | |
| 58 | + android:layout_weight="1"> | |
| 59 | + | |
| 60 | + <android.support.v7.widget.RecyclerView | |
| 61 | + android:id="@+id/rv_friends" | |
| 62 | + android:layout_width="match_parent" | |
| 63 | + android:layout_height="match_parent" | |
| 64 | + android:layout_marginTop="10dp" /> | |
| 65 | + | |
| 66 | + <com.cnlive.strike.ui.widget.LetterBarView | |
| 67 | + android:id="@+id/letterBarView" | |
| 68 | + android:layout_width="match_parent" | |
| 69 | + android:layout_height="match_parent" | |
| 70 | + android:layout_alignParentRight="true" | |
| 71 | + android:layout_gravity="right" | |
| 72 | + letterBar:lbLetterBarBackground="@drawable/bg_letterbar" | |
| 73 | + letterBar:lbLetterBarTextColor="@drawable/selector_letterbar_text" | |
| 74 | + letterBar:lbOverlayBackground="@drawable/bg_overlay" | |
| 75 | + letterBar:lbOverlayTextColor="#FFF" | |
| 76 | + letterBar:lbOverlayTextSize="40sp" /> | |
| 77 | + </FrameLayout> | |
| 78 | + | |
| 79 | + <Button | |
| 80 | + android:layout_width="match_parent" | |
| 81 | + android:layout_height="45dp" | |
| 82 | + android:layout_margin="30dp" | |
| 83 | + android:background="@drawable/selector_btn_green" | |
| 84 | + android:text="下一步" | |
| 85 | + android:textColor="@color/white" | |
| 86 | + android:textSize="17sp" | |
| 87 | + android:textStyle="bold" /> | |
| 88 | + </LinearLayout> | |
| 89 | +</layout> | |
| 0 | 90 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/item_list_contact_letter_guide.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<layout> | |
| 3 | + | |
| 4 | + <TextView xmlns:android="http://schemas.android.com/apk/res/android" | |
| 5 | + android:id="@+id/tv_letter" | |
| 6 | + android:layout_width="match_parent" | |
| 7 | + android:layout_height="wrap_content" | |
| 8 | + android:paddingLeft="10dp" | |
| 9 | + android:paddingTop="6dp" | |
| 10 | + android:paddingBottom="6dp" | |
| 11 | + android:textColor="@color/color_656565" | |
| 12 | + android:textSize="15sp" /> | |
| 13 | +</layout> | |
| 0 | 14 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/res/layout/item_list_select_im_contact.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 | + android:layout_width="match_parent" | |
| 6 | + android:layout_height="65dp" | |
| 7 | + android:background="@color/white" | |
| 8 | + android:gravity="center_vertical"> | |
| 9 | + | |
| 10 | + <LinearLayout | |
| 11 | + android:layout_width="0dp" | |
| 12 | + android:layout_height="match_parent" | |
| 13 | + android:layout_weight="1" | |
| 14 | + android:gravity="center_vertical"> | |
| 15 | + | |
| 16 | + <ImageView | |
| 17 | + android:id="@+id/iv_icon" | |
| 18 | + android:layout_width="40dp" | |
| 19 | + android:layout_height="40dp" | |
| 20 | + android:layout_marginLeft="10dp" /> | |
| 21 | + | |
| 22 | + <TextView | |
| 23 | + android:id="@+id/tv_name" | |
| 24 | + android:layout_width="wrap_content" | |
| 25 | + android:layout_height="wrap_content" | |
| 26 | + android:layout_marginLeft="10dp" | |
| 27 | + android:textColor="@color/color_282828" | |
| 28 | + android:textSize="16sp" /> | |
| 29 | + </LinearLayout> | |
| 30 | + | |
| 31 | + <CheckBox | |
| 32 | + android:id="@+id/checkBox" | |
| 33 | + style="@style/CustomCheckboxTheme" | |
| 34 | + android:layout_width="21dp" | |
| 35 | + android:layout_height="21dp" | |
| 36 | + android:layout_marginLeft="10dp" | |
| 37 | + android:layout_marginRight="20dp" | |
| 38 | + android:clickable="false" | |
| 39 | + android:enabled="false" | |
| 40 | + android:focusable="false" | |
| 41 | + android:focusableInTouchMode="false" /> | |
| 42 | + </LinearLayout> | |
| 43 | +</layout> | |
| 0 | 44 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/res/values/colors.xml
module_xiaojiaSoundBox/src/main/res/values/strings.xml