Commit 185c3c8fb4225b5c1e65c5848b68714f2d17afa6
1 parent
374a9ac4
1 优化配网
Showing
21 changed files
with
1089 additions
and
541 deletions
app/build.gradle
| ... | ... | @@ -5,11 +5,11 @@ static def stringValue(def value) { |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | android { |
| 8 | - compileSdkVersion 28 | |
| 8 | + compileSdkVersion 29 | |
| 9 | 9 | defaultConfig { |
| 10 | 10 | applicationId "com.cnlive.strike" |
| 11 | 11 | minSdkVersion 18 |
| 12 | - targetSdkVersion 28 | |
| 12 | + targetSdkVersion 29 | |
| 13 | 13 | versionCode 1 |
| 14 | 14 | versionName "1.0" |
| 15 | 15 | testInstrumentationRunner "android.test.runner.AndroidJUnitRunner" | ... | ... |
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/MainActivity.java
| ... | ... | @@ -35,12 +35,13 @@ public class MainActivity extends AppCompatActivity { |
| 35 | 35 | // startActivity(new Intent(MainActivity.this, BluetoothConnActivity.class)); |
| 36 | 36 | // startActivity(new Intent(MainActivity.this, BlueToothStep1Activity.class)); |
| 37 | 37 | // startActivity(new Intent(MainActivity.this, ConnBluetoothSuccessActivity.class)); |
| 38 | - startActivity(new Intent(MainActivity.this, AllDeviceActivity.class)); | |
| 38 | +// startActivity(new Intent(MainActivity.this, AllDeviceActivity.class)); | |
| 39 | 39 | // startActivity(new Intent(MainActivity.this, DeviceInstructionActivity.class)); |
| 40 | 40 | // startActivity(new Intent(MainActivity.this, DeviceManagerActivity.class)); |
| 41 | 41 | // startActivity(new Intent(MainActivity.this, FirmwareUpdateActivity.class)); |
| 42 | 42 | // startActivity(new Intent(MainActivity.this, SelectWifiActivity.class)); |
| 43 | -// startActivity(new Intent(MainActivity.this, ToolBarTestActivity.class)); | |
| 43 | + startActivity(new Intent(MainActivity.this, ToolBarTestActivity.class)); | |
| 44 | + | |
| 44 | 45 | // startActivity(new Intent(MainActivity.this, SelectIMFriendActivity.class)); |
| 45 | 46 | // startActivity(new Intent(MainActivity.this, InvitFriendActivity.class)); |
| 46 | 47 | ... | ... |
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/ToolBarTestActivity.java
| ... | ... | @@ -40,172 +40,173 @@ public class ToolBarTestActivity extends AppCompatActivity { |
| 40 | 40 | protected void onCreate(Bundle savedInstanceState) { |
| 41 | 41 | super.onCreate(savedInstanceState); |
| 42 | 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 | 43 | |
| 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); | |
| 44 | +// LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) binding.ivLife.getLayoutParams(); | |
| 45 | +// Log.e(TAG, "onCreate: " + params.topMargin); | |
| 46 | +// YoYo.with(Techniques.Swing) | |
| 47 | +// .duration(700) | |
| 48 | +// .repeat(0) | |
| 49 | +// .playOn(binding.ivLife); | |
| 50 | +// binding.appbar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { | |
| 51 | +// @Override | |
| 52 | +// public void onOffsetChanged(AppBarLayout appBarLayout, int i) { | |
| 53 | +// Log.e(TAG, "onOffsetChanged: " + i + "getTotalScrollRange:" + appBarLayout.getTotalScrollRange()); | |
| 54 | +// if (isFirstSlide) { | |
| 55 | +// if (i != 0) { | |
| 56 | +// binding.tvCircle.setVisibility(View.GONE); | |
| 57 | +// binding.tvSub.setVisibility(View.GONE); | |
| 58 | +// binding.tvShop.setVisibility(View.GONE); | |
| 59 | +// binding.llMenu.startAnimation(AnimationUtils.makeOutAnimation(ToolBarTestActivity.this, true)); | |
| 60 | +// binding.llMenu.setVisibility(View.INVISIBLE); | |
| 193 | 61 | // |
| 194 | - } | |
| 195 | - | |
| 196 | - } | |
| 197 | - }); | |
| 62 | +// ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llLife, "scaleY", 1f, 0.8f); | |
| 63 | +// // 正式开始启动执行动画 | |
| 64 | +// ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llLife, "scaleX", 1f, 0.8f); | |
| 65 | +// // 正式开始启动执行动画 | |
| 66 | +// AnimatorSet animatorSet = new AnimatorSet(); | |
| 67 | +// animatorSet.play(anim).with(anim1); | |
| 68 | +// animatorSet.setDuration(500); | |
| 69 | +// animatorSet.start(); | |
| 70 | +// | |
| 71 | +// | |
| 72 | +// ObjectAnimator translationX = ObjectAnimator.ofFloat(binding.llLife, "translationY", 50, -50); | |
| 73 | +// translationX.setDuration(300); | |
| 74 | +// translationX.setInterpolator(new FastOutLinearInInterpolator()); | |
| 75 | +// translationX.start(); | |
| 76 | +// new Handler().postDelayed(new Runnable() { | |
| 77 | +// @Override | |
| 78 | +// public void run() { | |
| 79 | +// ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llSub, "scaleY", 1f, 0.8f); | |
| 80 | +// // 正式开始启动执行动画 | |
| 81 | +// ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llSub, "scaleX", 1f, 0.8f); | |
| 82 | +// // 正式开始启动执行动画 | |
| 83 | +// AnimatorSet animatorSet = new AnimatorSet(); | |
| 84 | +// animatorSet.play(anim).with(anim1); | |
| 85 | +// animatorSet.setDuration(500); | |
| 86 | +// animatorSet.start(); | |
| 87 | +// | |
| 88 | +// ObjectAnimator translationX1 = ObjectAnimator.ofFloat(binding.llSub, "translationY", 50, -50); | |
| 89 | +// translationX1.setDuration(300); | |
| 90 | +// translationX1.setInterpolator(new FastOutLinearInInterpolator()); | |
| 91 | +// translationX1.start(); | |
| 92 | +// new Handler().postDelayed(new Runnable() { | |
| 93 | +// @Override | |
| 94 | +// public void run() { | |
| 95 | +// ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llShop, "scaleY", 1f, 0.8f); | |
| 96 | +// // 正式开始启动执行动画 | |
| 97 | +// ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llShop, "scaleX", 1f, 0.8f); | |
| 98 | +// // 正式开始启动执行动画 | |
| 99 | +// AnimatorSet animatorSet = new AnimatorSet(); | |
| 100 | +// animatorSet.play(anim).with(anim1); | |
| 101 | +// animatorSet.setDuration(500); | |
| 102 | +// animatorSet.start(); | |
| 103 | +// | |
| 104 | +// ObjectAnimator translationX2 = ObjectAnimator.ofFloat(binding.llShop, "translationY", 50, -50); | |
| 105 | +// translationX2.setDuration(300); | |
| 106 | +// translationX2.setInterpolator(new FastOutLinearInInterpolator()); | |
| 107 | +// translationX2.start(); | |
| 108 | +// | |
| 109 | +// } | |
| 110 | +// }, 50); | |
| 111 | +// } | |
| 112 | +// }, 50); | |
| 113 | +// | |
| 114 | +// | |
| 115 | +// } | |
| 116 | +// } | |
| 117 | +// if (i != 0) { | |
| 118 | +// isFirstSlide = false; | |
| 119 | +// if (i == -appBarLayout.getTotalScrollRange()) { | |
| 120 | +// setMargin(100); | |
| 121 | +// } | |
| 122 | +// } else { | |
| 123 | +// if (!isFirstSlide) { | |
| 124 | +// setMargin(0); | |
| 125 | +// } | |
| 126 | +// isFirstSlide = true; | |
| 127 | +// binding.tvCircle.setVisibility(View.VISIBLE); | |
| 128 | +// binding.tvSub.setVisibility(View.VISIBLE); | |
| 129 | +// binding.tvShop.setVisibility(View.VISIBLE); | |
| 130 | +// binding.llMenu.setVisibility(View.VISIBLE); | |
| 131 | +// binding.ivLife.setVisibility(View.VISIBLE); | |
| 132 | +// | |
| 133 | +// ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llShop, "scaleY", 0.8f, 1f); | |
| 134 | +// // 正式开始启动执行动画 | |
| 135 | +// ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llShop, "scaleX", 0.8f, 1f); | |
| 136 | +// // 正式开始启动执行动画 | |
| 137 | +// AnimatorSet animatorSet = new AnimatorSet(); | |
| 138 | +// animatorSet.play(anim).with(anim1); | |
| 139 | +// animatorSet.setDuration(500); | |
| 140 | +// animatorSet.start(); | |
| 141 | +// | |
| 142 | +// ObjectAnimator translationX = ObjectAnimator.ofFloat(binding.llShop, "translationY", 100, 0); | |
| 143 | +// translationX.setDuration(300); | |
| 144 | +// translationX.setInterpolator(new FastOutLinearInInterpolator()); | |
| 145 | +// translationX.start(); | |
| 146 | +// new Handler().postDelayed(new Runnable() { | |
| 147 | +// @Override | |
| 148 | +// public void run() { | |
| 149 | +// ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llSub, "scaleY", 0.8f, 1f); | |
| 150 | +// // 正式开始启动执行动画 | |
| 151 | +// ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llSub, "scaleX", 0.8f, 1f); | |
| 152 | +// // 正式开始启动执行动画 | |
| 153 | +// AnimatorSet animatorSet = new AnimatorSet(); | |
| 154 | +// animatorSet.play(anim).with(anim1); | |
| 155 | +// animatorSet.setDuration(500); | |
| 156 | +// animatorSet.start(); | |
| 157 | +// | |
| 158 | +// ObjectAnimator translationX1 = ObjectAnimator.ofFloat(binding.llSub, "translationY", 100, 0); | |
| 159 | +// translationX1.setDuration(300); | |
| 160 | +// translationX1.setInterpolator(new FastOutLinearInInterpolator()); | |
| 161 | +// translationX1.start(); | |
| 162 | +// new Handler().postDelayed(new Runnable() { | |
| 163 | +// @Override | |
| 164 | +// public void run() { | |
| 165 | +// ObjectAnimator anim = ObjectAnimator.ofFloat(binding.llLife, "scaleY", 0.8f, 1f); | |
| 166 | +// // 正式开始启动执行动画 | |
| 167 | +// ObjectAnimator anim1 = ObjectAnimator.ofFloat(binding.llLife, "scaleX", 0.8f, 1f); | |
| 168 | +// // 正式开始启动执行动画 | |
| 169 | +// AnimatorSet animatorSet = new AnimatorSet(); | |
| 170 | +// animatorSet.play(anim).with(anim1); | |
| 171 | +// animatorSet.setDuration(500); | |
| 172 | +// animatorSet.start(); | |
| 173 | +// | |
| 174 | +// | |
| 175 | +// ObjectAnimator translationX2 = ObjectAnimator.ofFloat(binding.llLife, "translationY", 100, 0); | |
| 176 | +// translationX2.setDuration(300); | |
| 177 | +// translationX2.setInterpolator(new FastOutLinearInInterpolator()); | |
| 178 | +// translationX2.start(); | |
| 179 | +// //设置缩放动画 | |
| 180 | +// new Handler().postDelayed(new Runnable() { | |
| 181 | +// @Override | |
| 182 | +// public void run() { | |
| 183 | +// ButtonAnimUtil.setViewShowZoomIn(binding.ivLife); | |
| 184 | +// YoYo.with(Techniques.Swing) | |
| 185 | +// .duration(700) | |
| 186 | +// .repeat(0) | |
| 187 | +// .playOn(binding.ivLife); | |
| 188 | +// } | |
| 189 | +// }, 500); | |
| 190 | +// } | |
| 191 | +// }, 50); | |
| 192 | +// } | |
| 193 | +// }, 50); | |
| 194 | +//// | |
| 195 | +// } | |
| 196 | +// | |
| 197 | +// } | |
| 198 | +// }); | |
| 198 | 199 | } |
| 199 | 200 | |
| 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); | |
| 210 | - } | |
| 201 | +// private void setMargin(int topmargin) { | |
| 202 | +// LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) binding.llLife.getLayoutParams(); | |
| 203 | +// params.topMargin = topmargin; | |
| 204 | +// binding.llLife.setLayoutParams(params); | |
| 205 | +// LinearLayout.LayoutParams params2 = (LinearLayout.LayoutParams) binding.llSub.getLayoutParams(); | |
| 206 | +// params2.topMargin = topmargin; | |
| 207 | +// binding.llSub.setLayoutParams(params2); | |
| 208 | +// LinearLayout.LayoutParams params3 = (LinearLayout.LayoutParams) binding.llShop.getLayoutParams(); | |
| 209 | +// params3.topMargin = topmargin; | |
| 210 | +// binding.llShop.setLayoutParams(params3); | |
| 211 | +// } | |
| 211 | 212 | } | ... | ... |
app/src/main/res/layout/activity_tool_bar_test.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | <layout> |
| 3 | 3 | |
| 4 | - <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 4 | + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 5 | 5 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 6 | 6 | xmlns:tools="http://schemas.android.com/tools" |
| 7 | 7 | android:layout_width="match_parent" |
| ... | ... | @@ -10,267 +10,253 @@ |
| 10 | 10 | tools:context="com.cnlive.strike.xiaojiaspeaker.ToolBarTestActivity" |
| 11 | 11 | tools:ignore="MissingDefaultResource"> |
| 12 | 12 | |
| 13 | - <android.support.design.widget.AppBarLayout | |
| 14 | - android:id="@+id/appbar" | |
| 13 | + <!----> | |
| 14 | + <!----> | |
| 15 | + <LinearLayout | |
| 16 | + android:id="@+id/ll_menu" | |
| 15 | 17 | android:layout_width="match_parent" |
| 16 | - android:layout_height="150dp" | |
| 17 | - android:background="@drawable/mian_bg" | |
| 18 | - android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | |
| 18 | + android:layout_height="40dp" | |
| 19 | + android:background="@color/btn_green" | |
| 20 | + android:gravity="center|right"> | |
| 19 | 21 | |
| 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 | 22 | <LinearLayout |
| 183 | - android:id="@+id/ll_root" | |
| 184 | - android:layout_width="match_parent" | |
| 23 | + android:id="@+id/ll_search" | |
| 24 | + android:layout_width="45dp" | |
| 185 | 25 | 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"> | |
| 26 | + android:layout_marginTop="5dp" | |
| 27 | + android:layout_marginBottom="5dp" | |
| 28 | + android:clickable="true" | |
| 29 | + android:focusable="true" | |
| 30 | + android:gravity="center"> | |
| 197 | 31 | |
| 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" /> | |
| 32 | + <ImageView | |
| 33 | + android:layout_width="wrap_content" | |
| 34 | + android:layout_height="19dp" | |
| 35 | + android:background="@drawable/icon_mian_search" | |
| 36 | + android:clickable="false" | |
| 37 | + android:focusable="false" /> | |
| 38 | + </LinearLayout> | |
| 205 | 39 | |
| 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"> | |
| 40 | + <FrameLayout | |
| 41 | + android:id="@+id/fl_contact" | |
| 42 | + android:layout_width="45dp" | |
| 43 | + android:layout_height="match_parent" | |
| 44 | + android:layout_marginTop="5dp" | |
| 45 | + android:layout_marginBottom="5dp" | |
| 46 | + android:clickable="true" | |
| 47 | + android:focusable="true"> | |
| 48 | + | |
| 49 | + <FrameLayout | |
| 50 | + android:layout_width="wrap_content" | |
| 51 | + android:layout_height="wrap_content" | |
| 52 | + android:layout_gravity="center" | |
| 53 | + android:clickable="false" | |
| 54 | + android:focusable="false"> | |
| 224 | 55 | |
| 225 | 56 | <ImageView |
| 226 | - android:id="@+id/iv_sub" | |
| 227 | - android:layout_width="55dp" | |
| 228 | - android:layout_height="55dp" | |
| 57 | + android:layout_width="18dp" | |
| 58 | + android:layout_height="18dp" | |
| 229 | 59 | android:layout_gravity="center" |
| 230 | - android:background="@drawable/icon_main_subscribe" | |
| 60 | + android:background="@drawable/icon_mian_contact" | |
| 61 | + android:clickable="false" | |
| 231 | 62 | android:focusable="false" /> |
| 232 | 63 | |
| 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"> | |
| 64 | + </FrameLayout> | |
| 65 | + </FrameLayout> | |
| 251 | 66 | |
| 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" /> | |
| 67 | + <LinearLayout | |
| 68 | + android:id="@+id/ll_add" | |
| 69 | + android:layout_width="45dp" | |
| 70 | + android:layout_height="match_parent" | |
| 71 | + android:layout_marginTop="5dp" | |
| 72 | + android:layout_marginRight="5dp" | |
| 73 | + android:layout_marginBottom="5dp" | |
| 74 | + android:clickable="true" | |
| 75 | + android:focusable="true" | |
| 76 | + android:gravity="center"> | |
| 77 | + | |
| 78 | + <ImageView | |
| 79 | + android:id="@+id/iv_add" | |
| 80 | + android:layout_width="18dp" | |
| 81 | + android:layout_height="18dp" | |
| 82 | + android:background="@drawable/icon_mian_add" | |
| 83 | + android:clickable="false" | |
| 84 | + android:focusable="false" /> | |
| 85 | + </LinearLayout> | |
| 86 | + </LinearLayout> | |
| 87 | + <!----> | |
| 88 | + <LinearLayout | |
| 89 | + android:layout_width="match_parent" | |
| 90 | + android:layout_height="wrap_content" | |
| 91 | + android:layout_gravity="bottom" | |
| 92 | + android:orientation="horizontal" | |
| 93 | + android:visibility="gone" | |
| 94 | + app:layout_collapseMode="parallax"> | |
| 95 | + | |
| 96 | + <LinearLayout | |
| 97 | + android:layout_width="0dp" | |
| 98 | + android:layout_height="wrap_content" | |
| 99 | + android:layout_weight="1" | |
| 100 | + android:gravity="center" | |
| 101 | + android:orientation="vertical"> | |
| 102 | + | |
| 103 | + <ImageView | |
| 104 | + android:layout_width="55dp" | |
| 105 | + android:layout_height="55dp" | |
| 106 | + android:layout_gravity="center" | |
| 107 | + android:background="@drawable/icon_mian_life" | |
| 108 | + android:focusable="false" /> | |
| 109 | + | |
| 110 | + <TextView | |
| 111 | + android:layout_width="wrap_content" | |
| 112 | + android:layout_height="wrap_content" | |
| 113 | + android:focusable="false" | |
| 114 | + android:text="生活圈" | |
| 115 | + android:textColor="@color/color_282828" | |
| 116 | + android:textSize="13sp" /> | |
| 117 | + </LinearLayout> | |
| 118 | + | |
| 119 | + <LinearLayout | |
| 120 | + android:layout_width="0dp" | |
| 121 | + android:layout_height="wrap_content" | |
| 122 | + android:layout_weight="1" | |
| 123 | + android:gravity="center" | |
| 124 | + android:orientation="vertical"> | |
| 125 | + | |
| 126 | + <ImageView | |
| 127 | + android:layout_width="55dp" | |
| 128 | + android:layout_height="55dp" | |
| 129 | + android:layout_gravity="center" | |
| 130 | + android:background="@drawable/icon_main_subscribe" | |
| 131 | + android:focusable="false" /> | |
| 132 | + | |
| 133 | + <TextView | |
| 134 | + android:layout_width="wrap_content" | |
| 135 | + android:layout_height="wrap_content" | |
| 136 | + android:focusable="false" | |
| 137 | + android:text="订阅号" | |
| 138 | + android:textColor="@color/color_282828" | |
| 139 | + android:textSize="13sp" /> | |
| 140 | + </LinearLayout> | |
| 141 | + | |
| 142 | + <LinearLayout | |
| 143 | + android:layout_width="0dp" | |
| 144 | + android:layout_height="wrap_content" | |
| 145 | + android:layout_weight="1" | |
| 146 | + android:gravity="center" | |
| 147 | + android:orientation="vertical"> | |
| 148 | + | |
| 149 | + <ImageView | |
| 150 | + android:layout_width="55dp" | |
| 151 | + android:layout_height="55dp" | |
| 152 | + android:layout_gravity="center" | |
| 153 | + android:background="@drawable/icon_main_shop" | |
| 154 | + android:focusable="false" /> | |
| 155 | + | |
| 156 | + <TextView | |
| 157 | + android:layout_width="wrap_content" | |
| 158 | + android:layout_height="wrap_content" | |
| 159 | + android:focusable="false" | |
| 160 | + android:text="优选库" | |
| 161 | + android:textColor="@color/color_282828" | |
| 162 | + android:textSize="13sp" /> | |
| 163 | + </LinearLayout> | |
| 164 | + </LinearLayout> | |
| 165 | + | |
| 166 | + <!-- --> | |
| 167 | + <LinearLayout | |
| 168 | + android:id="@+id/ll_root" | |
| 169 | + android:layout_width="match_parent" | |
| 170 | + android:layout_height="100dp" | |
| 171 | + android:layout_gravity="bottom" | |
| 172 | + android:background="@color/color_F2F2F2" | |
| 173 | + android:orientation="horizontal" | |
| 174 | + app:layout_collapseMode="parallax"> | |
| 175 | + | |
| 176 | + <LinearLayout | |
| 177 | + android:id="@+id/ll_life" | |
| 178 | + android:layout_width="0dp" | |
| 179 | + android:layout_height="match_parent" | |
| 180 | + android:layout_weight="1" | |
| 181 | + android:gravity="center" | |
| 182 | + android:orientation="vertical"> | |
| 183 | + | |
| 184 | + <ImageView | |
| 185 | + android:id="@+id/iv_life" | |
| 186 | + android:layout_width="55dp" | |
| 187 | + android:layout_height="55dp" | |
| 188 | + android:layout_gravity="center" | |
| 189 | + android:background="@drawable/icon_mian_life" | |
| 190 | + android:focusable="false" /> | |
| 191 | + | |
| 192 | + <TextView | |
| 193 | + android:id="@+id/tv_circle" | |
| 194 | + android:layout_width="wrap_content" | |
| 195 | + android:layout_height="wrap_content" | |
| 196 | + android:focusable="false" | |
| 197 | + android:text="生活圈" | |
| 198 | + android:textColor="@color/color_282828" | |
| 199 | + android:textSize="13sp" /> | |
| 200 | + </LinearLayout> | |
| 259 | 201 | |
| 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> | |
| 202 | + <LinearLayout | |
| 203 | + android:id="@+id/ll_sub" | |
| 204 | + android:layout_width="0dp" | |
| 205 | + android:layout_height="match_parent" | |
| 206 | + android:layout_weight="1" | |
| 207 | + android:gravity="center" | |
| 208 | + | |
| 209 | + android:orientation="vertical"> | |
| 210 | + | |
| 211 | + <ImageView | |
| 212 | + android:id="@+id/iv_sub" | |
| 213 | + android:layout_width="55dp" | |
| 214 | + android:layout_height="55dp" | |
| 215 | + android:layout_gravity="center" | |
| 216 | + android:background="@drawable/icon_main_subscribe" | |
| 217 | + android:focusable="false" /> | |
| 218 | + | |
| 219 | + <TextView | |
| 220 | + android:id="@+id/tv_sub" | |
| 221 | + android:layout_width="wrap_content" | |
| 222 | + android:layout_height="wrap_content" | |
| 223 | + android:focusable="false" | |
| 224 | + android:text="订阅号" | |
| 225 | + android:textColor="@color/color_282828" | |
| 226 | + android:textSize="13sp" /> | |
| 227 | + </LinearLayout> | |
| 228 | + | |
| 229 | + <LinearLayout | |
| 230 | + android:id="@+id/ll_shop" | |
| 231 | + android:layout_width="0dp" | |
| 232 | + android:layout_height="match_parent" | |
| 233 | + android:layout_weight="1" | |
| 234 | + android:gravity="center" | |
| 235 | + | |
| 236 | + android:orientation="vertical"> | |
| 237 | + | |
| 238 | + <ImageView | |
| 239 | + android:id="@+id/iv_shop" | |
| 240 | + android:layout_width="55dp" | |
| 241 | + android:layout_height="55dp" | |
| 242 | + android:layout_gravity="center" | |
| 243 | + android:background="@drawable/icon_main_shop" | |
| 244 | + android:focusable="false" /> | |
| 245 | + | |
| 246 | + <TextView | |
| 247 | + android:id="@+id/tv_shop" | |
| 248 | + android:layout_width="wrap_content" | |
| 249 | + android:layout_height="wrap_content" | |
| 250 | + android:focusable="false" | |
| 251 | + android:text="优选库" | |
| 252 | + android:textColor="@color/color_282828" | |
| 253 | + android:textSize="13sp" /> | |
| 269 | 254 | </LinearLayout> |
| 270 | - <!-- --> | |
| 271 | - </android.support.design.widget.AppBarLayout> | |
| 255 | + </LinearLayout> | |
| 256 | + <!-- --> | |
| 272 | 257 | |
| 273 | 258 | <android.support.v4.widget.NestedScrollView |
| 259 | + android:id="@+id/scrollView" | |
| 274 | 260 | android:layout_width="match_parent" |
| 275 | 261 | android:layout_height="match_parent" |
| 276 | 262 | app:layout_behavior="@string/appbar_scrolling_view_behavior"> |
| ... | ... | @@ -365,5 +351,5 @@ |
| 365 | 351 | android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> |
| 366 | 352 | </LinearLayout> |
| 367 | 353 | </android.support.v4.widget.NestedScrollView> |
| 368 | - </android.support.design.widget.CoordinatorLayout> | |
| 354 | + </LinearLayout> | |
| 369 | 355 | </layout> |
| 370 | 356 | \ No newline at end of file | ... | ... |
app/src/main/res/layout/activity_tool_bar_test1.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | <layout> |
| 3 | 3 | |
| 4 | - <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 4 | + <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| 5 | 5 | xmlns:app="http://schemas.android.com/apk/res-auto" |
| 6 | 6 | xmlns:tools="http://schemas.android.com/tools" |
| 7 | 7 | android:layout_width="match_parent" |
| ... | ... | @@ -10,99 +10,187 @@ |
| 10 | 10 | tools:context="com.cnlive.strike.xiaojiaspeaker.ToolBarTestActivity" |
| 11 | 11 | tools:ignore="MissingDefaultResource"> |
| 12 | 12 | |
| 13 | - <LinearLayout | |
| 13 | + <android.support.design.widget.AppBarLayout | |
| 14 | + android:id="@+id/appbar" | |
| 14 | 15 | android:layout_width="match_parent" |
| 15 | - android:layout_height="wrap_content" | |
| 16 | - android:background="@color/colorPrimary" | |
| 17 | - android:orientation="vertical"> | |
| 16 | + android:layout_height="150dp" | |
| 17 | + android:background="@drawable/mian_bg" | |
| 18 | + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> | |
| 19 | + | |
| 18 | 20 | <!----> |
| 19 | - <LinearLayout | |
| 20 | - android:id="@+id/ll_menu" | |
| 21 | + <android.support.design.widget.CollapsingToolbarLayout | |
| 22 | + android:id="@+id/ctb" | |
| 21 | 23 | android:layout_width="match_parent" |
| 22 | - android:layout_height="40dp" | |
| 23 | - android:gravity="center|right" | |
| 24 | - app:layout_collapseMode="pin"> | |
| 24 | + android:layout_height="wrap_content" | |
| 25 | + android:fitsSystemWindows="true" | |
| 25 | 26 | |
| 27 | + app:layout_scrollFlags="scroll|exitUntilCollapsed"> | |
| 28 | + <!----> | |
| 26 | 29 | <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"> | |
| 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"> | |
| 35 | 45 | |
| 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"> | |
| 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> | |
| 52 | 53 | |
| 53 | 54 | <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"> | |
| 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"> | |
| 59 | 91 | |
| 60 | 92 | <ImageView |
| 93 | + android:id="@+id/iv_add" | |
| 61 | 94 | android:layout_width="18dp" |
| 62 | 95 | android:layout_height="18dp" |
| 63 | - android:layout_gravity="center" | |
| 64 | - android:background="@drawable/icon_mian_contact" | |
| 96 | + android:background="@drawable/icon_mian_add" | |
| 65 | 97 | android:clickable="false" |
| 66 | 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"> | |
| 67 | 109 | |
| 68 | - </FrameLayout> | |
| 69 | - </FrameLayout> | |
| 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"> | |
| 70 | 116 | |
| 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"> | |
| 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" /> | |
| 81 | 123 | |
| 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" /> | |
| 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> | |
| 89 | 178 | </LinearLayout> |
| 90 | - </LinearLayout> | |
| 179 | + | |
| 180 | + </android.support.design.widget.CollapsingToolbarLayout> | |
| 91 | 181 | <!-- --> |
| 92 | 182 | <LinearLayout |
| 93 | 183 | android:id="@+id/ll_root" |
| 94 | 184 | android:layout_width="match_parent" |
| 95 | - android:layout_height="wrap_content" | |
| 96 | - android:layout_margin="10dp" | |
| 97 | - android:gravity="bottom" | |
| 98 | - android:minHeight="100dp" | |
| 185 | + android:layout_height="match_parent" | |
| 186 | + android:layout_gravity="bottom" | |
| 99 | 187 | android:orientation="horizontal" |
| 100 | 188 | app:layout_collapseMode="parallax"> |
| 101 | 189 | |
| 102 | 190 | <LinearLayout |
| 103 | 191 | android:id="@+id/ll_life" |
| 104 | 192 | android:layout_width="0dp" |
| 105 | - android:layout_height="wrap_content" | |
| 193 | + android:layout_height="match_parent" | |
| 106 | 194 | android:layout_weight="1" |
| 107 | 195 | android:gravity="center" |
| 108 | 196 | android:orientation="vertical"> |
| ... | ... | @@ -128,7 +216,7 @@ |
| 128 | 216 | <LinearLayout |
| 129 | 217 | android:id="@+id/ll_sub" |
| 130 | 218 | android:layout_width="0dp" |
| 131 | - android:layout_height="wrap_content" | |
| 219 | + android:layout_height="match_parent" | |
| 132 | 220 | android:layout_weight="1" |
| 133 | 221 | android:gravity="center" |
| 134 | 222 | |
| ... | ... | @@ -155,7 +243,7 @@ |
| 155 | 243 | <LinearLayout |
| 156 | 244 | android:id="@+id/ll_shop" |
| 157 | 245 | android:layout_width="0dp" |
| 158 | - android:layout_height="wrap_content" | |
| 246 | + android:layout_height="match_parent" | |
| 159 | 247 | android:layout_weight="1" |
| 160 | 248 | android:gravity="center" |
| 161 | 249 | |
| ... | ... | @@ -180,12 +268,9 @@ |
| 180 | 268 | </LinearLayout> |
| 181 | 269 | </LinearLayout> |
| 182 | 270 | <!-- --> |
| 183 | - </LinearLayout> | |
| 184 | - | |
| 185 | - <!-- --> | |
| 271 | + </android.support.design.widget.AppBarLayout> | |
| 186 | 272 | |
| 187 | 273 | <android.support.v4.widget.NestedScrollView |
| 188 | - android:id="@+id/scroll" | |
| 189 | 274 | android:layout_width="match_parent" |
| 190 | 275 | android:layout_height="match_parent" |
| 191 | 276 | app:layout_behavior="@string/appbar_scrolling_view_behavior"> |
| ... | ... | @@ -280,5 +365,5 @@ |
| 280 | 365 | android:text="sajgfdkl;sdkgl;'sdjhgf;losdkmjgl;" /> |
| 281 | 366 | </LinearLayout> |
| 282 | 367 | </android.support.v4.widget.NestedScrollView> |
| 283 | - </LinearLayout> | |
| 368 | + </android.support.design.widget.CoordinatorLayout> | |
| 284 | 369 | </layout> |
| 285 | 370 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/AndroidManifest.xml
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 | <activity android:name=".ui.activity.SearchDeviceActivity" /> |
| 39 | 39 | <activity android:name=".ui.activity.SpeakerMainActivity" /> |
| 40 | 40 | <activity android:name=".ui.activity.BluetoothConnActivity" /> |
| 41 | + <activity android:name=".ui.activity.ChangeWifiActivity"/> | |
| 41 | 42 | </application> |
| 42 | 43 | |
| 43 | 44 | </manifest> |
| 44 | 45 | \ No newline at end of file | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/AllDeviceFragmentPresenter.java
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/ChangeWifiFragmentPresenter.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.frame.presenter; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.util.Log; | |
| 5 | + | |
| 6 | +import com.cnlive.libs.base.logic.Logic; | |
| 7 | +import com.cnlive.libs.base.logic.callback.DataCallback; | |
| 8 | +import com.cnlive.libs.base.logic.callback.FailureCallback; | |
| 9 | +import com.cnlive.libs.base.logic.callback.SuccessCallback; | |
| 10 | +import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeWifiFragmentView; | |
| 11 | +import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; | |
| 12 | +import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; | |
| 13 | +import com.cnlive.strike.xiaojiaspeaker.netWork.ApiServiceXiaoJia; | |
| 14 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.APIBaseInfo; | |
| 15 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | |
| 16 | +import com.cnlive.strike.xiaojiaspeaker.netWork.result.SubscriptionRequest; | |
| 17 | +import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; | |
| 18 | +import com.hannesdorfmann.mosby3.mvp.MvpBasePresenter; | |
| 19 | + | |
| 20 | +import org.greenrobot.eventbus.EventBus; | |
| 21 | + | |
| 22 | +import java.util.HashMap; | |
| 23 | +import java.util.Map; | |
| 24 | + | |
| 25 | +import io.reactivex.disposables.Disposable; | |
| 26 | + | |
| 27 | +public class ChangeWifiFragmentPresenter extends MvpBasePresenter<ChangeWifiFragmentView> { | |
| 28 | + private String TAG = "ChangeWifiFragmentPresenter"; | |
| 29 | + | |
| 30 | + | |
| 31 | + public void changeWifi(Activity context, String devId, String wifiName, String wifiPasswd, String wifiMac, OnResponseListener onResponseListener) { | |
| 32 | + if (null == getView()) { | |
| 33 | + return; | |
| 34 | + } | |
| 35 | + QMUITipDialogUtil.loadingDialog(context, "请稍后...", false); | |
| 36 | + Map<String, String> map = new HashMap<>(); | |
| 37 | + map.put("devId", devId); | |
| 38 | + map.put("name", wifiName); | |
| 39 | + map.put("passwd", wifiPasswd); | |
| 40 | + map.put("mac", wifiMac); | |
| 41 | + Logic.create(map) | |
| 42 | + .action(new Logic.Action<Map<String, String>, APIBaseInfo>() { | |
| 43 | + @Override | |
| 44 | + public Disposable action(Map<String, String> paramsMap, DataCallback<APIBaseInfo> dataCallback) { | |
| 45 | + return SubscriptionRequest.service(ApiServiceXiaoJia.class, api -> api.changeWiFi(paramsMap)).subscribe(context, dataCallback); | |
| 46 | + } | |
| 47 | + }).<APIBaseInfo>event() | |
| 48 | + .setSuccessCallback(new SuccessCallback<APIBaseInfo>() { | |
| 49 | + @Override | |
| 50 | + public void onSuccess(APIBaseInfo baseInfo) { | |
| 51 | + if (null == getView()) { | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + QMUITipDialogUtil.dismessDialog(); | |
| 55 | + QMUITipDialogUtil.successDialog(context, baseInfo.getMessage(), 1); | |
| 56 | + Log.e(TAG, "onSuccess: " + baseInfo.getMessage()); | |
| 57 | + if (null != onResponseListener) { | |
| 58 | + onResponseListener.onSuccess(); | |
| 59 | + } | |
| 60 | + } | |
| 61 | + }) | |
| 62 | + .setFailureCallback(new FailureCallback() { | |
| 63 | + @Override | |
| 64 | + public void onFailure(int i, String s) { | |
| 65 | + //显示重试 | |
| 66 | + Log.e(TAG, "onFailure: " + s); | |
| 67 | + if (null == getView()) { | |
| 68 | + return; | |
| 69 | + } | |
| 70 | + QMUITipDialogUtil.dismessDialog(); | |
| 71 | + QMUITipDialogUtil.failedDialog(context, s, 1); | |
| 72 | + } | |
| 73 | + }) | |
| 74 | + | |
| 75 | + .start(); | |
| 76 | + } | |
| 77 | + | |
| 78 | + | |
| 79 | + public interface OnResponseListener { | |
| 80 | + void onSuccess(); | |
| 81 | + } | |
| 82 | +} | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/presenter/DeviceManagerFragmentPresenter.java
| ... | ... | @@ -31,6 +31,7 @@ public class DeviceManagerFragmentPresenter extends MvpBasePresenter<DeviceManag |
| 31 | 31 | QMUITipDialogUtil.loadingDialog(context, "请稍后", false); |
| 32 | 32 | Map<String, String> map = new HashMap<>(); |
| 33 | 33 | map.put("devId", deviceId); |
| 34 | + | |
| 34 | 35 | Logic.create(map) |
| 35 | 36 | .action(new Logic.Action<Map<String, String>, APIBaseInfo>() { |
| 36 | 37 | @Override | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/AllDeviceFragmentView.java
| ... | ... | @@ -83,7 +83,7 @@ public class AllDeviceFragmentView implements MvpView { |
| 83 | 83 | adapter.setOnItemClickListener(new AllDeviceAdapter.OnItemClickListener() { |
| 84 | 84 | @Override |
| 85 | 85 | public void onItemClick(int position, FamilyListBean.UsersBeanX.DeviceListBean AllDeviceInfo) { |
| 86 | - DeviceDetailActivity.startActivity(fragment.getActivity(), AllDeviceInfo, familyListBean.getUsers().get(AllDeviceInfo.getParentPosition()).getId()); | |
| 86 | + DeviceDetailActivity.startActivity(fragment.getActivity(), AllDeviceInfo, familyListBean.getUsers().get(AllDeviceInfo.getParentPosition())); | |
| 87 | 87 | } |
| 88 | 88 | }); |
| 89 | 89 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/ChangeWifiFragmentView.java
0 → 100644
| 1 | +package com.cnlive.strike.xiaojiaspeaker.frame.view; | |
| 2 | + | |
| 3 | +import android.app.Activity; | |
| 4 | +import android.bluetooth.BluetoothGatt; | |
| 5 | +import android.graphics.Typeface; | |
| 6 | +import android.net.wifi.ScanResult; | |
| 7 | +import android.os.Handler; | |
| 8 | +import android.support.v4.content.ContextCompat; | |
| 9 | +import android.support.v7.widget.LinearLayoutManager; | |
| 10 | +import android.text.TextUtils; | |
| 11 | +import android.util.Log; | |
| 12 | +import android.view.View; | |
| 13 | + | |
| 14 | +import com.clj.fastble.BleManager; | |
| 15 | +import com.clj.fastble.callback.BleGattCallback; | |
| 16 | +import com.clj.fastble.callback.BleNotifyCallback; | |
| 17 | +import com.clj.fastble.callback.BleWriteCallback; | |
| 18 | +import com.clj.fastble.data.BleDevice; | |
| 19 | +import com.clj.fastble.exception.BleException; | |
| 20 | +import com.cnlive.libs.base.util.AlertUtil; | |
| 21 | +import com.cnlive.strike.xiaojiaspeaker.R; | |
| 22 | +import com.cnlive.strike.xiaojiaspeaker.commonInfo.XiaoJIaCommInfo; | |
| 23 | +import com.cnlive.strike.xiaojiaspeaker.constants.BlufiConstants; | |
| 24 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.ChangeWifiFragmentPresenter; | |
| 25 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectWifiFragmentPresenter; | |
| 26 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; | |
| 27 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.NetworkResultBean; | |
| 28 | +import com.cnlive.strike.xiaojiaspeaker.ui.activity.ConnBluetoothSuccessActivity; | |
| 29 | +import com.cnlive.strike.xiaojiaspeaker.ui.adapter.WifiRecycleAdapter; | |
| 30 | +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.ChangeWifiFragment; | |
| 31 | +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; | |
| 32 | +import com.cnlive.strike.xiaojiaspeaker.ui.widget.TipDialog; | |
| 33 | +import com.cnlive.strike.xiaojiaspeaker.ui.widget.WifiPwdDialog; | |
| 34 | +import com.cnlive.strike.xiaojiaspeaker.util.BlueToothUtil; | |
| 35 | +import com.cnlive.strike.xiaojiaspeaker.util.QMUITipDialogUtil; | |
| 36 | +import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; | |
| 37 | +import com.hannesdorfmann.mosby3.mvp.MvpView; | |
| 38 | + | |
| 39 | +import java.io.UnsupportedEncodingException; | |
| 40 | +import java.util.ArrayList; | |
| 41 | +import java.util.List; | |
| 42 | + | |
| 43 | +public class ChangeWifiFragmentView implements MvpView { | |
| 44 | + private ChangeWifiFragment fragment; | |
| 45 | + private WifiRecycleAdapter adapter; | |
| 46 | + private List<ScanResult> results = new ArrayList<>(); | |
| 47 | + private WifiUtils wifiUtils; | |
| 48 | + private String TAG = "ChangeWifiFragmentView"; | |
| 49 | + private WifiPwdDialog wifiPwdDialog; | |
| 50 | + private TipDialog errorDialog; | |
| 51 | + private String SSID; | |
| 52 | + private String BSSID; | |
| 53 | + private FamilyListBean.UsersBeanX currentUser; | |
| 54 | + private String sn; | |
| 55 | + | |
| 56 | + public ChangeWifiFragmentView(ChangeWifiFragment fragment) { | |
| 57 | + this.fragment = fragment; | |
| 58 | + wifiUtils = new WifiUtils(fragment.getActivity()); | |
| 59 | + } | |
| 60 | + | |
| 61 | + public Activity getContext() { | |
| 62 | + return fragment == null ? null : fragment.getActivity(); | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void initWifiList(String sn, FamilyListBean.UsersBeanX currentUser) { | |
| 66 | + this.currentUser = currentUser; | |
| 67 | + this.sn = sn; | |
| 68 | + showLoading(); | |
| 69 | + initWifiPwdDialog(); | |
| 70 | + initErrorDialog(); | |
| 71 | + if (null == adapter) { | |
| 72 | + adapter = new WifiRecycleAdapter(getContext(), results); | |
| 73 | + fragment.binding.rvWifi.setLayoutManager(new LinearLayoutManager(getContext())); | |
| 74 | + fragment.binding.rvWifi.setAdapter(adapter); | |
| 75 | + } | |
| 76 | + adapter.setOnItemClickListener(new WifiRecycleAdapter.onItemClickListener() { | |
| 77 | + @Override | |
| 78 | + public void onItemClick(int position, ScanResult scanResult) { | |
| 79 | + String encryptionType = scanResult.capabilities; | |
| 80 | + SSID = scanResult.SSID; | |
| 81 | + BSSID = scanResult.BSSID; | |
| 82 | + if (TextUtils.isEmpty(currentUser.getUserId()) || TextUtils.isEmpty(currentUser.getId())) { | |
| 83 | + AlertUtil.showDeftToast(getContext(), "参数异常,请稍后重试!"); | |
| 84 | + return; | |
| 85 | + } | |
| 86 | + //判断是否需要输入密码 | |
| 87 | + if (!encryptionType.contains("WEP") && !encryptionType.contains("PSK") && !encryptionType.contains("EAP")) { | |
| 88 | + Log.e(TAG, "onItemClick: 不需要密码"); | |
| 89 | + if (!TextUtils.isEmpty(scanResult.SSID) && !TextUtils.isEmpty(scanResult.BSSID)) { | |
| 90 | + changeWifi(sn, scanResult.SSID, "", scanResult.BSSID); | |
| 91 | + } | |
| 92 | + | |
| 93 | + } else { | |
| 94 | + //需要密码 | |
| 95 | + if (!wifiPwdDialog.isShowing()) { | |
| 96 | + wifiPwdDialog.setMsgTip(scanResult.SSID); | |
| 97 | + wifiPwdDialog.show(); | |
| 98 | + } | |
| 99 | + } | |
| 100 | + } | |
| 101 | + }); | |
| 102 | + wifiUtils.startScanWifi(); | |
| 103 | + } | |
| 104 | + | |
| 105 | + private void initErrorDialog() { | |
| 106 | + errorDialog = new TipDialog(getContext(), "", "关闭", R.color.btn_green, new TipDialog.DialogInterface() { | |
| 107 | + @Override | |
| 108 | + public void onClick(TipDialog dialog) { | |
| 109 | + dialog.dismiss(); | |
| 110 | + } | |
| 111 | + }); | |
| 112 | + errorDialog.setTipTextStyle(Typeface.DEFAULT); | |
| 113 | + errorDialog.setTipTextSize(16); | |
| 114 | + errorDialog.setCancelable(false); | |
| 115 | + errorDialog.setCanceledOnTouchOutside(false); | |
| 116 | + } | |
| 117 | + | |
| 118 | + private void initRefreshLayout() { | |
| 119 | +// fragment.binding.refreshLayout.setEnableLoadMore(false); | |
| 120 | +// fragment.binding.refreshLayout.setOnRefreshListener(new OnRefreshListener() { | |
| 121 | +// @Override | |
| 122 | +// public void onRefresh(@NonNull RefreshLayout refreshLayout) { | |
| 123 | +// showLoading(); | |
| 124 | +// wifiUtils.startScanWifi(); | |
| 125 | +// } | |
| 126 | +// }); | |
| 127 | + } | |
| 128 | + | |
| 129 | + public void changeWifi(String sn, String wifiName, String wifiPwd, String wifiMac) { | |
| 130 | + if (null == getContext()) { | |
| 131 | + return; | |
| 132 | + } | |
| 133 | + fragment.getPresenter().changeWifi(getContext(), sn, wifiName, wifiPwd, wifiMac, new ChangeWifiFragmentPresenter.OnResponseListener() { | |
| 134 | + @Override | |
| 135 | + public void onSuccess() { | |
| 136 | + | |
| 137 | + } | |
| 138 | + }); | |
| 139 | + } | |
| 140 | + | |
| 141 | + private void initWifiPwdDialog() { | |
| 142 | + wifiPwdDialog = new WifiPwdDialog(getContext(), "", "取消", new WifiPwdDialog.DialogInterface() { | |
| 143 | + @Override | |
| 144 | + public void onClick(WifiPwdDialog dialog) { | |
| 145 | + dialog.dismiss(); | |
| 146 | + } | |
| 147 | + }, "确定", new WifiPwdDialog.ConnDialogInterface() { | |
| 148 | + @Override | |
| 149 | + public void onClick(WifiPwdDialog dialog, String pwd) { | |
| 150 | + if (!TextUtils.isEmpty(pwd) && !TextUtils.isEmpty(SSID)) { | |
| 151 | + dialog.dismiss(); | |
| 152 | + if (!TextUtils.isEmpty(SSID) && !TextUtils.isEmpty(BSSID)) { | |
| 153 | + changeWifi(sn, SSID, pwd, BSSID); | |
| 154 | + } | |
| 155 | + } else { | |
| 156 | + AlertUtil.showDeftToast(getContext(), "密码不能为空"); | |
| 157 | + } | |
| 158 | + } | |
| 159 | + }); | |
| 160 | + wifiPwdDialog.setLeftBtnColor(R.color.color_999999); | |
| 161 | + wifiPwdDialog.setRightBtnColor(R.color.btn_green); | |
| 162 | + wifiPwdDialog.setCancelable(false); | |
| 163 | + wifiPwdDialog.setCanceledOnTouchOutside(false); | |
| 164 | + } | |
| 165 | + | |
| 166 | + public void updateWifiList() { | |
| 167 | + hideLoading(); | |
| 168 | + List<ScanResult> scanResults = wifiUtils.getScanResults(); | |
| 169 | + if (null != scanResults && null != results) { | |
| 170 | + results.clear(); | |
| 171 | + results.addAll(scanResults); | |
| 172 | + if (null != adapter) { | |
| 173 | + adapter.notifyDataSetChanged(); | |
| 174 | + } | |
| 175 | + } | |
| 176 | + } | |
| 177 | + | |
| 178 | + public void showLoading() { | |
| 179 | + if (null == getContext()) { | |
| 180 | + return; | |
| 181 | + } | |
| 182 | + fragment.binding.avLoading.show(); | |
| 183 | + fragment.binding.llLoading.setVisibility(View.VISIBLE); | |
| 184 | + //设置按钮不可点击 | |
| 185 | + fragment.binding.btnNext.setClickable(false); | |
| 186 | + fragment.binding.btnNext.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.shape_btn_press)); | |
| 187 | + | |
| 188 | + } | |
| 189 | + | |
| 190 | + public void hideLoading() { | |
| 191 | + if (null == getContext()) { | |
| 192 | + return; | |
| 193 | + } | |
| 194 | +// fragment.binding.refreshLayout.finishRefresh(); | |
| 195 | + fragment.binding.avLoading.hide(); | |
| 196 | + fragment.binding.llLoading.setVisibility(View.GONE); | |
| 197 | + //设置按钮可点击 | |
| 198 | + fragment.binding.btnNext.setClickable(true); | |
| 199 | + fragment.binding.btnNext.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.selector_btn_green)); | |
| 200 | + } | |
| 201 | + | |
| 202 | + | |
| 203 | +// private void queryDeviceConfigNet(Activity activity, String fromId) { | |
| 204 | +// ConfigDeviceNetParam param = new ConfigDeviceNetParam(); | |
| 205 | +// param.setAction("mc/getWifiResult"); | |
| 206 | +// ConfigDeviceNetParam.DataBean dataBean = new ConfigDeviceNetParam.DataBean(); | |
| 207 | +// dataBean.setFrom("he:28850150e8bd4c830314819939361b77"); | |
| 208 | +// dataBean.setMyid("he:28850150e8bd4c830314819939361b77"); | |
| 209 | +// dataBean.setToken("6fdff0f39ec659c94dd12cdc32937e9d"); | |
| 210 | +// param.setData(dataBean); | |
| 211 | +// fragment.getPresenter().queryConfigDeviceNetResult(activity, param); | |
| 212 | +// } | |
| 213 | +} | |
| 214 | + | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/DeviceDetailView.java
| ... | ... | @@ -15,7 +15,7 @@ import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 15 | 15 | public class DeviceDetailView implements MvpView { |
| 16 | 16 | private DeviceDetailFragment fragment; |
| 17 | 17 | private FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo; |
| 18 | - private String currentSelectFamilyId; | |
| 18 | + private FamilyListBean.UsersBeanX currentUser; | |
| 19 | 19 | |
| 20 | 20 | public DeviceDetailView(DeviceDetailFragment fragment) { |
| 21 | 21 | this.fragment = fragment; |
| ... | ... | @@ -25,15 +25,15 @@ public class DeviceDetailView implements MvpView { |
| 25 | 25 | return fragment == null ? null : fragment.getActivity(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public void initView(FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, String currentSelectFamilyId) { | |
| 29 | - this.currentSelectFamilyId = currentSelectFamilyId; | |
| 28 | + public void initView(FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, FamilyListBean.UsersBeanX currentUser) { | |
| 29 | + this.currentUser = currentUser; | |
| 30 | 30 | this.allDeviceInfo = allDeviceInfo; |
| 31 | 31 | //使用者管理 |
| 32 | 32 | fragment.binding.rlUserManager.setOnClickListener(new View.OnClickListener() { |
| 33 | 33 | @Override |
| 34 | 34 | public void onClick(View view) { |
| 35 | - if (!TextUtils.isEmpty(currentSelectFamilyId)) { | |
| 36 | - UserManagerActivity.StartActivity(getContext(), currentSelectFamilyId); | |
| 35 | + if (null!=currentUser&&!TextUtils.isEmpty(currentUser.getId())) { | |
| 36 | + UserManagerActivity.StartActivity(getContext(), currentUser.getId()); | |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | }); |
| ... | ... | @@ -41,7 +41,7 @@ public class DeviceDetailView implements MvpView { |
| 41 | 41 | fragment.binding.rlDeviceManager.setOnClickListener(new View.OnClickListener() { |
| 42 | 42 | @Override |
| 43 | 43 | public void onClick(View view) { |
| 44 | - DeviceManagerActivity.startActivity(getContext(), allDeviceInfo); | |
| 44 | + DeviceManagerActivity.startActivity(getContext(), currentUser,allDeviceInfo); | |
| 45 | 45 | } |
| 46 | 46 | }); |
| 47 | 47 | //设备说明 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/frame/view/DeviceManagerFragmentView.java
| 1 | 1 | package com.cnlive.strike.xiaojiaspeaker.frame.view; |
| 2 | 2 | |
| 3 | +import android.Manifest; | |
| 3 | 4 | import android.app.Activity; |
| 5 | +import android.content.Intent; | |
| 6 | +import android.content.pm.PackageManager; | |
| 4 | 7 | import android.graphics.Typeface; |
| 8 | +import android.net.Uri; | |
| 9 | +import android.provider.Settings; | |
| 10 | +import android.support.annotation.NonNull; | |
| 11 | +import android.support.v4.app.ActivityCompat; | |
| 5 | 12 | import android.support.v7.widget.DefaultItemAnimator; |
| 6 | 13 | import android.support.v7.widget.LinearLayoutManager; |
| 7 | 14 | import android.text.TextUtils; |
| 15 | +import android.util.Log; | |
| 8 | 16 | import android.view.View; |
| 9 | 17 | |
| 18 | +import com.clj.fastble.BleManager; | |
| 10 | 19 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 11 | 20 | import com.cnlive.strike.xiaojiaspeaker.model.DeviceManagerMenu; |
| 12 | 21 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.DeviceDetail; |
| 13 | 22 | import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; |
| 23 | +import com.cnlive.strike.xiaojiaspeaker.ui.activity.BlueToothStep2Activity; | |
| 14 | 24 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.ChangeDeviceNameActivity; |
| 25 | +import com.cnlive.strike.xiaojiaspeaker.ui.activity.ChangeWifiActivity; | |
| 15 | 26 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceInfoActivity; |
| 16 | 27 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.DeviceManagerActivity; |
| 17 | 28 | import com.cnlive.strike.xiaojiaspeaker.ui.activity.FirmwareUpdateActivity; |
| 29 | +import com.cnlive.strike.xiaojiaspeaker.ui.activity.SearchDeviceActivity; | |
| 18 | 30 | import com.cnlive.strike.xiaojiaspeaker.ui.adapter.DeviceManagerMenuAdapter; |
| 19 | 31 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.DeviceManagerFragment; |
| 20 | 32 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; |
| 33 | +import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsListener; | |
| 34 | +import com.cnlive.strike.xiaojiaspeaker.util.lib_permisshelper.PermissionsUtils; | |
| 35 | +import com.cnlive.strike.xiaojiaspeaker.util.utilcode.CheckUtil; | |
| 21 | 36 | import com.hannesdorfmann.mosby3.mvp.MvpView; |
| 22 | 37 | |
| 23 | 38 | import java.util.ArrayList; |
| ... | ... | @@ -29,17 +44,25 @@ public class DeviceManagerFragmentView implements MvpView { |
| 29 | 44 | // private List<DeviceManagerMenu> deviceManagerMenuList; |
| 30 | 45 | private DeviceDetail deviceDetail; |
| 31 | 46 | private FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo; |
| 47 | + private FamilyListBean.UsersBeanX currentUser; | |
| 48 | + private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 | |
| 49 | + private int permissionRequestCount = 0;//权限请求次数 | |
| 50 | + private boolean isClickNextBtn = false; | |
| 51 | + private SelectDialog selectDialog; | |
| 52 | + private String TAG = "DeviceManagerFragmentView"; | |
| 32 | 53 | |
| 33 | 54 | public DeviceManagerFragmentView(DeviceManagerFragment fragment) { |
| 34 | 55 | this.fragment = fragment; |
| 56 | + initPermissionDefineTip(); | |
| 35 | 57 | } |
| 36 | 58 | |
| 37 | 59 | public Activity getContext() { |
| 38 | 60 | return fragment == null ? null : fragment.getActivity(); |
| 39 | 61 | } |
| 40 | 62 | |
| 41 | - public void initView(FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo) { | |
| 63 | + public void initView(FamilyListBean.UsersBeanX currentUser, FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo) { | |
| 42 | 64 | this.currentDeviceInfo = currentDeviceInfo; |
| 65 | + this.currentUser = currentUser; | |
| 43 | 66 | // deviceManagerMenuList = new ArrayList<>(); |
| 44 | 67 | // deviceManagerMenuList.add(new DeviceManagerMenu("音箱名称", "as", DeviceManagerMenu.NO_RIGHT_ARROW)); |
| 45 | 68 | // deviceManagerMenuList.add(new DeviceManagerMenu("WIFI设置", "asd", DeviceManagerMenu.NORMAL)); |
| ... | ... | @@ -65,6 +88,14 @@ public class DeviceManagerFragmentView implements MvpView { |
| 65 | 88 | fragment.binding.llWifiSetting.setOnClickListener(new View.OnClickListener() { |
| 66 | 89 | @Override |
| 67 | 90 | public void onClick(View view) { |
| 91 | + //判断GPS是否打开 | |
| 92 | + boolean isOpenGPS = CheckUtil.isOPenGps(getContext()); | |
| 93 | + if (!isOpenGPS) { | |
| 94 | + CheckUtil.openGPS(getContext()); | |
| 95 | + } else { | |
| 96 | + //判断蓝牙是否打开 | |
| 97 | + getPermissionsWithTip(); | |
| 98 | + } | |
| 68 | 99 | |
| 69 | 100 | } |
| 70 | 101 | }); |
| ... | ... | @@ -171,4 +202,106 @@ public class DeviceManagerFragmentView implements MvpView { |
| 171 | 202 | } |
| 172 | 203 | fragment.binding.emptyLayout.show(false, titleText, detailText, getContext().getString(R.string.retry), R.drawable.wufalianjie, listener); |
| 173 | 204 | } |
| 205 | + | |
| 206 | + | |
| 207 | + /** | |
| 208 | + * 一次申请一组权限(使用拒绝弹框)点击事件 | |
| 209 | + */ | |
| 210 | + public void getPermissionsWithTip() { | |
| 211 | + if (1 == permissionRequestCount) { | |
| 212 | + return; | |
| 213 | + } | |
| 214 | + mPermissionsUtils | |
| 215 | + .setPermissionsListener(new PermissionsListener() { | |
| 216 | + @Override | |
| 217 | + public void onDenied(String[] deniedPermissions) { | |
| 218 | +// getPermissionsWithTip(); | |
| 219 | + } | |
| 220 | + | |
| 221 | + @Override | |
| 222 | + public void onGranted() { | |
| 223 | + isClickNextBtn = true; | |
| 224 | + ChangeWifiActivity.StartActivity(getContext(), deviceDetail.getSN(), currentUser); | |
| 225 | + | |
| 226 | + } | |
| 227 | + }) | |
| 228 | + .withActivity(getContext()) | |
| 229 | + .getPermissions(getContext() | |
| 230 | + , 100 | |
| 231 | + , Manifest.permission.INTERNET | |
| 232 | + , Manifest.permission.ACCESS_FINE_LOCATION | |
| 233 | + , Manifest.permission.ACCESS_COARSE_LOCATION | |
| 234 | + ); | |
| 235 | +// .getPermissionsWithTips(MainActivity.this | |
| 236 | +// ,100 | |
| 237 | +// , new String[]{"人家要录音","我们需要读取你的信息,磨磨唧唧的","我要上网","我要读内存卡","我要看日历","我要定位"} | |
| 238 | +// , Manifest.permission.RECORD_AUDIO | |
| 239 | +// , Manifest.permission.READ_SMS | |
| 240 | +// , Manifest.permission.INTERNET | |
| 241 | +// , Manifest.permission.READ_EXTERNAL_STORAGE | |
| 242 | +// , Manifest.permission.READ_CALENDAR | |
| 243 | +// , Manifest.permission.ACCESS_FINE_LOCATION); | |
| 244 | + } | |
| 245 | + | |
| 246 | + | |
| 247 | + private void initPermissionDefineTip() { | |
| 248 | + selectDialog = new SelectDialog(getContext(), "您尚未授予程序运行所需权限\n是否设置?", | |
| 249 | + "取消", new SelectDialog.DialogInterface() { | |
| 250 | + @Override | |
| 251 | + public void onClick(SelectDialog dialog) { | |
| 252 | + dialog.dismiss(); | |
| 253 | + permissionRequestCount = 0; | |
| 254 | + } | |
| 255 | + }, "设置", new SelectDialog.DialogInterface() { | |
| 256 | + @Override | |
| 257 | + public void onClick(SelectDialog dialog) { | |
| 258 | + dialog.dismiss(); | |
| 259 | + Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); | |
| 260 | + Uri uri = Uri.fromParts("package", getContext().getPackageName(), null); | |
| 261 | + intent.setData(uri); | |
| 262 | + getContext().startActivityForResult(intent, 0); | |
| 263 | + permissionRequestCount = 0; | |
| 264 | + } | |
| 265 | + }); | |
| 266 | + selectDialog.setRightBtnColor(R.color.green); | |
| 267 | + | |
| 268 | + } | |
| 269 | + | |
| 270 | + /** | |
| 271 | + * 权限回调 | |
| 272 | + * | |
| 273 | + * @param requestCode | |
| 274 | + * @param permissions | |
| 275 | + * @param grantResults | |
| 276 | + */ | |
| 277 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, | |
| 278 | + @NonNull int[] grantResults) { | |
| 279 | + Log.e(TAG, "onRequestPermissionsResult: "); | |
| 280 | + if (1 == permissionRequestCount) { | |
| 281 | + return; | |
| 282 | + } | |
| 283 | + boolean isShowPermissionTip = true; | |
| 284 | + for (int i = 0; i < grantResults.length; i++) {//判断权限的结果,如果有被拒绝,就return | |
| 285 | + if (grantResults[i] == PackageManager.PERMISSION_DENIED) { | |
| 286 | + if (!ActivityCompat.shouldShowRequestPermissionRationale(getContext(), permissions[i])) { | |
| 287 | + isShowPermissionTip = false; | |
| 288 | + break; | |
| 289 | + } | |
| 290 | + } | |
| 291 | + } | |
| 292 | + if (isShowPermissionTip) { | |
| 293 | + mPermissionsUtils.dealResult(requestCode, permissions, grantResults); | |
| 294 | + } else { | |
| 295 | + if (0 == permissionRequestCount) { | |
| 296 | + selectDialog.setCancelable(false); | |
| 297 | + selectDialog.setCanceledOnTouchOutside(false); | |
| 298 | + if (!selectDialog.isShowing()) { | |
| 299 | + selectDialog.show(); | |
| 300 | + permissionRequestCount = 1; | |
| 301 | + } | |
| 302 | + } else { | |
| 303 | + return; | |
| 304 | + } | |
| 305 | + } | |
| 306 | + } | |
| 174 | 307 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/netWork/ApiServiceXiaoJia.java
| ... | ... | @@ -100,5 +100,17 @@ public interface ApiServiceXiaoJia { |
| 100 | 100 | */ |
| 101 | 101 | @POST("/Daren/sound/deleteDevice.action") |
| 102 | 102 | Observable<Result<APIBaseInfo>> deleteDevice(@QueryMap() Map<String, String> maps); |
| 103 | + | |
| 104 | + /** | |
| 105 | + * devId String true 设备id | |
| 106 | + * name String true WiFi名称 | |
| 107 | + * passwd String true WiFi密码 | |
| 108 | + * mac String true mac地址 | |
| 109 | + * | |
| 110 | + * @param maps | |
| 111 | + * @return | |
| 112 | + */ | |
| 113 | + @POST("/Daren/sound/changeWiFi.action") | |
| 114 | + Observable<Result<APIBaseInfo>> changeWiFi(@QueryMap() Map<String, String> maps); | |
| 103 | 115 | } |
| 104 | 116 | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/BlueToothStep2Activity.java
| ... | ... | @@ -40,9 +40,10 @@ public class BlueToothStep2Activity extends AppCompatActivity { |
| 40 | 40 | private ActivityBlueToothStep2Binding binding; |
| 41 | 41 | private PermissionsUtils mPermissionsUtils = new PermissionsUtils();//权限申请 |
| 42 | 42 | private int permissionRequestCount = 0;//权限请求次数 |
| 43 | + private boolean isClickNextBtn = false; | |
| 43 | 44 | private SelectDialog selectDialog; |
| 44 | 45 | private String TAG = "BlueToothStep2"; |
| 45 | - private boolean isClickNextBtn = false; | |
| 46 | + | |
| 46 | 47 | |
| 47 | 48 | @Override |
| 48 | 49 | protected void onCreate(Bundle savedInstanceState) { | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/ChangeWifiActivity.java
| ... | ... | @@ -11,10 +11,13 @@ import android.provider.Settings; |
| 11 | 11 | import android.support.annotation.NonNull; |
| 12 | 12 | import android.support.v4.app.ActivityCompat; |
| 13 | 13 | import android.support.v7.app.AppCompatActivity; |
| 14 | +import android.text.TextUtils; | |
| 14 | 15 | import android.util.Log; |
| 15 | 16 | |
| 16 | 17 | import com.clj.fastble.data.BleDevice; |
| 17 | 18 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 19 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; | |
| 20 | +import com.cnlive.strike.xiaojiaspeaker.ui.fragment.ChangeWifiFragment; | |
| 18 | 21 | import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; |
| 19 | 22 | import com.cnlive.strike.xiaojiaspeaker.ui.widget.SelectDialog; |
| 20 | 23 | import com.cnlive.strike.xiaojiaspeaker.util.WifiUtils; |
| ... | ... | @@ -27,22 +30,24 @@ public class ChangeWifiActivity extends AppCompatActivity { |
| 27 | 30 | private SelectDialog selectDialog; |
| 28 | 31 | private WifiUtils wifiUtils; |
| 29 | 32 | private String TAG = "ChangeWifiActivity"; |
| 30 | - private BleDevice bleDevice; | |
| 33 | + private FamilyListBean.UsersBeanX currentUser; | |
| 31 | 34 | private boolean isFirstCheckWifi = true; |
| 32 | 35 | private Runnable wifiRunable; |
| 33 | 36 | private Handler handler; |
| 37 | + private String sn; | |
| 34 | 38 | |
| 35 | 39 | @Override |
| 36 | 40 | protected void onCreate(Bundle savedInstanceState) { |
| 37 | 41 | super.onCreate(savedInstanceState); |
| 38 | 42 | setContentView(R.layout.activity_select_wifi); |
| 39 | 43 | if (null != getIntent().getExtras()) { |
| 40 | - bleDevice = (BleDevice) getIntent().getExtras().get("bleDevice"); | |
| 44 | + currentUser = (FamilyListBean.UsersBeanX) getIntent().getExtras().getSerializable("currentUser"); | |
| 45 | + sn = getIntent().getExtras().getString("sn"); | |
| 41 | 46 | } |
| 42 | 47 | wifiUtils = new WifiUtils(this); |
| 43 | -// registerBroadcast(); | |
| 44 | -// getPermissionsWithTip(); | |
| 45 | - getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, SelectWifiFragment.newInstance(bleDevice)).commitAllowingStateLoss(); | |
| 48 | + if (null != currentUser && !TextUtils.isEmpty(sn)) { | |
| 49 | + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, ChangeWifiFragment.newInstance(sn, currentUser)).commitAllowingStateLoss(); | |
| 50 | + } | |
| 46 | 51 | } |
| 47 | 52 | |
| 48 | 53 | |
| ... | ... | @@ -211,9 +216,10 @@ public class ChangeWifiActivity extends AppCompatActivity { |
| 211 | 216 | // } |
| 212 | 217 | // }; |
| 213 | 218 | |
| 214 | - public static void StartActivity(Activity activity, BleDevice bleDevice) { | |
| 219 | + public static void StartActivity(Activity activity, String sn, FamilyListBean.UsersBeanX currentUser) { | |
| 215 | 220 | Intent intent = new Intent(activity, ChangeWifiActivity.class); |
| 216 | - intent.putExtra("bleDevice", bleDevice); | |
| 221 | + intent.putExtra("currentUser", currentUser); | |
| 222 | + intent.putExtra("sn", sn); | |
| 217 | 223 | activity.startActivity(intent); |
| 218 | 224 | } |
| 219 | 225 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/DeviceDetailActivity.java
| ... | ... | @@ -36,9 +36,9 @@ public class DeviceDetailActivity extends AppCompatActivity { |
| 36 | 36 | binding = DataBindingUtil.setContentView(this, R.layout.activity_device_detail); |
| 37 | 37 | if (null != getIntent().getExtras()) { |
| 38 | 38 | FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo = (FamilyListBean.UsersBeanX.DeviceListBean) getIntent().getExtras().getSerializable("allDeviceInfo"); |
| 39 | - String currentSelectFamilyId = getIntent().getExtras().getString("currentSelectFamilyId"); | |
| 40 | - if (null != allDeviceInfo && !TextUtils.isEmpty(currentSelectFamilyId)) { | |
| 41 | - getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, DeviceDetailFragment.newInstance(allDeviceInfo, currentSelectFamilyId)).commitAllowingStateLoss(); | |
| 39 | + FamilyListBean.UsersBeanX currentUser = (FamilyListBean.UsersBeanX) getIntent().getExtras().getSerializable("currentUser"); | |
| 40 | + if (null != allDeviceInfo && null!=currentUser) { | |
| 41 | + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, DeviceDetailFragment.newInstance(allDeviceInfo, currentUser)).commitAllowingStateLoss(); | |
| 42 | 42 | |
| 43 | 43 | } |
| 44 | 44 | |
| ... | ... | @@ -47,10 +47,10 @@ public class DeviceDetailActivity extends AppCompatActivity { |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | - public static void startActivity(Activity activity, FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, String currentSelectFamilyId) { | |
| 50 | + public static void startActivity(Activity activity, FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, FamilyListBean.UsersBeanX currentUser) { | |
| 51 | 51 | Intent intent = new Intent(activity, DeviceDetailActivity.class); |
| 52 | 52 | intent.putExtra("allDeviceInfo", (Serializable) allDeviceInfo); |
| 53 | - intent.putExtra("currentSelectFamilyId", currentSelectFamilyId); | |
| 53 | + intent.putExtra("currentUser", currentUser); | |
| 54 | 54 | activity.startActivity(intent); |
| 55 | 55 | } |
| 56 | 56 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/DeviceManagerActivity.java
| ... | ... | @@ -3,6 +3,7 @@ package com.cnlive.strike.xiaojiaspeaker.ui.activity; |
| 3 | 3 | import android.app.Activity; |
| 4 | 4 | import android.content.Intent; |
| 5 | 5 | import android.databinding.DataBindingUtil; |
| 6 | +import android.support.annotation.NonNull; | |
| 6 | 7 | import android.support.v4.content.ContextCompat; |
| 7 | 8 | import android.support.v7.app.AppCompatActivity; |
| 8 | 9 | import android.os.Bundle; |
| ... | ... | @@ -24,15 +25,18 @@ import com.cnlive.strike.xiaojiaspeaker.ui.fragment.SelectWifiFragment; |
| 24 | 25 | */ |
| 25 | 26 | public class DeviceManagerActivity extends AppCompatActivity { |
| 26 | 27 | private ActivityDeviceManagerBinding binding; |
| 28 | + private DeviceManagerFragment fragment; | |
| 27 | 29 | |
| 28 | 30 | @Override |
| 29 | 31 | protected void onCreate(Bundle savedInstanceState) { |
| 30 | 32 | super.onCreate(savedInstanceState); |
| 31 | 33 | binding = DataBindingUtil.setContentView(this, R.layout.activity_device_manager); |
| 32 | - if (null!=getIntent().getExtras()){ | |
| 33 | - FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo= (FamilyListBean.UsersBeanX.DeviceListBean) getIntent().getExtras().getSerializable("currentDeviceInfo"); | |
| 34 | - if (null!=currentDeviceInfo){ | |
| 35 | - getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, DeviceManagerFragment.newInstance(currentDeviceInfo)).commitAllowingStateLoss(); | |
| 34 | + if (null != getIntent().getExtras()) { | |
| 35 | + FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo = (FamilyListBean.UsersBeanX.DeviceListBean) getIntent().getExtras().getSerializable("currentDeviceInfo"); | |
| 36 | + FamilyListBean.UsersBeanX currentUser = (FamilyListBean.UsersBeanX) getIntent().getExtras().getSerializable("currentUser"); | |
| 37 | + if (null != currentDeviceInfo && null != currentUser) { | |
| 38 | + fragment = DeviceManagerFragment.newInstance(currentUser, currentDeviceInfo); | |
| 39 | + getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment).commitAllowingStateLoss(); | |
| 36 | 40 | } |
| 37 | 41 | } |
| 38 | 42 | // initTopBar(); |
| ... | ... | @@ -85,9 +89,20 @@ public class DeviceManagerActivity extends AppCompatActivity { |
| 85 | 89 | // } |
| 86 | 90 | // } |
| 87 | 91 | |
| 88 | - public static void startActivity(Activity activity, FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo) { | |
| 89 | - Intent intent=new Intent(activity, DeviceManagerActivity.class); | |
| 90 | - intent.putExtra("currentDeviceInfo",currentDeviceInfo); | |
| 92 | + public static void startActivity(Activity activity, FamilyListBean.UsersBeanX currentUser, FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo) { | |
| 93 | + Intent intent = new Intent(activity, DeviceManagerActivity.class); | |
| 94 | + intent.putExtra("currentDeviceInfo", currentDeviceInfo); | |
| 95 | + intent.putExtra("currentUser", currentUser); | |
| 96 | + | |
| 91 | 97 | activity.startActivity(intent); |
| 92 | 98 | } |
| 99 | + | |
| 100 | + @Override | |
| 101 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
| 102 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 103 | + if (null==fragment){ | |
| 104 | + return; | |
| 105 | + } | |
| 106 | + fragment.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 107 | + } | |
| 93 | 108 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/ChangeWifiFragment.java
| ... | ... | @@ -9,6 +9,7 @@ import android.net.wifi.WifiManager; |
| 9 | 9 | import android.os.Bundle; |
| 10 | 10 | import android.support.annotation.Nullable; |
| 11 | 11 | import android.support.v4.content.ContextCompat; |
| 12 | +import android.text.TextUtils; | |
| 12 | 13 | import android.util.Log; |
| 13 | 14 | import android.view.View; |
| 14 | 15 | |
| ... | ... | @@ -18,20 +19,24 @@ import com.cnlive.libs.base.util.StatusBarUtil; |
| 18 | 19 | import com.cnlive.libs.base.util.StatusBarUtil2; |
| 19 | 20 | import com.cnlive.strike.xiaojiaspeaker.R; |
| 20 | 21 | import com.cnlive.strike.xiaojiaspeaker.databinding.FragmentSelectWifiBinding; |
| 22 | +import com.cnlive.strike.xiaojiaspeaker.frame.presenter.ChangeWifiFragmentPresenter; | |
| 21 | 23 | import com.cnlive.strike.xiaojiaspeaker.frame.presenter.SelectWifiFragmentPresenter; |
| 24 | +import com.cnlive.strike.xiaojiaspeaker.frame.view.ChangeWifiFragmentView; | |
| 22 | 25 | import com.cnlive.strike.xiaojiaspeaker.frame.view.SelectWifiFragmentView; |
| 23 | 26 | import com.cnlive.strike.xiaojiaspeaker.model.message.EventMsg; |
| 27 | +import com.cnlive.strike.xiaojiaspeaker.netWork.bean.FamilyListBean; | |
| 24 | 28 | import com.cnlive.strike.xiaojiaspeaker.util.EventBusUtil; |
| 25 | 29 | |
| 26 | 30 | import org.greenrobot.eventbus.Subscribe; |
| 27 | 31 | import org.greenrobot.eventbus.ThreadMode; |
| 28 | 32 | |
| 29 | -public class ChangeWifiFragment extends MvpBindingFragment<SelectWifiFragmentView, SelectWifiFragmentPresenter, Object, FragmentSelectWifiBinding> { | |
| 33 | +public class ChangeWifiFragment extends MvpBindingFragment<ChangeWifiFragmentView, ChangeWifiFragmentPresenter, Object, FragmentSelectWifiBinding> { | |
| 30 | 34 | private String TAG = "SelectWifiFragment"; |
| 31 | 35 | |
| 32 | - public static ChangeWifiFragment newInstance(BleDevice bleDevice) { | |
| 36 | + public static ChangeWifiFragment newInstance(String sn,FamilyListBean.UsersBeanX currentUser) { | |
| 33 | 37 | Bundle bundle = new Bundle(); |
| 34 | - bundle.putParcelable("bleDevice", bleDevice); | |
| 38 | + bundle.putSerializable("currentUser", currentUser); | |
| 39 | + bundle.putString("sn",sn); | |
| 35 | 40 | ChangeWifiFragment fragment = new ChangeWifiFragment(); |
| 36 | 41 | fragment.setArguments(bundle); |
| 37 | 42 | return fragment; |
| ... | ... | @@ -52,14 +57,13 @@ public class ChangeWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie |
| 52 | 57 | @Override |
| 53 | 58 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { |
| 54 | 59 | super.onViewCreated(view, savedInstanceState); |
| 55 | - EventBusUtil.register(this); | |
| 56 | - | |
| 57 | 60 | initTopBar(); |
| 61 | + registerBroadcast(); | |
| 58 | 62 | if (null != getArguments()) { |
| 59 | - BleDevice bleDevice = (BleDevice) getArguments().get("bleDevice"); | |
| 60 | - if (null != getMvpView() && null != bleDevice) { | |
| 61 | - getMvpView().initWifiList(bleDevice); | |
| 62 | - registerBroadcast(); | |
| 63 | + FamilyListBean.UsersBeanX currentUser = (FamilyListBean.UsersBeanX) getArguments().getSerializable("currentUser"); | |
| 64 | + String sn=getArguments().getString("sn"); | |
| 65 | + if (null != getMvpView() && null != currentUser&&!TextUtils.isEmpty(sn)) { | |
| 66 | + getMvpView().initWifiList(sn,currentUser); | |
| 63 | 67 | } |
| 64 | 68 | } |
| 65 | 69 | |
| ... | ... | @@ -70,7 +74,7 @@ public class ChangeWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie |
| 70 | 74 | StatusBarUtil.setStatusBarWrite(getActivity()); |
| 71 | 75 | StatusBarUtil2.setColor(getActivity(), ContextCompat.getColor(getActivity(), R.color.white), 0); |
| 72 | 76 | if (null != binding) { |
| 73 | - binding.topbar.setTitle("请选择WIFI网络").setTextColor(ContextCompat.getColor(getActivity(), R.color.color_282828)); | |
| 77 | + binding.topbar.setTitle("切换WIFI网络").setTextColor(ContextCompat.getColor(getActivity(), R.color.color_282828)); | |
| 74 | 78 | //设置返回按钮 |
| 75 | 79 | binding.topbar.addLeftImageButton(R.drawable.icon_back, R.id.left_back).setOnClickListener(new View.OnClickListener() { |
| 76 | 80 | @Override |
| ... | ... | @@ -95,7 +99,6 @@ public class ChangeWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie |
| 95 | 99 | @Override |
| 96 | 100 | public void onDestroy() { |
| 97 | 101 | super.onDestroy(); |
| 98 | - EventBusUtil.unRegister(this); | |
| 99 | 102 | if (null != mBroadcastReceiver) { |
| 100 | 103 | getActivity().unregisterReceiver(mBroadcastReceiver); |
| 101 | 104 | } |
| ... | ... | @@ -123,10 +126,4 @@ public class ChangeWifiFragment extends MvpBindingFragment<SelectWifiFragmentVie |
| 123 | 126 | } |
| 124 | 127 | }; |
| 125 | 128 | |
| 126 | - @Subscribe(threadMode = ThreadMode.MAIN) | |
| 127 | - public void event(EventMsg msg) { | |
| 128 | - if (EventMsg.CLOSE_BLUETOOTH_ACTIVITY == msg.getEventType()) { | |
| 129 | - getActivity().finish(); | |
| 130 | - } | |
| 131 | - } | |
| 132 | 129 | } | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/DeviceDetailFragment.java
| ... | ... | @@ -21,11 +21,11 @@ import org.greenrobot.eventbus.Subscribe; |
| 21 | 21 | import org.greenrobot.eventbus.ThreadMode; |
| 22 | 22 | |
| 23 | 23 | public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, DeviceDetailPresenter, Object, FragmentDeviceDetailBinding> { |
| 24 | - public static DeviceDetailFragment newInstance(FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, String currentSelectFamilyId) { | |
| 24 | + public static DeviceDetailFragment newInstance(FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo, FamilyListBean.UsersBeanX currentUser) { | |
| 25 | 25 | DeviceDetailFragment fragment = new DeviceDetailFragment(); |
| 26 | 26 | Bundle bundle = new Bundle(); |
| 27 | 27 | bundle.putSerializable("allDeviceInfo", allDeviceInfo); |
| 28 | - bundle.putString("currentSelectFamilyId", currentSelectFamilyId); | |
| 28 | + bundle.putSerializable("currentUser", currentUser); | |
| 29 | 29 | fragment.setArguments(bundle); |
| 30 | 30 | return fragment; |
| 31 | 31 | } |
| ... | ... | @@ -36,10 +36,10 @@ public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, D |
| 36 | 36 | EventBusUtil.register(this); |
| 37 | 37 | if (null != getArguments()) { |
| 38 | 38 | FamilyListBean.UsersBeanX.DeviceListBean allDeviceInfo = (FamilyListBean.UsersBeanX.DeviceListBean) getArguments().getSerializable("allDeviceInfo"); |
| 39 | - String currentSelectFamilyId = getArguments().getString("currentSelectFamilyId"); | |
| 39 | + FamilyListBean.UsersBeanX currentUser = (FamilyListBean.UsersBeanX) getArguments().getSerializable("currentUser"); | |
| 40 | 40 | if (null != getMvpView()) { |
| 41 | 41 | initTopBar(allDeviceInfo.getName()); |
| 42 | - getMvpView().initView(allDeviceInfo, currentSelectFamilyId); | |
| 42 | + getMvpView().initView(allDeviceInfo, currentUser); | |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| ... | ... | @@ -76,7 +76,7 @@ public class DeviceDetailFragment extends MvpBindingFragment<DeviceDetailView, D |
| 76 | 76 | if (EventMsg.DELETE_DEVICE_NAME_SUCCESS == msg.getEventType()) { |
| 77 | 77 | getActivity().finish(); |
| 78 | 78 | } else if (EventMsg.CHANGE_DEVICE_NAME_SUCCESS == msg.getEventType()) { |
| 79 | - if (null==getMvpView()){ | |
| 79 | + if (null == getMvpView()) { | |
| 80 | 80 | return; |
| 81 | 81 | } |
| 82 | 82 | String deviceName = (String) msg.getData(); | ... | ... |
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/fragment/DeviceManagerFragment.java
| 1 | 1 | package com.cnlive.strike.xiaojiaspeaker.ui.fragment; |
| 2 | 2 | |
| 3 | 3 | import android.os.Bundle; |
| 4 | +import android.support.annotation.NonNull; | |
| 4 | 5 | import android.support.annotation.Nullable; |
| 5 | 6 | import android.support.v4.content.ContextCompat; |
| 6 | 7 | import android.text.TextUtils; |
| ... | ... | @@ -29,10 +30,11 @@ import org.greenrobot.eventbus.ThreadMode; |
| 29 | 30 | public class DeviceManagerFragment extends MvpBindingFragment<DeviceManagerFragmentView, DeviceManagerFragmentPresenter, Object, FragmentDeviceManagerBinding> { |
| 30 | 31 | private FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo; |
| 31 | 32 | |
| 32 | - public static DeviceManagerFragment newInstance(FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo) { | |
| 33 | + public static DeviceManagerFragment newInstance(FamilyListBean.UsersBeanX currentUser,FamilyListBean.UsersBeanX.DeviceListBean currentDeviceInfo) { | |
| 33 | 34 | DeviceManagerFragment fragment = new DeviceManagerFragment(); |
| 34 | 35 | Bundle bundle = new Bundle(); |
| 35 | 36 | bundle.putSerializable("currentDeviceInfo", currentDeviceInfo); |
| 37 | + bundle.putSerializable("currentUser", currentUser); | |
| 36 | 38 | fragment.setArguments(bundle); |
| 37 | 39 | return fragment; |
| 38 | 40 | } |
| ... | ... | @@ -57,8 +59,9 @@ public class DeviceManagerFragment extends MvpBindingFragment<DeviceManagerFragm |
| 57 | 59 | if (null != getMvpView()) { |
| 58 | 60 | if (null != getArguments()) { |
| 59 | 61 | currentDeviceInfo = (FamilyListBean.UsersBeanX.DeviceListBean) getArguments().getSerializable("currentDeviceInfo"); |
| 60 | - if (null != currentDeviceInfo && !TextUtils.isEmpty(currentDeviceInfo.getMcid())) { | |
| 61 | - getMvpView().initView(currentDeviceInfo); | |
| 62 | + FamilyListBean.UsersBeanX currentUser= (FamilyListBean.UsersBeanX) getArguments().getSerializable("currentUser"); | |
| 63 | + if (null != currentDeviceInfo && !TextUtils.isEmpty(currentDeviceInfo.getMcid())&&null!=currentUser) { | |
| 64 | + getMvpView().initView(currentUser,currentDeviceInfo); | |
| 62 | 65 | getPresenter().getDeviceDetailMsg(getActivity(), currentDeviceInfo.getMcid()); |
| 63 | 66 | } |
| 64 | 67 | } |
| ... | ... | @@ -99,4 +102,13 @@ public class DeviceManagerFragment extends MvpBindingFragment<DeviceManagerFragm |
| 99 | 102 | }); |
| 100 | 103 | } |
| 101 | 104 | } |
| 105 | + | |
| 106 | + @Override | |
| 107 | + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
| 108 | + super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
| 109 | + if (null==getMvpView()){ | |
| 110 | + return; | |
| 111 | + } | |
| 112 | + getMvpView().onRequestPermissionsResult(requestCode,permissions,grantResults); | |
| 113 | + } | |
| 102 | 114 | } | ... | ... |