| | |
| | | import android.net.Uri; |
| | | import android.os.Build; |
| | | import android.provider.Settings; |
| | | |
| | | import androidx.annotation.NonNull; |
| | | |
| | | import com.google.android.material.appbar.AppBarLayout; |
| | | |
| | | import androidx.core.app.NotificationManagerCompat; |
| | | |
| | | import android.util.DisplayMetrics; |
| | | import android.view.Display; |
| | | import android.view.View; |
| | |
| | | import com.alibaba.baichuan.android.trade.model.AlibcShowParams; |
| | | import com.alibaba.baichuan.android.trade.model.OpenType; |
| | | import com.app.hubert.guide.util.ScreenUtils; |
| | | import com.coloros.mcssdk.PushManager; |
| | | import com.google.gson.Gson; |
| | | import com.huawei.android.hms.agent.HMSAgent; |
| | | import com.huawei.android.hms.agent.push.handler.EnableReceiveNormalMsgHandler; |
| | | import com.heytap.msp.push.HeytapPushManager; |
| | | import com.heytap.msp.push.callback.ICallBackResultService; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache; |
| | |
| | | import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; |
| | | import com.nostra13.universalimageloader.core.assist.ImageScaleType; |
| | | import com.nostra13.universalimageloader.core.assist.QueueProcessingType; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity; |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.vivo.push.PushClient; |
| | | import com.wpc.library.util.common.StringUtils; |
| | |
| | | import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; |
| | | import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; |
| | | import com.tejia.lijin.app.ui.main.MainActivity; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivityTB; |
| | | import com.tejia.lijin.app.ui.recommend.SearchResultActivity; |
| | | import com.tejia.lijin.app.ui.recommend.ShareGoodsImageActivity31; |
| | | import com.tejia.lijin.app.util.umengCustomEvent.MainCustomEvent; |
| | |
| | | } else { |
| | | try { |
| | | if (cClass.equals("com.tejia.lijin.app.ui.recommend.GoodsBrowserActivity")) { |
| | | cClass = GoodsDetailActivityTB.class.getName(); |
| | | cClass = GoodsDetailActivity.class.getName(); |
| | | } |
| | | Intent intent = new Intent(context, Class.forName(JumpActivityUtil.filterActivityName(cClass))); |
| | | if (!StringUtils.isEmpty(url1)) |
| | | intent.putExtra("url", url1); |
| | | if (!StringUtils.isEmpty(id)) { |
| | | intent.putExtra("id", id); |
| | | intent.putExtra("goodsId", id); |
| | | intent.putExtra("goodsType", Constant.GOODS_TYPE_TB); |
| | | } |
| | | |
| | | |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | context.startActivity(intent); |
| | | } catch (ClassNotFoundException e) { |
| | |
| | | } catch (JSONException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 注册 OPPO RegId |
| | | */ |
| | | public static void registeredOPPOId(Context context) { |
| | | String registerId = null; |
| | | if (PushManager.getInstance() != null) |
| | | registerId = PushManager.getInstance().getRegisterID(); |
| | | if (!StringUtils.isEmpty(registerId)) |
| | | ShoppingApi.bindOPPOPush(context, UserUtil.getUid(ShoppingApplication.application), registerId, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 注册 VIVO RegId |
| | | */ |
| | | public static void registeredVIVORegId(Context context) { |
| | | // Log.e("eee", "registeredVIVORegId-uid: " + uid); |
| | | String registerId = null; |
| | | if (PushClient.getInstance(context) != null) |
| | | registerId = PushClient.getInstance(context).getRegId(); |
| | | if (!StringUtils.isEmpty(registerId)) |
| | | ShoppingApi.bindVIVOPush(context, UserUtil.getUid(ShoppingApplication.application), registerId, new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | super.onSuccessPerfect(statusCode, headers, jsonObject); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | weekDays.add(i); |
| | | } |
| | | if (isChecked) |
| | | PushManager.getInstance().setPushTime(weekDays, 20, 0, 8, 0); |
| | | HeytapPushManager.setPushTime(weekDays, 20, 0, 8, 0); |
| | | else |
| | | PushManager.getInstance().setPushTime(weekDays, 0, 0, 23, 59); |
| | | HeytapPushManager.setPushTime(weekDays, 0, 0, 23, 59); |
| | | break; |
| | | case "vivo": |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 打开或关闭推送 |
| | | */ |
| | | public static void setPush_OFF_NO(MainActivity mContext) { |
| | | if (mContext != null) { |
| | | /** |
| | | * false 关闭推送 |
| | | * _01 第一次查询(第一次查询 关闭推送 只关闭一次) |
| | | * true 开启推送 |
| | | * _02 二次查询(只开启一次) |
| | | * */ |
| | | SharedPreferences sp = mContext.getSharedPreferences("user", Context.MODE_PRIVATE); |
| | | String off_no = sp.getString("push_off_no", "false_01"); |
| | | SharedPreferences.Editor editor = sp.edit(); |
| | | String mBRAND = Build.BRAND.toLowerCase(); |
| | | if (mBRAND.equals("xiaomi")) { |
| | | // Log.e("eee", "setPush_OFF_NO: " + mBRAND + "--" + off_no); |
| | | if (off_no.equals("false_01")) {//关闭一次推送 |
| | | // Log.e("eee", "setPush_OFF_NO: 关闭MiPush推送服务"); |
| | | MiPushClient.pausePush(mContext, null);/**暂停接收MiPush服务推送的消息*/ |
| | | editor.putString("push_off_no", "false_02"); |
| | | } else if (off_no.equals("true_01")) { |
| | | // Log.e("eee", "setPush_OFF_NO: 启用MiPush推送服务"); |
| | | MiPushClient.resumePush(mContext, null);/**恢复接收MiPush服务推送的消息,这时服务器会把暂停时期的推送消息重新推送过来*/ |
| | | editor.putString("push_off_no", "true_02"); |
| | | } |
| | | } else if (mBRAND.equals("huawei") || mBRAND.equals("honor")) { |
| | | // Log.e("eee", "honor: "); |
| | | if (off_no.equals("false_01")) { |
| | | editor.putString("push_off_no", "false_02"); |
| | | HMSAgent.Push.enableReceiveNormalMsg(false, new EnableReceiveNormalMsgHandler() { |
| | | @Override |
| | | public void onResult(int rst) { |
| | | } |
| | | }); |
| | | } else if (off_no.equals("true_01")) { |
| | | editor.putString("push_off_no", "true_02"); |
| | | HMSAgent.Push.enableReceiveNormalMsg(true, new EnableReceiveNormalMsgHandler() { |
| | | @Override |
| | | public void onResult(int rst) { |
| | | } |
| | | }); |
| | | } |
| | | } else if (mBRAND.equals("oppo")) { |
| | | if (off_no.equals("false_01")) { |
| | | PushManager.getInstance().pausePush();/*** 暂停接收OPush服务推送的消息*/ |
| | | editor.putString("push_off_no", "false_02"); |
| | | } else if (off_no.equals("true_01")) { |
| | | PushManager.getInstance().resumePush();/*** 恢复接收OPush服务推送的消息,这时服务器会把暂停时期的推送消息重新推送过来*/ |
| | | editor.putString("push_off_no", "true_02"); |
| | | } |
| | | } else if (mBRAND.equals("vivo")) { |
| | | |
| | | } |
| | | editor.commit(); |
| | | } |
| | | } |
| | | |