Compare commits
2 Commits
c90376ab01
...
f4af131dfb
Author | SHA1 | Date | |
---|---|---|---|
f4af131dfb | |||
989ff635c6 |
@ -139,5 +139,4 @@ dependencies {
|
|||||||
implementation 'xyz.doikki.android.dkplayer:dkplayer-ui:3.3.7'
|
implementation 'xyz.doikki.android.dkplayer:dkplayer-ui:3.3.7'
|
||||||
//可选,使用ijkplayer进行解码
|
//可选,使用ijkplayer进行解码
|
||||||
implementation 'xyz.doikki.android.dkplayer:player-ijk:3.3.7'
|
implementation 'xyz.doikki.android.dkplayer:player-ijk:3.3.7'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"artifactType": {
|
|
||||||
"type": "APK",
|
|
||||||
"kind": "Directory"
|
|
||||||
},
|
|
||||||
"applicationId": "com.tairui.industrial_operation",
|
|
||||||
"variantName": "release",
|
|
||||||
"elements": [
|
|
||||||
{
|
|
||||||
"type": "SINGLE",
|
|
||||||
"filters": [],
|
|
||||||
"attributes": [],
|
|
||||||
"versionCode": 1,
|
|
||||||
"versionName": "1.0",
|
|
||||||
"outputFile": "IndustrialOperation_app_v1.0_20250610153115.apk"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"elementType": "File"
|
|
||||||
}
|
|
@ -138,12 +138,29 @@
|
|||||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
<activity
|
||||||
|
android:name=".ui.brand.PublicBrandActivity"
|
||||||
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||||
|
android:exported="false"
|
||||||
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.photoview.PhotoViewActivty"
|
android:name=".ui.photoview.PhotoViewActivty"
|
||||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
|
<provider
|
||||||
|
android:name="androidx.core.content.FileProvider"
|
||||||
|
android:authorities="${applicationId}.fileprovider"
|
||||||
|
android:exported="false"
|
||||||
|
android:grantUriPermissions="true">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
|
android:resource="@xml/file_paths" />
|
||||||
|
</provider>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -30,6 +30,8 @@ public class Api {
|
|||||||
public static final String REGISTER = BASE_HOST + "/auth/registerApp";
|
public static final String REGISTER = BASE_HOST + "/auth/registerApp";
|
||||||
public static final String LOGIN = BASE_HOST + "/auth/login";
|
public static final String LOGIN = BASE_HOST + "/auth/login";
|
||||||
|
|
||||||
|
public static final String UPDATE_APP = BASE_HOST + "/checkUpdate";
|
||||||
|
|
||||||
public static final String HOME_GOODS_LIST = BASE_HOST + "/goods/goodInfoManage/transactionGoodInfo";
|
public static final String HOME_GOODS_LIST = BASE_HOST + "/goods/goodInfoManage/transactionGoodInfo";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,41 @@
|
|||||||
package com.tairui.industrial_operation.ui;
|
package com.tairui.industrial_operation.ui;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.flyco.tablayout.listener.CustomTabEntity;
|
import com.flyco.tablayout.listener.CustomTabEntity;
|
||||||
import com.flyco.tablayout.listener.OnTabSelectListener;
|
import com.flyco.tablayout.listener.OnTabSelectListener;
|
||||||
import com.gyf.immersionbar.ImmersionBar;
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
import com.rxjava.rxlife.RxLife;
|
||||||
|
import com.tairui.industrial_operation.BuildConfig;
|
||||||
import com.tairui.industrial_operation.R;
|
import com.tairui.industrial_operation.R;
|
||||||
import com.tairui.industrial_operation.base.BaseActivity;
|
import com.tairui.industrial_operation.base.BaseActivity;
|
||||||
import com.tairui.industrial_operation.base.BaseFragment;
|
import com.tairui.industrial_operation.base.BaseFragment;
|
||||||
import com.tairui.industrial_operation.base.adapter.TabFragmentPagerAdapter;
|
import com.tairui.industrial_operation.base.adapter.TabFragmentPagerAdapter;
|
||||||
import com.tairui.industrial_operation.databinding.ActivityMainBinding;
|
import com.tairui.industrial_operation.databinding.ActivityMainBinding;
|
||||||
|
import com.tairui.industrial_operation.entity.Api;
|
||||||
import com.tairui.industrial_operation.entity.TabEntity;
|
import com.tairui.industrial_operation.entity.TabEntity;
|
||||||
|
import com.tairui.industrial_operation.http.OnError;
|
||||||
import com.tairui.industrial_operation.ui.home.HomeFragment;
|
import com.tairui.industrial_operation.ui.home.HomeFragment;
|
||||||
import com.tairui.industrial_operation.ui.my.MyFragment;
|
import com.tairui.industrial_operation.ui.my.MyFragment;
|
||||||
import com.tairui.industrial_operation.ui.service.ServiceFragment;
|
import com.tairui.industrial_operation.ui.service.ServiceFragment;
|
||||||
import com.tairui.industrial_operation.ui.shopping.ShoppingFragment;
|
import com.tairui.industrial_operation.ui.shopping.ShoppingFragment;
|
||||||
|
import com.tairui.industrial_operation.util.DownloadUtil;
|
||||||
|
import com.tairui.industrial_operation.util.LogUtil;
|
||||||
|
import com.tairui.industrial_operation.util.NetUtil;
|
||||||
|
import com.tairui.industrial_operation.util.ToastUtil;
|
||||||
|
import com.tairui.industrial_operation.widget.CustomProgressDialog;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import androidx.core.content.FileProvider;
|
||||||
import androidx.viewpager.widget.ViewPager;
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import rxhttp.RxHttp;
|
||||||
|
|
||||||
public class MainActivity extends BaseActivity<ActivityMainBinding> {
|
public class MainActivity extends BaseActivity<ActivityMainBinding> {
|
||||||
|
|
||||||
@ -28,6 +46,8 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> {
|
|||||||
private ArrayList<CustomTabEntity> mTabEntities = new ArrayList<>();
|
private ArrayList<CustomTabEntity> mTabEntities = new ArrayList<>();
|
||||||
private TabFragmentPagerAdapter mPagerAdapter;
|
private TabFragmentPagerAdapter mPagerAdapter;
|
||||||
|
|
||||||
|
private CustomProgressDialog downloadDialog;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initStatusBar() {
|
protected void initStatusBar() {
|
||||||
ImmersionBar.with(this).fitsSystemWindows(false).transparentStatusBar()
|
ImmersionBar.with(this).fitsSystemWindows(false).transparentStatusBar()
|
||||||
@ -111,4 +131,124 @@ public class MainActivity extends BaseActivity<ActivityMainBinding> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onApplyData() {
|
||||||
|
// getAppVersionInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取线上APP的版本信息
|
||||||
|
*/
|
||||||
|
private void getAppVersionInfo() {
|
||||||
|
RxHttp.get(Api.UPDATE_APP)
|
||||||
|
.asResponse(Object.class)
|
||||||
|
.as(RxLife.asOnMain(this))
|
||||||
|
.subscribe(data -> {
|
||||||
|
//TODO
|
||||||
|
|
||||||
|
}, (OnError) error -> {
|
||||||
|
LogUtil.e("getAppVersionInfo", error.getErrorMsg());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param grade app 的下载级别
|
||||||
|
* @param appDownloadUrl app 的下载地址
|
||||||
|
* @param remark 描述
|
||||||
|
*/
|
||||||
|
private void showUpdateDialog(int grade, final String appDownloadUrl, String remark) {
|
||||||
|
if (grade == 1) { // 强制更新
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(getString(R.string.str_hint_update));
|
||||||
|
builder.setMessage(remark);
|
||||||
|
builder.setPositiveButton(getString(R.string.str_confirm), (dialog, which) -> {
|
||||||
|
if (!isFinishing()) {
|
||||||
|
doAppDownload(appDownloadUrl);
|
||||||
|
}
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
builder.setCancelable(false);
|
||||||
|
builder.create().show();
|
||||||
|
|
||||||
|
} else { // 非强制更新
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(getString(R.string.str_hint_update));
|
||||||
|
builder.setMessage(remark);
|
||||||
|
builder.setPositiveButton(getString(R.string.str_confirm), (dialog, which) -> {
|
||||||
|
if (!isFinishing()) {
|
||||||
|
doAppDownload(appDownloadUrl);
|
||||||
|
}
|
||||||
|
dialog.dismiss();
|
||||||
|
});
|
||||||
|
builder.setNegativeButton(getString(R.string.str_cancel), (dialog, which) -> {
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下载新版本的apk
|
||||||
|
*/
|
||||||
|
private void doAppDownload(String appUrl) {
|
||||||
|
if (NetUtil.isNetworkConnected(this)) {
|
||||||
|
if (downloadDialog == null) {
|
||||||
|
downloadDialog = new CustomProgressDialog(this, getString(R.string.str_download_app));
|
||||||
|
downloadDialog.setCancelable(false);
|
||||||
|
}
|
||||||
|
downloadDialog.show();
|
||||||
|
//文件存储路径
|
||||||
|
String dir = DownloadUtil.getDownloadDir(mContext);
|
||||||
|
String fileName = System.currentTimeMillis() + ".apk";
|
||||||
|
String destPath = dir + "/" + fileName;
|
||||||
|
RxHttp.get(appUrl)
|
||||||
|
.asAppendDownload(destPath, AndroidSchedulers.mainThread(), progress -> {
|
||||||
|
//下载进度回调,0-100,仅在进度有更新时才会回调
|
||||||
|
int currentProgress = progress.getProgress(); //当前进度 0-100
|
||||||
|
long currentSize = progress.getCurrentSize(); //当前已下载的字节大小
|
||||||
|
long totalSize = progress.getTotalSize(); //要下载的总字节大小
|
||||||
|
if (null != downloadDialog) {
|
||||||
|
downloadDialog.setProgress(currentProgress);
|
||||||
|
}
|
||||||
|
}) //指定主线程回调
|
||||||
|
.doFinally(() -> {
|
||||||
|
if (null != downloadDialog) {
|
||||||
|
downloadDialog.dismiss();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.subscribe(s -> { //s为String类型
|
||||||
|
// 下载成功。进行安装
|
||||||
|
if (!TextUtils.isEmpty(s)) {
|
||||||
|
installApk(new File(s));
|
||||||
|
}
|
||||||
|
}, throwable -> {
|
||||||
|
if (null != downloadDialog) {
|
||||||
|
downloadDialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ToastUtil.showShortToast(getString(R.string.network_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安装 APK
|
||||||
|
*/
|
||||||
|
private void installApk(File file) {
|
||||||
|
try {
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
Uri data;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
data = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".fileprovider", file);
|
||||||
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
} else {
|
||||||
|
data = Uri.fromFile(file);
|
||||||
|
}
|
||||||
|
intent.setDataAndType(data, "application/vnd.android.package-archive");
|
||||||
|
startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.tairui.industrial_operation.ui.brand;
|
||||||
|
|
||||||
|
import com.gyf.immersionbar.ImmersionBar;
|
||||||
|
import com.tairui.industrial_operation.base.BaseActivity;
|
||||||
|
import com.tairui.industrial_operation.databinding.ActivityPublicBrandBinding;
|
||||||
|
|
||||||
|
public class PublicBrandActivity extends BaseActivity<ActivityPublicBrandBinding> {
|
||||||
|
@Override
|
||||||
|
protected Class<ActivityPublicBrandBinding> getBindingClass() {
|
||||||
|
return ActivityPublicBrandBinding.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initStatusBar() {
|
||||||
|
ImmersionBar.with(this).fitsSystemWindows(false).transparentStatusBar()
|
||||||
|
.statusBarDarkFont(true).init();
|
||||||
|
}
|
||||||
|
}
|
@ -3,10 +3,10 @@ package com.tairui.industrial_operation.ui.home.adapter;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.tairui.industrial_operation.R;
|
import com.tairui.industrial_operation.R;
|
||||||
import com.tairui.industrial_operation.base.entity.BaseHolderEntity;
|
import com.tairui.industrial_operation.base.entity.BaseHolderEntity;
|
||||||
|
import com.tairui.industrial_operation.ui.brand.PublicBrandActivity;
|
||||||
import com.tairui.industrial_operation.ui.home.entity.HomeGoodsEntity;
|
import com.tairui.industrial_operation.ui.home.entity.HomeGoodsEntity;
|
||||||
import com.tairui.industrial_operation.ui.smart_farm.SmartFarmActivity;
|
import com.tairui.industrial_operation.ui.smart_farm.SmartFarmActivity;
|
||||||
import com.tairui.industrial_operation.util.DensityUtils;
|
import com.tairui.industrial_operation.util.DensityUtils;
|
||||||
@ -20,7 +20,6 @@ import com.zhpan.indicator.enums.IndicatorStyle;
|
|||||||
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.GridLayoutManager;
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
@ -82,12 +81,11 @@ public class HomeAdapter extends BaseMultiItemQuickAdapter<BaseHolderEntity, Bas
|
|||||||
HomeFuncAdapter funcAdapter = new HomeFuncAdapter();
|
HomeFuncAdapter funcAdapter = new HomeFuncAdapter();
|
||||||
funcAdapter.setNewData((List<BaseHolderEntity>) entity.getData());
|
funcAdapter.setNewData((List<BaseHolderEntity>) entity.getData());
|
||||||
funcRecycler.setAdapter(funcAdapter);
|
funcRecycler.setAdapter(funcAdapter);
|
||||||
funcAdapter.setOnItemClickListener(new OnItemClickListener() {
|
funcAdapter.setOnItemClickListener((baseQuickAdapter, view, i) -> {
|
||||||
@Override
|
if (i == 0) {
|
||||||
public void onItemClick(BaseQuickAdapter baseQuickAdapter, View view, int i) {
|
IntentUtil.startActivity(mContext, SmartFarmActivity.class);
|
||||||
if (i == 0) {
|
} else if (i == 3) {
|
||||||
IntentUtil.startActivity(mContext, SmartFarmActivity.class);
|
IntentUtil.startActivity(mContext, PublicBrandActivity.class);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.tairui.industrial_operation.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Environment;
|
||||||
|
|
||||||
|
public class DownloadUtil {
|
||||||
|
|
||||||
|
public static String getPictureDir(Context context) {
|
||||||
|
return context.getExternalFilesDir(Environment.DIRECTORY_PICTURES).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMovieDir(Context context) {
|
||||||
|
return context.getExternalFilesDir(Environment.DIRECTORY_MOVIES).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getMusicDir(Context context) {
|
||||||
|
return context.getExternalFilesDir(Environment.DIRECTORY_MUSIC).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDcimDir(Context context) {
|
||||||
|
return context.getExternalFilesDir(Environment.DIRECTORY_DCIM).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDownloadDir(Context context) {
|
||||||
|
return context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDocumentsDir(Context context) {
|
||||||
|
return context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDbDir(Context context) {
|
||||||
|
return context.getExternalFilesDir("Databases").getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.tairui.industrial_operation.util;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.net.NetworkInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网络工具类
|
||||||
|
* 判断是否有网络
|
||||||
|
* 网络的状态
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class NetUtil {
|
||||||
|
/**
|
||||||
|
* 判断网络连接状态
|
||||||
|
*
|
||||||
|
* @param context 上下文对象
|
||||||
|
* @return 网络是否连接
|
||||||
|
*/
|
||||||
|
public static boolean isNetworkConnected(Context context) {
|
||||||
|
if (context != null) {
|
||||||
|
ConnectivityManager connectivityManager = (ConnectivityManager) context
|
||||||
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo networkInfo = connectivityManager
|
||||||
|
.getActiveNetworkInfo();
|
||||||
|
if (networkInfo != null) {
|
||||||
|
return networkInfo.isAvailable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网络状态是否为 WIFI
|
||||||
|
*
|
||||||
|
* @param context 上下文对象
|
||||||
|
* @return 是否 WIFI 网络
|
||||||
|
*/
|
||||||
|
public static boolean isWifiConnected(Context context) {
|
||||||
|
if (context != null) {
|
||||||
|
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
|
||||||
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo mWiFiNetworkInfo = mConnectivityManager
|
||||||
|
.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
|
||||||
|
if (mWiFiNetworkInfo != null) {
|
||||||
|
return mWiFiNetworkInfo.isAvailable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网络状态是否为数据流量
|
||||||
|
*
|
||||||
|
* @param context 上下文对象
|
||||||
|
* @return 是否为数据流量
|
||||||
|
*/
|
||||||
|
public static boolean isMobileConnected(Context context) {
|
||||||
|
if (context != null) {
|
||||||
|
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
|
||||||
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo mMobileNetworkInfo = mConnectivityManager
|
||||||
|
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
|
||||||
|
if (mMobileNetworkInfo != null) {
|
||||||
|
return mMobileNetworkInfo.isAvailable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取网络连接类型
|
||||||
|
*
|
||||||
|
* @param context 上下文对象
|
||||||
|
* @return 网络连接状态
|
||||||
|
*/
|
||||||
|
public static int getConnectedType(Context context) {
|
||||||
|
if (context != null) {
|
||||||
|
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
|
||||||
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
NetworkInfo mNetworkInfo = mConnectivityManager
|
||||||
|
.getActiveNetworkInfo();
|
||||||
|
if (mNetworkInfo != null && mNetworkInfo.isAvailable()) {
|
||||||
|
return mNetworkInfo.getType();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.tairui.industrial_operation.widget;
|
||||||
|
|
||||||
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class CustomProgressDialog extends ProgressDialog {
|
||||||
|
|
||||||
|
public CustomProgressDialog(Context context) {
|
||||||
|
super(context);
|
||||||
|
setMessage("loading...");
|
||||||
|
setMax(100);
|
||||||
|
setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||||
|
setCanceledOnTouchOutside(false);
|
||||||
|
setCancelable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomProgressDialog(Context context, String title) {
|
||||||
|
super(context);
|
||||||
|
setMessage(title);
|
||||||
|
setMax(100);
|
||||||
|
setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||||
|
setCanceledOnTouchOutside(false);
|
||||||
|
setCancelable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss() {
|
||||||
|
super.dismiss();
|
||||||
|
setProgress(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel() {
|
||||||
|
super.cancel();
|
||||||
|
setProgress(0);
|
||||||
|
}
|
||||||
|
}
|
12
app/src/main/res/drawable/bg_gradient_public_brand.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
|
||||||
|
<gradient
|
||||||
|
android:angle="315"
|
||||||
|
android:centerColor="#F5F5F5"
|
||||||
|
android:endColor="#F5F5F5"
|
||||||
|
android:startColor="#94FFD5"
|
||||||
|
android:type="linear" />
|
||||||
|
|
||||||
|
</shape>
|
274
app/src/main/res/layout/activity_public_brand.xml
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="400dp"
|
||||||
|
android:background="@drawable/bg_gradient_public_brand"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<com.tairui.industrial_operation.widget.statusbar.StatusBarHeightView
|
||||||
|
android:id="@+id/statusbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/statusbar">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btnBack"
|
||||||
|
android:layout_width="32dp"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:src="@mipmap/ic_back_black"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="公共品牌"
|
||||||
|
android:textColor="@color/color_txt_black"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:id="@+id/refreshRecycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/toolbar">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/qwrz"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:src="@mipmap/pic_public_brand_1"
|
||||||
|
app:layout_constraintDimensionRatio="358:140"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/dt"
|
||||||
|
android:layout_width="200dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:src="@mipmap/pic_public_brand_2"
|
||||||
|
app:layout_constraintDimensionRatio="200:140"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/qwrz" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/wdcp"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:src="@mipmap/pic_public_brand_3"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/ph1"
|
||||||
|
app:layout_constraintDimensionRatio="150:64"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/dt"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/dt" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/ph1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="12dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/lqpp"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/wdcp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/lqpp"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginLeft="2dp"
|
||||||
|
android:src="@mipmap/pic_public_brand_4"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/dt"
|
||||||
|
app:layout_constraintDimensionRatio="156:64"
|
||||||
|
app:layout_constraintLeft_toRightOf="@id/dt"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/ph1" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:src="@mipmap/ic_ppdj" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="品牌登记"
|
||||||
|
android:textColor="@color/color_txt_black"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:src="@mipmap/ic_cpdj" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="产品登记"
|
||||||
|
android:textColor="@color/color_txt_black"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:src="@mipmap/ic_sqjl" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="申请记录"
|
||||||
|
android:textColor="@color/color_txt_black"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:src="@mipmap/ic_sqsq" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:text="授权申请"
|
||||||
|
android:textColor="@color/color_txt_black"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_container_white_raduis_10"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="12dp">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="left|center_vertical"
|
||||||
|
android:text="品牌服务"
|
||||||
|
android:textColor="@color/color_txt_black"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right|center_vertical"
|
||||||
|
android:drawableRight="@mipmap/ic_arrow_right_gray"
|
||||||
|
android:text="查看更多"
|
||||||
|
android:textColor="@color/color_txt_label"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:src="@mipmap/pic_public_brand_5" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:src="@mipmap/pic_public_brand_6" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
BIN
app/src/main/res/mipmap-xxhdpi/ic_arrow_right_gray.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_cpdj.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_ppdj.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_sqjl.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_sqsq.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/pic_public_brand_1.png
Normal file
After Width: | Height: | Size: 468 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/pic_public_brand_2.png
Normal file
After Width: | Height: | Size: 84 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/pic_public_brand_3.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/pic_public_brand_4.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/pic_public_brand_5.png
Normal file
After Width: | Height: | Size: 310 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/pic_public_brand_6.png
Normal file
After Width: | Height: | Size: 713 KiB |
@ -7,4 +7,10 @@
|
|||||||
<string name="time_out_please_try_again_later">网络连接超时,请稍后再试</string>
|
<string name="time_out_please_try_again_later">网络连接超时,请稍后再试</string>
|
||||||
|
|
||||||
<string name="str_no_content">空空如也~</string>
|
<string name="str_no_content">空空如也~</string>
|
||||||
|
|
||||||
|
|
||||||
|
<string name="str_download_app">软件下载中...</string>
|
||||||
|
<string name="str_hint_update">更新提示</string>
|
||||||
|
<string name="str_confirm">确定</string>
|
||||||
|
<string name="str_cancel">取消</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
7
app/src/main/res/xml/file_paths.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<paths>
|
||||||
|
<!--所有路径-->
|
||||||
|
<external-path
|
||||||
|
name="external_storage_root"
|
||||||
|
path="." />
|
||||||
|
</paths>
|