version:1.0.0
fix: update:移植到酷信
This commit is contained in:
@@ -17,8 +17,8 @@ android {
|
||||
minSdkVersion 26
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 48
|
||||
versionName "1.5.6"
|
||||
versionCode 1
|
||||
versionName "1.0.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -124,9 +124,54 @@ android {
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
|
||||
U807 {
|
||||
storeFile file("keystore/AllwinnerU807.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "u807"
|
||||
keyPassword "123456"
|
||||
v2SigningEnabled false
|
||||
}
|
||||
|
||||
iPlay50P {
|
||||
storeFile file("keystore/iPlay50P.jks")
|
||||
storePassword "123456"
|
||||
keyAlias "iplay50p"
|
||||
keyPassword "123456"
|
||||
v1SigningEnabled true
|
||||
v2SigningEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
iPlay50PDebug.initWith(debug)
|
||||
iPlay50PDebug {
|
||||
buildConfigField "String", "platform", '"T1102"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.iPlay50P
|
||||
}
|
||||
|
||||
iPlay50PRelease.initWith(release)
|
||||
iPlay50PRelease {
|
||||
buildConfigField "String", "platform", '"T1102"'
|
||||
signingConfig signingConfigs.iPlay50P
|
||||
}
|
||||
|
||||
U807Debug.initWith(debug)
|
||||
U807Debug {
|
||||
buildConfigField "String", "platform", '"U807"'
|
||||
versionNameSuffix "-debug"
|
||||
debuggable true
|
||||
signingConfig signingConfigs.U807
|
||||
}
|
||||
|
||||
U807Release.initWith(release)
|
||||
U807Release {
|
||||
buildConfigField "String", "platform", '"U807"'
|
||||
signingConfig signingConfigs.U807
|
||||
}
|
||||
|
||||
Cube8183Debug.initWith(debug)
|
||||
Cube8183Debug {
|
||||
debuggable true
|
||||
@@ -307,6 +352,8 @@ android {
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
iPlay50PDebug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
U807Debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
Cube8183Debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
Teclast8183Debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
Teclast8515Debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
@@ -318,6 +365,8 @@ android {
|
||||
zhanRuiDebug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
debug { manifest.srcFile 'src/debug/AndroidManifest.xml' }
|
||||
|
||||
iPlay50PRelease { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
U807Release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
Cube8183Release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
Teclast8183Release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
Teclast8515Release { manifest.srcFile 'src/main/AndroidManifest.xml' }
|
||||
|
||||
BIN
app/keystore/AllwinnerU807.jks
Normal file
BIN
app/keystore/AllwinnerU807.jks
Normal file
Binary file not shown.
BIN
app/keystore/iPlay50P.jks
Normal file
BIN
app/keystore/iPlay50P.jks
Normal file
Binary file not shown.
@@ -33,6 +33,7 @@ import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.bean.GlideCircleWithBorder;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.dialog.InstallDialog;
|
||||
import com.uiui.zyappstore.helper.CustomSnapHelper;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.utils.ApkUtils;
|
||||
@@ -143,7 +144,32 @@ public class DetailsActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!Utils.canDownloadApp(DetailsActivity.this)) {
|
||||
ToastUtil.show("应用市场已被禁止安装");
|
||||
// ToastUtil.show("应用市场已被禁止安装");
|
||||
|
||||
InstallDialog installDialog = new InstallDialog(DetailsActivity.this);
|
||||
installDialog.setMessage(String.format(getString(R.string.install_note), appInfo.getApp_name()))
|
||||
.setTitle("提示")
|
||||
.setPositive("申请安装")
|
||||
.setNegtive("取消")
|
||||
.setImageUrl(appInfo.getApp_img())
|
||||
.setOnClickBottomListener(new InstallDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
NetInterfaceManager.getInstance().getApplyForInstall(appInfo.getApp_package(), appInfo.getApp_name()
|
||||
, new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
installDialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegtiveClick() {
|
||||
installDialog.dismiss();
|
||||
}
|
||||
});
|
||||
installDialog.show();
|
||||
return;
|
||||
}
|
||||
if (installed && !update) {
|
||||
|
||||
@@ -28,6 +28,8 @@ import com.uiui.zyappstore.activity.DetailsActivity;
|
||||
import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.GlideCircleWithBorder;
|
||||
import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.dialog.InstallDialog;
|
||||
import com.uiui.zyappstore.network.NetInterfaceManager;
|
||||
import com.uiui.zyappstore.utils.ApkUtils;
|
||||
import com.uiui.zyappstore.utils.FileUtils;
|
||||
import com.uiui.zyappstore.utils.StorageUtils;
|
||||
@@ -139,7 +141,32 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.Holder> {
|
||||
ApkUtils.openApp(mContext, appInfo.getApp_package());
|
||||
} else {
|
||||
if (!Utils.canDownloadApp(mContext)) {
|
||||
ToastUtil.show("应用市场已被禁止安装");
|
||||
// ToastUtil.show("应用市场已被禁止安装");
|
||||
|
||||
InstallDialog installDialog = new InstallDialog(mContext);
|
||||
installDialog.setMessage(String.format(mContext.getString(R.string.install_note), appInfo.getApp_name()))
|
||||
.setTitle("提示")
|
||||
.setPositive("申请安装")
|
||||
.setNegtive("取消")
|
||||
.setImageUrl(appInfo.getApp_img())
|
||||
.setOnClickBottomListener(new InstallDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
NetInterfaceManager.getInstance().getApplyForInstall(appInfo.getApp_package(), appInfo.getApp_name(),
|
||||
new NetInterfaceManager.onCompleteCallback() {
|
||||
@Override
|
||||
public void onComplete() {
|
||||
installDialog.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegtiveClick() {
|
||||
installDialog.dismiss();
|
||||
}
|
||||
});
|
||||
installDialog.show();
|
||||
return;
|
||||
}
|
||||
Utils.addPackageToWhiteList(mContext, appInfo.getApp_package());
|
||||
|
||||
249
app/src/main/java/com/uiui/zyappstore/dialog/InstallDialog.java
Normal file
249
app/src/main/java/com/uiui/zyappstore/dialog/InstallDialog.java
Normal file
@@ -0,0 +1,249 @@
|
||||
package com.uiui.zyappstore.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.uiui.zyappstore.R;
|
||||
import com.uiui.zyappstore.utils.GlideLoadUtils;
|
||||
|
||||
/**
|
||||
* description:自定义dialog
|
||||
*/
|
||||
|
||||
public class InstallDialog extends AlertDialog {
|
||||
/**
|
||||
* 显示的图片
|
||||
*/
|
||||
private ImageView imageIv;
|
||||
|
||||
/**
|
||||
* 显示的标题
|
||||
*/
|
||||
private TextView titleTv;
|
||||
|
||||
/**
|
||||
* 显示的消息
|
||||
*/
|
||||
private TextView messageTv;
|
||||
|
||||
/**
|
||||
* 确认和取消按钮
|
||||
*/
|
||||
private TextView negtiveBn, positiveBn;
|
||||
|
||||
/**
|
||||
* 按钮之间的分割线
|
||||
*/
|
||||
// private View columnLineView;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public InstallDialog(Context context) {
|
||||
super(context, R.style.CustomDialog);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 都是内容数据
|
||||
*/
|
||||
private String message;
|
||||
private String title;
|
||||
private String positive, negtive;
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 底部是否只有一个按钮
|
||||
*/
|
||||
private boolean isSingle = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.dialog_install);
|
||||
//按空白处不能取消动画
|
||||
setCanceledOnTouchOutside(false);
|
||||
//初始化界面控件
|
||||
initView();
|
||||
//初始化界面数据
|
||||
refreshView();
|
||||
//初始化界面控件的事件
|
||||
initEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面的确定和取消监听器
|
||||
*/
|
||||
private void initEvent() {
|
||||
//设置确定按钮被点击后,向外界提供监听
|
||||
positiveBn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onClickBottomListener != null) {
|
||||
onClickBottomListener.onPositiveClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
//设置取消按钮被点击后,向外界提供监听
|
||||
negtiveBn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onClickBottomListener != null) {
|
||||
onClickBottomListener.onNegtiveClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面控件的显示数据
|
||||
*/
|
||||
private void refreshView() {
|
||||
//如果用户自定了title和message
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
titleTv.setText(title);
|
||||
titleTv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
titleTv.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(message)) {
|
||||
messageTv.setText(message);
|
||||
}
|
||||
//如果设置按钮的文字
|
||||
if (!TextUtils.isEmpty(positive)) {
|
||||
positiveBn.setText(positive);
|
||||
} else {
|
||||
positiveBn.setText("确定");
|
||||
}
|
||||
if (!TextUtils.isEmpty(negtive)) {
|
||||
negtiveBn.setText(negtive);
|
||||
} else {
|
||||
negtiveBn.setText("取消");
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(imageUrl)) {
|
||||
GlideLoadUtils.getInstance().glideLoad(mContext, imageUrl, imageIv, R.mipmap.ic_launcher);
|
||||
imageIv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
imageIv.setVisibility(View.GONE);
|
||||
}
|
||||
/**
|
||||
* 只显示一个按钮的时候隐藏取消按钮,回掉只执行确定的事件
|
||||
*/
|
||||
if (isSingle) {
|
||||
// columnLineView.setVisibility(View.GONE);
|
||||
negtiveBn.setVisibility(View.GONE);
|
||||
} else {
|
||||
negtiveBn.setVisibility(View.VISIBLE);
|
||||
// columnLineView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
refreshView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面控件
|
||||
*/
|
||||
private void initView() {
|
||||
negtiveBn = findViewById(R.id.negtive);
|
||||
positiveBn = findViewById(R.id.positive);
|
||||
titleTv = findViewById(R.id.title);
|
||||
messageTv = findViewById(R.id.message);
|
||||
imageIv = findViewById(R.id.image);
|
||||
// columnLineView = findViewById(R.id.column_line);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置确定取消按钮的回调
|
||||
*/
|
||||
private OnClickBottomListener onClickBottomListener;
|
||||
|
||||
public void setOnClickBottomListener(OnClickBottomListener onClickBottomListener) {
|
||||
this.onClickBottomListener = onClickBottomListener;
|
||||
}
|
||||
|
||||
public interface OnClickBottomListener {
|
||||
/**
|
||||
* 点击确定按钮事件
|
||||
*/
|
||||
void onPositiveClick();
|
||||
|
||||
/**
|
||||
* 点击取消按钮事件
|
||||
*/
|
||||
void onNegtiveClick();
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public InstallDialog setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public InstallDialog setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPositive() {
|
||||
return positive;
|
||||
}
|
||||
|
||||
public InstallDialog setPositive(String positive) {
|
||||
this.positive = positive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNegtive() {
|
||||
return negtive;
|
||||
}
|
||||
|
||||
public InstallDialog setNegtive(String negtive) {
|
||||
this.negtive = negtive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public InstallDialog setNegtiveText(String negtive) {
|
||||
negtiveBn.setText(negtive);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImageUrl() {
|
||||
return imageUrl;
|
||||
}
|
||||
|
||||
public boolean isSingle() {
|
||||
return isSingle;
|
||||
}
|
||||
|
||||
public InstallDialog setSingle(boolean single) {
|
||||
isSingle = single;
|
||||
return this;
|
||||
}
|
||||
|
||||
public InstallDialog setImageUrl(String imageResId) {
|
||||
this.imageUrl = imageResId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import com.uiui.zyappstore.common.CommonConfig;
|
||||
import com.uiui.zyappstore.disklrucache.CacheHelper;
|
||||
import com.uiui.zyappstore.network.api.AdminAppApi;
|
||||
import com.uiui.zyappstore.network.api.AdminAppClassApi;
|
||||
import com.uiui.zyappstore.network.api.ApplyForInstallApi;
|
||||
import com.uiui.zyappstore.network.api.BannerImage;
|
||||
import com.uiui.zyappstore.network.api.ClassAppApi;
|
||||
import com.uiui.zyappstore.network.api.DownloadApp;
|
||||
@@ -26,6 +27,7 @@ import com.uiui.zyappstore.network.api.SearchAdminAppApi;
|
||||
import com.uiui.zyappstore.network.api.SearchAppApi;
|
||||
import com.uiui.zyappstore.network.interceptor.RepeatRequestInterceptor;
|
||||
import com.uiui.zyappstore.utils.JGYUtils;
|
||||
import com.uiui.zyappstore.utils.ToastUtil;
|
||||
import com.uiui.zyappstore.utils.Utils;
|
||||
|
||||
import java.io.File;
|
||||
@@ -37,7 +39,10 @@ import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
@@ -159,6 +164,14 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getApplyForInstallObservable(String pkg, String name) {
|
||||
return mRetrofit.create(ApplyForInstallApi.class)
|
||||
.applyForInstall(pkg, name, Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
public SNInfo getuserInfoControl() {
|
||||
return mRetrofit.create(SNInfo.class);
|
||||
}
|
||||
@@ -216,6 +229,10 @@ public class NetInterfaceManager {
|
||||
set.add(JGYUtils.iPlay5013Tag);
|
||||
} else if (platform == JGYUtils.iPlay50miniProPlatform) {
|
||||
set.add(JGYUtils.iPlay50miniProTag);
|
||||
} else if (platform == JGYUtils.U807Platform) {
|
||||
set.add(JGYUtils.U807Tag);
|
||||
} else if (platform == JGYUtils.iPlay50PPlatform) {
|
||||
set.add(JGYUtils.iPlay50PTag);
|
||||
}
|
||||
});
|
||||
setpushTag(set);
|
||||
@@ -249,4 +266,37 @@ public class NetInterfaceManager {
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
public void getApplyForInstall(String pkg, String name, onCompleteCallback callback) {
|
||||
getApplyForInstallObservable(pkg, name)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getApplyForInstall", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("getApplyForInstall", "onNext: " + baseResponse);
|
||||
ToastUtil.show(baseResponse.msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getApplyForInstall", "onError: " + e.getMessage());
|
||||
ToastUtil.show("网络连接失败");
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getApplyForInstall", "onComplete: ");
|
||||
if (callback != null) {
|
||||
callback.onComplete();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,20 +3,23 @@ package com.uiui.zyappstore.network;
|
||||
public class UrlAddress {
|
||||
public static final String ROOT_URL = "https://led.aolelearn.com/android/";
|
||||
|
||||
//获取所有应用
|
||||
/*获取所有应用*/
|
||||
public final static String GET_ALL_APPINFO = "app/queryAllApp";
|
||||
//获取管理员应用分类
|
||||
/*获取管理员应用分类*/
|
||||
public final static String GET_ADMIN_APP_CLASS = "app/getAdminAppClass";
|
||||
//获取管理员所有应用
|
||||
/*获取管理员所有应用*/
|
||||
public final static String GET_ADMIN_APP = "getAdminApp";
|
||||
//获取应用详情
|
||||
/*获取应用详情*/
|
||||
public final static String GET_PACKAGE_APP = "app/queryPackageApp";
|
||||
//通过SN获取绑定信息
|
||||
/*通过SN获取绑定信息*/
|
||||
public final static String GET_INFO_FROMESN = "sn/getSnInfo";
|
||||
//获取banner图
|
||||
/*获取banner图*/
|
||||
public final static String GET_BANNER_IMG = "app/getBrand";
|
||||
public final static String GET_BANNER = "sn/getBanner";
|
||||
public final static String SEND_DOWNLOADAPP = "app/downloadApp";
|
||||
//根据包名获取更新
|
||||
/*根据包名获取更新*/
|
||||
public final static String GET_NEWESTAPPUPDATE = "app/newestAppUpdate";
|
||||
/*应用安装申请*/
|
||||
public final static String APPLY_FOR_INSTALL = "app/applyForInstall";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.uiui.zyappstore.network.api;
|
||||
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.network.UrlAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface ApplyForInstallApi {
|
||||
@FormUrlEncoded
|
||||
@POST(UrlAddress.APPLY_FOR_INSTALL)
|
||||
Observable<BaseResponse> applyForInstall(
|
||||
@Field("package") String packageName,
|
||||
@Field("app_name") String app_name,
|
||||
@Field("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.uiui.zyappstore.network.api;
|
||||
|
||||
|
||||
|
||||
import com.uiui.zyappstore.bean.AppInfo;
|
||||
import com.uiui.zyappstore.bean.BaseResponse;
|
||||
import com.uiui.zyappstore.network.UrlAddress;
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.uiui.zyappstore.utils;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
/**
|
||||
* Glide 加载 简单判空封装 防止异步加载数据时调用Glide 抛出异常
|
||||
* Created by Li_Xavier on 2017/6/20 0020.
|
||||
*/
|
||||
public class GlideLoadUtils {
|
||||
private String TAG = "ImageLoader";
|
||||
|
||||
/**
|
||||
* 借助内部类 实现线程安全的单例模式
|
||||
* 属于懒汉式单例,因为Java机制规定,内部类SingletonHolder只有在getInstance()
|
||||
* 方法第一次调用的时候才会被加载(实现了lazy),而且其加载过程是线程安全的。
|
||||
* 内部类加载的时候实例化一次instance。
|
||||
*/
|
||||
public GlideLoadUtils() {
|
||||
}
|
||||
|
||||
private static class GlideLoadUtilsHolder {
|
||||
private final static GlideLoadUtils INSTANCE = new GlideLoadUtils();
|
||||
}
|
||||
|
||||
public static GlideLoadUtils getInstance() {
|
||||
return GlideLoadUtilsHolder.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Glide 加载 简单判空封装 防止异步加载数据时调用Glide 抛出异常
|
||||
*
|
||||
* @param context
|
||||
* @param url 加载图片的url地址 String
|
||||
* @param imageView 加载图片的ImageView 控件
|
||||
* @param default_image 图片展示错误的本地图片 id
|
||||
*/
|
||||
public void glideLoad(Context context, String url, ImageView imageView, int default_image) {
|
||||
if (context != null) {
|
||||
Glide.with(context).load(url).centerCrop().error(default_image).into(imageView);
|
||||
} else {
|
||||
Log.i(TAG, "Picture loading failed,context is null");
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||
public void glideLoad(Activity activity, String url, ImageView imageView, int default_image) {
|
||||
if (!activity.isDestroyed()) {
|
||||
Glide.with(activity).load(url).centerCrop().error(default_image).into(imageView);
|
||||
} else {
|
||||
Log.i(TAG, "Picture loading failed,activity is Destroyed");
|
||||
}
|
||||
}
|
||||
|
||||
public void glideLoad(Fragment fragment, String url, ImageView imageView, int default_image) {
|
||||
if (fragment != null && fragment.getActivity() != null) {
|
||||
Glide.with(fragment).load(url).centerCrop().error(default_image).into(imageView);
|
||||
} else {
|
||||
Log.i(TAG, "Picture loading failed,fragment is null");
|
||||
}
|
||||
}
|
||||
|
||||
public void glideLoad(android.app.Fragment fragment, String url, ImageView imageView, int default_image) {
|
||||
if (fragment != null && fragment.getActivity() != null) {
|
||||
Glide.with(fragment).load(url).centerCrop().error(default_image).into(imageView);
|
||||
} else {
|
||||
Log.i(TAG, "Picture loading failed,android.app.Fragment is null");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,10 @@ public class JGYUtils {
|
||||
public static final int iPlayMiniPlatform = 13;
|
||||
public static final int iPlay5013Platform = 14;
|
||||
public static final int iPlay50miniProPlatform = 16;
|
||||
public static final int U807Platform = 19;
|
||||
public static final int iPlay50PPlatform = 21;
|
||||
|
||||
|
||||
public static final int UnknowPlatform = 0;
|
||||
|
||||
public static final String MTKTag = "MTK";
|
||||
@@ -75,6 +79,8 @@ public class JGYUtils {
|
||||
public static final String iPlayMiniTag = "T811";
|
||||
public static final String iPlay5013Tag = "iplay5013";
|
||||
public static final String iPlay50miniProTag = "miniG99";
|
||||
public static final String U807Tag = "U807";
|
||||
public static final String iPlay50PTag = "T1102";
|
||||
|
||||
|
||||
private JGYUtils(Context context) {
|
||||
@@ -354,14 +360,19 @@ public class JGYUtils {
|
||||
} else if (iPlay5013Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "ipaly50 13");
|
||||
return iPlay5013Platform;
|
||||
}else if (iPlay50miniProTag.equalsIgnoreCase(platform)) {
|
||||
} else if (iPlay50miniProTag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "miniG99");
|
||||
return iPlay50miniProPlatform;
|
||||
} else {
|
||||
} else if (U807Tag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "U807");
|
||||
return U807Platform;
|
||||
} else if (iPlay50PTag.equalsIgnoreCase(platform)) {
|
||||
Log.i(TAG, "checkAppPlatform: " + "T1102");
|
||||
return iPlay50PPlatform;
|
||||
} else {
|
||||
Log.i(TAG, "checkAppPlatform: " + "没有数据");
|
||||
return UnknowPlatform;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isSamePlatform(String platform) {
|
||||
@@ -399,8 +410,12 @@ public class JGYUtils {
|
||||
getAppPlatformCallback.AppPlatform(iPlayMiniPlatform);
|
||||
} else if (iPlay5013Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(iPlay5013Platform);
|
||||
} else if (iPlay50miniProTag.equalsIgnoreCase(platform)) {
|
||||
} else if (iPlay50miniProTag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(iPlay50miniProPlatform);
|
||||
} else if (U807Tag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(U807Platform);
|
||||
} else if (iPlay50PTag.equalsIgnoreCase(platform)) {
|
||||
getAppPlatformCallback.AppPlatform(iPlay50PPlatform);
|
||||
} else {
|
||||
getAppPlatformCallback.AppPlatform(UnknowPlatform);
|
||||
}
|
||||
|
||||
9
app/src/main/res/drawable/bg_dialog.xml
Normal file
9
app/src/main/res/drawable/bg_dialog.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#ffffff" />
|
||||
<stroke
|
||||
android:width="0.8dp"
|
||||
android:color="#ffffff" />
|
||||
<!-- 圆角 -->
|
||||
<corners android:radius="@dimen/dp_10" />
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/join_background.xml
Normal file
13
app/src/main/res/drawable/join_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/bt_join_background_color" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
|
||||
<!-- <padding-->
|
||||
<!-- android:bottom="0dp"-->
|
||||
<!-- android:left="8dp"-->
|
||||
<!-- android:right="8dp"-->
|
||||
<!-- android:top="0dp" />-->
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/joined_background.xml
Normal file
13
app/src/main/res/drawable/joined_background.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 内部颜色 -->
|
||||
<solid android:color="@color/bt_joined_background_color" />
|
||||
<!-- 圆角的幅度 -->
|
||||
<corners android:radius="@dimen/dp_16" />
|
||||
|
||||
<!-- <padding-->
|
||||
<!-- android:bottom="0dp"-->
|
||||
<!-- android:left="8dp"-->
|
||||
<!-- android:right="8dp"-->
|
||||
<!-- android:top="0dp" />-->
|
||||
</shape>
|
||||
105
app/src/main/res/layout/dialog_install.xml
Normal file
105
app/src/main/res/layout/dialog_install.xml
Normal file
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/dp_240"
|
||||
android:layout_height="@dimen/dp_180"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/bg_dialog"
|
||||
android:minWidth="@dimen/dp_240"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_12"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible"
|
||||
tools:text="消息提示" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_48"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="3dp"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
|
||||
android:minHeight="50dp"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_10"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="提示消息提示消息提示消息提示消息提示消息" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/negtive"
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/joined_background"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="取消" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/positive"
|
||||
android:layout_width="@dimen/dp_52"
|
||||
android:layout_height="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_32"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/join_background"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="0.0"
|
||||
tools:text="申请安装" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -23,4 +23,6 @@
|
||||
<color name="adapter_selector_default">#f3f0f0</color>
|
||||
<color name="activation_color">#4880ff</color>
|
||||
|
||||
<color name="bt_join_background_color">#4880ff</color>
|
||||
<color name="bt_joined_background_color">#CFCFCF</color>
|
||||
</resources>
|
||||
|
||||
@@ -18,4 +18,6 @@
|
||||
<string name="class_video">偏科助手</string>
|
||||
<string name="class_entertainment">基础工具</string>
|
||||
<string name="class_manage">学习软件</string>
|
||||
|
||||
<string name="install_note">基于安全管理策略,【%s】需要家长审批后才能安装</string>
|
||||
</resources>
|
||||
|
||||
@@ -48,4 +48,16 @@
|
||||
<item name="android:minHeight">16dp</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomDialog" parent="Theme.AppCompat.Dialog.Alert">
|
||||
<!--背景颜色及和透明程度-->
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<!--是否去除标题 -->
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!--是否去除边框-->
|
||||
<item name="android:windowFrame">@null</item>
|
||||
<!--是否浮现在activity之上-->
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<!--是否模糊-->
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
include ':app'
|
||||
rootProject.name='科大讯飞应用市场'
|
||||
rootProject.name='酷信应用市场'
|
||||
|
||||
Reference in New Issue
Block a user