9个文件已删除
1 文件已重命名
61个文件已修改
25个文件已添加
| | |
| | | apply plugin: 'com.android.library' |
| | | apply plugin: 'android-library' |
| | | |
| | | android { |
| | | compileSdkVersion 28 |
| | |
| | | targetSdkVersion 26 |
| | | versionCode 1 |
| | | versionName "1.0" |
| | | |
| | | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' |
| | | |
| | | } |
| | | |
| | | buildTypes { |
| | |
| | | applicationId "com.tejia.lijin" |
| | | minSdkVersion 19 |
| | | targetSdkVersion 26 |
| | | versionCode 67//2.0.2 |
| | | versionName "1.1.3" |
| | | versionCode 70 |
| | | versionName "1.1.6" |
| | | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' |
| | | // ndk { |
| | | // //兼容64位与32位系统 |
| | | // abiFilters 'armeabi-v7a', 'arm64-v8a'//, 'x86', 'x86_64' |
| | | // } |
| | | ndk { |
| | | //兼容64位与32位系统 |
| | | abiFilters 'armeabi-v7a', 'arm64-v8a'//, 'x86', 'x86_64' |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | def manifestContent = file(manifestPath).getText() |
| | | //删除注释,防止注释里面的中文乱码导致更改后的内容系统无法正常解析 |
| | | manifestContent = manifestContent.replaceAll("<!--[\\s\\S]*?-->", "") |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.CAMERA" />', '') |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.BLUETOOTH" />', '') |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.CAMERA"/>', '') |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.BLUETOOTH"/>', '') |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>', '') |
| | | manifestContent = manifestContent.replace('<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>', '') |
| | | |
| | | println "AndroidManifest-Content:" |
| | | println manifestContent |
| | |
| | | api project(':APPUpdate') |
| | | api files('libs/eventbus-2.4.0.jar') |
| | | api files('libs/universal-image-loader-1.9.5.jar') |
| | | api files('libs/open_ad_sdk.aar') |
| | | api files("libs/open_ad_sdk_4.7.0.8.aar") |
| | | |
| | | |
| | | api files('libs/umeng-common-9.4.4.jar') |
| | | api files('libs/umeng-asms-armeabi-v1.4.1.aar') |
| | | api files('libs/umeng-apm-armeabi-v1.5.2.aar') |
| | | |
| | | implementation 'com.github.bumptech.glide:glide:4.9.0' |
| | | implementation project(path: ':library-gallery') |
| | | implementation project(path: ':library-push') |
| | | annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0' |
| | | implementation project(':library-ViewPagerIndicator') |
| | | implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+' |
| | | implementation 'com.tencent.mm.opensdk:wechat-sdk-android:+' |
| | | // implementation project(':social_sdk_library_project') |
| | | implementation 'androidx.multidex:multidex:2.0.0' |
| | | api files('libs/tbs_sdk_thirdapp_v2.4.0.1073_36840_sharewithdownload_obfs_20161011_194834.jar') |
| | | api 'com.qq.e.union:union:4.480.1350' |
| | | |
| | | api 'com.tencent.tbs:tbssdk:44213' |
| | | |
| | | //QQ登录 |
| | | implementation files('libs/open_sdk_3.5.4.11_r3f56456_lite.jar') |
| | |
| | | //加载动画依赖 |
| | | implementation 'com.wang.avi:library:2.1.3' |
| | | implementation 'jp.wasabeef:glide-transformations:2.0.0' |
| | | api files('libs/umeng-analytics-8.0.0.jar') |
| | | implementation 'com.felipecsl:gifimageview:2.0.0' |
| | | api project(':guide') |
| | | implementation project(':library-mine') |
| | | implementation files('libs/umeng-common-2.0.2.jar') |
| | | implementation files('libs/jd_crash_lib_release_210.jar') |
| | | implementation files('libs/JDSDK_h.jar') |
| | | implementation project(':JdSDK') |
| | | //导航栏 |
| | | implementation 'com.github.hackware1993:MagicIndicator:1.7.0' |
| | | |
| | | //广点通广告 |
| | | implementation(name: 'GDTSDK.unionNormal.4.362.1232', ext: 'aar') |
| | | |
| | | implementation 'com.google.android.material:material:1.0.0' |
| | | |
| | |
| | | <!-- HMS-SDK引导升级HMS功能,保存下载的升级包需要SD卡写权限 --> |
| | | <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 检测网络状态 --> |
| | | <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 检测wifi状态 --> |
| | | <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 为了获取用户手机的IMEI,用来唯一的标识用户。 --> |
| | | <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 如果是安卓8.0,应用编译配置的targetSdkVersion>=26,请务必添加以下权限 --> |
| | | <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <!-- 接收PUSH TOKEN的广播以及PUSH消息需要定义该权限 ${PACKAGE_NAME} 要替换上您应用的包名 --> |
| | | <permission |
| | | android:name="com.tejia.lijin.permission.PROCESS_PUSH_MSG" |
| | |
| | | |
| | | <!-- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />--> |
| | | <!-- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />--> |
| | | |
| | | <queries> |
| | | <intent> |
| | | <action android:name="com.huawei.hms.core.aidlservice" /> |
| | | </intent> |
| | | </queries> |
| | | |
| | | <application |
| | | android:name=".ShoppingApplication" |
| | |
| | | <activity |
| | | android:name=".ui.recommend.SelfBuyAndReductionActivity" |
| | | android:screenOrientation="portrait"></activity> |
| | | |
| | | <activity |
| | | android:name=".ui.SimpleBrowserActivity" |
| | | android:screenOrientation="portrait" /> |
| | | |
| | | <activity |
| | | android:name=".ui.HMPushReceiveActivity" |
| | | android:screenOrientation="portrait"> |
| | |
| | | <activity |
| | | android:name=".ui.PushOpenClickActivity" |
| | | android:exported="true" |
| | | android:launchMode="singleTask" |
| | | android:screenOrientation="portrait" |
| | | android:theme="@style/fullScreen"> |
| | | <intent-filter> |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.google.gson.Gson; |
| | | import com.loopj.android.http.AsyncHttpClient; |
| | | import com.loopj.android.http.SyncHttpClient; |
| | | import com.tejia.lijin.app.entity.goods.ShareCommonGoods; |
| | | import com.tejia.lijin.app.entity.user.TeamScreenInfo; |
| | | import com.tejia.lijin.app.util.DeviceInfoUtil; |
| | | import com.tejia.lijin.app.util.ToolUtil; |
| | | import com.tejia.lijin.app.util.clipboard.ClipboardUtil; |
| | | import com.tejia.lijin.app.util.user.LoginAndInviteStatusUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.wpc.library.DeviceUuidFactory; |
| | | import com.wpc.library.util.GetManifestDataUtil; |
| | | import com.wpc.library.util.MacUtil; |
| | |
| | | import com.wpc.library.util.common.PackageUtils2; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | import com.wpc.library.util.security.MD5Utils; |
| | | import com.tejia.lijin.app.entity.goods.ShareCommonGoods; |
| | | import com.tejia.lijin.app.entity.user.TeamScreenInfo; |
| | | import com.tejia.lijin.app.util.ToolUtil; |
| | | import com.tejia.lijin.app.util.clipboard.ClipboardUtil; |
| | | import com.tejia.lijin.app.util.user.LoginAndInviteStatusUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.yeshi.push.entity.PushRomType; |
| | | |
| | | import org.apache.http.Header; |
| | |
| | | * @param context |
| | | * @param goodsId |
| | | * @param goodsType |
| | | * @param lijinId |
| | | * @param uid |
| | | * @param from |
| | | * @param handler |
| | | */ |
| | | public static void getUserLijinCreatedInfo(Context context, String goodsId, Integer goodsType, Long uid, |
| | |
| | | } |
| | | |
| | | public static void recieveHongBao(Context context, String id, |
| | | BasicTextHttpResponseHandler handler) { |
| | | BasicTextHttpResponseHandler handler) { |
| | | LinkedHashMap<String, String> params = new LinkedHashMap<String, String>(); |
| | | Long uid = UserUtil.getUid(context); |
| | | if (uid != null) |
| | |
| | | } |
| | | } |
| | | |
| | | private static String getDeviceId(Context context) { |
| | | SharedPreferences deviceInfo = context.getSharedPreferences("deviceInfo", MODE_PRIVATE); |
| | | String deviceId = deviceInfo.getString("device", ""); |
| | | if (StringUtils.isEmpty(deviceId)) { |
| | | deviceId = new DeviceUuidFactory(context).getDeviceUuid() + ""; |
| | | if (!StringUtils.isEmpty(deviceId)) { |
| | | SharedPreferences.Editor editor = deviceInfo.edit(); |
| | | editor.putString("device", deviceId); |
| | | editor.commit(); |
| | | } |
| | | } |
| | | return deviceId; |
| | | } |
| | | |
| | | private static String getUtdid(Context context) { |
| | | SharedPreferences deviceInfo = context.getSharedPreferences("deviceInfo", MODE_PRIVATE); |
| | | String utdid = deviceInfo.getString("utdid", ""); |
| | | if (StringUtils.isEmpty(utdid)) { |
| | | utdid = com.ta.utdid2.device.UTDevice.getUtdid(context); |
| | | if (!StringUtils.isEmpty(utdid)) { |
| | | SharedPreferences.Editor editor = deviceInfo.edit(); |
| | | editor.putString("utdid", utdid); |
| | | editor.commit(); |
| | | } |
| | | } |
| | | if (StringUtils.isEmpty(utdid)) |
| | | return ""; |
| | | else |
| | | return utdid; |
| | | } |
| | | |
| | | public static LinkedHashMap<String, String> validateParams( |
| | | LinkedHashMap<String, String> params, Context context) { |
| | |
| | | |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | long time = System.currentTimeMillis(); |
| | | String deviceType = MobileUtil.getSystemModel(); |
| | | String deviceType = DeviceInfoUtil.getSystemModel(context); |
| | | params.put("packages", API_PACKAGE_NAME); |
| | | params.put("Version", version + ""); |
| | | params.put("appkey", BuXinConstant.TAO_BAO_KE_KEY); |
| | |
| | | params.put("apiversion", "1"); |
| | | |
| | | params.put("channel", GetManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL")); |
| | | String imei = MobileUtil.getIMEI(context); |
| | | String imei = DeviceInfoUtil.getIMEI(context); |
| | | if (!StringUtils.isEmpty(imei)) |
| | | params.put("imei", imei); |
| | | params.put("osVersion", MobileUtil.getSystemVersion()); |
| | | params.put("osVersion", DeviceInfoUtil.getSystemVersion(context)); |
| | | params.put("network", NetUtils.getNetworkState(context)); |
| | | |
| | | params.put("deviceType", StringUtils.isEmpty(deviceType) ? "" : deviceType); |
| | | params.put("time", time + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | params.put("utdid", getUtdid(context)); |
| | | params.put("Device", DeviceInfoUtil.getDeviceId(context)); |
| | | params.put("utdid", DeviceInfoUtil.getUtdid(context)); |
| | | |
| | | Iterator<String> its = params.keySet().iterator(); |
| | | List<String> list = new ArrayList<>(); |
| | |
| | | // } |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | long time = System.currentTimeMillis(); |
| | | String deviceType = MobileUtil.getSystemModel(); |
| | | String deviceType = DeviceInfoUtil.getSystemModel(context); |
| | | params.put("packages", API_PACKAGE_NAME); |
| | | params.put("Version", version + ""); |
| | | params.put("appkey", BuXinConstant.TAO_BAO_KE_KEY); |
| | | params.put("platform", "android"); |
| | | params.put("apiversion", "1"); |
| | | params.put("channel", GetManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL")); |
| | | String imei = MobileUtil.getIMEI(context); |
| | | String imei = DeviceInfoUtil.getIMEI(context); |
| | | if (!StringUtils.isEmpty(imei)) { |
| | | params.put("imei", imei); |
| | | } |
| | | params.put("osVersion", MobileUtil.getSystemVersion()); |
| | | params.put("osVersion", DeviceInfoUtil.getSystemVersion(context)); |
| | | params.put("network", NetUtils.getNetworkState(context)); |
| | | params.put("deviceType", StringUtils.isEmpty(deviceType) ? "" : deviceType); |
| | | params.put("time", time + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | params.put("utdid", getUtdid(context)); |
| | | params.put("Device", DeviceInfoUtil.getDeviceId(context)); |
| | | params.put("utdid", DeviceInfoUtil.getUtdid(context)); |
| | | |
| | | |
| | | Iterator<String> its = params.keySet().iterator(); |
| | |
| | | // } |
| | | int version = PackageUtils2.getVersionCode(context); |
| | | long time = System.currentTimeMillis(); |
| | | String deviceType = MobileUtil.getSystemModel(); |
| | | String deviceType = DeviceInfoUtil.getSystemModel(context); |
| | | params.put("packages", API_PACKAGE_NAME); |
| | | params.put("Version", version + ""); |
| | | params.put("appkey", BuXinConstant.TAO_BAO_KE_KEY); |
| | | params.put("platform", "android"); |
| | | params.put("apiversion", "1"); |
| | | params.put("channel", GetManifestDataUtil.getAppMetaData(context, "UMENG_CHANNEL")); |
| | | String imei = MobileUtil.getIMEI(context); |
| | | String imei = DeviceInfoUtil.getIMEI(context); |
| | | if (!StringUtils.isEmpty(imei)) |
| | | params.put("imei", imei); |
| | | params.put("osVersion", MobileUtil.getSystemVersion()); |
| | | params.put("osVersion", DeviceInfoUtil.getSystemVersion(context)); |
| | | params.put("network", NetUtils.getNetworkState(context)); |
| | | params.put("deviceType", StringUtils.isEmpty(deviceType) ? "" : deviceType); |
| | | params.put("time", time + ""); |
| | | params.put("Device", getDeviceId(context)); |
| | | params.put("utdid", getUtdid(context)); |
| | | params.put("Device", DeviceInfoUtil.getDeviceId(context)); |
| | | params.put("utdid", DeviceInfoUtil.getUtdid(context)); |
| | | |
| | | Iterator<String> its = params.keySet().iterator(); |
| | | List<String> list = new ArrayList<>(); |
| | |
| | | import de.greenrobot.event.EventBus; |
| | | |
| | | import android.util.Log; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.baichuan.android.trade.AlibcTradeSDK; |
| | | import com.alibaba.baichuan.android.trade.callback.AlibcTradeInitCallback; |
| | | import com.alibaba.baichuan.trade.biz.core.taoke.AlibcTaokeParams; |
| | | import com.bytedance.sdk.openadsdk.LocationProvider; |
| | | import com.bytedance.sdk.openadsdk.TTAdConfig; |
| | | import com.bytedance.sdk.openadsdk.TTAdConstant; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.bytedance.sdk.openadsdk.TTCustomController; |
| | | import com.kepler.jd.Listener.AsyncInitListener; |
| | | import com.kepler.jd.login.KeplerApiManager; |
| | | import com.qq.e.comm.managers.GDTADManager; |
| | | import com.qq.e.comm.managers.GDTAdSdk; |
| | | import com.qq.e.comm.managers.setting.GlobalSetting; |
| | | import com.tejia.lijin.app.ui.SplashActivity; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.ad.TTAdManagerHolder; |
| | | import com.tejia.lijin.app.util.ui.GoodsDetailUtil; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | | import com.tencent.mm.opensdk.openapi.IWXAPI; |
| | | import com.tencent.mm.opensdk.openapi.WXAPIFactory; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.umeng.commonsdk.UMConfigure; |
| | | import com.wpc.library.util.ManifestDataUtil; |
| | | import com.wpc.library.util.NetUtils; |
| | | import com.tejia.lijin.app.service.NetworkStateService; |
| | | import com.tejia.lijin.app.util.CrashHandler; |
| | | import com.tejia.lijin.app.util.TestUtil; |
| | | import com.tejia.lijin.app.util.ToolUtil; |
| | | import com.wpc.library.util.common.DeviceUtil; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.Method; |
| | |
| | | public static ShoppingApplication application = null; |
| | | public static boolean isJDInit = false; |
| | | |
| | | public static boolean init = false; |
| | | |
| | | // public Tencent mTencent; |
| | | |
| | | @Override |
| | | public void onCreate() { |
| | | super.onCreate(); |
| | | Log.i(TAG, "onCreate"); |
| | | application = this; |
| | | disableAPIDialog(); |
| | | //测试注入用户信息 |
| | |
| | | |
| | | |
| | | public static void init(final Application application) { |
| | | init = true; |
| | | GoodsDetailUtil.initInstallTime(application); |
| | | initAD(application); |
| | | //进程名字 |
| | |
| | | CrashHandler.getInstance().init(application); |
| | | } |
| | | |
| | | UMConfigure.init(application, UMConfigure.DEVICE_TYPE_PHONE, null); |
| | | String channel = ManifestDataUtil.getAppMetaData(application, "UMENG_CHANNEL"); |
| | | UMConfigure.init(application, application.getResources().getString(R.string.umeng_key), channel, UMConfigure.DEVICE_TYPE_PHONE, null); |
| | | UMConfigure.setEncryptEnabled(true); |
| | | MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO); |
| | | |
| | | if (!AlibcTradeSDK.initState.isInitialized() && !AlibcTradeSDK.initState.isInitializing()) |
| | | AlibcTradeSDK.asyncInit(application, new AlibcTradeInitCallback() { |
| | |
| | | /** |
| | | * 穿山甲广告初始化 |
| | | */ |
| | | private static void initAD(Context context) { |
| | | private static void initAD(final Context context) { |
| | | try { |
| | | GDTADManager.getInstance().initWith(context, Constant.GDT_APP_ID); |
| | | GlobalSetting.setEnableCollectAppInstallStatus(false); |
| | | GDTAdSdk.init(application, Constant.GDT_APP_ID); |
| | | |
| | | TTAdSdk.init(context, |
| | | new TTAdConfig.Builder() |
| | | .appId(Constant.CSJ_APP_ID) |
| | | .useTextureView(true) //默认使用SurfaceView播放视频广告,当有SurfaceView冲突的场景,可以使用TextureView |
| | | .appName("特价") |
| | | .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)//落地页主题 |
| | | .allowShowNotify(true) //是否允许sdk展示通知栏提示 |
| | | .debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用 |
| | | .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI) //允许直接下载的网络状态集合,没有设置的网络下点击下载apk会有二次确认弹窗,弹窗中会披露应用信息 |
| | | .supportMultiProcess(false) //是否支持多进程,true支持 |
| | | .asyncInit(true) //是否异步初始化sdk,设置为true可以减少SDK初始化耗时。3450版本开始废弃~~ |
| | | //.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。 |
| | | .build()); |
| | | TTAdManagerHolder.init(context, new TTAdSdk.InitCallback() { |
| | | @Override |
| | | public void success() { |
| | | Log.i(TAG, "穿山甲初始化成功"); |
| | | } |
| | | |
| | | @Override |
| | | public void fail(int i, String s) { |
| | | Log.e(TAG, "穿山甲初始化失败:"+s); |
| | | } |
| | | }); |
| | | } catch (Exception e) { |
| | | |
| | | } |
New file |
| | |
| | | package com.tejia.lijin.app.entity.common; |
| | | |
| | | public class ExpireValue { |
| | | private String value; |
| | | private long expireTime; |
| | | |
| | | public ExpireValue(String value, long expireTime) { |
| | | this.value = value; |
| | | this.expireTime = expireTime; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public long getExpireTime() { |
| | | return expireTime; |
| | | } |
| | | |
| | | public void setExpireTime(long expireTime) { |
| | | this.expireTime = expireTime; |
| | | } |
| | | } |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onResume(this); |
| | | if (!showRecommend) |
| | | return; |
| | | final SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); |
| | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | } |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onResume(this); |
| | | final SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); |
| | | if (enableRecommend) { |
| | | ClipboardUtil.getClipboardContent(this, new IClipboardContentListener() { |
| | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.DeviceInfoUtil; |
| | | import com.tejia.lijin.app.util.JumpActivityUtil; |
| | | import com.google.gson.Gson; |
| | | import com.umeng.analytics.MobclickAgent; |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | params.put("platform", "android"); |
| | | params.put("apiversion", "1"); |
| | | params.put("channel", GetManifestDataUtil.getAppMetaData(BrowserActivity.this, "UMENG_CHANNEL")); |
| | | String imei = MobileUtil.getIMEI(BrowserActivity.this); |
| | | String imei = DeviceInfoUtil.getIMEI(BrowserActivity.this); |
| | | if (!StringUtils.isEmpty(imei)) |
| | | params.put("imei", imei); |
| | | params.put("osVersion", MobileUtil.getSystemVersion()); |
| | |
| | | |
| | | |
| | | private static void jump(Activity context, String type, String activity, String params) { |
| | | Log.i(TAG, "推送事件跳转"); |
| | | pushData = null; |
| | | Log.i(TAG, String.format("%s:%s:%s", type, activity, params)); |
| | | JumpDetail jumpDetail = new JumpDetail(); |
| | |
| | | super.onCreate(savedInstanceState); |
| | | mTextView = new TextView(this); |
| | | setContentView(mTextView); |
| | | init(getIntent()); |
| | | } |
| | | |
| | | private void init(Intent intent) { |
| | | String activity = getIntent().getStringExtra("activity"); |
| | | String params = getIntent().getStringExtra("params"); |
| | | String type = getIntent().getStringExtra("type"); |
| | |
| | | builder.append("params:" + params); |
| | | mTextView.setText(builder.toString()); |
| | | if (!isAppRunning(getApplicationContext(), getPackageName())) { |
| | | Log.i(TAG, "当前应用没有运行"); |
| | | //暂存数据 |
| | | pushData = new PushData(type, activity, params); |
| | | Intent intent = new Intent(this, MainActivity.class); |
| | | startActivity(intent); |
| | | Intent intent1 = new Intent(this, MainActivity.class); |
| | | startActivity(intent1); |
| | | finish(); |
| | | } else { |
| | | Log.i(TAG, "当前应用在运行"); |
| | | jump(this, type, activity, params); |
| | | finish(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | Log.i(TAG, "onResume"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onNewIntent(Intent intent) { |
| | | super.onNewIntent(intent); |
| | | Log.i(TAG, "onNewIntent"); |
| | | init(intent); |
| | | } |
| | | |
| | | private boolean isAppRunning(Context context, String packageName) { |
| | | ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); |
New file |
| | |
| | | package com.tejia.lijin.app.ui; |
| | | |
| | | import android.annotation.SuppressLint; |
| | | import android.app.Activity; |
| | | import android.content.Intent; |
| | | import android.graphics.Bitmap; |
| | | import android.graphics.PixelFormat; |
| | | import android.os.Bundle; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.View.OnClickListener; |
| | | import android.webkit.WebChromeClient; |
| | | import android.webkit.WebResourceRequest; |
| | | import android.webkit.WebSettings; |
| | | import android.webkit.WebView; |
| | | import android.webkit.WebViewClient; |
| | | import android.widget.Button; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.ImageView; |
| | | import android.widget.ProgressBar; |
| | | import android.widget.TextView; |
| | | |
| | | import com.tejia.lijin.app.R; |
| | | import com.tejia.lijin.app.ui.dialog.ShapeLoadingDialog; |
| | | import com.tejia.lijin.app.util.AndroidBug5497Workaround; |
| | | import com.tejia.lijin.app.util.TopStatusSettings; |
| | | import com.tejia.lijin.app.util.web.RebateJavaInterface; |
| | | import com.tejia.lijin.app.util.web.RebateJavaInterfaceBS; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | |
| | | public class SimpleBrowserActivity extends Activity implements OnClickListener { |
| | | |
| | | private TextView tv_top_bar_left; |
| | | private TextView tv_top_bar_left2; |
| | | private ImageView iv_right; |
| | | private Button tv_top_bar_middle; |
| | | private WebView webview; |
| | | private FrameLayout fl_webview; |
| | | View v_cover_web; |
| | | ProgressBar progressBar; |
| | | ShapeLoadingDialog pd = null; |
| | | String mTitle; |
| | | RebateJavaInterface javaInterface; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | |
| | | setContentView(R.layout.browser_activity); |
| | | // AndroidBug5497Workaround.assistActivity(this); |
| | | // TopStatusSettings.setStatusViewAndDeepColor(this); |
| | | // getWindow().setFormat(PixelFormat.TRANSLUCENT); |
| | | tv_top_bar_left = findViewById(R.id.tv_top_bar_left); |
| | | tv_top_bar_left2 = findViewById(R.id.tv_top_bar_left2); |
| | | tv_top_bar_left2.setVisibility(View.VISIBLE); |
| | | tv_top_bar_middle = findViewById(R.id.tv_top_bar_middle1); |
| | | v_cover_web = findViewById(R.id.v_cover_web); |
| | | iv_right = findViewById(R.id.iv_top_bar_right); |
| | | iv_right.setVisibility(View.GONE); |
| | | fl_webview = findViewById(R.id.fl_webview); |
| | | |
| | | tv_top_bar_left.setOnClickListener(this); |
| | | tv_top_bar_left2.setOnClickListener(this); |
| | | iv_right.setOnClickListener(this); |
| | | v_cover_web.setOnClickListener(this); |
| | | tv_top_bar_middle.setVisibility(View.VISIBLE); |
| | | |
| | | |
| | | mTitle = getIntent().getStringExtra("title"); |
| | | if (!StringUtils.isEmpty(mTitle)) { |
| | | tv_top_bar_middle.setText(mTitle); |
| | | } |
| | | pd = new ShapeLoadingDialog.Builder(this).build(); |
| | | |
| | | webview = new WebView(SimpleBrowserActivity.this); |
| | | |
| | | fl_webview.addView(webview, new FrameLayout.LayoutParams( |
| | | FrameLayout.LayoutParams.MATCH_PARENT, |
| | | FrameLayout.LayoutParams.MATCH_PARENT)); |
| | | |
| | | |
| | | initWebView(); |
| | | progressBar = findViewById(R.id.myProgressBar); |
| | | progressBar.setMax(100); |
| | | progressBar.setProgressDrawable(this.getResources() |
| | | .getDrawable(R.drawable.color_progressbar)); |
| | | webview.loadUrl(getIntent().getStringExtra("url")); |
| | | } |
| | | |
| | | /** |
| | | * 初始化webview |
| | | */ |
| | | @SuppressLint("SetJavaScriptEnabled") |
| | | private void initWebView() { |
| | | WebSettings webSettings = webview.getSettings(); |
| | | webSettings.setJavaScriptEnabled(true); |
| | | webSettings.setDomStorageEnabled(true); |
| | | webSettings.setUseWideViewPort(true); |
| | | webSettings.setTextZoom(100); |
| | | webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);//设置缓存模式(根据cache-control决定是否从网络上取数据。) |
| | | |
| | | webview.setWebViewClient(webViewClient); |
| | | webview.setWebChromeClient(webChromeClient); |
| | | javaInterface = new RebateJavaInterface(SimpleBrowserActivity.this, |
| | | tv_top_bar_middle, tv_top_bar_left2, new TextView(this), iv_right, webview, pd); |
| | | webview.addJavascriptInterface(javaInterface, "yestv"); |
| | | } |
| | | |
| | | WebViewClient webViewClient = new WebViewClient() { |
| | | |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { |
| | | System.out.println("shouldOverrideUrlLoading"); |
| | | return super.shouldOverrideUrlLoading(view, request); |
| | | } |
| | | |
| | | @Override |
| | | public boolean shouldOverrideUrlLoading(WebView view, String url) { |
| | | if (!url.startsWith("http")) |
| | | return true; |
| | | return super.shouldOverrideUrlLoading(view, url); |
| | | } |
| | | |
| | | @Override |
| | | public void onPageStarted(WebView view, String url, Bitmap favicon) { |
| | | super.onPageStarted(view, url, favicon); |
| | | if (view.canGoBack()) { |
| | | tv_top_bar_left2.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_web_close, 0, 0, 0); |
| | | } else { |
| | | tv_top_bar_left2.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | WebChromeClient webChromeClient = new WebChromeClient() { |
| | | |
| | | |
| | | @Override |
| | | public void onReceivedTitle(WebView view, String title) { |
| | | if (StringUtils.isEmpty(mTitle) && null != title && !StringUtils.isEmpty(title.trim())) { |
| | | tv_top_bar_middle.setText(title); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onProgressChanged(WebView webView, int i) { |
| | | if (i == 100) { |
| | | progressBar.setVisibility(View.GONE); |
| | | } else { |
| | | if (View.INVISIBLE == progressBar.getVisibility()) { |
| | | progressBar.setVisibility(View.VISIBLE); |
| | | } |
| | | progressBar.setProgress(i); |
| | | } |
| | | super.onProgressChanged(webView, i); |
| | | } |
| | | |
| | | }; |
| | | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | if (webview != null) { |
| | | webview.onResume(); |
| | | webview.loadUrl("javascript:yestvcallback.resume()"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | if (webview != null) { |
| | | webview.onPause(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected void onDestroy() { |
| | | if (webview != null) { |
| | | webview.removeAllViews(); |
| | | webview.destroy(); |
| | | } |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.tv_top_bar_left: { |
| | | if (webview.canGoBack()) { |
| | | webview.goBack(); |
| | | } else { |
| | | finish(); |
| | | } |
| | | } |
| | | break; |
| | | case R.id.tv_top_bar_left2: { |
| | | finish(); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| | | if ((keyCode == KeyEvent.KEYCODE_BACK)) { |
| | | if (webview.canGoBack()) { |
| | | webview.goBack(); // goBack()表示返回WebView的上一页面 |
| | | return true; |
| | | } else { |
| | | finish(); |
| | | } |
| | | } |
| | | return super.onKeyDown(keyCode, event); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | protected void onNewIntent(Intent intent) { |
| | | super.onNewIntent(intent); |
| | | } |
| | | } |
| | |
| | | import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; |
| | | import com.qq.e.ads.splash.SplashAD; |
| | | import com.qq.e.ads.splash.SplashADListener; |
| | | import com.qq.e.comm.managers.GDTADManager; |
| | | import com.qq.e.comm.managers.GDTAdSdk; |
| | | import com.qq.e.comm.managers.setting.GlobalSetting; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.tejia.lijin.app.ShoppingApplication; |
| | | import com.tejia.lijin.app.ui.dialog.PermissionAuthNotifyDialog; |
| | | import com.tejia.lijin.app.ui.dialog.UserGuideDialog; |
| | | import com.tejia.lijin.app.ui.dialog.UserProtocolDialog; |
| | | import com.tejia.lijin.app.util.user.UserUtil; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | import androidx.core.content.ContextCompat; |
| | | import okhttp3.Call; |
| | | |
| | | import static android.content.pm.PackageManager.PERMISSION_DENIED; |
| | | import static android.content.pm.PackageManager.PERMISSION_GRANTED; |
| | | |
| | | /** |
| | | * Created by weikou2015 on 2017/2/20. |
| | | */ |
| | | public class SplashActivity extends BaseActivity implements SplashADListener { |
| | | public class SplashActivity extends Activity implements SplashADListener { |
| | | // 所需的全部权限 |
| | | static final String[] PERMISSIONS = new String[]{ |
| | | Manifest.permission.READ_PHONE_STATE};//, Manifest.permission.READ_EXTERNAL_STORAGE, |
| | |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_splash); |
| | | initView(); |
| | | setShowRecommend(false); |
| | | // TopStatusSettings.setStatusViewAndDeepColor(this); |
| | | ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); |
| | | ActivityManager.RunningTaskInfo info = manager.getRunningTasks(1).get(0); |
| | | int acitivitynum = info.numActivities; |
| | | if (acitivitynum > 1) { |
| | | finish(); |
| | | } |
| | | |
| | | /*同化顶部状态栏*/ |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | 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); |
| | | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
| | | window.setStatusBarColor(Color.TRANSPARENT); |
| | | //设置状态栏文字颜色及图标为深色 |
| | | window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | try { |
| | | Class decorViewClazz = Class.forName("com.android.internal.policy.DecorView"); |
| | | Field field = decorViewClazz.getDeclaredField("mSemiTransparentStatusBarColor"); |
| | | field.setAccessible(true); |
| | | field.setInt(getWindow().getDecorView(), Color.TRANSPARENT); //改为透明 |
| | | } catch (Exception e) { |
| | | if (UserUtil.isAgreeUserProtocol(getApplicationContext())) { |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| | | 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); |
| | | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); |
| | | window.setStatusBarColor(Color.TRANSPARENT); |
| | | //设置状态栏文字颜色及图标为深色 |
| | | window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | try { |
| | | Class decorViewClazz = Class.forName("com.android.internal.policy.DecorView"); |
| | | Field field = decorViewClazz.getDeclaredField("mSemiTransparentStatusBarColor"); |
| | | field.setAccessible(true); |
| | | field.setInt(getWindow().getDecorView(), Color.TRANSPARENT); //改为透明 |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | iv_splash = findViewById(R.id.iv_splash); |
| | | |
| | | if (UserUtil.isAgreeUserProtocol(this)) { |
| | | init(); |
| | | nextStep(); |
| | | } else { |
| | | String data = "感谢您对特价一直以来的信任!<br> 我们依照新的监管要求条例更新了<a href=\"http://h5.tejia.yeshitv.com/privacy.html\" style=\"text-decoration: none;\">《隐私政策》</a> 和<a href=\"http://h5.tejia.yeshitv.com/user-protocol.html\" style=\"text-decoration: none;\">《用户协议》</a>,为采取相应安全保护措施,尽力保护您的个人信息安全可控,特向你说明如下:\n" + |
| | | "\t\t<br> 1、您在使用特价各项产品或服务时,将会提供与具体功能相关的个人信息(可能涉及帐号、位置、交易等信息)。\n" + |
| | | "\t\t<br> 2、您可以随时查询、更正、删除您的个人信息,我们也提供账户注销的渠道。\n" + |
| | | "\t\t<br> 3、未经您的再次同意,我们不会将上述信息用于您未授权的其他用途或目的。\n" + |
| | | "\t\t<br> 4、未经监护人同意,我们不会收集使用14周岁以下(含14周岁)未成年人个人信息,且不会利用其信息推送新闻、时政信息、广告等定向推送活动。"; |
| | | String data = "尊敬的用户:<br>感谢您对" + getResources().getString(R.string.app_name) + "一直以来的信任!<br>"; |
| | | data += "我们非常尊重并保护您的个人信息、隐私。为了更好的保障您的权利,在您使用我们的产品之前,请您务必审慎阅读"; |
| | | data += String.format("<a href='%s'>《隐私政策》</a>和", "http://h5.tejia.yeshitv.com/privacy.html"); |
| | | data += String.format("<a href='%s'>《用户协议》</a>", "http://h5.tejia.yeshitv.com/user-protocol.html"); |
| | | data += "内的所有条款,<b>尤其是:<br>" + |
| | | "1、我们对您的个人信息(包括但不限于<font color='#FF0000'>设备MAC地址、IMEI/AndroidID/OAID/IMSI/ICCID/GAID/MEID</font>等信息)的收集/保存/使用/对外提供/保护等规则条款,以及您的用户权利等条款;<br>" + |
| | | "2、约定我们的限制责任、免责条款;<br>" + |
| | | "3、其他以加粗或斜体字进行标识的重要条款。</b><br>" + |
| | | "如您对协议有任何疑虑,可通过电子邮箱: tjapp@qq.com 向我们询问,我们将为您竭诚解答。您点击“同意”的行为代表您已阅读完毕并接受以上协议全部条款。如您同意以上协议内容,请您点击“同意”,开始使用您的产品。"; |
| | | showUserProtocolAndGuide(data); |
| | | } |
| | | } |
| | | |
| | | |
| | | private void myRequetPermission() { |
| | | if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PERMISSION_GRANTED) { |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | //是否需要再次请求权限 |
| | | if (sharedPreferences.getBoolean("show", true)) |
| | | ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_PHONE_STATE}, REQUEST_CODE); |
| | | else { |
| | | nextStep(); |
| | | } |
| | | } else { |
| | | nextStep(); |
| | | } |
| | | } |
| | | |
| | |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | UserUtil.agreeUserProtocol(getApplicationContext()); |
| | | dialog.dismiss(); |
| | | ShoppingApplication.init(ShoppingApplication.application); |
| | | init(); |
| | | //展示弹框 |
| | | new PermissionAuthNotifyDialog.Builder(SplashActivity.this).setPositiveButton(null, new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialog, int which) { |
| | | dialog.dismiss(); |
| | | myRequetPermission(); |
| | | } |
| | | }).create().show(); |
| | | //请求权限 |
| | | } |
| | | }); |
| | | dialogBuilder.create().show(); |
| | | |
| | | } |
| | | |
| | | private void init() { |
| | | |
| | | private void nextStep() { |
| | | ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); |
| | | ActivityManager.RunningTaskInfo info = manager.getRunningTasks(1).get(0); |
| | | int acitivitynum = info.numActivities; |
| | | if (acitivitynum > 1) { |
| | | finish(); |
| | | } |
| | | if (!ShoppingApplication.init) { |
| | | ShoppingApplication.init(ShoppingApplication.application); |
| | | } |
| | | |
| | | if (!AlibcTradeSDK.initState.isInitialized() && !AlibcTradeSDK.initState.isInitializing()) |
| | | taobaoInit(); |
| | | getSystemParams(); |
| | |
| | | @Override |
| | | public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { |
| | | super.onRequestPermissionsResult(requestCode, permissions, grantResults); |
| | | if (requestCode == 1024 && hasAllPermissionsGranted(grantResults)) { |
| | | GDTAdInfo adInfo = AdUtil.getGDTADInfo(getApplicationContext()); |
| | | if (adInfo == null) |
| | | return; |
| | | fetchSplashAD(this, container, skipView, adInfo.getSplashPid(), this, 0); |
| | | } else { |
| | | // 如果用户没有授权,那么应该说明意图,引导用户去设置里面授权。 |
| | | Toast.makeText(this, "应用缺少必要的权限!请点击\"权限\",打开所需要的权限。", Toast.LENGTH_LONG).show(); |
| | | Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); |
| | | intent.setData(Uri.parse("package:" + getPackageName())); |
| | | startActivity(intent); |
| | | finish(); |
| | | if (requestCode == REQUEST_CODE) { |
| | | for (int i = 0; i < permissions.length; i++) { |
| | | if (grantResults[i] == PERMISSION_GRANTED) {//选择了“始终允许” |
| | | myRequetPermission(); |
| | | } else { |
| | | //拒绝了授权 |
| | | if (grantResults[i] == PERMISSION_DENIED) { |
| | | SharedPreferences sharedPreferences = getSharedPreferences("permission", Context.MODE_PRIVATE); |
| | | SharedPreferences.Editor editor = sharedPreferences.edit(); |
| | | editor.putBoolean("show", false); |
| | | editor.commit(); |
| | | } |
| | | nextStep(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | GDTAdInfo info = new Gson().fromJson(ad.toString(), GDTAdInfo.class); |
| | | if (info != null) { |
| | | AdUtil.saveGDTADInfo(getApplicationContext(), info); |
| | | GDTADManager.getInstance().initWith(SplashActivity.this, info.getAppId()); |
| | | GlobalSetting.setEnableCollectAppInstallStatus(false); |
| | | GDTAdSdk.init(SplashActivity.this, info.getAppId()); |
| | | loadAD(); |
| | | iv_splash.postDelayed(new Runnable() { |
| | | @Override |
| | |
| | | OkHttpUtils.getInstance().cancelTag(tag2); |
| | | OkHttpUtils.getInstance().cancelTag(tag3); |
| | | handler.removeCallbacksAndMessages(null); |
| | | } |
| | | |
| | | private void startPermissionsActivity() { |
| | | PermissionsActivity.startActivityForResult(this, REQUEST_CODE, true, PERMISSIONS); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onADClicked() { |
| | | Log.i("AD_DEMO", "SplashADClicked clickUrl: " |
| | | + (splashAD.getExt() != null ? splashAD.getExt().get("clickUrl") : "")); |
| | | |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.tejia.lijin.app.ui.dialog; |
| | | |
| | | import android.app.Activity; |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.tejia.lijin.app.R; |
| | | import com.wpc.library.util.SystemCommon; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | |
| | | public class PermissionAuthNotifyDialog extends Dialog { |
| | | |
| | | public PermissionAuthNotifyDialog(Context context) { |
| | | super(context); |
| | | this.setCancelable(false); |
| | | } |
| | | |
| | | public PermissionAuthNotifyDialog(Context context, int theme) { |
| | | super(context, theme); |
| | | this.setCancelable(false); |
| | | } |
| | | |
| | | |
| | | public static class Builder { |
| | | public final static int TEXT_ALIGIN_LEFT = 1; |
| | | public final static int TEXT_ALIGIN_MIDDLE = 2; |
| | | public final static int TEXT_ALIGIN_RIGHT = 3; |
| | | |
| | | private Activity context; |
| | | String webviewData; |
| | | String title; |
| | | private String positiveButtonText; |
| | | private String negativeButtonText; |
| | | private OnClickListener positiveButtonClickListener; |
| | | private OnClickListener negativeButtonClickListener; |
| | | |
| | | public Builder(Activity context) { |
| | | this.context = context; |
| | | } |
| | | |
| | | |
| | | public Builder setPositiveButton(String positiveButtonText, |
| | | OnClickListener listener) { |
| | | this.positiveButtonText = positiveButtonText; |
| | | this.positiveButtonClickListener = listener; |
| | | return this; |
| | | } |
| | | |
| | | public PermissionAuthNotifyDialog create() { |
| | | LayoutInflater inflater = (LayoutInflater) context |
| | | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| | | final PermissionAuthNotifyDialog dialog = new PermissionAuthNotifyDialog(context, R.style.Dialog); |
| | | dialog.setCanceledOnTouchOutside(false); |
| | | final View layout = inflater.inflate(R.layout.dialog_auth_notify, null); |
| | | dialog.addContentView(layout, new FrameLayout.LayoutParams( |
| | | FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | TextView tv_positive = layout.findViewById(R.id.tv_positive); |
| | | |
| | | |
| | | // set the confirm button |
| | | if (positiveButtonClickListener != null) { |
| | | if (!StringUtils.isEmpty(positiveButtonText)) |
| | | tv_positive.setText(positiveButtonText); |
| | | tv_positive.setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | positiveButtonClickListener.onClick(dialog, |
| | | DialogInterface.BUTTON_POSITIVE); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | dialog.setContentView(layout); |
| | | |
| | | android.view.WindowManager.LayoutParams params = dialog.getWindow() |
| | | .getAttributes(); |
| | | params.width = (int) ((SystemCommon.getScreenWidth(context) * 3) / 4); |
| | | params.height = android.view.WindowManager.LayoutParams.WRAP_CONTENT; |
| | | dialog.getWindow().setAttributes(params); |
| | | return dialog; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.graphics.Color; |
| | | import android.text.method.LinkMovementMethod; |
| | | import android.view.LayoutInflater; |
| | |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.tejia.lijin.app.ui.SimpleBrowserActivity; |
| | | import com.wpc.library.util.SystemCommon; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | import com.tejia.lijin.app.R; |
| | |
| | | LayoutInflater inflater = (LayoutInflater) context |
| | | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| | | final UserProtocolDialog dialog = new UserProtocolDialog(context, R.style.Dialog); |
| | | dialog.setCanceledOnTouchOutside(true); |
| | | dialog.setCanceledOnTouchOutside(false); |
| | | final View layout = inflater.inflate(R.layout.dialog_user_protocol, null); |
| | | dialog.addContentView(layout, new FrameLayout.LayoutParams( |
| | | FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | TextView tv_title = layout.findViewById(R.id.tv_title); |
| | | TextView tv_content = layout.findViewById(R.id.tv_content); |
| | | tv_content.setText(TextViewUtil.getClickableHtml(webviewData, context, Color.rgb(23, 106, 230))); |
| | | tv_content.setText(TextViewUtil.getClickableHtml(webviewData, context, Color.rgb(23, 106, 230), new TextViewUtil.URLClickListener() { |
| | | |
| | | @Override |
| | | public void onClick(String url) { |
| | | context.startActivity(new Intent(context, SimpleBrowserActivity.class).putExtra("url", url)); |
| | | } |
| | | })); |
| | | tv_content.setMovementMethod(LinkMovementMethod.getInstance()); |
| | | tv_content.setClickable(false); |
| | | tv_content.setHighlightColor(context.getResources().getColor(android.R.color.transparent)); |
| | |
| | | mChangeHelper.registerReceiver(); |
| | | indicator_category.setViewPager(vp_banner); |
| | | |
| | | // MobclickAgent.onPageStart("分类详情页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | // MobclickAgent.onPageEnd("分类详情页"); |
| | | srl_second_category.setRefreshing(false); |
| | | srl_second_category.destroyDrawingCache(); |
| | | srl_second_category.clearAnimation(); |
| | |
| | | |
| | | mPermissionsChecker = new PermissionHelper(this, this); |
| | | // webview.loadUrl("http://mp.weixin.qq.com/s/mu3lJ1DYEc0MxgnMHArHYA"); |
| | | // String url = "http://192.168.1.122:8848/test/WKWebView.html"; |
| | | //url = "https://amcn.bytedance.com/ug/armor/623040fd8df75a02420060e1?show_loading=1&pull_down_close=0&enter_from=UG_CF_CSJ_2022&ug_feed_type=1&ug_app=0&plan_id=7106425777876369677&ug_app=0&page_id=F618&ecom_pid=dy_107062945313497465096_11642_3276765365"; |
| | | if (!StringUtils.isEmpty(url)) { |
| | | getWebConfig(url); |
| | | } |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | if (webview != null) { |
| | | webview.onResume(); |
| | | webview.loadUrl("javascript:yestvcallback.resume()"); |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | if (webview != null) { |
| | | webview.onPause(); |
| | | } |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | if (webview != null) { |
| | | webview.onResume(); |
| | | webview.loadUrl("javascript:yestvcallback.resume()"); |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | if (webview != null) { |
| | | webview.onPause(); |
| | | } |
| | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("主页"); |
| | | MobclickAgent.onPause(this); |
| | | //注销美洽客服广播 |
| | | } |
| | | |
| | |
| | | listener(contentView); |
| | | app = new UpdateApp(getActivity(), getResources().getString(R.string.update_key)); |
| | | mPermissionsChecker = new PermissionHelper(getActivity(), this); |
| | | // startActivity(new Intent(getContext(),ShareBrowserActivity.class).putExtra("url","http://192.168.3.122:8848/flqFront/help/pdd.html?resourceType=39997")); |
| | | // startActivity(new Intent(getContext(),ShareBrowserActivity.class).putExtra("url","http://192.168.3.16:52330/index.html")); |
| | | } |
| | | |
| | | private void init(View contentView) { |
| | |
| | | getUserConfig(); |
| | | getLijinUserLevel(); |
| | | getUnReadMsgCount(UserUtil.getUid(getContext())); |
| | | MobclickAgent.onPageStart("我的"); |
| | | vp_banner.postDelayed(mAutoScroller, 2000); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("我的"); |
| | | lastTime = System.currentTimeMillis(); |
| | | toast_dialog.dialog_dismiss(); |
| | | ll_balance.setEnabled(true); |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("精选"); |
| | | mChangeHelper.registerReceiver(); |
| | | SharedPreferences sp = ll_recommend_content.getContext() |
| | | .getSharedPreferences("user", MODE_PRIVATE); |
| | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("精选"); |
| | | // Log.e("mResult", "首页onPause"); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| | | |
| | | setSendCodeState(); |
| | | setSetLoginPhoneState(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | Log.i(TAG, "onResume"); |
| | | MobclickAgent.onResume(this); |
| | | SharedPreferences sp = getSharedPreferences("user", MODE_PRIVATE); |
| | | boolean isLogin =UserUtil.isLogin(getApplicationContext()); |
| | | if (isLogin) {//用户已经登录 |
| | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | if (isIntent) { |
| | | finish(); |
| | | } |
| | |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | setContentView(R.layout.activity_login_select); |
| | | setShowRecommend(false); |
| | | mAquery = new AQuery(this); |
| | | TopStatusSettings.setStatusViewAndDeepColorNoView(this); |
| | | initData(getIntent()); |
| | |
| | | canSend = true; |
| | | } |
| | | } |
| | | if(canSend) { |
| | | tv_login_gain_sms.setEnabled(canSend); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable editable) { |
| | | tv_login_gain_sms.setEnabled(editable.length() == 13 ? true : false); |
| | | String text=editable !=null?editable.toString():""; |
| | | if(text.replace(" ","").length()==11){ |
| | | tv_login_gain_sms.setEnabled(true); |
| | | }else{ |
| | | tv_login_gain_sms.setEnabled(false); |
| | | } |
| | | |
| | | // tv_login_gain_sms.setBackgroundResource(editable.length() == 13 ? |
| | | // R.drawable.shape_mobile_login_light : R.drawable.shape_login_gain_sms); |
| | | } |
| | |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | Log.i(TAG, "onResume"); |
| | | MobclickAgent.onResume(this); |
| | | boolean isLogin = UserUtil.isLogin(getApplicationContext()); |
| | | if (isLogin) {//用户已经登录 |
| | | if (isWXLogin) { |
| | |
| | | mAquery.id(R.id.ll_other_login).visibility(View.GONE); |
| | | mAquery.id(R.id.tv_login_onekey).text("本机号码一键绑定"); |
| | | mAquery.id(R.id.tv_mobile_hint).text(String.format("新的手机号必须没有绑定过其他%s帐号", getResources().getString(R.string.app_name))); |
| | | |
| | | mAquery.id(R.id.cb_agree).checked(false); |
| | | |
| | | break; |
| | | } |
| | | |
| | |
| | | |
| | | break; |
| | | case R.id.tv_login_gain_sms: |
| | | if (!isAgreed()) { |
| | | if (!isAgreed() && (type == TYPE_LOGIN || type == TYPE_BIND_WITHOUT_LOGINED)) { |
| | | return; |
| | | } |
| | | tv_login_gain_sms.setEnabled(false); |
| | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | if (isIntent) { |
| | | finish(); |
| | | } |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onResume(this); |
| | | } |
| | | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | class HistoryAdapter extends BaseAdapter { |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | mChangeHelper.registerReceiver(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | if (clickState == 1) { |
| | | showOrder(); |
| | | } |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | mChangeHelper.unregisterReceiver(); |
| | | if (ups != null) { |
| | | ups.dialog_dismiss(); |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onResume(this); |
| | | setSearchHistoryData(); |
| | | } |
| | | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | |
| | |
| | | private TextView tv_version; |
| | | private TextView tv_cache_num; |
| | | private CheckBox cb_msg, cb_no_see_red_point, cb_no_see_reward_statistics, |
| | | cb_no_see_share_and_selection, cb_no_see_phone;// cb_no_see_invite_reward;, cb_open_share_red_packet//开启推广红包 |
| | | cb_no_see_share_and_selection, cb_no_see_phone,cb_push;// cb_no_see_invite_reward;, cb_open_share_red_packet//开启推广红包 |
| | | private LinearLayout ll_clear_cache, ll_check_update, ll_person_info, ll_account_grade, |
| | | ll_about_us, ll_exit_account; |
| | | private int shareRedPacket, noBonusCount, noNewsRedDot, noShareRecordAndStorage, noDisplayPhoneNum; |
| | |
| | | cb_no_see_share_and_selection = findViewById(R.id.cb_no_see_share_and_selection); |
| | | |
| | | cb_no_see_phone = findViewById(R.id.cb_no_see_phone); |
| | | cb_push= findViewById(R.id.cb_push); |
| | | // cb_no_see_invite_reward = findViewById(R.id.cb_no_see_invite_reward); |
| | | ll_clear_cache = findViewById(R.id.ll_clear_cache); |
| | | ll_check_update = findViewById(R.id.ll_check_update); |
| | |
| | | editor.commit(); |
| | | } |
| | | }); |
| | | |
| | | cb_push.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | | UserCustomEvent.userSettingCommon(SettingActivity.this, "个性化推送开关"); |
| | | SharedPreferences.Editor editor = sp.edit(); |
| | | ToolUtil.notDisturb(SettingActivity.this, isChecked); |
| | | if (isChecked) |
| | | editor.putBoolean("doNotRecommend", true); |
| | | else |
| | | editor.putBoolean("doNotRecommend", false); |
| | | editor.commit(); |
| | | } |
| | | }); |
| | | |
| | | cb_no_see_red_point.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { |
| | | @Override |
| | | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| | |
| | | noDisplayPhoneNum = getIntent().getIntExtra("noDisplayPhoneNum", 0); |
| | | |
| | | cb_msg.setChecked(sp.getBoolean("doNotDisturb", false)); |
| | | cb_push.setChecked(sp.getBoolean("doNotRecommend", false)); |
| | | |
| | | // cb_open_share_red_packet.setChecked(shareRedPacket == 1 ? true : false); |
| | | cb_no_see_red_point.setChecked(noNewsRedDot == 1 ? true : false); |
| | | cb_no_see_reward_statistics.setChecked(noBonusCount == 1 ? true : false); |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onResume(this); |
| | | if (dialog != null && dialog.isShowing()) { |
| | | dialog.dismiss(); |
| | | dialog.cancel(); |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("购物车"); |
| | | final SharedPreferences sp = getActivity().getSharedPreferences("user", MODE_PRIVATE); |
| | | boolean isLogin = sp.getBoolean("isLogin", false); |
| | | if (isLogin) { |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("购物车"); |
| | | } |
| | | |
| | | private void bindInfo() { |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.gson.Gson; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.DeviceInfoUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | | import com.wpc.library.DeviceUuidFactory; |
| | | import com.wpc.library.util.GetManifestDataUtil; |
| | |
| | | params.put("uid", getSharedPreferences("user", MODE_PRIVATE).getString("uid", "")); |
| | | params.put("apiversion", "1"); |
| | | params.put("channel", GetManifestDataUtil.getAppMetaData(ChoicenessFreightFreeActivity.this, "UMENG_CHANNEL")); |
| | | String imei = MobileUtil.getIMEI(ChoicenessFreightFreeActivity.this); |
| | | String imei = DeviceInfoUtil.getIMEI(ChoicenessFreightFreeActivity.this); |
| | | if (!StringUtils.isEmpty(imei)) |
| | | params.put("imei", imei); |
| | | params.put("osVersion", MobileUtil.getSystemVersion()); |
| | |
| | | public void onResume() { |
| | | super.onResume(); |
| | | mChangeHelper.registerReceiver(); |
| | | MobclickAgent.onPageStart("搜索页"); |
| | | mPresenter.setHistoricalRecords(mBundle.getInt("id"), mList, ll_search_history_hint, null, ll_guidevideo, videoPicture);//显示历史记录 |
| | | setSearchHistoryData(); |
| | | } |
| | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("搜索页"); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | if (!getSharedPreferences("user", MODE_PRIVATE).getBoolean("isLogin", false)) { |
| | | if (getSharedPreferences("user", MODE_PRIVATE).getString("is_goods_web_detail", "0").contains("0")) { |
| | | findViewById(R.id.tv_prombt).setVisibility(View.GONE); |
| | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | @Override |
| | |
| | | super.onResume(); |
| | | mChangeHelper.registerReceiver(); |
| | | indicator_category.setViewPager(vp_banner); |
| | | MobclickAgent.onPageStart("分类详情页"); |
| | | |
| | | long stayTime = System.currentTimeMillis() - bannerAdapter.clickTime; |
| | | if (bannerAdapter.clickTime > 0 && stayTime > 15 * 1000) { |
| | |
| | | public void onPause() { |
| | | super.onPause(); |
| | | mChangeHelper.unregisterReceiver(); |
| | | MobclickAgent.onPageEnd("分类详情页"); |
| | | srl_second_category.setRefreshing(false); |
| | | srl_second_category.destroyDrawingCache(); |
| | | srl_second_category.clearAnimation(); |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("搜索页"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("搜索页"); |
| | | } |
| | | |
| | | |
| | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("网页"); |
| | | } |
| | | |
| | | @Override |
| | | public void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("网页"); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onResume(this); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPause(this); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | protected void onResume() { |
| | | super.onResume(); |
| | | MobclickAgent.onPageStart("学院文章搜索页"); |
| | | } |
| | | |
| | | @Override |
| | | protected void onPause() { |
| | | super.onPause(); |
| | | MobclickAgent.onPageEnd("学院文章搜索页"); |
| | | } |
| | | |
| | | |
| | |
| | | import com.tejia.lijin.app.R; |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.util.TimeJudge; |
| | | import com.wpc.library.util.common.DeviceUtil; |
| | | |
| | | import org.apache.http.Header; |
| | | import org.json.JSONObject; |
| | |
| | | |
| | | //检测是否安装了应用宝 |
| | | private boolean isMobile_spExist() { |
| | | PackageManager manager = mActivity.getPackageManager(); |
| | | List<PackageInfo> pkgList = manager.getInstalledPackages(0); |
| | | List<PackageInfo> pkgList = DeviceUtil.getInstalledPackagesCache(mActivity); |
| | | for (int i = 0; i < pkgList.size(); i++) { |
| | | PackageInfo pI = pkgList.get(i); |
| | | if (pI.packageName.equalsIgnoreCase("com.tencent.android.qqdownloader")) |
New file |
| | |
| | | package com.tejia.lijin.app.util; |
| | | |
| | | import android.content.Context; |
| | | import android.content.SharedPreferences; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.tejia.lijin.app.entity.common.ExpireValue; |
| | | import com.wpc.library.DeviceUuidFactory; |
| | | import com.wpc.library.util.MobileUtil; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | |
| | | import static android.content.Context.MODE_PRIVATE; |
| | | |
| | | public class DeviceInfoUtil { |
| | | enum DeviceInfoType { |
| | | deviceId("device_id_"), imei("imei_"), androidId("android_id_"), mac("mac_"), utdid("utdid_"), systemModel("system_model_"), systemVersion("system_version_"); |
| | | private String key; |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | private DeviceInfoType(String key) { |
| | | this.key = key; |
| | | } |
| | | } |
| | | |
| | | |
| | | private static String getDeviceInfo(Context context, DeviceInfoType deviceInfoType) { |
| | | SharedPreferences deviceInfo = context.getSharedPreferences("deviceInfo", MODE_PRIVATE); |
| | | String data = deviceInfo.getString(deviceInfoType.getKey(), ""); |
| | | ExpireValue value = null; |
| | | if (!StringUtils.isEmpty(data)) { |
| | | value = new Gson().fromJson(data, ExpireValue.class); |
| | | if (value.getExpireTime() < System.currentTimeMillis()) { |
| | | value = null; |
| | | } |
| | | } |
| | | |
| | | if (value == null) { |
| | | String v = ""; |
| | | if (deviceInfoType == DeviceInfoType.imei) { |
| | | v = MobileUtil.getIMEI(context); |
| | | } else if (deviceInfoType == DeviceInfoType.utdid) { |
| | | v = com.ta.utdid2.device.UTDevice.getUtdid(context); |
| | | } else if (deviceInfoType == DeviceInfoType.systemModel) { |
| | | v = MobileUtil.getSystemModel(); |
| | | } else if (deviceInfoType == DeviceInfoType.systemVersion) { |
| | | v = MobileUtil.getSystemVersion(); |
| | | } else if (deviceInfoType == DeviceInfoType.deviceId) { |
| | | v = new DeviceUuidFactory(context).getDeviceUuid() + ""; |
| | | } |
| | | value = new ExpireValue(v, System.currentTimeMillis() + 1000 * 60 * 10); |
| | | SharedPreferences.Editor editor = deviceInfo.edit(); |
| | | editor.putString(deviceInfoType.getKey(), new Gson().toJson(value)); |
| | | editor.commit(); |
| | | } |
| | | if (value == null) |
| | | return ""; |
| | | else |
| | | return value.getValue(); |
| | | } |
| | | |
| | | public static String getIMEI(Context context) { |
| | | return getDeviceInfo(context, DeviceInfoType.imei); |
| | | } |
| | | |
| | | public static String getAndroidId(Context context) { |
| | | return getDeviceInfo(context, DeviceInfoType.androidId); |
| | | } |
| | | |
| | | public static String getUtdid(Context context) { |
| | | return getDeviceInfo(context, DeviceInfoType.utdid); |
| | | } |
| | | |
| | | public static String getSystemModel(Context context) { |
| | | return getDeviceInfo(context, DeviceInfoType.systemModel); |
| | | } |
| | | |
| | | public static String getSystemVersion(Context context) { |
| | | return getDeviceInfo(context, DeviceInfoType.systemVersion); |
| | | } |
| | | |
| | | public static String getDeviceId(Context context) { |
| | | return getDeviceInfo(context, DeviceInfoType.deviceId); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.content.pm.ApplicationInfo; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.database.Cursor; |
| | |
| | | import com.wpc.lcjianlibrary.BuildConfig; |
| | | import com.wpc.library.util.MobileUtil; |
| | | import com.tejia.lijin.app.ui.dialog.UnbindDialog; |
| | | import com.wpc.library.util.common.DeviceUtil; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileNotFoundException; |
| | |
| | | public static int isTaobaoAvilible(final Context context) { |
| | | int returnNum; |
| | | final PackageManager packageManager = context.getPackageManager();// 获取packagemanager |
| | | List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);// 获取所有已安装程序的包信息 |
| | | List<PackageInfo> pinfo = DeviceUtil.getInstalledPackagesCache(context); |
| | | if (pinfo != null) { |
| | | boolean isReadSuc = false; |
| | | for (int i = 0; i < pinfo.size(); i++) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param context |
| | | * @return 0-安装了微信 1-没有读取应用权限 2-没有安装微信 |
| | | */ |
| | |
| | | public static int isWeixinAvilible(final Context context) { |
| | | int returnNum = 2; |
| | | final PackageManager packageManager = context.getPackageManager();// 获取packagemanager |
| | | List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);// 获取所有已安装程序的包信息 |
| | | List<PackageInfo> pinfo = DeviceUtil.getInstalledPackagesCache(context); |
| | | if (pinfo != null) { |
| | | boolean isReadSuc = false; |
| | | for (int i = 0; i < pinfo.size(); i++) { |
| | |
| | | //判断是否安装了sina |
| | | public static int isSinaAvilible(Context context) { |
| | | final PackageManager packageManager = context.getPackageManager();// 获取packagemanager |
| | | List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);// 获取所有已安装程序的包信息 |
| | | List<PackageInfo> pinfo = DeviceUtil.getInstalledPackagesCache(context); |
| | | int returnNum = 2; |
| | | if (pinfo != null) { |
| | | boolean isReadSuc = false; |
| | |
| | | //判断是否安装了QQ |
| | | public static int isQQAvilible(Context context) { |
| | | final PackageManager packageManager = context.getPackageManager();// 获取packagemanager |
| | | List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);// 获取所有已安装程序的包信息 |
| | | List<PackageInfo> pinfo = DeviceUtil.getInstalledPackagesCache(context); |
| | | int returnNum; |
| | | if (pinfo != null) { |
| | | boolean isReadSuc = false; |
| | |
| | | |
| | | private static void openAppListPermission(final Context context, String platform) { |
| | | UnbindDialog.Builder builder = new UnbindDialog.Builder(context); |
| | | builder.setMessage("需要检测是否安装" + platform +",请打开 读取应用列表权限") |
| | | builder.setMessage("需要检测是否安装" + platform + ",请打开 读取应用列表权限") |
| | | .setNegativeButton("取消", new DialogInterface.OnClickListener() { |
| | | @Override |
| | | public void onClick(DialogInterface dialogInterface, int i) { |
| | |
| | | * @return content Uri |
| | | */ |
| | | public static Uri getImageContentUri(Context context, File imageFile) { |
| | | // if (1 > 0) { |
| | | // try { |
| | | // ApplicationInfo applicationInfo = context.getApplicationInfo(); |
| | | // int targetSDK = applicationInfo.targetSdkVersion; |
| | | // Uri uri; |
| | | // if (targetSDK >= Build.VERSION_CODES.N && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
| | | // uri = Uri.parse(android.provider.MediaStore.Images.Media.insertImage(context.getContentResolver(), |
| | | // imageFile.getAbsolutePath(), imageFile.getName(), null)); |
| | | // } else { |
| | | // uri = Uri.fromFile(new File(imageFile.getPath())); |
| | | // } |
| | | // |
| | | // return uri; |
| | | // } catch (Exception e) { |
| | | // return null; |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | |
| | | String filePath = imageFile.getAbsolutePath(); |
| | | Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, |
| | | new String[]{MediaStore.Images.Media._ID}, MediaStore.Images.Media.DATA + "=? ", |
| | |
| | | import com.bytedance.sdk.openadsdk.TTNativeExpressAd; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.ads.nativ.NativeUnifiedADData; |
| | | import com.qq.e.ads.nativ.express2.NativeExpressADData2; |
| | | |
| | | //信息流原生广告容器 |
| | | public class ExpressAdContainer { |
| | | |
| | | TTNativeExpressAd csj; |
| | | NativeExpressADData2 gdt2;//2.0版广点通 |
| | | NativeExpressADView gdt;//旧版广点通 |
| | | NativeUnifiedADData gdt2Unfied;//2.0广点通自渲染 |
| | | |
| | | public NativeUnifiedADData getGdt2Unfied() { |
| | |
| | | } |
| | | |
| | | public ExpressAdContainer(NativeExpressADView gdt) { |
| | | } |
| | | |
| | | public ExpressAdContainer(NativeExpressADData2 gdt2) { |
| | | this.gdt2 = gdt2; |
| | | this.gdt = gdt; |
| | | } |
| | | |
| | | public ExpressAdContainer(NativeUnifiedADData gdt2Unfied) { |
| | |
| | | this.csj = csj; |
| | | } |
| | | |
| | | public NativeExpressADData2 getGdt2() { |
| | | return gdt2; |
| | | public NativeExpressADView getGdt() { |
| | | return gdt; |
| | | } |
| | | |
| | | public void setGdt2(NativeExpressADData2 gdt2) { |
| | | this.gdt2 = gdt2; |
| | | public void setGdt(NativeExpressADView gdt) { |
| | | this.gdt = gdt; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.bytedance.sdk.openadsdk.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdNative; |
| | | import com.bytedance.sdk.openadsdk.TTNativeExpressAd; |
| | | import com.qq.e.ads.cfg.VideoOption; |
| | | import com.qq.e.ads.nativ.ADSize; |
| | | import com.qq.e.ads.nativ.NativeExpressAD; |
| | | import com.qq.e.ads.nativ.NativeExpressADView; |
| | | import com.qq.e.ads.nativ.express2.AdEventListener; |
| | | import com.qq.e.ads.nativ.express2.NativeExpressAD2; |
| | | import com.qq.e.ads.nativ.express2.NativeExpressADData2; |
| | | import com.qq.e.ads.nativ.express2.VideoOption2; |
| | | import com.qq.e.comm.util.AdError; |
| | | import com.wpc.library.util.common.DimenUtils; |
| | | |
| | |
| | | */ |
| | | public void loadAd(int widthDP, int heightDP, String pid, int count, final IAdLoadListener adLoadListener) { |
| | | if (sourceType == AdUtil.AD_TYPE.gdt2) { |
| | | loadGDT2(pid, widthDP, heightDP, count, new IGDTAdLoadListener() { |
| | | loadGDT(pid, widthDP, heightDP, count, new IGDTAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<NativeExpressADView> adList) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onSuccess2(List<NativeExpressADData2> adList) { |
| | | List<ExpressAdContainer> adContainerList = new ArrayList<>(); |
| | | if (adList != null) |
| | | for (NativeExpressADData2 ad : adList) { |
| | | adContainerList.add(new ExpressAdContainer(ad)); |
| | | for (NativeExpressADView adView : adList) { |
| | | adContainerList.add(new ExpressAdContainer(adView)); |
| | | } |
| | | adLoadListener.onSuccess(adContainerList); |
| | | } |
| | | }, mContext); |
| | | |
| | | } else if (sourceType == AdUtil.AD_TYPE.csj) { |
| | | loadCSJ(pid, widthDP, heightDP, count, new ICSJAdLoadListener() { |
| | | @Override |
| | |
| | | } |
| | | |
| | | /** |
| | | * 2.0版本广点通原生 |
| | | * |
| | | * @param positionId |
| | | * @param widthDP |
| | | * @param heightDP |
| | | * @param count |
| | | * @param adLoadListener |
| | | * @param context |
| | | */ |
| | | private void loadGDT2(String positionId, int widthDP, int heightDP, int count, final IGDTAdLoadListener adLoadListener, Context context) { |
| | | |
| | | Log.i(TAG, String.format("loadGDT2:positionId-%s widthDP-%s heightDP-%s", positionId, widthDP, heightDP)); |
| | | |
| | | NativeExpressAD2 nativeExpressAD2 = new NativeExpressAD2(context, positionId, new NativeExpressAD2.AdLoadListener() { |
| | | @Override |
| | | public void onLoadSuccess(List<NativeExpressADData2> list) { |
| | | if (adLoadListener != null) |
| | | adLoadListener.onSuccess2(list); |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | if (adLoadListener != null) |
| | | adLoadListener.onSuccess2(null); |
| | | } |
| | | }); |
| | | |
| | | nativeExpressAD2.setAdSize(widthDP, heightDP); |
| | | VideoOption2.Builder builder = new VideoOption2.Builder(); |
| | | builder.setAutoPlayPolicy(VideoOption2.AutoPlayPolicy.WIFI) // WIFI 环境下可以自动播放视频 |
| | | .setAutoPlayMuted(true) // 自动播放时为静音 |
| | | .setDetailPageMuted(false) // 视频详情页播放时不静音 |
| | | .setMaxVideoDuration(0) // 设置返回视频广告的最大视频时长(闭区间,可单独设置),单位:秒,默认为 0 代表无限制,合法输入为:5<=maxVideoDuration<=60. 此设置会影响广告填充,请谨慎设置 |
| | | .setMinVideoDuration(0); // 设置返回视频广告的最小视频时长(闭区间,可单独设置),单位:秒,默认为 0 代表无限制, 此设置会影响广告填充,请谨慎设置 |
| | | nativeExpressAD2.setVideoOption2(builder.build()); |
| | | nativeExpressAD2.loadAd(count); |
| | | } |
| | | |
| | | /** |
| | | * 穿山甲广告 |
| | | * |
| | | * @param codeId |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 加载广点通广告 |
| | | * |
| | | * @param positionId |
| | | * @param count |
| | | * @param adLoadListener |
| | | * @param context |
| | | */ |
| | | private void loadGDT(String positionId, int widthDP, int heightDP, int count, final IGDTAdLoadListener adLoadListener, Context context) { |
| | | |
| | | |
| | | NativeExpressAD nativeExpressAD = new NativeExpressAD(context, new ADSize(widthDP, ADSize.AUTO_HEIGHT), |
| | | positionId, new NativeExpressAD.NativeExpressADListener() { |
| | | |
| | | @Override |
| | | public void onADLoaded(List<NativeExpressADView> list) { |
| | | if (adLoadListener != null) |
| | | adLoadListener.onSuccess(list); |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADExposure(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClicked(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADClosed(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onADLeftApplication(NativeExpressADView nativeExpressADView) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onNoAD(AdError adError) { |
| | | if (adLoadListener != null) |
| | | adLoadListener.onSuccess(null); |
| | | } |
| | | }); // 传入Activity |
| | | nativeExpressAD.setVideoOption(new VideoOption.Builder() |
| | | .setAutoPlayPolicy(VideoOption.AutoPlayPolicy.WIFI) // WIFI 环境下可以自动播放视频 |
| | | .setAutoPlayMuted(true) // 自动播放时为静音 |
| | | .build()); // |
| | | nativeExpressAD.loadAD(count); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 渲染模板和填充广告 |
| | |
| | | fl_ad.setVisibility(View.GONE); |
| | | } else { |
| | | fl_ad.setVisibility(View.VISIBLE); |
| | | if (ad.getGdt2() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getGdt2().getAdView()) { |
| | | if (ad.getGdt() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getGdt()) { |
| | | return; |
| | | } |
| | | fl_ad.removeAllViews(); |
| | | |
| | | ad.getGdt2().setAdEventListener(new AdEventListener() { |
| | | @Override |
| | | public void onClick() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onExposed() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | if (ad.getGdt2().getAdView().getParent() != null) { |
| | | ((ViewGroup) ad.getGdt2().getAdView().getParent()).removeAllViews(); |
| | | } |
| | | fl_ad.addView(ad.getGdt2().getAdView()); |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAdClosed() { |
| | | if (adEventListener != null) { |
| | | adEventListener.closeAd(ad); |
| | | } |
| | | } |
| | | }); |
| | | ad.getGdt2().render(); |
| | | |
| | | ad.getGdt().render(); |
| | | if (ad.getGdt().getParent() != null) { |
| | | ((ViewGroup) ad.getGdt().getParent()).removeAllViews(); |
| | | } |
| | | fl_ad.addView(ad.getGdt()); |
| | | } else if (ad.getCsj() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getCsj().getExpressAdView()) { |
| | | return; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 渲染广告 |
| | | * |
| | |
| | | return; |
| | | } |
| | | |
| | | if (ad.getGdt2() != null) { |
| | | ad.getGdt2().setAdEventListener(new AdEventListener() { |
| | | @Override |
| | | public void onClick() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onExposed() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | List<ExpressAdContainer> list = new ArrayList<>(); |
| | | list.add(ad); |
| | | if (adRenderListener != null) |
| | | adRenderListener.onRenderSuccess(list); |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | List<ExpressAdContainer> list = new ArrayList<>(); |
| | | list.add(ad); |
| | | if (adRenderListener != null) |
| | | adRenderListener.onRenderFail(list); |
| | | } |
| | | |
| | | @Override |
| | | public void onAdClosed() { |
| | | if (adEventListener != null) |
| | | adEventListener.closeAd(ad); |
| | | } |
| | | }); |
| | | ad.getGdt2().render(); |
| | | |
| | | if (ad.getGdt() != null) { |
| | | ad.getGdt().render(); |
| | | List<ExpressAdContainer> list = new ArrayList<>(); |
| | | list.add(ad); |
| | | if (adRenderListener != null) |
| | | adRenderListener.onRenderSuccess(list); |
| | | } else if (ad.getCsj() != null) { |
| | | Log.i(TAG, "广告曝光:csj"); |
| | | ad.getCsj().setExpressInteractionListener(new TTNativeExpressAd.ExpressAdInteractionListener() { |
| | | @Override |
| | | public void onAdClicked(View view, int i) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 为广告绑定关闭事件 |
| | | * |
| | |
| | | return; |
| | | } |
| | | |
| | | if (ad.getGdt2() != null) { |
| | | ad.getGdt2().setAdEventListener(new AdEventListener() { |
| | | @Override |
| | | public void onClick() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onExposed() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderSuccess() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onRenderFail() { |
| | | } |
| | | |
| | | @Override |
| | | public void onAdClosed() { |
| | | if (adEventListener != null) |
| | | adEventListener.closeAd(ad); |
| | | } |
| | | }); |
| | | |
| | | } else if (ad.getCsj() != null) { |
| | | if (ad.getGdt() != null) { |
| | | return; |
| | | } else if (ad.getCsj() != null) { |
| | | ad.getCsj().setExpressInteractionListener(new TTNativeExpressAd.ExpressAdInteractionListener() { |
| | | @Override |
| | | public void onAdClicked(View view, int i) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onCancel() { |
| | | |
| | | } |
| | | |
| | | |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | fl_ad.setVisibility(View.GONE); |
| | | } else { |
| | | fl_ad.setVisibility(View.VISIBLE); |
| | | if (ad.getGdt2() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getGdt2().getAdView()) { |
| | | if (ad.getGdt() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getGdt()) { |
| | | return; |
| | | } |
| | | if (ad.getGdt2().getAdView().getParent() != null) { |
| | | ((ViewGroup) ad.getGdt2().getAdView().getParent()).removeAllViews(); |
| | | if (ad.getGdt().getParent() != null) { |
| | | ((ViewGroup) ad.getGdt().getParent()).removeAllViews(); |
| | | } |
| | | fl_ad.removeAllViews(); |
| | | fl_ad.addView(ad.getGdt2().getAdView()); |
| | | |
| | | } else if (ad.getCsj() != null) { |
| | | fl_ad.addView(ad.getGdt()); |
| | | }else if (ad.getCsj() != null) { |
| | | if (fl_ad.getChildCount() > 0 && fl_ad.getChildAt(0) == ad.getCsj().getExpressAdView()) { |
| | | return; |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | interface IGDTAdLoadListener { |
| | | public void onSuccess(List<NativeExpressADView> adList); |
| | | |
| | | public void onSuccess2(List<NativeExpressADData2> adList); |
| | | } |
| | | |
| | | interface ICSJAdLoadListener { |
| | |
| | | |
| | | import android.content.Context; |
| | | |
| | | import com.bytedance.sdk.openadsdk.LocationProvider; |
| | | import com.bytedance.sdk.openadsdk.TTAdConfig; |
| | | import com.bytedance.sdk.openadsdk.TTAdConstant; |
| | | import com.bytedance.sdk.openadsdk.TTAdManager; |
| | | import com.bytedance.sdk.openadsdk.TTAdSdk; |
| | | import com.bytedance.sdk.openadsdk.TTCustomController; |
| | | import com.tejia.lijin.app.R; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.wpc.library.util.common.DeviceUtil; |
| | | |
| | | /** |
| | | * 可以用一个单例来保存TTAdManager实例,在需要初始化sdk的时候调用 |
| | |
| | | return TTAdSdk.getAdManager(); |
| | | } |
| | | |
| | | public static void init(Context context) { |
| | | doInit(context); |
| | | public static void init(Context context,TTAdSdk.InitCallback initCallback) { |
| | | doInit(context,initCallback); |
| | | } |
| | | |
| | | //step1:接入网盟广告sdk的初始化操作,详情见接入文档和穿山甲平台说明 |
| | | private static void doInit(Context context) { |
| | | if (!sInit) { |
| | | private static void doInit(Context context, TTAdSdk.InitCallback initCallback) { |
| | | if (!TTAdSdk.isInitSuccess()) { |
| | | try { |
| | | TTAdSdk.init(context, buildConfig(context)); |
| | | sInit = true; |
| | | } catch (Exception e) { |
| | | TTAdSdk.init(context, buildConfig(context), initCallback); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } else { |
| | | initCallback.success(); |
| | | } |
| | | } |
| | | |
| | | private static TTAdConfig buildConfig(Context context) { |
| | | private static TTAdConfig buildConfig(final Context context) { |
| | | return new TTAdConfig.Builder() |
| | | .appId(Constant.CSJ_APP_ID) |
| | | .useTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView |
| | | .appName(context.getString(R.string.app_name)) |
| | | .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK) |
| | | .allowShowNotify(true) //是否允许sdk展示通知栏提示 |
| | | .allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页 |
| | | .debug(true) //测试阶段打开,可以通过日志排查问题,上线时去除该调用 |
| | | .directDownloadNetworkType(TTAdConstant.NETWORK_STATE_WIFI) |
| | | .supportMultiProcess(true)//是否支持多进程 |
| | | .asyncInit(true) |
| | | .needClearTaskReset() |
| | | .supportMultiProcess(false)//是否支持多进程 |
| | | |
| | | .customController(new TTCustomController() { |
| | | @Override |
| | | public boolean isCanUseLocation() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public LocationProvider getTTLocation() { |
| | | return super.getTTLocation(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isCanUsePhoneState() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public String getDevImei() { |
| | | return DeviceUtil.getImeiCache(context); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isCanUseWifiState() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public String getMacAddress() { |
| | | return super.getMacAddress(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isCanUseWriteExternal() { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public String getDevOaid() { |
| | | return super.getDevOaid(); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isCanUseAndroidId() { |
| | | return false; |
| | | } |
| | | }).asyncInit(true) |
| | | //.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。 |
| | | .build(); |
| | | } |
| | |
| | | ComponentName comp = new ComponentName(packageName, activityName); |
| | | intent.setComponent(comp); |
| | | intent.setType("image/*"); |
| | | |
| | | if (imageList.size() == 1) { |
| | | intent.putExtra(Intent.EXTRA_STREAM, imageList.get(0)); |
| | | intent.setAction(Intent.ACTION_SEND); |
| | |
| | | intent.setFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);//增加读写权限 |
| | | } |
| | | context.startActivity(intent); |
| | | // intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); |
| | | // context.startActivity(Intent.createChooser(intent, "分享到:")); |
| | | } |
| | | |
| | | |
| | |
| | | return clickableHtmlBuilder; |
| | | } |
| | | |
| | | public static CharSequence getClickableHtml(String html, Context context, Integer color, URLClickListener urlClickListener) { |
| | | Spanned spannedHtml = Html.fromHtml(html); |
| | | SpannableStringBuilder clickableHtmlBuilder = new SpannableStringBuilder(spannedHtml); |
| | | URLSpan[] urls = clickableHtmlBuilder.getSpans(0, spannedHtml.length(), URLSpan.class); |
| | | for (final URLSpan span : urls) { |
| | | setLinkClickable(clickableHtmlBuilder, span, context, color, urlClickListener); |
| | | } |
| | | return clickableHtmlBuilder; |
| | | } |
| | | |
| | | public static CharSequence getClickableHtml(Spanned spannedHtml, Context context, Integer color) { |
| | | SpannableStringBuilder clickableHtmlBuilder = new SpannableStringBuilder(spannedHtml); |
| | | URLSpan[] urls = clickableHtmlBuilder.getSpans(0, spannedHtml.length(), URLSpan.class); |
| | |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.DeviceInfoUtil; |
| | | import com.tejia.lijin.app.util.JumpActivityUtil; |
| | | import com.tejia.lijin.app.util.WXUtil; |
| | | import com.umeng.analytics.MobclickAgent; |
| | |
| | | params.put("uid", mContext.getSharedPreferences("user", MODE_PRIVATE).getString("uid", "")); |
| | | params.put("apiversion", "1"); |
| | | params.put("channel", GetManifestDataUtil.getAppMetaData(mContext, "UMENG_CHANNEL")); |
| | | String imei = MobileUtil.getIMEI(mContext); |
| | | String imei = DeviceInfoUtil.getIMEI(mContext); |
| | | if (!StringUtils.isEmpty(imei)) |
| | | params.put("imei", imei); |
| | | params.put("osVersion", MobileUtil.getSystemVersion()); |
| | |
| | | import com.tejia.lijin.app.ui.invite.ShareBrowserActivity; |
| | | import com.tejia.lijin.app.ui.recommend.GoodsDetailActivity; |
| | | import com.tejia.lijin.app.ui.recommend.SearchActivity; |
| | | import com.tejia.lijin.app.util.DeviceInfoUtil; |
| | | import com.tejia.lijin.app.util.JumpActivityUtil; |
| | | import com.tejia.lijin.app.util.SystemParamsUtil; |
| | | import com.tejia.lijin.app.util.WXUtil; |
| | |
| | | params.put("uid", mContext.getSharedPreferences("user", MODE_PRIVATE).getString("uid", "")); |
| | | params.put("apiversion", "1"); |
| | | params.put("channel", GetManifestDataUtil.getAppMetaData(mContext, "UMENG_CHANNEL")); |
| | | String imei = MobileUtil.getIMEI(mContext); |
| | | String imei = DeviceInfoUtil.getIMEI(mContext); |
| | | if (!StringUtils.isEmpty(imei)) |
| | | params.put("imei", imei); |
| | | params.put("osVersion", MobileUtil.getSystemVersion()); |
| | |
| | | TTAdNative mTTAdNative = TTAdSdk.getAdManager().createAdNative(mContext); |
| | | AdSlot adSlot = new AdSlot.Builder() |
| | | .setCodeId(pid) |
| | | .setRewardName("金币") //奖励的名称 选填 |
| | | .setRewardAmount(3) //奖励的数量 选填 |
| | | // .setUserID("tag123")//tag_id |
| | | .setMediaExtra("media_extra") //附加参数 |
| | | .setOrientation(TTAdConstant.VERTICAL) //必填参数,期望视频的播放方向:TTAdConstant.HORIZONTAL 或 TTAdConstant.VERTICAL |
| | |
| | | mttRewardVideoAd.showRewardVideoAd(mContext, TTAdConstant.RitScenes.CUSTOMIZE_SCENES, "scenes_test"); |
| | | mttRewardVideoAd = null; |
| | | } |
| | | com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); |
| | | result.put("code", 100); |
| | | result.put("msg", "缓存成功"); |
| | | handler.setProgressData(result); |
| | | } |
| | | |
| | | @Override |
| | | public void onRewardVideoCached(TTRewardVideoAd ttRewardVideoAd) { |
| | | mttRewardVideoAd=ttRewardVideoAd; |
| | | //开发者做一个标识 |
| | | com.alibaba.fastjson.JSONObject result = new com.alibaba.fastjson.JSONObject(); |
| | | result.put("code", 100); |
| | | result.put("msg", "缓存成功"); |
| | |
| | | result.put("code", 0); |
| | | result.put("msg", "广告展示完成"); |
| | | handler.complete(result); |
| | | } |
| | | |
| | | @Override |
| | | public void onRewardArrived(boolean b, int i, Bundle bundle) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | ArrayList<Uri> uriList = new ArrayList<Uri>(); |
| | | if (imageList != null) |
| | | for (ShareImageEntity entity : imageList) |
| | | for (ShareImageEntity entity : imageList) { |
| | | uriList.add(Tools.getImageContentUri(mContext, new File(entity.getFilePath()))); |
| | | |
| | | } |
| | | if (platfrom == 1) { |
| | | ShareImageUtil.shareWXPictureByIntent(mContext, uriList); |
| | | } else if (platfrom == 2) { |
| | |
| | | import com.tejia.lijin.app.util.Tools; |
| | | import com.tejia.lijin.app.util.clipboard.ClipboardUtil; |
| | | |
| | | import java.net.URLDecoder; |
| | | |
| | | public class WebViewUtil { |
| | | |
| | | public static Boolean interceptUrl(final Context context, String url) { |
| | |
| | | return true; |
| | | } else |
| | | return true; |
| | | } else if (url.startsWith("snssdk1128://")) {//抖音 |
| | | try { |
| | | Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| | | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | context.startActivity(intent); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | return true; |
| | |
| | | import com.tencent.smtt.export.external.extension.proxy.ProxyWebViewClientExtension; |
| | | import com.tencent.smtt.export.external.interfaces.IX5WebViewBase.HitTestResult; |
| | | import com.tencent.smtt.export.external.interfaces.JsResult; |
| | | import com.tencent.smtt.export.external.interfaces.MediaAccessPermissionsCallback; |
| | | import com.tencent.smtt.sdk.WebViewCallbackClient; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | @Override |
| | | public void onColorModeChanged(long l) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean onPermissionRequest(String s, long l, MediaAccessPermissionsCallback mediaAccessPermissionsCallback) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void invalidate() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean dispatchTouchEvent(MotionEvent ev, View view) { |
| | | return webView.tbs_dispatchTouchEvent(ev, view); |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <gradient |
| | | android:angle="180" |
| | | android:endColor="#FF227B" |
| | | android:startColor="#FF2A3E" |
| | | android:type="linear" |
| | | android:useLevel="true" /> |
| | | <corners |
| | | android:radius="40dp" /> |
| | | |
| | | </shape> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <corners android:radius="5dp" /> |
| | | <corners android:radius="12dp" /> |
| | | <solid android:color="@color/white" /> |
| | | </shape> |
| | |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | <LinearLayout |
| | | style="@style/myInfoItemStyle" |
| | | android:layout_marginTop="10dp"> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="12dp" |
| | | android:gravity="center_vertical" |
| | | android:text="关闭个性化推送" |
| | | android:textColor="@color/text_black_1" |
| | | android:textSize="14sp" /> |
| | | |
| | | <View |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" /> |
| | | |
| | | <CheckBox |
| | | android:id="@+id/cb_push" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginRight="12dp" |
| | | android:button="@drawable/selector_msg_ischecked" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="48dp" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/shape_user_protocol_dialog_bg" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.wpc.library.widget.RatioLayout xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | app:ratio="0.3243"> |
| | | |
| | | <ImageView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:src="@drawable/ic_auth_notify_top"></ImageView> |
| | | |
| | | </com.wpc.library.widget.RatioLayout> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center_horizontal" |
| | | android:orientation="vertical" |
| | | android:padding="20dp"> |
| | | |
| | | <LinearLayout |
| | | android:layout_marginTop="10dp" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center_vertical"> |
| | | |
| | | <ImageView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginRight="7dp" |
| | | android:src="@drawable/icon_auth_notify_phone"> |
| | | |
| | | </ImageView> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="手机" |
| | | android:textColor="#ff333333" |
| | | android:textSize="16sp" /> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="10dp" |
| | | android:text="校验手机识别码,防止账号被盗" |
| | | android:textColor="#ff999999" |
| | | android:textSize="11sp" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="20dp" |
| | | android:gravity="center_vertical"> |
| | | |
| | | <ImageView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginRight="7dp" |
| | | android:src="@drawable/icon_auth_notify_storage"></ImageView> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="存储" |
| | | android:textColor="#ff333333" |
| | | android:textSize="16sp" /> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="10dp" |
| | | android:text="存储图片和视频,降低网络消耗" |
| | | android:textColor="#ff999999" |
| | | android:textSize="11sp" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_positive" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="44dp" |
| | | android:layout_gravity="center" |
| | | android:layout_marginTop="40dp" |
| | | android:layout_marginBottom="10dp" |
| | | android:layout_weight="1" |
| | | android:background="@drawable/shape_permission_notify_btn" |
| | | android:gravity="center" |
| | | android:text="立即开启" |
| | | android:textColor="@color/white" |
| | | android:textSize="16sp" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_marginTop="10dp" |
| | | android:gravity="center" |
| | | android:padding="8dp" |
| | | android:text="温馨提示" |
| | | android:text="隐私政策&用户协议" |
| | | android:textColor="@color/black" |
| | | android:textSize="20sp" /> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_content" |
| | | <ScrollView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_height="260dp" |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginRight="20dp" |
| | | android:layout_marginBottom="10dp" |
| | | android:autoLink="all" |
| | | android:background="@null" |
| | | android:foreground="@null" |
| | | android:lineSpacingExtra="8sp" |
| | | android:textSize="10sp"></TextView> |
| | | android:layout_marginBottom="10dp"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:autoLink="all" |
| | | android:background="@null" |
| | | android:foreground="@null" |
| | | android:lineSpacingExtra="8sp" |
| | | android:textSize="14sp"></TextView> |
| | | |
| | | </ScrollView> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | |
| | | // Top-level build file where you can add configuration options common to all sub-projects/modules. |
| | | buildscript { |
| | | repositories { |
| | | |
| | | //字节跳动SDK |
| | | maven { |
| | | url "https://artifact.bytedance.com/repository/Volcengine/" |
| | | } |
| | | maven { |
| | | url "https://artifact.bytedance.com/repository/pangle/" |
| | | } |
| | | maven { url "https://artifact.bytedance.com/repository/AwemeOpenSDK" } |
| | | |
| | | maven {url 'https://developer.huawei.com/repo/'} |
| | | maven { url "https://maven.aliyun.com/repository/public" } |
| | | maven { url 'https://maven.aliyun.com/repository/jcenter' } |
| | | maven { url "https://maven.aliyun.com/repository/google" } |
| | | // google() |
| | | // jcenter() |
| | | // maven { url "https://maven.google.com" } |
| | | maven { url "https://dl.bintray.com/thelasterstar/maven/" } |
| | | // maven { url "https://dl.bintray.com/thelasterstar/maven/" } |
| | | mavenCentral() |
| | | google() |
| | | maven {url 'https://developer.huawei.com/repo/'} |
| | | |
| | | |
| | | |
| | | } |
| | | dependencies { |
| | | classpath 'com.android.tools.build:gradle:4.0.1' |
| | | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'//Added line |
| | | classpath 'com.huawei.agconnect:agcp:1.4.2.300' |
| | | classpath 'com.huawei.agconnect:agcp:1.6.0.300' |
| | | |
| | | // NOTE: Do not place your application dependencies here; they belong |
| | | // in the individual module build.gradle files |
| | |
| | | } |
| | | allprojects { |
| | | repositories { |
| | | mavenCentral() |
| | | //字节跳动SDK |
| | | maven { |
| | | url "https://artifact.bytedance.com/repository/Volcengine/" |
| | | } |
| | | maven { |
| | | url "https://artifact.bytedance.com/repository/pangle/" |
| | | } |
| | | maven { url "https://artifact.bytedance.com/repository/AwemeOpenSDK" } |
| | | |
| | | maven {url 'https://developer.huawei.com/repo/'} |
| | | maven { url "https://maven.aliyun.com/repository/public" } |
| | | maven { url 'https://maven.aliyun.com/repository/jcenter' } |
| | | maven { url "https://maven.aliyun.com/repository/google" } |
| | | // maven { url "https://maven.google.com" } |
| | | maven { url "https://dl.bintray.com/thelasterstar/maven/" } |
| | | //maven { url "https://dl.bintray.com/thelasterstar/maven/" } |
| | | //Bmob的maven仓库地址,必须填写 |
| | | // maven { url "https://raw.github.com/bmob/bmob-android-sdk/master" } |
| | | maven { url "https://jitpack.io" } |
| | | |
| | | google() |
| | | |
| | | maven {url 'https://developer.huawei.com/repo/'} |
| | | |
| | | |
| | | } |
| | | } |
| | | task clean(type: Delete) { |
| | |
| | | #Tue May 18 16:33:16 CST 2021 |
| | | #Mon Aug 08 12:04:48 CST 2022 |
| | | distributionBase=GRADLE_USER_HOME |
| | | distributionPath=wrapper/dists |
| | | zipStoreBase=GRADLE_USER_HOME |
| | | zipStorePath=wrapper/dists |
| | | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip |
| | | distributionPath=wrapper/dists |
| | | zipStorePath=wrapper/dists |
| | | zipStoreBase=GRADLE_USER_HOME |
| | |
| | | import androidx.core.content.ContextCompat; |
| | | import android.telephony.TelephonyManager; |
| | | |
| | | import com.wpc.library.util.common.DeviceUtil; |
| | | |
| | | public class DeviceUuidFactory { |
| | | |
| | | protected static final String PREFS_FILE = "device_id.xml"; |
| | |
| | | String deviceId=""; |
| | | if (ContextCompat.checkSelfPermission(context, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED |
| | | || ContextCompat.checkSelfPermission(context, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { |
| | | deviceId = tm.getDeviceId();// 获取deviceId |
| | | deviceId = DeviceUtil.getImeiCache(context); |
| | | } |
| | | uuid = deviceId != null ? UUID.nameUUIDFromBytes(deviceId.getBytes("utf8")) : UUID.randomUUID(); |
| | | } |
| | |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | |
| | | import com.wpc.library.util.common.DeviceUtil; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | List<ApplicationInfo> infos = new ArrayList<>(); |
| | | if (context == null || MarketPackages == null || MarketPackages.size() == 0) |
| | | return infos; |
| | | PackageManager pm = context.getPackageManager(); |
| | | List<PackageInfo> installedPkgs = pm.getInstalledPackages(0); |
| | | List<PackageInfo> installedPkgs = DeviceUtil.getInstalledPackagesCache(context); |
| | | int li = installedPkgs.size(); |
| | | int lj = MarketPackages.size(); |
| | | for (int j = 0; j < lj; j++) { |
| | |
| | | ArrayList<String> empty = new ArrayList<String>(); |
| | | if (context == null || pkgs == null || pkgs.size() == 0) |
| | | return empty; |
| | | PackageManager pm = context.getPackageManager(); |
| | | List<PackageInfo> installedPkgs = pm.getInstalledPackages(0); |
| | | List<PackageInfo> installedPkgs = DeviceUtil.getInstalledPackagesCache(context); |
| | | int li = installedPkgs.size(); |
| | | int lj = pkgs.size(); |
| | | for (int j = 0; j < lj; j++) { |
| | |
| | | import androidx.core.content.ContextCompat; |
| | | import android.telephony.TelephonyManager; |
| | | |
| | | import com.wpc.library.util.common.DeviceUtil; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | |
| | | import java.io.File; |
| | |
| | | String deviceId=""; |
| | | if (ContextCompat.checkSelfPermission(ctx, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED |
| | | || ContextCompat.checkSelfPermission(ctx, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { |
| | | deviceId = tm.getDeviceId();// 获取deviceId |
| | | deviceId = DeviceUtil.getImeiCache(ctx); |
| | | } |
| | | return deviceId; |
| | | } |
| | |
| | | import android.telephony.TelephonyManager; |
| | | import android.util.DisplayMetrics; |
| | | |
| | | import com.wpc.library.util.common.DeviceUtil; |
| | | |
| | | public class SystemCommon { |
| | | |
| | | /** |
| | |
| | | String deviceId=""; |
| | | if (ContextCompat.checkSelfPermission(ctx, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED |
| | | || ContextCompat.checkSelfPermission(ctx, android.Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { |
| | | deviceId = tm.getDeviceId();// 获取deviceId |
| | | deviceId = DeviceUtil.getImeiCache(ctx); |
| | | } |
| | | return deviceId; |
| | | } |
New file |
| | |
| | | package com.wpc.library.util.common; |
| | | |
| | | import android.Manifest; |
| | | import android.content.Context; |
| | | import android.content.pm.PackageInfo; |
| | | import android.content.pm.PackageManager; |
| | | import android.provider.Settings; |
| | | import android.telephony.TelephonyManager; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import androidx.core.app.ActivityCompat; |
| | | |
| | | import static android.content.Context.TELEPHONY_SERVICE; |
| | | |
| | | public class DeviceUtil { |
| | | |
| | | private static List<PackageInfo> installedPackages; |
| | | private static String imei; |
| | | private static String android_id; |
| | | private static String imsi; |
| | | |
| | | public static synchronized List<PackageInfo> getInstalledPackagesCache(Context context) { |
| | | if (installedPackages != null) { |
| | | return installedPackages; |
| | | } |
| | | PackageManager pManager = context.getPackageManager(); |
| | | //获取手机内所有应用 |
| | | installedPackages = pManager.getInstalledPackages(0); |
| | | return installedPackages; |
| | | } |
| | | |
| | | |
| | | public static synchronized List<String> getInstalledPackageNamesCache(Context context) { |
| | | List<PackageInfo> list = getInstalledPackagesCache(context); |
| | | List<String> nameList = new ArrayList<>(); |
| | | for (PackageInfo pi : list) { |
| | | nameList.add(pi.packageName); |
| | | } |
| | | return nameList; |
| | | } |
| | | |
| | | public static synchronized String getImeiCache(Context context) { |
| | | if (imei != null) { |
| | | return imei; |
| | | } |
| | | |
| | | TelephonyManager manager = (TelephonyManager) context.getSystemService(TELEPHONY_SERVICE); |
| | | try { |
| | | if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { |
| | | return ""; |
| | | } |
| | | imei = manager.getDeviceId(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | imei = imei == null ? "" : imei; |
| | | return imei; |
| | | } |
| | | |
| | | public static synchronized String getAndroidIdCache(Context context) { |
| | | if (android_id != null) { |
| | | return android_id; |
| | | } |
| | | try { |
| | | android_id = Settings.System.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | android_id = android_id == null ? "" : android_id; |
| | | return android_id; |
| | | } |
| | | |
| | | |
| | | public static synchronized String getImsiCache(Context context) { |
| | | if (imsi != null) { |
| | | return imsi; |
| | | } |
| | | TelephonyManager mTelephonyMgr = (TelephonyManager) context |
| | | .getSystemService(Context.TELEPHONY_SERVICE); |
| | | try { |
| | | if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { |
| | | return ""; |
| | | } |
| | | imsi = mTelephonyMgr.getSubscriberId(); |
| | | }catch(Exception e){ |
| | | |
| | | } |
| | | imsi = imsi == null ? "" : imsi; |
| | | return imsi; |
| | | } |
| | | |
| | | } |
| | |
| | | apply plugin: 'com.android.library' |
| | | |
| | | apply plugin: 'android-library' |
| | | android { |
| | | compileSdkVersion 29 |
| | | buildToolsVersion "29.0.0" |
| | |
| | | |
| | | import com.heytap.msp.push.HeytapPushManager; |
| | | import com.heytap.msp.push.callback.ICallBackResultService; |
| | | import com.huawei.hmf.tasks.OnCompleteListener; |
| | | import com.huawei.hmf.tasks.Task; |
| | | import com.huawei.hms.aaid.HmsInstanceId; |
| | | import com.huawei.hms.common.ApiException; |
| | | import com.huawei.hms.push.HmsMessaging; |
| | | import com.meizu.cloud.pushsdk.PushManager; |
| | | import com.vivo.push.IPushActionListener; |
| | | import com.vivo.push.PushClient; |
| | |
| | | } |
| | | }.start(); |
| | | |
| | | HmsMessaging.getInstance(context).turnOnPush().addOnCompleteListener(new OnCompleteListener<Void>() { |
| | | @Override |
| | | public void onComplete(Task<Void> task) { |
| | | // 获取结果 |
| | | if (task.isSuccessful()) { |
| | | Log.i(TAG, "turnOnPush Complete"); |
| | | } else { |
| | | Log.e(TAG, "turnOnPush failed: ret=" + task.getException().getMessage()); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | return; |
| | | case "oppo"://上面官方判断 |
| | | /***OPPO官方判断方法*/ |
| | |
| | | apply plugin: 'android-library' |
| | | |
| | | dependencies { |
| | | api fileTree(include: '*.jar', dir: 'libs') |
| | | api files('libs/umeng-share-QQ-full-6.9.6.jar') |
| | | api files('libs/umeng-share-core-6.9.6.jar') |
| | | api files('libs/umeng-share-sina-full-6.9.6.jar') |
| | | api files('libs/umeng-share-wechat-simplify-6.9.6.jar') |
| | | api files('libs/umeng-shareboard-widget-6.9.6.jar') |
| | | api files('libs/umeng-sharetool-6.9.6.jar') |
| | | // api files('libs/SocialSDK_sms.jar') |
| | | api fileTree(include: '*.jar', dir: 'libs') |
| | | api files('libs/umeng-common-9.4.4.jar') |
| | | |
| | | // api files('libs/umeng-asms-armeabi-v1.4.1.aar') |
| | | // api files('libs/umeng-apm-armeabi-v1.5.2.aar') |
| | | implementation(name:'umeng-asms-armeabi-v1.4.1', ext:'aar') |
| | | implementation(name:'umeng-apm-armeabi-v1.5.2', ext:'aar') |
| | | api files('libs/umeng-share-QQ-full-7.1.6.jar') |
| | | api files('libs/umeng-share-core-7.1.6.jar') |
| | | api files('libs/umeng-share-sina-full-7.1.6.jar') |
| | | api files('libs/umeng-share-wechat-full-7.1.6.jar') |
| | | api files('libs/umeng-shareboard-widget-7.1.6.jar') |
| | | api files('libs/umeng-sharetool-7.1.6.jar') |
| | | api files('libs/open_sdk_r5990_lite.jar') |
| | | provided files('libs/core-4.3.1-openDefaultRelease.aar') |
| | | |
| | | } |
| | | |
| | | android { |
| | |
| | | minSdkVersion 17 |
| | | targetSdkVersion 26 |
| | | } |
| | | sourceSets { |
| | | main { |
| | | manifest.srcFile 'AndroidManifest.xml' |
| | | java.srcDirs = ['src'] |
| | | resources.srcDirs = ['src'] |
| | | aidl.srcDirs = ['src'] |
| | | renderscript.srcDirs = ['src'] |
| | | res.srcDirs = ['res'] |
| | | assets.srcDirs = ['assets'] |
| | | } |
| | | |
| | | // Move the build types to build-types/<type> |
| | | // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... |
| | | // This moves them out of them default location under src/<type>/... which would |
| | | // conflict with src/ being used by the main source set. |
| | | // Adding new build types or product flavors should be accompanied |
| | | // by a similar customization. |
| | | debug.setRoot('build-types/debug') |
| | | release.setRoot('build-types/release') |
| | | repositories { |
| | | flatDir { |
| | | dirs 'libs' |
| | | } |
| | | } |
| | | } |