admin
2021-05-14 1b4b3fed2569ac21ad6feb0a3a2c051175e7c36e
app/src/main/java/com/tejia/lijin/app/ui/main/MainActivity.java
@@ -34,6 +34,7 @@
import com.huawei.android.hms.agent.HMSAgent;
import com.huawei.android.hms.agent.push.handler.GetTokenHandler;
import com.tejia.lijin.app.entity.TrendsCategory;
import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity;
import com.tejia.lijin.app.ui.trends.SendCircleFragmet;
import com.tejia.lijin.app.util.TopStatusSettings;
import com.tejia.lijin.app.util.ui.HomeUIUtil;
@@ -168,7 +169,7 @@
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE );
                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);
            int result = 0;
@@ -186,9 +187,6 @@
        } else {
            findViewById(R.id.v_status_bar).setVisibility(View.GONE);
        }
        EventBus.getDefault().register(this);
@@ -285,6 +283,20 @@
        registeredOPPOId();//上传OPPO_RegId
//        onPush_OFF_NO();//检测是否打开推送
        registeredVIVOId();//上传VIVO_RegId
        tv_msg_num2.postDelayed(new Runnable() {
            @Override
            public void run() {
                //测试
                Bundle bundle = new Bundle();
                bundle.putString("goodsId", "19711731038");
                bundle.putString("goodsType", 1+"");
                startActivity(new Intent(getApplicationContext(), GoodsDetailActivity.class).putExtras(bundle));
            }
        },5000);
    }
    private void choiceTab(Integer tab, Integer subTab) {
@@ -356,9 +368,7 @@
     * 系统补充参数请求
     */
    private void getSystemParams() {
        String uid = getSharedPreferences("user",
                Context.MODE_PRIVATE).getString("uid", "");
        ShoppingApi.getSystemParams(MainActivity.this, uid, new BasicTextHttpResponseHandler() {
        ShoppingApi.getSystemParams(MainActivity.this, UserUtil.getUid(ShoppingApplication.application), new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                if (jsonObject.optString("code").equalsIgnoreCase("0")) {
@@ -412,7 +422,7 @@
        }
        boolean isLogin = sp.getBoolean("isLogin", false);
        v_no_login.setVisibility(isLogin ? View.INVISIBLE : View.VISIBLE);
        getUnReadMsgCount(sp.getString("uid", "0"));//消息 未读数量
        getUnReadMsgCount(UserUtil.getUid(ShoppingApplication.application));//消息 未读数量
        if (MiPushMessageReceiver.miPushMessage != null) {//打开小米推送
            MiPushMessage message = MiPushMessageReceiver.miPushMessage;
@@ -491,7 +501,7 @@
     *
     * @param uid
     */
    private void getUnReadMsgCount(String uid) {
    private void getUnReadMsgCount(Long uid) {
        ShoppingApi.getUnReadMsgCount(this, uid, new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
@@ -604,7 +614,7 @@
     * @param entity
     */
    public void onEventMainThread(EventMessageEntity entity) {
        getUnReadMsgCount(sp.getString("uid", "0"));
        getUnReadMsgCount(UserUtil.getUid(ShoppingApplication.application));
        if (messagePush != null) {
            // 这里就会调用我们Fragment中的MessagePush方法
            messagePush.MessagePush(true);//传入消息推送
@@ -761,9 +771,8 @@
     * @param homeMsgListListener
     */
    private void getHomeMsgList(final getHomeMsgListListener homeMsgListListener) {
        String uid = getSharedPreferences("user",
                Context.MODE_PRIVATE).getString("uid", "");
        ShoppingApi.getHomeMsgList(this, uid, mPage + "", new BasicTextHttpResponseHandler() {
        ShoppingApi.getHomeMsgList(this, UserUtil.getUid(ShoppingApplication.application), mPage + "", new BasicTextHttpResponseHandler() {
            @Override
            public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception {
                homeMsgListListener.onSuccessPerfect(statusCode, headers, jsonObject);
@@ -872,13 +881,12 @@
            SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE);
            if (MobileUtil.getDeviceBrand().equalsIgnoreCase("HUAWEI")
                    || MobileUtil.getDeviceBrand().equalsIgnoreCase("HONOR")) {
                String uid = sp.getString("uid", "0");
                Log.e("eee", "HONOR: ");
                //防止多次请求
                if (System.currentTimeMillis() - lastBindHWTime > 1000 * 5) {//5s后再请求
                    lastBindHWTime = System.currentTimeMillis();
                    Log.e("eee", "上传token");
                    ShoppingApi.bindHMPush(MainActivity.this, token, uid, null);
                    ShoppingApi.bindHMPush(MainActivity.this, token, UserUtil.getUid(ShoppingApplication.application), null);
                }
            }
        }