admin
2021-05-28 5965c01b38a2e83cecd7616daa11185fc2499303
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);
@@ -356,9 +354,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 +408,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 +487,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 +600,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 +757,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 +867,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);
                }
            }
        }