Commit 052e53caf7966fef54186fdaa95d6d978c095f50
1 parent
938ff9eb
1 修改首页数据传参逻辑
Showing
3 changed files
with
34 additions
and
22 deletions
app/src/main/java/com/cnlive/strike/xiaojiaspeaker/MainActivity.java
| ... | ... | @@ -36,7 +36,8 @@ public class MainActivity extends AppCompatActivity { |
| 36 | 36 | binding = DataBindingUtil.setContentView(this, R.layout.activity_speaker_main); |
| 37 | 37 | XiaoJIaCommInfo.setUserId(this, "10514333".trim()); |
| 38 | 38 | XiaoJIaCommInfo.setUserPhone(this, "18301489586".trim()); |
| 39 | - | |
| 39 | + XiaoJIaCommInfo.setUserIcon(this,"123456"); | |
| 40 | + XiaoJIaCommInfo.setUserNickName(this,"我的昵称"); | |
| 40 | 41 | // XiaoJIaCommInfo.setUserId(this, "10535072".trim()); |
| 41 | 42 | // XiaoJIaCommInfo.setUserPhone(this, "15532913679".trim()); |
| 42 | 43 | |
| ... | ... | @@ -47,7 +48,9 @@ public class MainActivity extends AppCompatActivity { |
| 47 | 48 | // startActivity(new Intent(MainActivity.this, BluetoothConnActivity.class)); |
| 48 | 49 | // startActivity(new Intent(MainActivity.this, BlueToothStep1Activity.class)); |
| 49 | 50 | // startActivity(new Intent(MainActivity.this, ConnBluetoothSuccessActivity.class)); |
| 50 | - AllDeviceActivity.startActivity(MainActivity.this,XiaoJIaCommInfo.getUserId(this),"123","123",XiaoJIaCommInfo.getUserPhone(this)); | |
| 51 | +// AllDeviceActivity.startActivity(MainActivity.this,XiaoJIaCommInfo.getUserId(this),"123","123",XiaoJIaCommInfo.getUserPhone(this)); | |
| 52 | + AllDeviceActivity.startActivity(MainActivity.this); | |
| 53 | + | |
| 51 | 54 | // startActivity(new Intent(MainActivity.this, DeviceInstructionActivity.class)); |
| 52 | 55 | // startActivity(new Intent(MainActivity.this, DeviceManagerActivity.class)); |
| 53 | 56 | // startActivity(new Intent(MainActivity.this, FirmwareUpdateActivity.class)); | ... | ... |
config.gradle
module_xiaojiaSoundBox/src/main/java/com/cnlive/strike/xiaojiaspeaker/ui/activity/AllDeviceActivity.java
| ... | ... | @@ -33,32 +33,41 @@ public class AllDeviceActivity extends AppCompatActivity { |
| 33 | 33 | protected void onCreate(Bundle savedInstanceState) { |
| 34 | 34 | super.onCreate(savedInstanceState); |
| 35 | 35 | binding = DataBindingUtil.setContentView(this, R.layout.activity_all_device); |
| 36 | - if (null != getIntent().getExtras()) { | |
| 37 | - String uid = getIntent().getExtras().getString("uid"); | |
| 38 | - String userIcon = getIntent().getExtras().getString("userIcon"); | |
| 39 | - String nickName = getIntent().getExtras().getString("nickName"); | |
| 40 | - String phone = getIntent().getExtras().getString("phone"); | |
| 41 | - if (!TextUtils.isEmpty(uid) && !TextUtils.isEmpty(userIcon) && !TextUtils.isEmpty(nickName) && !TextUtils.isEmpty(phone)) { | |
| 42 | - XiaoJIaCommInfo.setUserId(this, uid); | |
| 43 | - XiaoJIaCommInfo.setUserPhone(this, phone); | |
| 44 | - XiaoJIaCommInfo.setUserIcon(this, userIcon); | |
| 45 | - XiaoJIaCommInfo.setUserNickName(this, nickName); | |
| 36 | +// if (null != getIntent().getExtras()) { | |
| 37 | +// String uid = getIntent().getExtras().getString("uid"); | |
| 38 | +// String userIcon = getIntent().getExtras().getString("userIcon"); | |
| 39 | +// String nickName = getIntent().getExtras().getString("nickName"); | |
| 40 | +// String phone = getIntent().getExtras().getString("phone"); | |
| 41 | +// if (!TextUtils.isEmpty(uid) && !TextUtils.isEmpty(userIcon) && !TextUtils.isEmpty(nickName) && !TextUtils.isEmpty(phone)) { | |
| 42 | +// XiaoJIaCommInfo.setUserId(this, uid); | |
| 43 | +// XiaoJIaCommInfo.setUserPhone(this, phone); | |
| 44 | +// XiaoJIaCommInfo.setUserIcon(this, userIcon); | |
| 45 | +// XiaoJIaCommInfo.setUserNickName(this, nickName); | |
| 46 | +// getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, AllDeviceFragment.newInstance()).commitAllowingStateLoss(); | |
| 47 | +// | |
| 48 | +// } else { | |
| 49 | +// AlertUtil.showDeftToast(this, "参数异常"); | |
| 50 | +// } | |
| 51 | +// | |
| 52 | +// } | |
| 53 | + if (!TextUtils.isEmpty(XiaoJIaCommInfo.getUserId(this)) && !TextUtils.isEmpty(XiaoJIaCommInfo.getUserIcon(this)) && !TextUtils.isEmpty(XiaoJIaCommInfo.getUserPhone(this)) && !TextUtils.isEmpty(XiaoJIaCommInfo.getUserNickName(this))) { | |
| 46 | 54 | getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, AllDeviceFragment.newInstance()).commitAllowingStateLoss(); |
| 47 | - | |
| 48 | 55 | } else { |
| 49 | 56 | AlertUtil.showDeftToast(this, "参数异常"); |
| 50 | 57 | } |
| 51 | - | |
| 52 | - } | |
| 53 | - | |
| 54 | 58 | } |
| 55 | 59 | |
| 56 | - public static void startActivity(Activity activity, String uid, String userIcon, String nickName, String phone) { | |
| 60 | +// public static void startActivity(Activity activity, String uid, String userIcon, String nickName, String phone) { | |
| 61 | +// Intent intent = new Intent(activity, AllDeviceActivity.class); | |
| 62 | +// intent.putExtra("uid", uid); | |
| 63 | +// intent.putExtra("userIcon", userIcon); | |
| 64 | +// intent.putExtra("nickName", nickName); | |
| 65 | +// intent.putExtra("phone", phone); | |
| 66 | +// activity.startActivity(intent); | |
| 67 | +// } | |
| 68 | + | |
| 69 | + public static void startActivity(Activity activity) { | |
| 57 | 70 | Intent intent = new Intent(activity, AllDeviceActivity.class); |
| 58 | - intent.putExtra("uid", uid); | |
| 59 | - intent.putExtra("userIcon", userIcon); | |
| 60 | - intent.putExtra("nickName", nickName); | |
| 61 | - intent.putExtra("phone", phone); | |
| 62 | 71 | activity.startActivity(intent); |
| 63 | 72 | } |
| 64 | 73 | ... | ... |