Commit b777dcb0 by zxl

创建华洋钢管app

parents
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
app/release/*
*.apk
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State />
<State>
<id>Abstraction issuesJava</id>
</State>
<State>
<id>AccessibilityLintAndroid</id>
</State>
<State>
<id>Android</id>
</State>
<State>
<id>Bidirectional TextInternationalizationLintAndroid</id>
</State>
<State>
<id>Code maturityJava</id>
</State>
<State>
<id>Code style issuesJava</id>
</State>
<State>
<id>CorrectnessLintAndroid</id>
</State>
<State>
<id>EncapsulationJava</id>
</State>
<State>
<id>InitializationJava</id>
</State>
<State>
<id>InternationalizationLintAndroid</id>
</State>
<State>
<id>J2ME issuesJava</id>
</State>
<State>
<id>Java</id>
</State>
<State>
<id>JavadocJava</id>
</State>
<State>
<id>LintAndroid</id>
</State>
<State>
<id>LoggingJava</id>
</State>
<State>
<id>PerformanceLintAndroid</id>
</State>
<State>
<id>Resource managementJava</id>
</State>
<State>
<id>SecurityJava</id>
</State>
<State>
<id>SecurityLintAndroid</id>
</State>
<State>
<id>toString() issuesJava</id>
</State>
</expanded-state>
<selected-state>
<State>
<id>Android</id>
</State>
</selected-state>
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.roke.huayangproject"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
//黄油刀添加如下配置就OK了
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.android.support:appcompat-v7:30.0.0'
implementation 'com.android.support:design:30.0.0'
//屏幕自适应
implementation 'me.jessyan:autosize:1.1.2'
//黄油刀
implementation 'com.jakewharton:butterknife:7.0.1'
//谷歌权限三方
implementation 'pub.devrel:easypermissions:1.2.0'
//网络框架
implementation 'com.lzy.net:okgo:2.1.4'
//gson解析
implementation 'com.google.code.gson:gson:2.8.2'
//网页加载
implementation 'com.just.agentweb:agentweb:4.0.3-beta'
implementation 'com.just.agentweb:filechooser:4.0.3-beta'
// 上下拉出屏
implementation 'com.lcodecorex:tkrefreshlayout:1.0.7'
//通用适配器
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.0'
//扫码
implementation 'cn.bingoogolapple:bga-qrcode-zxing:1.3.6'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha06'
//侧滑删除按钮
// implementation 'com.yanzhenjie.recyclerview:support:1.3.2'
implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.roke.huayangproject;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.roke.huayangproject", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.roke.huayangproject">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--相机-->
<uses-permission android:name="android.permission.CAMERA" />
<!--震动-->
<uses-permission android:name="android.permission.VIBRATE" />
<!--传感器-->
<uses-permission android:name="android.permission.BODY_SENSORS" />
<uses-permission android:name="android.scanner.library" />
<!--音频-->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!--日历-->
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<!--读log-->
<uses-permission android:name="android.permission.READ_LOGS"
tools:ignore="ProtectedPermissions" />
<!--短信-->
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />
<uses-permission android:name="android.permission.RECEIVE_MMS" />
<!--安装app-->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<!-- 在SDCard中创建与删除文件权限 -->
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission .WRITE_SETTINGS" />
<!-- 这个权限用于进行网络定位-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<!-- 这个权限用于访问GPS定位-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!-- 获取运营商信息,用于支持提供运营商信息相关的接口-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- 这个权限用于获取wifi的获取权限,wifi信息会用来进行网络定位-->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<!-- 用于读取手机当前的状态-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<!-- 访问网络,网络定位需要上网-->
<uses-permission android:name="android.permission.INTERNET" />
<!-- SD卡读取权限,用户写入离线定位数据-->
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore="ProtectedPermissions" />
<!-- 获取精确gps位置 -->
<uses-permission android:name="android.permission.ACCESS_GPS"/>
<!-- 允许程序访问额外的定位提供者指令获取模拟定位信息 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
<!--用于申请获取蓝牙信息进行室内定位-->
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<!--休眠唤醒权限-->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!--读取联系人-->
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name=".HuaYangApp"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:networkSecurityConfig="@xml/network_security_config"
android:theme="@style/My.App.Theme.Light"
tools:ignore="GoogleAppIndexingWarning"
>
<meta-data
android:name="design_width_in_dp"
android:value="360" />
<meta-data
android:name="design_height_in_dp"
android:value="640" />
<activity android:name=".ui.login.LoginActivity"
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize|keyboardHidden"
android:theme="@style/App.Theme.Launch">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">
</activity>
<activity
android:name=".ui.SplashActivity"
android:label="宣传页"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".ui.setting.SettingActivity"
android:label="设置"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".ui.loading.LoadingActivity"
android:label="装车"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait">
</activity>
<activity
android:name=".ui.pick.PickingActivity"
android:label="拣货确认"
android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait">
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.roke.huayangproject.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
\ No newline at end of file
package com.roke.huayangproject;
import android.content.Context;
import com.roke.huayangproject.base.BaseApplication;
/**
* 自定义application
* Created by 赵新龙 on 2019/6/17.
*/
public class HuaYangApp extends BaseApplication {
private final int DB_VERSION = 0;
private final int OLD_DB_VERSION = 0;
public static final String DB_NAME = "roke.db";
public static final String PAGE="装车"; // 1.装车 2.仓管
private static Context mContext;
private static String TAG = HuaYangApp.class.getCanonicalName();
@Override
public void onCreate() {
super.onCreate();
mContext = this;
}
public static Context getContext(){
return mContext;
}
}
package com.roke.huayangproject;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
package com.roke.huayangproject.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.roke.huayangproject.R;
import com.roke.huayangproject.bean.LoadingInfo;
import java.util.List;
public class LoadingAdapter extends BaseQuickAdapter<LoadingInfo.ResultBean.RecordListBean, BaseViewHolder> {
public LoadingAdapter(List<LoadingInfo.ResultBean.RecordListBean> data) {
super(R.layout.recycler_item_loading, data);
}
@Override
protected void convert(BaseViewHolder helper, LoadingInfo.ResultBean.RecordListBean item) {
helper.setText(R.id.et_cpmc,item.getProduct())
.setText(R.id.et_cpsl,item.getProduct_num())
;
}
}
package com.roke.huayangproject.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.roke.huayangproject.R;
import com.roke.huayangproject.bean.LoadingInfo;
import java.util.List;
public class UnLoadingAdapter extends BaseQuickAdapter<LoadingInfo.ResultBean.DetailListBean, BaseViewHolder> {
public UnLoadingAdapter(List<LoadingInfo.ResultBean.DetailListBean> data) {
super(R.layout.recycler_item_unloading, data);
}
@Override
protected void convert(BaseViewHolder helper, LoadingInfo.ResultBean.DetailListBean item) {
helper.setText(R.id.tv_cpmc,item.getProduct())
.setText(R.id.tv_cpsl,item.getProduct_num())
.addOnClickListener(R.id.btn_submit)
;
}
}
package com.roke.huayangproject.base;
import android.app.DatePickerDialog;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import com.lzy.okgo.OkGo;
import com.roke.huayangproject.R;
import com.roke.huayangproject.utils.CommonUtils;
import com.roke.huayangproject.utils.DialogUtils;
import java.util.Calendar;
import butterknife.ButterKnife;
import me.jessyan.autosize.internal.CustomAdapt;
/**
* baseActionBar Activity
*
*/
public abstract class BaseActivity extends AppCompatActivity implements BaseViewInterface, CustomAdapt {
private boolean hasMenu = true; //是否有右边的按钮
public Context mContext;
protected LayoutInflater mInflater;
protected ActionBar mActionBar;
protected TextView dateView; //时间显示控件
private final String packageName4Umeng = this.getClass().getName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTheme(R.style.My_App_Theme_Light);
onBeforeSetContentLayout();
if (getLayoutId() != 0) {
setContentView(getLayoutId());
}
mContext = this;
hasMenu = getHasMenu();
mActionBar = getSupportActionBar();
mInflater = getLayoutInflater();
if (hasActionBar()) {
initActionBar(mActionBar);
}else{
mActionBar.hide();
}
// 通过注解绑定控件
ButterKnife.bind(this);
Calendar ca = Calendar.getInstance();
mYear = ca.get(Calendar.YEAR);
mMonth = ca.get(Calendar.MONTH);
mDay = ca.get(Calendar.DAY_OF_MONTH);
init(savedInstanceState);
init();
initData();
initView();
Log.i(packageName4Umeng, "onCreate: 当前oncreate方法执行完毕了");
}
//默认有菜单
protected boolean getHasMenu() {
return true;
}
protected abstract void init();
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onResume() {
super.onResume();
}
protected void onBeforeSetContentLayout() {
}
protected boolean hasActionBar() {
return getSupportActionBar() != null;
}
protected abstract int getLayoutId();
protected View inflateView(int resId) {
return mInflater.inflate(resId, null);
}
protected abstract String getActionBarTitle();
protected boolean hasBackButton() {
return true;
}
protected void init(Bundle savedInstanceState) {
}
protected void initActionBar(ActionBar actionBar) {
if (actionBar == null)
return;
if (hasBackButton()) {
mActionBar.setDisplayHomeAsUpEnabled(true);
mActionBar.setHomeButtonEnabled(true);
} else {
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE);
mActionBar.setDisplayShowHomeEnabled(false);
mActionBar.setDisplayUseLogoEnabled(false);
mActionBar.setDisplayHomeAsUpEnabled(false);
mActionBar.setHomeButtonEnabled(false);
}
if (!CommonUtils.isNull(getActionBarTitle())){
actionBar.setTitle(getActionBarTitle());
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
break;
case R.id.action_submit:
submitClick();
break;
default:
break;
}
return super.onOptionsItemSelected(item);
}
protected abstract void submitClick();
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (hasMenu){
getMenuInflater().inflate(R.menu.inspection_menu, menu);
}
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean isBaseOnWidth() {
return false;
}
@Override
public float getSizeInDp() {
return 0;
}
public void showD(){
DialogUtils.getInstance().createLoadingDialog(mContext, "请求中...").showDialog();
}
public void closeD(){
DialogUtils.getInstance().closeDialog();
OkGo.getInstance().cancelTag(mContext);
}
protected int mYear;
protected int mMonth;
protected int mDay;
/**
* 日期选择器对话框监听
*/
protected DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
mYear = year;
mMonth = monthOfYear;
mDay = dayOfMonth;
String days;
if (mMonth + 1 < 10) {
if (mDay < 10) {
days = mYear + "0" +
(mMonth + 1) + "0" + mDay;
} else {
days = mYear + "0" +
(mMonth + 1) + "" + mDay;
}
} else {
if (mDay < 10) {
days = mYear + "" +
(mMonth + 1) + "0" + mDay;
} else {
days = mYear +"" +
(mMonth + 1) + "" +mDay;
}
}
if (dateView!=null){
setDataToMainInfo(days);
dateView.setText(days);
}
}
};
protected void setDataToMainInfo(String days){
}
public class MyEditGoodsListener implements TextView.OnEditorActionListener {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i == EditorInfo.IME_ACTION_UNSPECIFIED) {
//隐藏软键盘
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getWindow().getDecorView().getWindowToken(), 0);
requestByScan(textView.getText().toString());
}
return false;
}
}
public void requestByScan(String scan) {
}
public void getFocusableByEdittext(EditText editText){
editText.setText("");
editText .setFocusable(true);
editText .setFocusableInTouchMode(true);
editText .requestFocus();
}
}
package com.roke.huayangproject.base;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheEntity;
import com.lzy.okgo.cache.CacheMode;
import com.lzy.okgo.cookie.store.MemoryCookieStore;
import java.util.Map;
import java.util.logging.Level;
/**
* Created by 赵新龙 on 2019/6/14.
*/
public class BaseApplication extends Application {
private static String PREF_NAME = "shared_data";
static Context _context;
public static String ip = "";
@Override
public void onCreate() {
super.onCreate();
_context = getApplicationContext();
initOkgo();
}
public static synchronized BaseApplication context() {
return (BaseApplication) _context;
}
public void initOkgo() {
// HttpParams params = new HttpParams();
// params.put("jtoken", Util.getUserToken()+""); //全局请求参数
//必须调用初始化
OkGo.init(this);
//以下设置的所有参数是全局参数,同样的参数可以在请求的时候再设置一遍,那么对于该请求来讲,请求中的参数会覆盖全局参数
//好处是全局参数统一,特定请求可以特别定制参数
try {
//以下都不是必须的,根据需要自行选择,一般来说只需要 debug,缓存相关,cookie相关的 就可以了
OkGo.getInstance()
// 打开该调试开关,打印级别INFO,并不是异常,是为了显眼,不需要就不要加入该行
// 最后的true表示是否打印okgo的内部异常,一般打开方便调试错误
.debug("OkGo", Level.INFO
, true)
//如果使用默认的 60秒,以下三行也不需要传
// .addCommonHeaders(headers)
// .addCommonParams(params)
.setCookieStore(new MemoryCookieStore()) //cookie使用内存缓存(app退出后,cookie消失
.setCertificates()
.setConnectTimeout(5000) //全局的连接超时时间
.setReadTimeOut(OkGo.DEFAULT_MILLISECONDS) //全局的读取超时时间
.setWriteTimeOut(OkGo.DEFAULT_MILLISECONDS) //全局的写入超时时间
// .setCertificates(getAssets().open("2_www.myyouta.com.crt
.setRetryCount(0) //设置请求失败后重复请求次数
// ")) // 设置https证书
//可以全局统一设置缓存模式,默认是不使用缓存,可以不传,具体其他模式看 github 介绍 https://github.com/jeasonlzy/
.setCacheMode(CacheMode.NO_CACHE)
//可以全局统一设置缓存时间,默认永不过期,具体使用方法看 github 介绍
.setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 保存数据
* @param key 键
* @param object 值
*/
public static void setData(String key, Object object) {
SharedPreferences.Editor editor = getPreferences().edit();
if (object instanceof String) {
editor.putString(key, (String) object);
} else if (object instanceof Integer) {
editor.putInt(key, (Integer) object);
} else if (object instanceof Boolean) {
editor.putBoolean(key, (Boolean) object);
} else if (object instanceof Float) {
editor.putFloat(key, (Float) object);
} else if (object instanceof Long) {
editor.putLong(key, (Long) object);
} else {
editor.putString(key, object.toString());
}
editor.apply();
}
/**
* 获取保存的数据
* @param key 对应的键
* @param defaultObject 默认值
* @return 返回值
*/
public static Object getData(String key, Object defaultObject) {
SharedPreferences sp = getPreferences();
if (defaultObject instanceof String) {
return sp.getString(key, (String) defaultObject);
} else if (defaultObject instanceof Integer) {
return sp.getInt(key, (Integer) defaultObject);
} else if (defaultObject instanceof Boolean) {
return sp.getBoolean(key, (Boolean) defaultObject);
} else if (defaultObject instanceof Float) {
return sp.getFloat(key, (Float) defaultObject);
} else if (defaultObject instanceof Long) {
return sp.getLong(key, (Long) defaultObject);
}
return "";
}
public static String getUser(){
String user = "";
user = getData("user","").toString();
return user;
}
public static String getUser_id(){
String user_id = "";
user_id = getData("user_id","").toString();
return user_id;
}
/**
* 移除某个key值已经对应的值
*
* @param context
* @param key
*/
public static void remove(Context context, String key) {
SharedPreferences sp =getPreferences();
SharedPreferences.Editor editor = sp.edit();
editor.remove(key);
editor.apply();
}
/**
* 查询某个key是否已经存在
*
* @param context
* @param key
* @return
*/
public static boolean contains(Context context, String key) {
SharedPreferences sp = getPreferences();
return sp.contains(key);
}
/**
* 返回所有的键值对
*
* @param context
* @return
*/
public static Map<String, ?> getAll(Context context) {
SharedPreferences sp =getPreferences();
return sp.getAll();
}
public static SharedPreferences getPreferences() {
return context().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
}
package com.roke.huayangproject.base;
/**
* @author deyi
*/
public interface BaseViewInterface {
public void initView();
public void initData();
}
package com.roke.huayangproject.bean;
import java.util.List;
//create : 3C
//时间2021/8/2 16:30
public class LoadingInfo {
/**
* state : success
* msg : 查询成功
* result : {"order_id":1,"send_order_number":"S00011","business_type":"销售出库","car":"鲁A99881","driver":"张三","remark":"","detail_list":[{"sale_line_id":1,"product_num":1,"product_id":4,"product":"加工类钢管"},{"sale_line_id":2,"product_num":1,"product_id":3,"product":"埋弧焊钢管"}],"record_list":[{"sale_line_id":1,"product_num":1,"product_id":4,"product":"加工类钢管"},{"sale_line_id":2,"product_num":1,"product_id":3,"product":"埋弧焊钢管"}]}
* code : 0
*/
private String state;
private String msg;
private ResultBean result;
private String code;
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public ResultBean getResult() {
return result;
}
public void setResult(ResultBean result) {
this.result = result;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public static class ResultBean {
/**
* order_id : 1
* send_order_number : S00011
* business_type : 销售出库
* car : 鲁A99881
* driver : 张三
* remark :
* detail_list : [{"sale_line_id":1,"product_num":1,"product_id":4,"product":"加工类钢管"},{"sale_line_id":2,"product_num":1,"product_id":3,"product":"埋弧焊钢管"}]
* record_list : [{"sale_line_id":1,"product_num":1,"product_id":4,"product":"加工类钢管"},{"sale_line_id":2,"product_num":1,"product_id":3,"product":"埋弧焊钢管"}]
*/
private String order_id;
private String send_order_number;
private String business_type;
private String car;
private String driver;
private String remark;
private List<DetailListBean> detail_list;
private List<RecordListBean> record_list;
public String getOrder_id() {
return order_id;
}
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
public String getSend_order_number() {
return send_order_number;
}
public void setSend_order_number(String send_order_number) {
this.send_order_number = send_order_number;
}
public String getBusiness_type() {
return business_type;
}
public void setBusiness_type(String business_type) {
this.business_type = business_type;
}
public String getCar() {
return car;
}
public void setCar(String car) {
this.car = car;
}
public String getDriver() {
return driver;
}
public void setDriver(String driver) {
this.driver = driver;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public List<DetailListBean> getDetail_list() {
return detail_list;
}
public void setDetail_list(List<DetailListBean> detail_list) {
this.detail_list = detail_list;
}
public List<RecordListBean> getRecord_list() {
return record_list;
}
public void setRecord_list(List<RecordListBean> record_list) {
this.record_list = record_list;
}
public static class DetailListBean {
/**
* sale_line_id : 1
* product_num : 1.0
* product_id : 4
* product : 加工类钢管
*/
private String sale_line_id;
private String product_num;
private String product_id;
private String product;
private String line_id;
private String state;
public String getSale_line_id() {
return sale_line_id;
}
public void setSale_line_id(String sale_line_id) {
this.sale_line_id = sale_line_id;
}
public String getProduct_num() {
return product_num;
}
public void setProduct_num(String product_num) {
this.product_num = product_num;
}
public String getProduct_id() {
return product_id;
}
public void setProduct_id(String product_id) {
this.product_id = product_id;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getLine_id() {
return line_id;
}
public void setLine_id(String line_id) {
this.line_id = line_id;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
public static class RecordListBean {
/**
* sale_line_id : 1
* product_num : 1.0
* product_id : 4
* product : 加工类钢管
*/
private String sale_line_id;
private String product_num;
private String product_id;
private String product;
private String line_id;
public String getSale_line_id() {
return sale_line_id;
}
public void setSale_line_id(String sale_line_id) {
this.sale_line_id = sale_line_id;
}
public String getProduct_num() {
return product_num;
}
public void setProduct_num(String product_num) {
this.product_num = product_num;
}
public String getProduct_id() {
return product_id;
}
public void setProduct_id(String product_id) {
this.product_id = product_id;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getLine_id() {
return line_id;
}
public void setLine_id(String line_id) {
this.line_id = line_id;
}
}
}
}
package com.roke.huayangproject.bean;
/**
* Created by 赵新龙 on 2019/7/17.
*/
public class LoginInfo {
/**
* message :
* code : 0
* result : [{"user_name":"admin","session_id":"f23c0ce2718cc34ddd0d7afe08d58afd9a387283"}]
*/
private String message;
private String code;
private ResultBean result;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public ResultBean getResult() {
return result;
}
public void setResult(ResultBean result) {
this.result = result;
}
public static class ResultBean {
/**
* user_name : admin
* session_id : f23c0ce2718cc34ddd0d7afe08d58afd9a387283
*/
private String user_name;
private String session_id;
private String user_id;
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getSession_id() {
return session_id;
}
public void setSession_id(String session_id) {
this.session_id = session_id;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
}
}
package com.roke.huayangproject.http;
import android.content.Context;
import android.util.Log;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.request.BaseRequest;
import com.roke.huayangproject.utils.JsonUtil;
import okhttp3.Call;
import okhttp3.Response;
/**
* Created by coder on 2017/7/16.
* <p>
* 封装 获取网络数据的回调基类
*/
public abstract class BaseCallback extends StringCallback {
private Context mActivity;
private static final String TAG = BaseCallback.class.getCanonicalName();
public BaseCallback(Context activity) {
this.mActivity = activity;
}
@Override
public void onSuccess(String json, Call call, Response response) {
Log.i(TAG, "onSuccess: "+ json);
if (response.code() == 200){
if (JsonUtil.isContains(json,"code")&&null!=JsonUtil.getFieldValue(json,"code") ) {
if (Integer.parseInt(JsonUtil.getFieldValue(json, "code")) == ShipHttpClient.RESULT_CODE_SUCCESS) {
onSuccessInfo(json);
} else {
onSuccessError(json);
}
}else if (null!= JsonUtil.getFieldValue(json,"result")&& null!= JsonUtil.getFieldValue(JsonUtil.getFieldValue(json,"result"),"code")){
if (Integer.parseInt(JsonUtil.getFieldValue(JsonUtil.getFieldValue(json,"result"),"code")) == ShipHttpClient.RESULT_CODE_SUCCESS) {
onSuccessInfo(json);
} else {
onSuccessError(json);
}
}else{
onSuccessError(json);
}
}else{
onSuccessError(json);
}
}
public void onSuccessError(String json) {
}
@Override
public void onBefore(BaseRequest request) {
super.onBefore(request);
}
@Override
public void onCacheSuccess(String s, Call call) {
super.onCacheSuccess(s, call);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
Log.e("连接网络返回的错误信息===>", ":::::" + e.toString());
// ShowMsgUtils.ShowToast(mActivity.getApplicationContext(), ShipHttpClient.ERROR_MSG);
}
@Override
public void onCacheError(Call call, Exception e) {
super.onCacheError(call, e);
}
@Override
public void onAfter(String s, Exception e) {
super.onAfter(s, e);
}
@Override
public void upProgress(long currentSize, long totalSize, float progress, long networkSpeed) {
super.upProgress(currentSize, totalSize, progress, networkSpeed);
}
@Override
public void downloadProgress(long currentSize, long totalSize, float progress, long networkSpeed) {
super.downloadProgress(currentSize, totalSize, progress, networkSpeed);
}
@Override
public void parseError(Call call, Exception e) {
super.parseError(call, e);
}
public abstract void onSuccessInfo(String json);
}
package com.roke.huayangproject.http;
import android.Manifest;
import android.os.Environment;
/**
* Created by hasee on 2018/6/5.
*/
public class Constant {
//尾部必须以/结尾
//测试接口地址:端口
public static final String baseUrl = "http://222.173.210.250:48080/";
//排队测试接口
public static final String ceshiUrl = "http://47.105.84.179/";
//服务器地址
public static final String database="JNDT_R3_WMS";
//登录
public static final String login = "roke/login/";
//获取菜单
public static final String get_order_info = "send/get_order_info";
//获取菜单
public static final String detail_button = "send/detail_button";
//拣货确认
public static final String button_line_done = "send/button_line_done";
//版本迭代
public static final String CACHE_DIR = Environment.getExternalStorageDirectory().getAbsolutePath() + "/roke/";
//测试获取版本
public static final String SERVER_URL = "http://192.168.0.181:8080/tmsGate/proxy/tms/app_version/roke.ver";
// 允许程序录制音频
public static final String PERMISSION_RECORD_AUDIO = Manifest.permission.RECORD_AUDIO;
// 允许程序访问Accounts Service帐户列表 联系人
public static final String PERMISSION_GET_ACCOUNTS = Manifest.permission.GET_ACCOUNTS;
// 允许程序访问手机状态信息 电话
public static final String PERMISSION_READ_PHONE_STATE = Manifest.permission.READ_PHONE_STATE;
// public static final String PERMISSION_CALL_PHONE = Manifest.permission.CALL_PHONE;
// 允许程序使用照相设备 相机
public static final String PERMISSION_CAMERA = Manifest.permission.CAMERA;
// 允许程序访问位置信息 定位
// 允许程序访问CellID或WiFi热点来获取位置信息
public static final String PERMISSION_ACCESS_FINE_LOCATION = Manifest.permission.ACCESS_FINE_LOCATION;
public static final String PERMISSION_ACCESS_COARSE_LOCATION = Manifest.permission.ACCESS_COARSE_LOCATION;
// 允许程序读扩展存储卡 读写
// 允许程序写扩展存储卡
public static final String PERMISSION_READ_EXTERNAL_STORAGE = Manifest.permission.READ_EXTERNAL_STORAGE;
public static final String PERMISSION_WRITE_EXTERNAL_STORAGE = Manifest.permission.WRITE_EXTERNAL_STORAGE;
//安装app
public static final String REQUEST_INSTALL_PACKAGES = Manifest.permission.REQUEST_INSTALL_PACKAGES;
//日历
public static final String PERMISSION_READ_CALENDAR = Manifest.permission.READ_CALENDAR;
//传感器
// public static final String PERMISSION_BODY_SENSORS = Manifest.permission.BODY_SENSORS;
//读写短信
public static final String PERMISSION_READ_SMS = Manifest.permission.READ_SMS;
public static final String[] requestPermissions = {
PERMISSION_RECORD_AUDIO,
PERMISSION_GET_ACCOUNTS,
PERMISSION_READ_PHONE_STATE,
PERMISSION_READ_SMS,
//PERMISSION_BODY_SENSORS,
PERMISSION_ACCESS_COARSE_LOCATION,
PERMISSION_READ_EXTERNAL_STORAGE,
PERMISSION_READ_CALENDAR,
PERMISSION_CAMERA
};
/**
* 申请的动态权限
*/
public static final int REQUEST_PERMISSION = 999;
/**
* 存储requestCode
*/
public static final int REQUEST_CODE_STORAGE = 16064;
/**
* 安装APPrequestCode
*/
public static final int REQUEST_INSTALL = 16065;
/**
* 定位requestCode
*/
public static final int REQUEST_CODE_LOCATION = 16062;
/**
* 扫码requestCode
*/
public static final int REQUEST_CODE_SCAN = 16061;
/**
* 联系人requestCode
*/
public static final int REQUEST_CODE_CALENDAR = 16063;
}
package com.roke.huayangproject.http;
import android.content.Context;
import android.util.Log;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.request.GetRequest;
import com.lzy.okgo.request.PostRequest;
import com.roke.huayangproject.HuaYangApp;
import com.roke.huayangproject.utils.CommonUtils;
import com.roke.huayangproject.utils.JsonUtil;
import org.json.JSONException;
import org.json.JSONObject;
import okhttp3.Call;
import okhttp3.Response;
/**
* Created by Administrator on 2018/6/4.
*/
public class ShipHttpClient {
static String ERROR_MSG = "连接服务器失败,请检查网络";
public static final int RESULT_CODE_SUCCESS = 0;
public static final int RESULT_CODE_ERROR = 1;
public static final int RESULT_CODE_PASW = 100003;
public interface CrabHttpCallback<String> {
void onSuccess(String json);
void onError(String msg);
}
private static ShipHttpClient instance;
public static synchronized ShipHttpClient getInstance() {
if (instance == null) {
instance = new ShipHttpClient();
}
return instance;
}
/**
* 登录--通过--内网
*
* @param crabHttpCallback`
*/
public void login(String ip,String zt,Context context, String username, String password, CrabHttpCallback<String> crabHttpCallback) {
String[] key = new String[]{"login", "password", "db_name"};
getRequestParams(context, ip + Constant.login, crabHttpCallback, key, username, password,zt);
}
/**
* 扫码获取产品详情
*
* @param crabHttpCallback`
*/
public void get_order_info( Context context, String order_code, CrabHttpCallback<String> crabHttpCallback) {
String[] key = new String[]{"order_code", "sign"};
getRequestParams(context, HuaYangApp.ip + Constant.get_order_info, crabHttpCallback, key, order_code, "app");
}
/**
* 确认装车,取消确认
*
* @param crabHttpCallback`
*/
public void detail_button( Context context, String line_id,String sign,String user_id, CrabHttpCallback<String> crabHttpCallback) {
String[] key = new String[]{"line_id", "sign", "user_id"};
getRequestParams(context, HuaYangApp.ip + Constant.detail_button, crabHttpCallback, key, line_id,sign,user_id);
}
/**
* 拣货确认
*
* @param crabHttpCallback`
*/
public void button_line_done( Context context, String order_id,String user_id, CrabHttpCallback<String> crabHttpCallback) {
String[] key = new String[]{"order_id", "user_id"};
getRequestParams(context, HuaYangApp.ip + Constant.button_line_done, crabHttpCallback, key, order_id,user_id);
}
// /**
// * 图片上传
// *
// * @param context
// * @param staffId
// * @param token
// * @param type
// * @param crabHttpCallback
// */
// public void uploadFile(Context context, String staffId, String token, String type, File file, final CrabHttpCallback crabHttpCallback) {
//
// OkGo.post(HttpURLInterface.UPLOADALL + "?staffId=" + staffId + "&token=" + token)
// .tag(this)
// .params("staffId", staffId)
// .params("token", token)
// .params("type", type)
// .params(file.getName(), file)
// .execute(new BaseCallback(context) {
// @Override
// public void onSuccessInfo(String json) {
// crabHttpCallback.onSuccess(json);
// }
//
// @Override
// public void onError(Call call, Response response, Exception e) {
// super.onError(call, response, e);
// crabHttpCallback.onFailed(e.toString());
// }
//
// @Override
// public void onSuccessError(String json) {
// super.onSuccessError(json);
// crabHttpCallback.onSuccessError(json);
// }
// });
// }
private static void getRequestParams(final Context context, String url, final CrabHttpCallback<String> callback,
String[] key, String... values) {
PostRequest request = OkGo.post(url);
request.tag(context);
if (key != null) {
for (int i = 0; i < key.length; i++) {
request.params(key[i], values[i]);
}
}
request.execute(new BaseCallback(context) {
@Override
public void onSuccessInfo(String json) {
callback.onSuccess(json);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
if (call.isCanceled()) {
Log.e("request", "用户取消了这次请求");
} else {
callback.onError("系统开了会小差,请重试...");
}
}
@Override
public void onSuccessError(String json) {
super.onSuccessError(json);
if (!CommonUtils.isNull(JsonUtil.getFieldValue(json, "message"))) {
callback.onError(JsonUtil.getFieldValue(json, "message"));
} else {
if (!CommonUtils.isNull(JsonUtil.getFieldValue(json, "msg"))) {
callback.onError(JsonUtil.getFieldValue(json, "msg"));
} else {
callback.onError("系统开了会小差,请重试...");
}
}
}
});
}
private static void getRequestParamsBySession(final Context context, String url, final CrabHttpCallback<String> callback,
String[] key, String... values) {
PostRequest request = OkGo.post(url);
try {
JSONObject params = new JSONObject();
if (key != null) {
for (int i = 0; i < key.length; i++) {
params.put(key[i], values[i]);
}
}
request.tag(context)
.upJson(params)
.execute(new BaseCallback(context) {
@Override
public void onSuccessInfo(String json) {
callback.onSuccess(json);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
if (call.isCanceled()) {
Log.e("request", "用户取消了这次请求");
} else {
callback.onError("系统开了会小差,请重试...");
}
}
@Override
public void onSuccessError(String json) {
super.onSuccessError(json);
if (JsonUtil.isContains(json, "error")) {
callback.onError(JsonUtil.getFieldValue(json, "error"));
} else {
if (JsonUtil.isContains(json, "msg")){
callback.onError(JsonUtil.getFieldValue(json, "msg"));
}else if (JsonUtil.isContains(json,"result")){
callback.onError(JsonUtil.getFieldValue(JsonUtil.getFieldValue(json,"result"), "msg"));
}else{
callback.onError("系统开了会小差,请重试...");
}
}
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
private static void getRequestParamsBySessionByJson(final Context context, String url, final CrabHttpCallback<String> callback,
String[] key, String... values) {
PostRequest request = OkGo.post(url);
try {
JSONObject params = new JSONObject();
if (key != null) {
for (int i = 0; i < key.length; i++) {
params.put(key[i], values[i]);
}
}
String data = params.toString();
String data1= data.replace(":\"[",":[");
String data2= data1.replace("]\"","]");
String data3= data2.replaceAll("\\\\","");
request.tag(context)
.upJson(data3)
.execute(new BaseCallback(context) {
@Override
public void onSuccessInfo(String json) {
callback.onSuccess(json);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
if (call.isCanceled()) {
Log.e("request", "用户取消了这次请求");
} else {
callback.onError("系统开了会小差,请重试...");
}
}
@Override
public void onSuccessError(String json) {
super.onSuccessError(json);
if (null != JsonUtil.getFieldValue(json, "error")) {
callback.onError(JsonUtil.getFieldValue(json, "error"));
} else {
if (null!=JsonUtil.getFieldValue(json, "msg")){
callback.onError(JsonUtil.getFieldValue(json, "msg"));
}else if (null!=JsonUtil.getFieldValue(json,"result")){
callback.onError(JsonUtil.getFieldValue(JsonUtil.getFieldValue(json,"result"), "msg"));
}else{
callback.onError("系统开了会小差,请重试...");
}
}
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
private static void getRequestParamsGET(final Context context, String url, final CrabHttpCallback<String> callback,
String[] key, String... values) {
GetRequest request = OkGo.get(url);
request.tag(context);
if (key != null) {
for (int i = 0; i < key.length; i++) {
request.params(key[i], values[i]);
}
}
request.execute(new BaseCallback(context) {
@Override
public void onSuccessInfo(String json) {
callback.onSuccess(json);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
if (call.isCanceled()) {
Log.e("request", "用户取消了这次请求");
} else {
callback.onError("系统开了会小差,请重试...");
}
}
@Override
public void onSuccessError(String json) {
super.onSuccessError(json);
if (null != JsonUtil.getFieldValue(json, "message")) {
callback.onError(JsonUtil.getFieldValue(json, "message"));
} else {
callback.onError("系统开了会小差,请重试...");
}
}
});
}
private static void getRequestParamsGET(Context context, String url, final BaseCallback callback,
String[] key, String... values) {
GetRequest request = OkGo.get(url);
request.tag(context);
if (key != null) {
for (int i = 0; i < key.length; i++) {
request.params(key[i], values[i]);
}
}
request.execute(callback);
}
private static void getRequestParamsPOST(Context context, String url, final BaseCallback callback,
String[] key, String... values) {
PostRequest request = OkGo.post(url);
request.tag(context);
if (key != null) {
for (int i = 0; i < key.length; i++) {
request.params(key[i], values[i]);
}
}
request.execute(callback);
}
}
package com.roke.huayangproject.ui;
import android.Manifest;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import com.roke.huayangproject.R;
import com.roke.huayangproject.http.Constant;
import com.roke.huayangproject.ui.login.LoginActivity;
import com.roke.huayangproject.utils.Permission;
import com.roke.huayangproject.utils.PermissionUtil;
import com.roke.huayangproject.utils.ShowMsgUtils;
import com.roke.huayangproject.utils.SimplexToast;
import com.roke.huayangproject.utils.UpdateManager;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import pub.devrel.easypermissions.AppSettingsDialog;
import pub.devrel.easypermissions.EasyPermissions;
/**
* 欢迎页面
* Created by 赵新龙 on 2019/6/10.
*/
public class SplashActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks{
private int GET_UNKNOWN_APP_SOURCES = 5;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
initWindow();
requestSavePermissions();
//测试的时候需要添加,如果是真实的情况还需要根据具体情况设定
}
private void requestSavePermissions() {
PermissionUtil.requestStoragePermissions(this, new PermissionUtil.PermissionsCallBackListener() {
@Override
public void hasPermissions() {
requestScanPermissions();
}
});
}
private void requestScanPermissions() {
PermissionUtil.requestScanPermissions(this, new PermissionUtil.PermissionsCallBackListener() {
@Override
public void hasPermissions() {
isAndroidO();
}
});
}
private void isAndroidO() {
//来判断应用是否有权限安装apk
if (Build.VERSION.SDK_INT >= 26) {
//来判断应用是否有权限安装apk
PackageManager packageManager = getPackageManager();
boolean installAllowed= packageManager.canRequestPackageInstalls();
//有权限
if (installAllowed) {
//安装apk
checkUpdate();
} else {
ShowMsgUtils.ShowMessageWithCancelBtn(SplashActivity.this, "手机需要开启允许安装应用权限,是否切换到设置页面?", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
//请求安装未知应用来源的权限
ActivityCompat.requestPermissions(SplashActivity.this, new String[]{Manifest.permission.REQUEST_INSTALL_PACKAGES}, 4);
}
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
});
}
} else {
checkUpdate();
}
}
private void checkUpdate() {
UpdateManager updateManager = new UpdateManager(SplashActivity.this, new UpdateManager.UpdateListener() {
@Override
public void hasUpdate(boolean hasUpdate) {
//只有不需要更新的时候执行跳转
if (!hasUpdate) {
initTimer();
}
}
});
updateManager.CheckUpdate(false);
}
private void initTimer() {
Timer timer = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
Intent intent = new Intent( SplashActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
};
timer.schedule(task, 500);
}
protected void initWindow() {
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);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case Constant.REQUEST_CODE_STORAGE:
if (!PermissionUtil.hasPermissions(this, Constant.PERMISSION_WRITE_EXTERNAL_STORAGE, Permission.STORAGE)) {
SimplexToast.show( SplashActivity.this,"未开启存储权限,某些功能受限");
return;
}
requestScanPermissions();
break;
case Constant.REQUEST_CODE_SCAN:
if (!PermissionUtil.hasPermissions(this, Constant.PERMISSION_WRITE_EXTERNAL_STORAGE, Permission.STORAGE)) {
SimplexToast.show( SplashActivity.this,"未开启相机和扫码权限,某些功能受限");
return;
}
requestScanPermissions();
break;
case 5:
if (Build.VERSION.SDK_INT >= 26) {
//来判断应用是否有权限安装apk
boolean installAllowed= getPackageManager().canRequestPackageInstalls();
//有权限
if (installAllowed) {
//安装apk
checkUpdate();
} else {
ShowMsgUtils.ShowMessageWithCancelBtn( SplashActivity.this, "未开启允许安装应用权限,是否重新设置?", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//请求安装未知应用来源的权限
ActivityCompat.requestPermissions( SplashActivity.this, new String[]{Manifest.permission.REQUEST_INSTALL_PACKAGES}, 4);
dialog.dismiss();
}
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
});
}
}
break;
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case 4:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
checkUpdate();
} else {
Intent intent = new Intent(Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES);
startActivityForResult(intent, GET_UNKNOWN_APP_SOURCES);
}
break;
default:
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
break;
}
}
@Override //申请成功时调用权限
public void onPermissionsGranted(int requestCode, @NonNull List<String> list) {
switch (requestCode) {
case 0:
isAndroidO();
break;
case 3:
requestScanPermissions();
break;
case 4:
checkUpdate();
break;
default:
break;
}
}
@Override //申请失败时调用
public void onPermissionsDenied(int requestCode, @NonNull List<String> list) {
new AppSettingsDialog
.Builder(this)
.setTitle("APP权限 : ")
.setRationale("请在设置中开启对应权限,否则APP将无法使用")
.setRequestCode(requestCode == 0?Constant.REQUEST_CODE_SCAN:Constant.REQUEST_CODE_STORAGE)
.build().show();
}
}
package com.roke.huayangproject.ui.loading;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.roke.huayangproject.HuaYangApp;
import com.roke.huayangproject.R;
import com.roke.huayangproject.adapter.LoadingAdapter;
import com.roke.huayangproject.adapter.UnLoadingAdapter;
import com.roke.huayangproject.base.BaseActivity;
import com.roke.huayangproject.bean.LoadingInfo;
import com.roke.huayangproject.http.ShipHttpClient;
import com.roke.huayangproject.utils.JsonUtil;
import com.roke.huayangproject.utils.ShowMsgUtils;
import com.roke.huayangproject.utils.SimplexToast;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
//create : 3C
//时间2021/8/2 16:07
public class LoadingActivity extends BaseActivity {
@Bind(R.id.tv_ydh)
EditText tvYdh;
@Bind(R.id.tv_cph)
TextView tvCph;
@Bind(R.id.tv_czy)
TextView tvCzy;
@Bind(R.id.tv_xq)
TextView tvXq;
@Bind(R.id.btn_xq)
LinearLayout btnXq;
@Bind(R.id.tv_ss)
TextView tvSs;
@Bind(R.id.btn_ss)
LinearLayout btnSs;
@Bind(R.id.rv_menu)
RecyclerView rvMenu;
private LoadingInfo info;
private int currentPosition = 0;//当前显示的页面
private UnLoadingAdapter unLoadingAdapter;
private LoadingAdapter loadingAdapter;
private String scan;
private List<LoadingInfo.ResultBean.DetailListBean> unLoadingDatas;
@Override
protected void init() {
tvYdh.setOnEditorActionListener(new MyEditGoodsListener());
tvCzy.setText(HuaYangApp.getUser());
rvMenu.setLayoutManager(new LinearLayoutManager(mContext));
}
@Override
protected int getLayoutId() {
return R.layout.activity_loading;
}
@Override
protected String getActionBarTitle() {
return "装车确认";
}
@Override
protected boolean hasActionBar() {
return false;
}
@Override
protected boolean getHasMenu() {
return false;
}
@Override
protected void submitClick() {
}
@Override
public void initView() {
}
@Override
public void initData() {
}
@Override
public void requestByScan(String scan) {
this.scan = scan;
showD();
ShipHttpClient.getInstance().get_order_info(mContext, scan, new ShipHttpClient.CrabHttpCallback<String>() {
@Override
public void onSuccess(String json) {
closeD();
info = JsonUtil.parseJsonToBean(json, LoadingInfo.class);
if (null != info && null != info.getResult() && null != info.getResult().getDetail_list() && info.getResult().getDetail_list().size() > 0) {
tvCph.setText(info.getResult().getCar());
setRecycleView();
} else {
ShowMsgUtils.ShowMessage(mContext, "数据解析有误,请联系管理员!");
}
}
@Override
public void onError(String msg) {
closeD();
ShowMsgUtils.ShowMessage(mContext, msg);
}
});
}
private void setRecycleView() {
if (currentPosition == 0){
unLoadingDatas = new ArrayList<>();
for (LoadingInfo.ResultBean.DetailListBean detailListBean : info.getResult().getDetail_list()) {
if (detailListBean.getState().equals("wait_confirm")){
unLoadingDatas.add(detailListBean);
}
}
unLoadingAdapter = new UnLoadingAdapter(unLoadingDatas);
rvMenu.setAdapter(unLoadingAdapter);
unLoadingAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public boolean onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
if (view.getId() == R.id.btn_submit){
submitState(unLoadingDatas.get(position).getLine_id(),"confirm");
}
return true;
}
});
}else{
loadingAdapter = new LoadingAdapter(info.getResult().getRecord_list());
rvMenu.setAdapter(loadingAdapter);
loadingAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, final int position) {
ShowMsgUtils.ShowMessageWithCancelBtn(mContext, "确认要清除确认状态么?", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
submitState(info.getResult().getRecord_list().get(position).getLine_id(),"confirm_cancel");
}
});
}
});
}
}
private void submitState(String sale_line_id, final String confirm) {
showD();
ShipHttpClient.getInstance().detail_button(mContext, sale_line_id, confirm, HuaYangApp.getUser_id(), new ShipHttpClient.CrabHttpCallback<String>() {
@Override
public void onSuccess(String json) {
closeD();
SimplexToast.show(mContext,JsonUtil.getFieldValue(json,"msg"));
requestByScan(scan);//请求数据
}
@Override
public void onError(String msg) {
closeD();
ShowMsgUtils.ShowMessage(mContext,msg);
}
});
}
@OnClick({R.id.btn_xq, R.id.btn_ss})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.btn_xq:
if (currentPosition != 0) {
setPosition(0);
setRecycleView();
}
break;
case R.id.btn_ss:
if (currentPosition != 1) {
setPosition(1);
setRecycleView();
}
break;
}
}
private void setPosition(int position) {
currentPosition = position;
tvXq.setTextColor(position == 0? Color.WHITE:Color.BLACK);
tvSs.setTextColor(position == 1? Color.WHITE:Color.BLACK);
tvXq.setBackgroundResource(position == 0 ? R.drawable.btn_left_background : R.drawable.btn_left_background_normal);
tvSs.setBackgroundResource(position == 1 ? R.drawable.btn_right_background : R.drawable.btn_right_background_normal);
}
}
package com.roke.huayangproject.ui.login;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import com.lzy.okgo.OkGo;
import com.roke.huayangproject.MainActivity;
import com.roke.huayangproject.R;
import com.roke.huayangproject.HuaYangApp;
import com.roke.huayangproject.bean.LoginInfo;
import com.roke.huayangproject.http.ShipHttpClient;
import com.roke.huayangproject.ui.loading.LoadingActivity;
import com.roke.huayangproject.ui.pick.PickingActivity;
import com.roke.huayangproject.ui.setting.SettingActivity;
import com.roke.huayangproject.utils.CommonUtils;
import com.roke.huayangproject.utils.DialogUtils;
import com.roke.huayangproject.utils.JsonUtil;
import com.roke.huayangproject.utils.SimplexToast;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTextChanged;
import me.jessyan.autosize.internal.CustomAdapt;
public class LoginActivity extends AppCompatActivity implements CustomAdapt {
@Bind(R.id.iv_setting)
ImageView ivSetting;
@Bind(R.id.tv_input_user)
TextInputLayout tvInputUser;
@Bind(R.id.tv_input_pwd)
TextInputLayout tvInputPwd;
@Bind(R.id.et_user)
TextInputEditText etUser;
@Bind(R.id.et_pwd)
TextInputEditText etPwd;
@Bind(R.id.btn_login)
Button btnLogin;
private SharedPreferences pref;
private SharedPreferences.Editor editor;
private Context mContext;
private String TAG = MainActivity.class.getCanonicalName();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mContext = this;
ButterKnife.bind(this);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
if (null != getSupportActionBar()) {
getSupportActionBar().hide();
}
String username = (String) HuaYangApp.getData("username","");
String password = (String) HuaYangApp.getData("password","");
if (!CommonUtils.isNull(username) && !CommonUtils.isNull(password)) {
etUser.setText(username);
etPwd.setText(password);
}
}
@OnClick({R.id.iv_setting, R.id.btn_login})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_setting:
//进入设置页面
Intent intent = new Intent(mContext, SettingActivity.class);
startActivity(intent);
// finish();
break;
case R.id.btn_login:
login();
break;
}
}
//登录逻辑
private void login() {
if (validate()){
showD();
requestLogin();
}
}
private boolean validate() {
if (CommonUtils.isNull(etUser)) {
tvInputUser.setError("账号不能为空!");
return false;
}else{
tvInputUser.setError(null);
}
if (CommonUtils.isNull(etPwd)) {
tvInputPwd.setError("密码不能为空!");
return false;
}else{
tvInputPwd.setError(null);
}
return true;
}
private void requestLogin() {
pref = getSharedPreferences("IpInfo",MODE_PRIVATE);
editor = pref.edit();
final String ip = "http://"+pref.getString("ip",null)+"/";
String zt = pref.getString("zt",null);
System.out.print(ip);
ShipHttpClient.getInstance().login(ip,zt,mContext, etUser.getText().toString().trim(), etPwd.getText().toString().trim(), new ShipHttpClient.CrabHttpCallback<String>() {
@Override
public void onSuccess(String json) {
closeD();
LoginInfo info = JsonUtil.parseJsonToBean(json,LoginInfo.class);
if (null!=info){
HuaYangApp.setData("user",info.getResult().getUser_name());
HuaYangApp.setData("user_id",info.getResult().getUser_id());
HuaYangApp.setData("cookie",info.getResult().getSession_id());
HuaYangApp.setData("username",etUser.getText().toString().trim());
HuaYangApp.setData("password",etPwd.getText().toString().trim());
HuaYangApp.ip = ip;
Intent intent;
if (HuaYangApp.PAGE.equals("装车")){
intent = new Intent(mContext, LoadingActivity.class);
}else{
intent = new Intent(mContext, PickingActivity.class);
}
startActivity(intent);
finish();
}else{
btnLogin.setEnabled(true);
SimplexToast.show(mContext,"解析数据失败,请联系管理员");
}
}
@Override
public void onError(String msg) {
btnLogin.setEnabled(true);
closeD();
SimplexToast.show(mContext,msg);
}
});
}
//是否按照宽度进行适配,true为是,false用高度进行适配
@Override
public boolean isBaseOnWidth() {
return false;
}
//设置当前屏幕大小,根据上边true或者false设置宽高,是用系统的用的是0
@Override
public float getSizeInDp() {
return 0;
}
@Override
protected void onDestroy() {
super.onDestroy();
ButterKnife.unbind(this);
}
public void showD() {
DialogUtils.getInstance().createLoadingDialog(mContext, "发送中...").showDialog();
}
public void closeD() {
DialogUtils.getInstance().closeDialog();
OkGo.getInstance().cancelTag(mContext);
}
}
package com.roke.huayangproject.ui.pick;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.roke.huayangproject.HuaYangApp;
import com.roke.huayangproject.R;
import com.roke.huayangproject.adapter.LoadingAdapter;
import com.roke.huayangproject.adapter.UnLoadingAdapter;
import com.roke.huayangproject.base.BaseActivity;
import com.roke.huayangproject.bean.LoadingInfo;
import com.roke.huayangproject.http.ShipHttpClient;
import com.roke.huayangproject.utils.CommonUtils;
import com.roke.huayangproject.utils.JsonUtil;
import com.roke.huayangproject.utils.ShowMsgUtils;
import java.util.ArrayList;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
//create : 3C
//时间2021/8/4 14:32
public class PickingActivity extends BaseActivity {
@Bind(R.id.tv_ydh)
EditText tvYdh;
@Bind(R.id.tv_cph)
TextView tvCph;
@Bind(R.id.tv_czy)
TextView tvCzy;
@Bind(R.id.rv_menu)
RecyclerView rvMenu;
@Bind(R.id.btn_submit)
Button btnSubmit;
private LoadingInfo info;
private LoadingAdapter loadingAdapter;
private String scan;
@Override
protected void init() {
tvYdh.setOnEditorActionListener(new MyEditGoodsListener());
rvMenu.setLayoutManager(new LinearLayoutManager(mContext));
tvCzy.setText(HuaYangApp.getUser());
}
@Override
protected int getLayoutId() {
return R.layout.activity_picking;
}
@Override
protected String getActionBarTitle() {
return "拣货确认";
}
@Override
protected boolean hasActionBar() {
return false;
}
@Override
protected boolean getHasMenu() {
return false;
}
@Override
protected void submitClick() {
}
@Override
public void initView() {
}
@Override
public void initData() {
}
@Override
public void requestByScan(String scan) {
this.scan = scan;
showD();
ShipHttpClient.getInstance().get_order_info(mContext, scan, new ShipHttpClient.CrabHttpCallback<String>() {
@Override
public void onSuccess(String json) {
closeD();
info = JsonUtil.parseJsonToBean(json, LoadingInfo.class);
if (null != info && null != info.getResult() && null != info.getResult().getDetail_list() && info.getResult().getDetail_list().size() > 0) {
tvCph.setText(info.getResult().getCar());
setRecycleView();
} else {
ShowMsgUtils.ShowMessage(mContext, "数据解析有误,请联系管理员!");
}
}
@Override
public void onError(String msg) {
closeD();
ShowMsgUtils.ShowMessage(mContext,msg);
}
});
}
private void setRecycleView() {
loadingAdapter = new LoadingAdapter(info.getResult().getRecord_list());
rvMenu.setAdapter(loadingAdapter);
}
@OnClick(R.id.btn_submit)
public void onViewClicked() {
if (CommonUtils.isNull(scan) || null == info || null == info.getResult() || null == info.getResult().getRecord_list() || info.getResult().getRecord_list().size() <=0){
ShowMsgUtils.ShowMessage(mContext,"请先扫描正确的运单码,然后再点击确认.");
}else{
requestSubmit();
}
}
private void requestSubmit() {
showD();
ShipHttpClient.getInstance().button_line_done(mContext, info.getResult().getOrder_id(), HuaYangApp.getUser_id(), new ShipHttpClient.CrabHttpCallback<String>() {
@Override
public void onSuccess(String json) {
closeD();
ShowMsgUtils.ShowMessage(mContext, JsonUtil.getFieldValue(json, "msg"), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
tvYdh.setText("");
tvCph.setText("");
scan = "";
info = null;
loadingAdapter = new LoadingAdapter(new ArrayList<LoadingInfo.ResultBean.RecordListBean>());
rvMenu.setAdapter(loadingAdapter);
}
});
}
@Override
public void onError(String msg) {
closeD();
ShowMsgUtils.ShowMessage(mContext,msg);
}
});
}
}
package com.roke.huayangproject.ui.setting;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import com.roke.huayangproject.MainActivity;
import com.roke.huayangproject.R;
import com.roke.huayangproject.utils.CommonUtils;
import com.roke.huayangproject.utils.SimplexToast;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import me.jessyan.autosize.internal.CustomAdapt;
public class SettingActivity extends AppCompatActivity implements CustomAdapt {
private Context mContext;
private String TAG = MainActivity.class.getCanonicalName();
@Bind(R.id.iv_back_left)
ImageView iv_back_left;
@Bind(R.id.et_ip)
EditText et_ip;
@Bind(R.id.et_zt)
EditText et_zt;
@Bind(R.id.btn_setip)
Button btn_setip;
private SharedPreferences pref;
private SharedPreferences.Editor editor;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_setting);
mContext = this;
ButterKnife.bind(this);
getWindow().setFormat(PixelFormat.TRANSLUCENT);
if (null != getSupportActionBar()) {
getSupportActionBar().hide();
}
pref = getSharedPreferences("IpInfo",MODE_PRIVATE);
editor = pref.edit();
if (pref.getString("ip",null)!=null){
et_ip.setText(pref.getString("ip",null));
et_zt.setText(pref.getString("zt",null));
}
}
@OnClick({R.id.iv_back_left, R.id.btn_setip})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_back_left:
//返回上一页
finish();
break;
case R.id.btn_setip:
if (CommonUtils.isNull(et_ip)) {
SimplexToast.show(mContext, "IP及端口不能为空!");
return;
}
if (CommonUtils.isNull(et_zt)) {
SimplexToast.show(mContext, "账套不能为空!");
return;
}
String ip = et_ip.getText().toString();
if (ip.contains("http://")){
ip = ip.replace("http://","");
}
if (ip.contains("https://")){
ip = ip.replace("https://","");
}
int len = ip.length()-2;
String last = ip.substring(len,ip.length()-1);
if (last.equals("/")){
ip = ip.substring(0,ip.length()-1);
}
editor.putString("ip",ip);
editor.putString("zt",et_zt.getText().toString());
editor.commit();
SimplexToast.show(mContext,"设置成功");
finish();
break;
}
}
//是否按照宽度进行适配,true为是,false用高度进行适配
@Override
public boolean isBaseOnWidth() {
return false;
}
//设置当前屏幕大小,根据上边true或者false设置宽高,是用系统的用的是0
@Override
public float getSizeInDp() {
return 0;
}
@Override
protected void onDestroy() {
super.onDestroy();
ButterKnife.unbind(this);
}
}
package com.roke.huayangproject.utils;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.content.Context;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 通用工具类
* Created by hasee on 2018/5/31.
*/
public class CommonUtils {
/**
* 判断手机号是否符合规范
* @param phoneNo 输入的手机号
* @return
*/
public static boolean isPhoneNumber(String phoneNo) {
if (TextUtils.isEmpty(phoneNo)) {
return false;
}
if (phoneNo.length() == 11) {
for (int i = 0; i < 11; i++) {
if (!PhoneNumberUtils.isISODigit(phoneNo.charAt(i))) {
return false;
}
}
Pattern p = Pattern.compile("^((13[^4,\\D])" + "|(134[^9,\\D])" +
"|(14[5,7])" +
"|(15[^4,\\D])" +
"|(17[3,6-8])" +
"|(18[0-9]))\\d{8}$");
Matcher m = p.matcher(phoneNo);
return m.matches();
}
return false;
}
//dip和px转换
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
//判断是否为空
public static boolean isNull(TextView tv){
if (null!=tv &&!tv.getText().toString().trim().equals("")){
return false;
}
return true;
}
public static boolean isNull(EditText tv){
if (null!=tv &&!tv.getText().toString().trim().equals("")){
return false;
}
return true;
}
public static boolean isNull(String str){
if (null!=str &&!str.trim().equals("")){
return false;
}
return true;
}
/**
* 提供精确的加法运算。
*
* @param v1 被加数
* @param v2 加数
* @return 两个参数的和
*/
public static double add(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.add(b2).doubleValue();
}
/**
* 提供精确的减法运算。
*
* @param v1 被减数
* @param v2 减数
* @return 两个参数的差
*/
public static double sub(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.subtract(b2).doubleValue();
}
/**
* 提供精确的乘法运算。
*
* @param v1 被乘数
* @param v2 乘数
* @return 两个参数的积
*/
public static double mul(double v1, double v2) {
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.multiply(b2).doubleValue();
}
/**
* 提供(相对)精确的除法运算,当发生除不尽的情况时,精确到
* 小数点以后10位,以后的数字四舍五入。
*
* @param v1 被除数
* @param v2 除数
* @return 两个参数的商
*/
public static double div(double v1, double v2) {
return div(v1, v2, 3);
}
/**
* 提供(相对)精确的除法运算。当发生除不尽的情况时,由scale参数指
* 定精度,以后的数字四舍五入。
*
* @param v1 被除数
* @param v2 除数
* @param scale 表示表示需要精确到小数点以后几位。
* @return 两个参数的商
*/
public static double div(double v1, double v2, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");
}
BigDecimal b1 = new BigDecimal(Double.toString(v1));
BigDecimal b2 = new BigDecimal(Double.toString(v2));
return b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
}
/**
* 提供精确的小数位四舍五入处理。
*
* @param v 需要四舍五入的数字
* @param scale 小数点后保留几位
* @return 四舍五入后的结果
*/
public static double round(double v, int scale) {
if (scale < 0) {
throw new IllegalArgumentException(
"The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(Double.toString(v));
BigDecimal one = new BigDecimal("1");
return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
}
/**
* 保留小数点后2位
*
* @param d
* @return
*/
public static String DF(double d) {
DecimalFormat df = new DecimalFormat("0.00");
return df.format(d);
}
/**
* 日期选择
* @param activity
* @param themeResId
* @param tv
* @param calendar
*/
public void showDatePickerDialog(Activity activity, int themeResId, final TextView tv, Calendar calendar) {
// 直接创建一个DatePickerDialog对话框实例,并将它显示出来
new DatePickerDialog(activity , themeResId, new DatePickerDialog.OnDateSetListener() {
// 绑定监听器(How the parent is notified that the date is set.)
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
// 此处得到选择的时间,可以进行你想要的操作
tv.setText(String.format("%d-%d-%d", year, monthOfYear, dayOfMonth));
}
}
// 设置初始日期
,calendar.get(Calendar.YEAR)
,calendar.get(Calendar.MONTH)
,calendar.get(Calendar.DAY_OF_MONTH)).show();
}
}
package com.roke.huayangproject.utils;
import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.roke.huayangproject.R;
/**
*/
public class DialogUtils {
private static TextView tipTextView;
private static Dialog loadingDialog;
private static DialogUtils dialogUtils;
public static DialogUtils getInstance(){
if (null == dialogUtils){
dialogUtils = new DialogUtils();
}
return dialogUtils;
}
public DialogUtils createLoadingDialog(Context context, String msg) {
LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(R.layout.dialog_loading, null);// 得到加载view
LinearLayout layout = (LinearLayout) v
.findViewById(R.id.dialog_loading_view);// 加载布局
// 提示文字
tipTextView = (TextView) v.findViewById(R.id.tipTextView);
tipTextView.setText(msg);// 设置加载信息
// 创建自定义样式dialog
loadingDialog = new Dialog(context, R.style.MyDialogStyle);
// loadingDialog.setCancelable(false); // 是否可以按“返回键”消失
loadingDialog.setCanceledOnTouchOutside(false); // 点击加载框以外的区域是否消失
loadingDialog.setContentView(layout, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));// 设置布局
/**
*将显示Dialog的方法封装在这里面
*/
Window window = loadingDialog.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setGravity(Gravity.CENTER);
window.setAttributes(lp);
window.setWindowAnimations(R.style.PopWindowAnimStyle);
return this;
}
/**
* 关闭dialog
*
*/
public void closeDialog() {
if (loadingDialog != null && loadingDialog.isShowing()) {
loadingDialog.dismiss();
}
onDestroyDialog();
}
/**
* 打开dialog
*
*/
public void showDialog() {
if (loadingDialog != null && !loadingDialog.isShowing()) {
loadingDialog.show();
}
}
public DialogUtils setTitle(String msg){
if (null !=tipTextView){
tipTextView.setText(msg);
}
return this;
}
public void onDestroyDialog(){
if (null!=tipTextView){
tipTextView = null;
}
if (null!=loadingDialog){
loadingDialog = null;
}
}
}
\ No newline at end of file
package com.roke.huayangproject.utils;
/**
* Created by zhaoxinlong
*/
public class FileSizeUtil {
public static String convertFileSize(long size) {
long kb = 1024;
long mb = kb * 1024;
long gb = mb * 1024;
if (size >= gb) {
return String.format("%.1f GB", (float) size / gb);
} else if (size >= mb) {
float f = (float) size / mb;
return String.format(f > 100 ? "%.0f MB" : "%.1f MB", f);
} else if (size >= kb) {
float f = (float) size / kb;
return String.format(f > 100 ? "%.0f KB" : "%.1f KB", f);
} else
return String.format("%d B", size);
}
}
package com.roke.huayangproject.utils;
import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.reflect.TypeToken;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* 封装的是使用Gson解析json的方法
* @author Administrator
*
*/
public class JsonUtil {
/**
* 把一个map变成json字符串
* @param map
* @return
*/
public static String parseMapToJson(Map<?, ?> map) {
try {
Gson gson = new Gson();
return gson.toJson(map);
} catch (Exception e) {
}
return null;
}
/**
* 把一个list<map<string,object>>变成json字符串
* @return
*/
public static String parseListToJson(List<Map<String,Object>> list) {
try {
JsonArray jsonArray = new JsonArray();
Gson gson = new Gson();
for (Map<String, Object> stringObjectMap : list) {
jsonArray.add(gson.toJson(stringObjectMap));
}
return jsonArray.toString();
} catch (Exception e) {
}
return null;
}
/**
* 把一个json字符串变成对象
* @param json
* @param cls
* @return
*/
public static <T> T parseJsonToBean(String json, Class<T> cls) {
Gson gson = new Gson();
T t = null;
try {
t = gson.fromJson(json, cls);
} catch (Exception e) {
Log.e("error",e.toString());
}
return t;
}
/**
* 把json字符串变成map
* @param json
* @return
*/
public static HashMap<String, Object> parseJsonToMap(String json) {
Gson gson = new Gson();
Type type = new TypeToken<HashMap<String, Object>>() {
}.getType();
HashMap<String, Object> map = null;
try {
map = gson.fromJson(json, type);
} catch (Exception e) {
}
return map;
}
/**
* 把json字符串变成集合
* params: new TypeToken<List<yourbean>>(){}.getType(),
*
* @param json
* @param type new TypeToken<List<yourbean>>(){}.getType()
* @return
*/
public static List<?> parseJsonToList(String json, Type type) {
Gson gson = new Gson();
List<?> list = gson.fromJson(json, type);
return list;
}
/**
*
* 获取json串中某个字段的值,注意,只能获取同一层级的value
*
* @param json
* @param key
* @return
*/
public static String getFieldValue(String json, String key) {
JSONObject jsonObject = null;
String value = "";
try {
jsonObject = new JSONObject(json);
if (TextUtils.isEmpty(json))
return "";
if (!isContains(json,key))
return "";
value = jsonObject.getString(key);
} catch (JSONException e) {
e.printStackTrace();
}
return value;
}
/**
*
* 获取json串中某个字段的值,注意,只能获取同一层级的value
*
* @param json
* @param key
* @return
*/
public static boolean isContains(String json, String key) {
if (TextUtils.isEmpty(json))
return false;
if (json.contains(key)){
try {
JSONObject jsonObject = null;
String value = null;
jsonObject = new JSONObject(json);
Iterator it = jsonObject.keys();
while(it.hasNext()){
String nextKey = (String) it.next();
if (nextKey.equals(key)){
return true;
}
}
} catch (JSONException e) {
return false;
}
}else{
return false;
}
return false;
}
}
package com.roke.huayangproject.utils;
import android.Manifest;
import android.os.Build;
public final class Permission {
/*************android 8.0权限****************/
//日历
public static final String[] CALENDAR;
//相机
public static final String[] CAMERA;
//联系人
public static final String[] CONTACTS;
//定位
public static final String[] LOCATION;
//扩音器
public static final String[] MICROPHONE;
//电话
public static final String[] PHONE;
//传感器
public static final String[] SENSORS;
//短信
public static final String[] SMS;
//存储
public static final String[] STORAGE;
//存储
public static final String[] COMMON_PERMISSION;
static {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
CALENDAR = new String[]{};
CAMERA = new String[]{};
CONTACTS = new String[]{};
LOCATION = new String[]{};
MICROPHONE = new String[]{};
PHONE = new String[]{};
SENSORS = new String[]{};
SMS = new String[]{};
STORAGE = new String[]{};
COMMON_PERMISSION = new String[]{};
} else {
COMMON_PERMISSION = new String[]{
Manifest.permission.READ_CALENDAR,
Manifest.permission.WRITE_CALENDAR,
Manifest.permission.CAMERA,
Manifest.permission.READ_CONTACTS,
Manifest.permission.WRITE_CONTACTS,
Manifest.permission.GET_ACCOUNTS,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.RECORD_AUDIO,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.CALL_PHONE,
Manifest.permission.READ_CALL_LOG,
Manifest.permission.WRITE_CALL_LOG,
Manifest.permission.USE_SIP,
Manifest.permission.PROCESS_OUTGOING_CALLS,
Manifest.permission.BODY_SENSORS,
Manifest.permission.SEND_SMS,
Manifest.permission.RECEIVE_SMS,
Manifest.permission.READ_SMS,
Manifest.permission.RECEIVE_WAP_PUSH,
Manifest.permission.RECEIVE_MMS,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE
};
CALENDAR = new String[]{
Manifest.permission.READ_CALENDAR,
Manifest.permission.WRITE_CALENDAR};
CAMERA = new String[]{
Manifest.permission.CAMERA};
CONTACTS = new String[]{
Manifest.permission.READ_CONTACTS,
Manifest.permission.WRITE_CONTACTS,
Manifest.permission.GET_ACCOUNTS};
LOCATION = new String[]{
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.ACCESS_WIFI_STATE,
Manifest.permission.ACCESS_NETWORK_STATE,
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.INTERNET,
Manifest.permission.CHANGE_WIFI_STATE,
Manifest.permission.GET_ACCOUNTS};
MICROPHONE = new String[]{
Manifest.permission.RECORD_AUDIO};
PHONE = new String[]{
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.CALL_PHONE,
Manifest.permission.READ_CALL_LOG,
Manifest.permission.WRITE_CALL_LOG,
Manifest.permission.USE_SIP,
Manifest.permission.PROCESS_OUTGOING_CALLS};
SENSORS = new String[]{
Manifest.permission.BODY_SENSORS};
SMS = new String[]{
Manifest.permission.SEND_SMS,
Manifest.permission.RECEIVE_SMS,
Manifest.permission.READ_SMS,
Manifest.permission.RECEIVE_WAP_PUSH,
Manifest.permission.RECEIVE_MMS};
STORAGE = new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
}
}
}
\ No newline at end of file
package com.roke.huayangproject.utils;
import android.Manifest;
import android.app.Activity;
import android.os.Build;
import com.roke.huayangproject.http.Constant;
import pub.devrel.easypermissions.EasyPermissions;
/**
* Created by zhaohui on 16/12/15.
* android 6.0 动态获取权限工具
*/
public class PermissionUtil {
private static final String TAG = PermissionUtil.class.getSimpleName();
public static final int CODE_RECORD_AUDIO = 0;
public static final int CODE_GET_ACCOUNTS = 1;
public static final int CODE_READ_PHONE_STATE = 2;
public static final int CODE_ACCESS_FINE_LOCATION = 3;
public static final int CODE_ACCESS_COARSE_LOCATION = 4;
public static final int CODE_READ_EXTERNAL_STORAGE = 5;
public static final int CODE_WRITE_EXTERNAL_STORAGE = 6;
public static final int CODE_MULTI_PERMISSION = 100;
public static final int CODE_CALL_PHONE = 8;
public static final int CODE_CAMERA = 7;
// 允许程序录制音频
public static final String PERMISSION_RECORD_AUDIO = Manifest.permission.RECORD_AUDIO;
// 允许程序访问Accounts Service帐户列表
public static final String PERMISSION_GET_ACCOUNTS = Manifest.permission.GET_ACCOUNTS;
// 允许程序访问手机状态信息
public static final String PERMISSION_READ_PHONE_STATE = Manifest.permission.READ_PHONE_STATE;
public static final String PERMISSION_CALL_PHONE = Manifest.permission.CALL_PHONE;
// 允许程序使用照相设备
public static final String PERMISSION_CAMERA = Manifest.permission.CAMERA;
// 允许程序访问位置信息
public static final String PERMISSION_ACCESS_FINE_LOCATION = Manifest.permission.ACCESS_FINE_LOCATION;
// 允许程序访问CellID或WiFi热点来获取位置信息
public static final String PERMISSION_ACCESS_COARSE_LOCATION = Manifest.permission.ACCESS_COARSE_LOCATION;
// 允许程序读扩展存储卡
public static final String PERMISSION_READ_EXTERNAL_STORAGE = Manifest.permission.READ_EXTERNAL_STORAGE;
// 允许程序写扩展存储卡
public static final String PERMISSION_WRITE_EXTERNAL_STORAGE = Manifest.permission.WRITE_EXTERNAL_STORAGE;
public static final String[] requestPermissions = {
PERMISSION_RECORD_AUDIO,
PERMISSION_GET_ACCOUNTS,
PERMISSION_READ_PHONE_STATE,
PERMISSION_CALL_PHONE,
PERMISSION_ACCESS_FINE_LOCATION,
PERMISSION_ACCESS_COARSE_LOCATION,
PERMISSION_READ_EXTERNAL_STORAGE,
PERMISSION_WRITE_EXTERNAL_STORAGE,
PERMISSION_CAMERA
};
// PERMISSION_CALL_PHONE,
// PERMISSION_ACCESS_FINE_LOCATION,
// PERMISSION_ACCESS_COARSE_LOCATION,
private static void requestPermissions(Activity activity, int requestCode, String rationale, String params1, PermissionsCallBackListener listener, String...params2){
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
if (!EasyPermissions.hasPermissions(activity, params1)) {
EasyPermissions.requestPermissions(activity, rationale, requestCode, params1);
} else {
if (null!=listener){
listener.hasPermissions();
}
}
} else {
if (EasyPermissions.hasPermissions(activity, params2)) {
if (null!=listener){
listener.hasPermissions();
}
} else {
EasyPermissions.requestPermissions(activity, rationale, requestCode,params2);
}
}
}
public static boolean hasPermissions(Activity activity, String params1, String...params2){
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return EasyPermissions.hasPermissions(activity, params1);
} else {
return EasyPermissions.hasPermissions(activity, params2);
}
}
/**
* 请求定位
*/
public static void requestLocationPermissions(Activity activity, PermissionsCallBackListener listener){
PermissionUtil.requestPermissions(activity, 1,"当前APP请求使用定位权限", Constant.PERMISSION_ACCESS_COARSE_LOCATION,listener, Permission.LOCATION);
}
/**
* 请求相机
*/
public static void requestScanPermissions(Activity activity, PermissionsCallBackListener listener){
PermissionUtil.requestPermissions(activity, 0,"当前APP请求使用相机权限", Constant.PERMISSION_CAMERA, listener,Permission.CAMERA);
}
/**
* 请求联系人
*/
public static void requestContactsPermissions(Activity activity, PermissionsCallBackListener listener) {
PermissionUtil.requestPermissions(activity, 2, "当前APP申请联系人权限.", Constant.PERMISSION_GET_ACCOUNTS,listener,Permission.CONTACTS);
}
/**
* 申请读写sd卡
*/
public static void requestStoragePermissions(Activity activity, PermissionsCallBackListener listener) {
PermissionUtil.requestPermissions(activity, 3, "当前APP申请读写SD卡权限.", Constant.PERMISSION_WRITE_EXTERNAL_STORAGE,listener,Permission.STORAGE);
}
/**
* 请求安装app权限
*/
public static void requestInstallPermissions(Activity activity, PermissionsCallBackListener listener) {
PermissionUtil.requestPermissions(activity, 4, "当前APP请求安装app权限.", Constant.REQUEST_INSTALL_PACKAGES,listener,Constant.REQUEST_INSTALL_PACKAGES);
}
public interface PermissionsCallBackListener{
void hasPermissions();
}
}
package com.roke.huayangproject.utils;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
/**
* toast和dialog工具类
* Created by 赵新龙 on 16/7/28.
*/
public class ShowMsgUtils {
public static void ShowMessage(Context mContext, String msg) {
//可以使用自定义 R.style.MyDialogTheme
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(mContext);
alertBuilder.setTitle("提示");
alertBuilder.setMessage(msg);
alertBuilder.setCancelable(false);
alertBuilder.setPositiveButton("确定", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertBuilder.show();
}
public static void ShowMessage(Context mContext,String title, String msg) {
//可以使用自定义 R.style.MyDialogTheme
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(mContext);
alertBuilder.setTitle(title);
alertBuilder.setMessage(msg);
alertBuilder.setCancelable(false);
alertBuilder.setPositiveButton("确定", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertBuilder.show();
}
public static void ShowMessage(Context mContext, String msg, OnClickListener listener) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(mContext);
alertBuilder.setTitle("提示");
alertBuilder.setMessage(msg);
alertBuilder.setCancelable(false);
alertBuilder.setPositiveButton("确定", listener);
alertBuilder.show();
}
public static void ShowMessageWithCancelBtn(Context mContext, String msg,
OnClickListener listener) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(mContext);
alertBuilder.setTitle("提示");
alertBuilder.setMessage(msg);
alertBuilder.setCancelable(false);
alertBuilder.setPositiveButton("确定", listener);
alertBuilder.setNegativeButton("取消", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertBuilder.show();
}
public static void ShowMessageWithCancelBtn(Context mContext, String msg,
final OnClickListener confirmListener, OnClickListener cancleListener) {
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(mContext);
alertBuilder.setTitle("提示");
alertBuilder.setMessage(msg);
alertBuilder.setCancelable(false);
alertBuilder.setPositiveButton("确定", confirmListener);
alertBuilder.setNegativeButton("取消", cancleListener);
alertBuilder.show();
}
}
package com.roke.huayangproject.utils;
import android.content.Context;
import android.os.Build;
import android.view.Gravity;
import android.widget.Toast;
/**
* 以后请用这个吐司,谢谢!!!
* Created by zxl on 2016/11/15.
*/
@SuppressWarnings("all")
public class SimplexToast {
private static Toast mToast;
private static long nextTimeMillis;
private static int yOffset;
private SimplexToast(Context context) {
}
public static Toast init(Context context) {
if (context == null) {
throw new IllegalArgumentException("Context should not be null!!!");
}
if (mToast == null) {
mToast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
yOffset = mToast.getYOffset();
}
// mToast.setDuration(Toast.LENGTH_SHORT);
// mToast.setGravity(Gravity.BOTTOM, 0, yOffset);
// mToast.setMargin(0, 0);
return mToast;
}
public static void show(String content) {
show(content, Toast.LENGTH_SHORT);
}
public static void show(String content, int duration) {
show(null, content, Gravity.BOTTOM, duration);
}
public static void show(Context context, int rid) {
show(context, context.getResources().getString(rid));
}
public static void show(Context context, String content) {
show(context, content, Gravity.BOTTOM);
}
public static void show(Context context, String content, int gravity) {
show(context, content, gravity, Toast.LENGTH_SHORT);
}
public static void show(Context context, String content, int gravity, int duration) {
// long current = System.currentTimeMillis();
//if (current < nextTimeMillis) return;
if (Build.VERSION.SDK_INT < 28) {
if (mToast == null) {
init(context.getApplicationContext());
}
}else{
//部分机型无法覆盖以前的,需要再次调解
mToast = Toast.makeText(context, "", Toast.LENGTH_SHORT);
}
mToast.setText(content);
// mToast.setDuration(duration);
// mToast.setGravity(gravity, 0, yOffset);
// nextTimeMillis = current + (duration == Toast.LENGTH_LONG ? 3500 : 2000);
mToast.show();
}
}
package com.roke.huayangproject.utils;
import android.content.Context;
import android.util.Log;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* 系统工具类
* Created by zhaoxinlong on 16/8/18.
*/
public class SystemUtil {
/**
* 获取版本名称
*
* @param mContext 数据上下文
* @return 版本号:v1.0
*/
public static String getVersionName(Context mContext) {
String verName = "1.0";
try {
verName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
} catch (Exception e) {
}
verName = "版本号:v" + verName;
return verName;
}
/**
* 获取版本号
* @return
*/
public static int getAppVersionCode(Context context) {
String packName = getPackageName(context);
int verCode = -1;
try {
verCode = context.getPackageManager().getPackageInfo(packName, 0).versionCode;
} catch (Exception e) {
Log.e("版本号获取异常", e.getMessage());
}
return verCode;
}
/**
* 获取版权信息
*
* @param copyright
*/
public static void getCopyright(TextView copyright) {
int birthdayYear = 2017;
// 获取当前年份,如果和birthday相等不做处理 不等则 birthday year-current year
Calendar calendar = Calendar.getInstance();
int currentYear = calendar.get(Calendar.YEAR);
if (currentYear == birthdayYear) {
copyright.setText("Copyright © " + birthdayYear + " 佳怡物流.");
} else {
copyright.setText("Copyright © " + birthdayYear + "-" + currentYear + " 佳怡物流.");
}
}
/**
* 获取包名
*
* @param context
* @return
*/
public static String getPackageName(Context context) {
return context.getPackageName();
}
// 获取当前系统时间
public static String getCurTime() {
SimpleDateFormat dateFormate = new SimpleDateFormat("yyyyMMdd");
Date date = new Date(System.currentTimeMillis());
return dateFormate.format(date);
}
// 获取当前系统时间
public static String getCurTimeByLine() {
SimpleDateFormat dateFormate = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date(System.currentTimeMillis());
return dateFormate.format(date);
}
// 获取当前系统时间
public static String getCurTimeDetail() {
SimpleDateFormat dateFormate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date(System.currentTimeMillis());
return dateFormate.format(date);
}
}
package com.roke.huayangproject.utils;
import android.app.Dialog;
import android.content.Context;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.roke.huayangproject.R;
/**
* Created by zhaoxinlong on 16/12/7.
* 版本升级
*/
public class UpdateDialog extends Dialog {
public Button btn_off;
public Button btn_on;
public ProgressBar progress;
public TextView tv_jdValue;
public TextView tv_memory;
public UpdateDialog(Context context) {
super(context);
setContentView(R.layout.dialog_update);
this.btn_off = (Button) findViewById(R.id.btn_off);
this.btn_on = (Button) findViewById(R.id.btn_on);
this.progress = (ProgressBar) findViewById(R.id.progress);
this.tv_jdValue = (TextView) findViewById(R.id.tv_jdValue);
this.tv_memory = (TextView) findViewById(R.id.tv_memory);
}
}
package com.roke.huayangproject.utils;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import androidx.core.content.FileProvider;
import com.roke.huayangproject.http.Constant;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by zhaohui on 16/12/7.
*/
public class UpdateManager {
private UpdateTipDialog tipDialog;
private UpdateDialog updateDialog;
private int progress;
private Context mContext;
private UpdateListener updateListener;
private static final int DOWNLOAD = 1;
private static final int DOWNLOAD_FINISH = 2;
private static final int NOTICE = 3;
private static final int ERROR = 4;
private static final String savePath = Constant.CACHE_DIR;
private static final String saveFileName = savePath + "/roke.apk";
private String apkUrl;
private String updateContent;
private String forceInstall;
private String mMemory;
private int verCode = -1;
private String verUrl;
private boolean cancelUpdate = false;
public interface UpdateListener{
void hasUpdate(boolean hasUpdate);
}
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case DOWNLOAD:
updateDialog.tv_memory.setText(mMemory);
updateDialog.tv_jdValue.setText("当前进度:" + (1 + progress) + "%");
updateDialog.progress.setProgress(progress);
break;
case DOWNLOAD_FINISH:
updateDialog.dismiss();
installApk();
break;
case NOTICE:
CompareVersion((boolean) msg.obj);
break;
case ERROR:
SimplexToast.show(mContext,"更新版本失败!");
updateDialog.dismiss();
break;
}
}
};
public UpdateManager(Context context, UpdateListener updateListener) {
this.mContext = context;
this.updateListener = updateListener;
verUrl = Constant.baseUrl;
}
public void CheckUpdate(final boolean type) {
new Thread(new Runnable() {
@Override
public void run() {
HttpURLConnection httpConn = null;
try {
URL realUrl = new URL(verUrl);
httpConn = (HttpURLConnection) realUrl
.openConnection();
httpConn.setDoInput(true);
httpConn.setDoOutput(true);
httpConn.setConnectTimeout(3000);
httpConn.setReadTimeout(3000);
httpConn.connect();
if (httpConn.getResponseCode() == 200) {
InputStream is = httpConn.getInputStream();
InputStreamReader isr = new InputStreamReader(is, "GBK");
BufferedReader br = new BufferedReader(isr);
String result = "";
String line = "";
while ((line = br.readLine()) != null) {
result += line;
}
br.close();
JSONObject json = new JSONObject(result);
apkUrl = json.getString("updateUrl");
verCode = json.getInt("verCode");
updateContent =json.getString("updateContent");// new String(json.getString("updateContent").getBytes("GBK"),"UTF-8");
String[] strings = updateContent.split(" ");
StringBuilder builder = new StringBuilder();
for (int i = 0; i < strings.length; i++) {
builder.append(strings[i]).append("\n");
}
updateContent = builder.toString();
forceInstall = json.getString("forceInstall");
Message message = new Message();
message.what = NOTICE;
message.obj = type;
mHandler.sendMessage(message);
}else{
if (null!=updateListener){
updateListener.hasUpdate(false);
}
Log.i("dsdasadsad", "网络连接有误,请检查网络"+httpConn.getResponseCode());
}
} catch (Exception e) {
if (null!=updateListener){
updateListener.hasUpdate(false);
}
Log.d("re",e.getMessage());
} finally {
if (httpConn != null) {
httpConn.disconnect();
}
}
}
}).start();
}
public void CompareVersion(boolean isShowToast) {
int localVerCode = SystemUtil.getAppVersionCode(mContext);
if (verCode > localVerCode) {
if (null!=updateListener){
updateListener.hasUpdate(true);
}
ShowUpdateTipDialog();
} else if (isShowToast) {
if (null!=updateListener){
updateListener.hasUpdate(false);
}
}
}
public void ShowUpdateTipDialog() {
try {
this.tipDialog = new UpdateTipDialog(mContext);
this.tipDialog.tvContent.setText(updateContent);
this.tipDialog.setCancelable(false);
this.tipDialog.setCanceledOnTouchOutside(false);
this.tipDialog.show();
this.tipDialog.btn_on.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
tipDialog.dismiss();
ShowDownloadDialog();
} else {
ShowMsgUtils.ShowMessage(mContext, "SD卡不在了");
return;
}
}
});
if (forceInstall.equals("1")) {
this.tipDialog.btn_off.setVisibility(View.VISIBLE);
this.tipDialog.btn_off.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
tipDialog.dismiss();
}
});
}
this.tipDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
if (i == 84) ;
for (boolean bool = true; ; bool = false)
return bool;
}
});
} catch (Exception e) {
Log.i("UpdateManager", e.getMessage());
}
}
public void ShowDownloadDialog() {
this.updateDialog = new UpdateDialog(mContext);
this.updateDialog.setCancelable(false);
this.updateDialog.setCanceledOnTouchOutside(false);
this.updateDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
if (i == 84) ;
for (boolean bool = true; ; bool = false)
return bool;
}
});
this.updateDialog.show();
down();
}
public void down() {
new Thread(new Runnable() {
@Override
public void run() {
try {
HttpURLConnection httpConn = (HttpURLConnection) new URL(apkUrl).openConnection();
httpConn.connect();
if (httpConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
int i = httpConn.getContentLength();
InputStream inputStream = httpConn.getInputStream();
File localFile = new File(savePath);
if (!localFile.exists()) {
localFile.mkdir();
}
FileOutputStream fileOutputStream = new FileOutputStream(new File(saveFileName));
byte[] b = new byte[1024];
int j = 0;
do {
int k = inputStream.read(b);
j += k;
mMemory = FileSizeUtil.convertFileSize(j) + "/" + FileSizeUtil.convertFileSize(i);
progress = (int) (((float) j / i) * 100);
mHandler.sendEmptyMessage(DOWNLOAD);
if (k <= 0) {
mHandler.sendEmptyMessage(DOWNLOAD_FINISH);
break;
}
fileOutputStream.write(b, 0, k);
} while (!cancelUpdate);
fileOutputStream.close();
inputStream.close();
}else{
Log.e("responseCode", "run: "+ httpConn.getResponseCode());
mHandler.sendEmptyMessage(ERROR);
}
} catch (Exception e) {
Log.e("UpdateManager", e.getMessage());
mHandler.sendEmptyMessage(ERROR);
}
}
}).start();
}
private void installApk() {
try {
File localFile = new File(saveFileName);
if (localFile.exists()) {
Intent intent = new Intent(Intent.ACTION_VIEW);
if(Build.VERSION.SDK_INT>= Build.VERSION_CODES.N){
Uri contentUri = FileProvider.getUriForFile(mContext.getApplicationContext(),"com.example.messystem.fileprovider",localFile);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setDataAndType(contentUri,"application/vnd.android.package-archive");
}else{
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(Uri.fromFile(localFile),"application/vnd.android.package-archive");
}
mContext.startActivity(intent);
android.os.Process.killProcess(android.os.Process.myPid());
}
} catch (Exception e) {
Log.e("版本升级", "installApk: "+e.toString());
e.printStackTrace();
}
}
}
package com.roke.huayangproject.utils;
import android.app.Dialog;
import android.content.Context;
import android.widget.Button;
import android.widget.TextView;
import com.roke.huayangproject.R;
/**
* Created by zhaoxinlong on 16/12/7.
*
*/
public class UpdateTipDialog extends Dialog {
public Button btn_off;
public Button btn_on;
public TextView tvContent;
public UpdateTipDialog(Context context) {
super(context);
setContentView(R.layout.dialog_update_tip);
this.btn_off = (Button) findViewById(R.id.btn_off);
this.btn_on = (Button) findViewById(R.id.btn_on);
this.tvContent = (TextView) findViewById(R.id.tv_content);
}
}
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="0.2"
android:toAlpha="1.0"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="1.0"
android:toAlpha="0"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="300"
android:fromXDelta="0"
android:toXDelta="0"
android:fromYDelta="100%"
android:toYDelta="0"
/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="300"
android:fromXDelta="0"
android:toXDelta="0"
android:fromYDelta="0"
android:toYDelta="100%"
/>
</set>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeWidth="1"
android:strokeColor="#00000000">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!--<solid android:color="#75c233" />-->
<!--设置渐变-->
<gradient android:startColor="#2975E6"
android:endColor="#2975E6"
android:angle="180"/>
<!--angle控制渐变的方向-->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="20dp" />
<!-- padding:Button里面的文字与Button边界的间隔 -->
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!--<solid android:color="#75c233" />-->
<!--设置渐变-->
<gradient android:startColor="@color/Blue"
android:endColor="@color/Blue"
android:angle="180"/>
<!--angle控制渐变的方向-->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:topLeftRadius="20dp" android:bottomLeftRadius="20dp"/>
<!-- padding:Button里面的文字与Button边界的间隔 -->
<!--<stroke android:color="@color/black" android:width="0.5dp"/>-->
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!--<solid android:color="#75c233" />-->
<!--设置渐变-->
<gradient android:startColor="@color/white"
android:endColor="@color/white"
android:angle="180"/>
<!--angle控制渐变的方向-->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:topLeftRadius="20dp" android:bottomLeftRadius="20dp"/>
<!-- padding:Button里面的文字与Button边界的间隔 -->
<!--<stroke android:color="@color/black" android:width="0.5dp"/>-->
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!--<solid android:color="#75c233" />-->
<!--设置渐变-->
<gradient android:startColor="@color/Blue"
android:endColor="@color/Blue"
android:angle="180"/>
<!--angle控制渐变的方向-->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:topRightRadius="20dp" android:bottomRightRadius="20dp"/>
<!-- padding:Button里面的文字与Button边界的间隔 -->
<!--<stroke android:color="@color/black" android:width="0.5dp"/>-->
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!--<solid android:color="#75c233" />-->
<!--设置渐变-->
<gradient android:startColor="@color/white"
android:endColor="@color/white"
android:angle="180"/>
<!--angle控制渐变的方向-->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:topRightRadius="20dp" android:bottomRightRadius="20dp"/>
<!-- padding:Button里面的文字与Button边界的间隔 -->
<!--<stroke android:color="@color/black" android:width="0.5dp"/>-->
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/instorage_btn_background1" /><!--选中时效果-->
<item android:state_pressed="false" android:drawable="@drawable/instorage_btn_background_6" /><!--未选中时效果-->
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@mipmap/dialog_loading_img"
android:pivotX="50%"
android:pivotY="50%" />
<!-- 下面是转圈的
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/dialog_loading_img2"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" />
-->
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/trans" />
<corners android:radius="10dp" />
<stroke android:color="#8888" android:width="1dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#008577"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!--<solid android:color="#75c233" />-->
<!--设置渐变-->
<gradient android:startColor="@color/Blue"
android:endColor="@color/Blue"
android:angle="180"/>
<!--angle控制渐变的方向-->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="10dp" />
<!-- padding:Button里面的文字与Button边界的间隔 -->
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!--<solid android:color="#75c233" />-->
<!--设置渐变-->
<gradient android:startColor="@color/pressed"
android:endColor="@color/pressed"
android:angle="180"/>
<!--angle控制渐变的方向-->
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="10dp" />
<!-- padding:Button里面的文字与Button边界的间隔 -->
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid android:color="#fff5f5f5" />
</shape>
</item>
<item android:id="@android:id/progress">
<clip>
<shape>
<solid android:color="@color/nc_sort_title_blue" />
</shape>
</clip>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<!--相当于做了一张圆角的图片,然后给button作为背景图片-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!--设置背景色-->
<solid android:color="@color/white" />
<!--设置圆角-->
<corners android:radius="20dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@mipmap/btn_back_pressed" />
<item android:drawable="@mipmap/btn_back_normal" />
</selector>
\ No newline at end of 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="match_parent"
android:padding="5dp"
android:focusable="true"
android:fitsSystemWindows="true"
android:orientation="vertical">
<LinearLayout
style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="运单号 : "
/>
<EditText
android:id="@+id/tv_ydh"
android:singleLine="true"
android:lines="1"
android:hint="请输入或者扫描运单号"
style="@style/edit_weight3_right"/>
</LinearLayout>
<LinearLayout
style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="车牌号 : "
/>
<TextView
android:id="@+id/tv_cph"
style="@style/text_weight3_right"/>
</LinearLayout>
<LinearLayout
style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="操作员 : "
/>
<TextView
android:id="@+id/tv_czy"
style="@style/text_weight3_right"/>
</LinearLayout>
<LinearLayout
android:padding="5dp"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/btn_xq"
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_xq"
android:layout_width="match_parent"
android:textSize="19sp"
android:text="未确认"
android:padding="8dp"
android:gravity="center"
android:background="@drawable/btn_left_background"
android:textColor="@color/white"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@+id/btn_ss"
android:layout_width="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_ss"
android:layout_width="match_parent"
android:textSize="19sp"
android:text="已确认"
android:padding="8dp"
android:gravity="center"
android:background="@drawable/btn_right_background_normal"
android:textColor="@color/black"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_menu"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"/>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@drawable/background"
>
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_setting"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="end"
android:contentDescription="@string/setting"
android:padding="10dp"
android:src="@drawable/setting">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="250dp"
android:layout_gravity="center"
android:padding="30dp"
android:text="@string/ckglxt"
android:gravity="center"
android:textColor="@color/white"
android:textSize="30sp" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tv_input_user"
android:layout_width="match_parent"
android:padding="5dp"
android:hint="账号"
android:layout_margin="10dp"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:inputType="text"
android:textSize="18sp"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tv_input_pwd"
android:layout_width="match_parent"
android:padding="5dp"
android:hint="密码"
android:layout_margin="10dp"
app:passwordToggleEnabled="true"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_pwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=""
android:inputType="textPassword"
android:textSize="18sp"
/>
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="35dp"
android:background="@drawable/btn_background"
android:padding="15dp"
android:text="@string/login"
android:textColor="@color/white"
android:textSize="20sp" />
</LinearLayout>
</ScrollView>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
tools:context=".MainActivity">
</LinearLayout>
\ No newline at end of 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="match_parent"
android:padding="5dp"
android:focusable="true"
android:fitsSystemWindows="true"
android:orientation="vertical">
<LinearLayout
style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="运单号 : "
/>
<EditText
android:id="@+id/tv_ydh"
android:singleLine="true"
android:lines="1"
android:hint="请输入或者扫描运单号"
style="@style/edit_weight3_right"/>
</LinearLayout>
<LinearLayout
style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="车牌号 : "
/>
<TextView
android:id="@+id/tv_cph"
style="@style/text_weight3_right"/>
</LinearLayout>
<LinearLayout
style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="操作员 : "
/>
<TextView
android:id="@+id/tv_czy"
style="@style/text_weight3_right"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_menu"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"/>
<Button
android:id="@+id/btn_submit"
android:text="确认"
android:textColor="@color/white"
android:textSize="21sp"
android:background="@drawable/btn_background"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="@color/white"
tools:context=".ui.setting.SettingActivity">
<ImageView
android:id="@+id/iv_back_left"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="start"
android:contentDescription="@string/setting"
android:padding="10dp"
android:src="@drawable/left1">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_gravity="center"
android:padding="30dp"
android:text="@string/ckglxt"
android:textColor="@color/black"
android:textSize="30sp" />
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:padding="10dp"
android:layout_height="wrap_content">
<EditText
android:id="@+id/et_ip"
style="@style/main_edit_right"
android:gravity="center"
android:hint="请输入IP地址及端口"
android:text=""
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:padding="10dp"
android:layout_height="wrap_content">
<EditText
android:id="@+id/et_zt"
style="@style/main_edit_right"
android:gravity="center"
android:hint="请输入账套"
android:text=""
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:padding="10dp"
android:layout_height="wrap_content">
</LinearLayout>
<Button
android:id="@+id/btn_setip"
android:layout_width="126dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginStart="134dp"
android:layout_marginTop="35dp"
android:background="@drawable/btn_background"
android:padding="15dp"
android:text="设置"
android:textColor="@color/white"
android:textSize="20sp" />
</LinearLayout>
<?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="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:scaleType="fitXY"
android:src="@drawable/splash"
android:layout_height="match_parent"
android:contentDescription="@string/app_name" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_loading_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="150dp"
android:layout_height="120dp"
android:background="@drawable/loading_bg"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="@dimen/dp_10"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="@dimen/dp_10">
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_gravity="center_horizontal"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/dialog_loading"
android:indeterminateOnly="true" />
<TextView
android:id="@+id/tipTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="加载中..."
android:textColor="#f0f0f0"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffffffff"
android:orientation="vertical">
<TextView
android:id="@+id/tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10.0dip"
android:text="正在下载,请稍候..."
android:textColor="@color/nc_sort_title_blue"
android:textSize="16sp" />
<View
android:id="@+id/div"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="@id/tv2"
android:background="@color/nc_sort_title_blue" />
<LinearLayout
android:id="@+id/ll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/div"
android:layout_margin="@dimen/dp_10"
android:orientation="vertical">
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/progressbar_color" />
<TextView
android:id="@+id/tv_jdValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:text="当前进度:0.0%"
android:textColor="@color/black" />
<TextView
android:id="@+id/tv_memory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginTop="6dp"
android:text="0K B/18 MB"
android:textColor="@color/black" />
</LinearLayout>
<View
android:id="@+id/v2"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="@id/ll"
android:layout_marginTop="@dimen/dp_10"
android:background="#ffdcdee0" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/v2"
android:orientation="horizontal"
android:visibility="gone">
<Button
android:id="@+id/btn_on"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:background="#ffd9434e"
android:padding="5dp"
android:text="下载"
android:textColor="#ffffffff"
android:textSize="18sp" />
<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="#ffdcdee0" />
<Button
android:id="@+id/btn_off"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:background="#ff909090"
android:padding="5dp"
android:text="取消"
android:textColor="#ffffffff"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/white">
<TextView
android:id="@+id/tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:textSize="16sp"
android:textColor="@color/nc_sort_title_blue"
android:text="版本更新提示"
/>
<View
android:id="@+id/div"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@id/tv2"
android:background="@color/nc_sort_title_blue"
/>
<TextView
android:id="@+id/tv_content"
android:textColor="@color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dp_10"
android:layout_below="@id/div"/>
<View
android:id="@+id/tv_div2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ffdcdee0"
android:layout_marginTop="@dimen/dp_10"
android:layout_below="@id/tv_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/tv_div2">
<Button
android:id="@+id/btn_off"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:layout_weight="1"
android:text="下次再说"
android:textSize="16sp"
android:textColor="@color/black"
android:background="@color/white"
android:visibility="gone"
/>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/nc_div_line"/>
<Button
android:id="@+id/btn_on"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:layout_weight="1"
android:text="立刻更新"
android:textSize="16sp"
android:textColor="@color/black"
android:background="@color/white"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of 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:layout_margin="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:background="@drawable/btn_left_background_normal"
android:orientation="vertical">
<LinearLayout style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="产品名称 : " />
<TextView
android:id="@+id/et_cpmc"
style="@style/text_weight3_right"
android:singleLine="true" />
</LinearLayout>
<LinearLayout style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="产品数量 : " />
<TextView
android:id="@+id/et_cpsl"
style="@style/text_weight3_right"
android:singleLine="true" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of 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:layout_margin="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:background="@drawable/btn_left_background_normal"
android:orientation="vertical">
<LinearLayout style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="产品名称 : " />
<TextView
android:id="@+id/tv_cpmc"
style="@style/text_weight2_right"
android:singleLine="true" />
</LinearLayout>
<LinearLayout style="@style/h_linearlayout">
<TextView
style="@style/title_weight1_style"
android:text="产品数量 : " />
<TextView
android:id="@+id/tv_cpsl"
style="@style/text_weight2_right"
android:singleLine="true" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/btn_submit"
android:background="@drawable/btn_right_background"
android:textSize="20sp"
android:textColor="@color/white"
android:gravity="center"
android:text="确认"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/action_submit"
android:icon="@drawable/scan"
app:showAsAction="ifRoom"
android:title="扫描" />
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorAccent">#ff80cbc4</color>
<color name="colorPrimary">#ff212121</color>
<color name="colorPrimaryDark">@android:color/black</color>
<color name="gray">#d2d1d0</color>
<color name="line">#c8c7cc</color>
<color name="pressed">#87CEEB</color>
<color name="content">#efeff4</color>
<color name="title_color">#33475f</color>
<color name="light_grey">#cccccc</color>
<color name="custom_blue">#1F2E54</color>
<color name="nc_white">#ffffffff</color>
<color name="mdtp_light_gray">#424242</color>
<color name="nc_sort_title_blue">#ff30a7e5</color>
<color name="nc_border">#ffe3e3e3</color>
<color name="nc_bg">#fff4f5f7</color>
<color name="nc_sort_content_nor">#ff555b67</color>
<color name="white40">#40FFFFFF</color>
<color name="white">#FFFFFF</color>
<color name="black">#000000</color>
<color name="green">#008000</color>
<color name="lightblue">#0083FF</color>
<color name="day_textColor">#333333</color>
<color name="day_infoTextColor">#999999</color>
<color name="day_layout_bg_normal">#f6f6f6</color>
<color name="day_layout_bg_pressed">#dfdfdf</color>
<color name="day_edit_color">#333333</color>
<color name="day_edit_hit_color">#999999</color>
<color name="window_background">#f2f2f2</color>
<color name="trans">#00000000</color>
<color name="light_blue_A700">#0091EA</color>
<color name="nc_div_line">#ffdcdee0</color>
<color name="instorage_backgound2">#00FF00</color>
<color name="instorage_backgound3">#FF6600</color>
<color name="red">#FF0000</color>
<color name="instorage_backgound4">#9900CC</color>
<color name="instorage_backgound5">#800080</color>
<color name="transparent">#00000000</color>
<color name="recycle_item_background">#118EE9</color>
<color name="red_50">#FFEBEE</color>
<color name="red_100">#FFCDD2</color>
<color name="red_200">#EF9A9A</color>
<color name="red_300">#E57373</color>
<color name="red_400">#EF5350</color>
<color name="red_500">#F44336</color>
<color name="red_600">#E53935</color>
<color name="red_700">#D32F2F</color>
<color name="red_800">#C62828</color>
<color name="red_900">#B71C1C</color>
<color name="red_A100">#FF8A80</color>
<color name="red_A200">#FF5252</color>
<color name="red_A400">#FF1744</color>
<color name="red_A700">#D50000</color>
<color name="deep_purple_50">#EDE7F6</color>
<color name="deep_purple_100">#D1C4E9</color>
<color name="deep_purple_200">#B39DDB</color>
<color name="deep_purple_300">#9575CD</color>
<color name="deep_purple_400">#7E57C2</color>
<color name="deep_purple_500">#673AB7</color>
<color name="deep_purple_600">#5E35B1</color>
<color name="deep_purple_700">#512DA8</color>
<color name="deep_purple_800">#4527A0</color>
<color name="deep_purple_900">#311B92</color>
<color name="deep_purple_A100">#B388FF</color>
<color name="deep_purple_A200">#7C4DFF</color>
<color name="deep_purple_A400">#651FFF</color>
<color name="deep_purple_A700">#6200EA</color>
<color name="light_blue_50">#E1F5FE</color>
<color name="light_blue_100">#B3E5FC</color>
<color name="light_blue_200">#81D4FA</color>
<color name="light_blue_300">#4FC3F7</color>
<color name="light_blue_400">#29B6F6</color>
<color name="light_blue_500">#03A9F4</color>
<color name="light_blue_600">#039BE5</color>
<color name="light_blue_700">#0288D1</color>
<color name="light_blue_800">#0277BD</color>
<color name="light_blue_900">#01579B</color>
<color name="light_blue_A100">#80D8FF</color>
<color name="light_blue_A200">#40C4FF</color>
<color name="light_blue_A400">#00B0FF</color>
<color name="green_50">#E8F5E9</color>
<color name="green_100">#C8E6C9</color>
<color name="green_200">#A5D6A7</color>
<color name="green_300">#81C784</color>
<color name="green_400">#66BB6A</color>
<color name="green_500">#4CAF50</color>
<color name="green_600">#43A047</color>
<color name="green_700">#388E3C</color>
<color name="green_800">#2E7D32</color>
<color name="green_900">#1B5E20</color>
<color name="green_A100">#B9F6CA</color>
<color name="green_A200">#69F0AE</color>
<color name="green_A400">#00E676</color>
<color name="green_A700">#00C853</color>
<color name="yellow_50">#FFFDE7</color>
<color name="yellow_100">#FFF9C4</color>
<color name="yellow_200">#FFF59D</color>
<color name="yellow_300">#FFF176</color>
<color name="yellow_400">#FFEE58</color>
<color name="yellow_500">#FFEB3B</color>
<color name="yellow_600">#FDD835</color>
<color name="yellow_700">#FBC02D</color>
<color name="yellow_800">#F9A825</color>
<color name="yellow_900">#F57F17</color>
<color name="yellow_A100">#FFFF8D</color>
<color name="yellow_A200">#FFFF00</color>
<color name="yellow_A400">#FFEA00</color>
<color name="yellow_A700">#FFD600</color>
<color name="deep_orange_50">#FBE9E7</color>
<color name="deep_orange_100">#FFCCBC</color>
<color name="deep_orange_200">#FFAB91</color>
<color name="deep_orange_300">#FF8A65</color>
<color name="deep_orange_400">#FF7043</color>
<color name="deep_orange_500">#FF5722</color>
<color name="deep_orange_600">#F4511E</color>
<color name="deep_orange_700">#E64A19</color>
<color name="deep_orange_800">#D84315</color>
<color name="deep_orange_900">#BF360C</color>
<color name="deep_orange_A100">#FF9E80</color>
<color name="deep_orange_A200">#FF6E40</color>
<color name="deep_orange_A400">#FF3D00</color>
<color name="deep_orange_A700">#DD2C00</color>
<color name="blue_grey_50">#ECEFF1</color>
<color name="blue_grey_100">#CFD8DC</color>
<color name="blue_grey_200">#B0BEC5</color>
<color name="blue_grey_300">#90A4AE</color>
<color name="blue_grey_400">#78909C</color>
<color name="blue_grey_500">#607D8B</color>
<color name="blue_grey_600">#546E7A</color>
<color name="blue_grey_700">#455A64</color>
<color name="blue_grey_800">#37474F</color>
<color name="blue_grey_900">#263238</color>
<color name="pink_50">#FCE4EC</color>
<color name="pink_100">#F8BBD0</color>
<color name="pink_200">#F48FB1</color>
<color name="pink_300">#F06292</color>
<color name="pink_400">#EC407A</color>
<color name="pink_500">#E91E63</color>
<color name="pink_600">#D81B60</color>
<color name="pink_700">#C2185B</color>
<color name="pink_800">#AD1457</color>
<color name="pink_900">#880E4F</color>
<color name="pink_A100">#FF80AB</color>
<color name="pink_A200">#FF4081</color>
<color name="pink_A400">#F50057</color>
<color name="pink_A700">#C51162</color>
<color name="indigo_50">#E8EAF6</color>
<color name="indigo_100">#C5CAE9</color>
<color name="indigo_200">#9FA8DA</color>
<color name="indigo_300">#7986CB</color>
<color name="indigo_400">#5C6BC0</color>
<color name="indigo_500">#3F51B5</color>
<color name="indigo_600">#3949AB</color>
<color name="indigo_700">#303F9F</color>
<color name="indigo_800">#283593</color>
<color name="indigo_900">#1A237E</color>
<color name="indigo_A100">#8C9EFF</color>
<color name="indigo_A200">#536DFE</color>
<color name="indigo_A400">#3D5AFE</color>
<color name="indigo_A700">#304FFE</color>
<color name="cyan_50">#E0F7FA</color>
<color name="cyan_100">#B2EBF2</color>
<color name="cyan_200">#80DEEA</color>
<color name="cyan_300">#4DD0E1</color>
<color name="cyan_400">#26C6DA</color>
<color name="cyan_500">#00BCD4</color>
<color name="cyan_600">#00ACC1</color>
<color name="cyan_700">#0097A7</color>
<color name="cyan_800">#00838F</color>
<color name="cyan_900">#006064</color>
<color name="cyan_A100">#84FFFF</color>
<color name="cyan_A200">#18FFFF</color>
<color name="cyan_A400">#00E5FF</color>
<color name="cyan_A700">#00B8D4</color>
<color name="light_green_50">#F1F8E9</color>
<color name="light_green_100">#DCEDC8</color>
<color name="light_green_200">#C5E1A5</color>
<color name="light_green_300">#AED581</color>
<color name="light_green_400">#9CCC65</color>
<color name="light_green_500">#8BC34A</color>
<color name="light_green_600">#7CB342</color>
<color name="light_green_700">#689F38</color>
<color name="light_green_800">#558B2F</color>
<color name="light_green_900">#33691E</color>
<color name="light_green_A100">#CCFF90</color>
<color name="light_green_A200">#B2FF59</color>
<color name="light_green_A400">#76FF03</color>
<color name="light_green_A700">#64DD17</color>
<color name="amber_50">#FFF8E1</color>
<color name="amber_100">#FFECB3</color>
<color name="amber_200">#FFE082</color>
<color name="amber_300">#FFD54F</color>
<color name="amber_400">#FFCA28</color>
<color name="amber_500">#FFC107</color>
<color name="amber_600">#FFB300</color>
<color name="amber_700">#FFA000</color>
<color name="amber_800">#FF8F00</color>
<color name="amber_900">#FF6F00</color>
<color name="amber_A100">#FFE57F</color>
<color name="amber_A200">#FFD740</color>
<color name="amber_A400">#FFC400</color>
<color name="amber_A700">#FFAB00</color>
<color name="brown_50">#EFEBE9</color>
<color name="brown_100">#D7CCC8</color>
<color name="brown_200">#BCAAA4</color>
<color name="brown_300">#A1887F</color>
<color name="brown_400">#8D6E63</color>
<color name="brown_500">#795548</color>
<color name="brown_600">#6D4C41</color>
<color name="brown_700">#5D4037</color>
<color name="brown_800">#4E342E</color>
<color name="brown_900">#3E2723</color>
<color name="purple_50">#F3E5F5</color>
<color name="purple_100">#E1BEE7</color>
<color name="purple_200">#CE93D8</color>
<color name="purple_300">#BA68C8</color>
<color name="purple_400">#AB47BC</color>
<color name="purple_500">#9C27B0</color>
<color name="purple_600">#8E24AA</color>
<color name="purple_700">#7B1FA2</color>
<color name="purple_800">#6A1B9A</color>
<color name="purple_900">#4A148C</color>
<color name="purple_A100">#EA80FC</color>
<color name="purple_A200">#E040FB</color>
<color name="purple_A400">#D500F9</color>
<color name="purple_A700">#AA00FF</color>
<color name="blue_50">#E3F2FD</color>
<color name="blue_100">#BBDEFB</color>
<color name="blue_200">#90CAF9</color>
<color name="blue_300">#64B5F6</color>
<color name="blue_400">#42A5F5</color>
<color name="blue_500">#2196F3</color>
<color name="blue_600">#1E88E5</color>
<color name="blue_700">#1976D2</color>
<color name="blue_800">#1565C0</color>
<color name="blue_900">#0D47A1</color>
<color name="blue_A100">#82B1FF</color>
<color name="blue_A200">#448AFF</color>
<color name="blue_A400">#2979FF</color>
<color name="blue_A700">#2962FF</color>
<color name="teal_50">#E0F2F1</color>
<color name="teal_100">#B2DFDB</color>
<color name="teal_200">#80CBC4</color>
<color name="teal_300">#4DB6AC</color>
<color name="teal_400">#26A69A</color>
<color name="teal_500">#009688</color>
<color name="teal_600">#00897B</color>
<color name="teal_700">#00796B</color>
<color name="teal_800">#00695C</color>
<color name="teal_900">#004D40</color>
<color name="teal_A100">#A7FFEB</color>
<color name="teal_A200">#64FFDA</color>
<color name="teal_A400">#1DE9B6</color>
<color name="teal_A700">#00BFA5</color>
<color name="lime_50">#F9FBE7</color>
<color name="lime_100">#F0F4C3</color>
<color name="lime_200">#E6EE9C</color>
<color name="lime_300">#DCE775</color>
<color name="lime_400">#D4E157</color>
<color name="lime_500">#CDDC39</color>
<color name="lime_600">#C0CA33</color>
<color name="lime_700">#AFB42B</color>
<color name="lime_800">#9E9D24</color>
<color name="lime_900">#827717</color>
<color name="lime_A100">#F4FF81</color>
<color name="lime_A200">#EEFF41</color>
<color name="lime_A400">#C6FF00</color>
<color name="lime_A700">#AEEA00</color>
<color name="orange_50">#FFF3E0</color>
<color name="orange_100">#FFE0B2</color>
<color name="orange_200">#FFCC80</color>
<color name="orange_300">#FFB74D</color>
<color name="orange_400">#FFA726</color>
<color name="orange_500">#FF9800</color>
<color name="orange_600">#FB8C00</color>
<color name="orange_700">#F57C00</color>
<color name="orange_800">#EF6C00</color>
<color name="orange_900">#E65100</color>
<color name="orange_A100">#FFD180</color>
<color name="orange_A200">#FFAB40</color>
<color name="orange_A400">#FF9100</color>
<color name="orange_A700">#FF6D00</color>
<color name="grey_50">#FAFAFA</color>
<color name="grey_100">#F5F5F5</color>
<color name="grey_200">#EEEEEE</color>
<color name="grey_300">#E0E0E0</color>
<color name="grey_400">#BDBDBD</color>
<color name="grey_500">#9E9E9E</color>
<color name="grey_600">#757575</color>
<color name="grey_700">#616161</color>
<color name="grey_750">#525252</color>
<color name="grey_800">#424242</color>
<color name="grey_850">#303030</color>
<color name="grey_875">#282828</color>
<color name="grey_900">#212121</color>
<color name="grey_950">#101010</color>
<color name="black_ae">#ef000000</color>
<color name="black_ac">#cf000000</color>
<color name="black_aa">#af000000</color>
<color name="black_a8">#8f000000</color>
<color name="black_a6">#6f000000</color>
<color name="black_a4">#4f000000</color>
<color name="black_a2">#2f000000</color>
<color name="black_a0">#0f000000</color>
<color name="white_ae">#efffffff</color>
<color name="white_ac">#cfffffff</color>
<color name="white_aa">#afffffff</color>
<color name="white_a8">#8fffffff</color>
<color name="white_a6">#6fffffff</color>
<color name="white_a4">#4fffffff</color>
<color name="white_a2">#2fffffff</color>
<color name="white_a0">#0fffffff</color>
</resources>
<resources>
<string name="app_name">华洋钢管</string>
<string name="setting">设置</string>
<string name="loading">加载中…</string>
<string name="loading_no_more">已加载全部</string>
<string name="un_user">还没有账号?</string>
<string name="qiehuan">切换公司</string>
<string name="chongzhi">重置密码</string>
<string name="wlsz">网络设置</string>
<!--login-->
<string name="user">账号 :</string>
<string name="pwd">密码 :</string>
<string name="user_hint">请输入账号</string>
<string name="pwd_hint">请输入密码</string>
<string name="login">登 录</string>
<string name="add">add</string>
<string name="ckglxt">华洋钢管</string>
</resources>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<!-- 日间模式 -->
<style name="My.App.Theme.Light" parent="Base.App.Theme.Light" />
<!-- 全透明的背景 -->
<style name="App.Theme.Transparent" parent="@style/My.App.Theme.Light">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowFullscreen">true</item>
</style>
<!--base theme light-->
<style name="Base.App.Theme.Light" parent="@style/Base.Theme.AppCompat.Light">
<!--appbar背景-->
<item name="colorPrimary">@color/colorPrimary</item>
<!--状态栏-->
<item name="colorPrimaryDark">@color/colorPrimary</item>
<!--选中颜色-->
<item name="colorAccent">@color/colorAccent</item>
<!--text style-->
<item name="editTextColor">@color/gray</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">14sp</item>
<item name="android:textColorPrimary">@color/black</item>
<item name="android:textColorLink">#0b9a27</item>
<item name="android:editTextColor">@color/day_edit_color</item>
<item name="android:textColorHint">@color/day_edit_hit_color</item>
<!--action style-->
<item name="actionBarStyle">@style/App.Widget.ActionBar</item>
<item name="homeAsUpIndicator">@mipmap/btn_back_normal</item>
<!--action popup-->
<item name="actionBarPopupTheme">@style/ThemeOverlay.AppCompat.Dark</item>
<!--action menu-->
<item name="actionMenuTextColor">@color/white</item>
<item name="actionMenuTextAppearance">@style/MenuTextStyle</item>
<!--action mode-->
<item name="actionModeBackground">@color/colorPrimary</item>
<!--toolbar style-->
<item name="actionBarSize">48dp</item>
<item name="toolbarStyle">@style/App.Widget.Light.Toolbar</item>
<!--button style-->
<item name="android:buttonStyle">@style/App.Widget.Button</item>
<!--window style-->
<item name="elevation">0dp</item>
<item name="android:windowBackground">@color/window_background</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@style/Animation</item>
</style>
<style name="MenuTextStyle">
<item name="android:textSize">17sp</item>
</style>
<!--action bar-->
<style name="App.Widget.ActionBar" parent="@style/Widget.AppCompat.Light.ActionBar">
<item name="background">?attr/colorPrimary</item>
<item name="titleTextStyle">@style/App.TextAppearance.Widget.ActionBar.Title</item>
<item name="contentInsetStart">0dp</item>
<item name="contentInsetStartWithNavigation">0dp</item>
<item name="contentInsetEnd">0dp</item>
<item name="elevation">0dp</item>
</style>
<style name="App.TextAppearance.Widget.ActionBar.Title" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textSize">17sp</item>
<item name="android:textColor">#FFF</item>
</style>
<!--toolbar-->
<style name="Base.App.Widget.Toolbar" parent="@style/Widget.AppCompat.Toolbar">
<item name="android:height">?attr/actionBarSize</item>
<item name="titleTextAppearance">@style/App.TextAppearance.Widget.Toolbar.Title</item>
<item name="titleMargin">0dp</item>
<item name="contentInsetStart">0dp</item>
<item name="contentInsetStartWithNavigation">0dp</item>
</style>
<style name="App.Widget.Light.Toolbar" parent="Base.App.Widget.Toolbar">
<item name="navigationIcon">@drawable/selector_nav_back_light</item>
</style>
<!--text appearance-->
<style name="App.TextAppearance.Widget.Toolbar.Title" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">17sp</item>
<item name="android:textColor">@color/white</item>
</style>
<!--button-->
<style name="App.Widget.Button" parent="Widget.AppCompat.Button">
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@color/trans</item>
<item name="android:windowIsTranslucent">true</item>
<item name="elevation">0dp</item>
<item name="android:gravity">center</item>
</style>
<style name="Base.App.Theme" parent="Base.App.Theme.Light">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<!--启动界面主题-->
<style name="App.Theme.Launch" parent="Base.App.Theme">
<!--<item name="android:windowBackground">@mipmap/default_android</item>-->
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<!-- my loading dialog -->
<style name="MyDialogStyle">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<!-- popup window 显示消失动画-->
<style name="PopWindowAnimStyle">
<item name="android:windowShowAnimation">@anim/dialog_enter</item>
<!-- 指定显示的动画xml -->
<item name="android:windowHideAnimation">@anim/dialog_exit</item>
<!-- 指定消失的动画xml -->
</style>
<style name="main_content_left">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:textSize">14sp</item>
<item name="android:gravity">right</item>
<item name="android:layout_gravity">center</item>
<item name="android:textColor">@color/black</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="main_edit_right">
<item name="android:textColor">@color/black</item>
<item name="android:textColorHint">#888</item>
<item name="android:padding">15dp</item>
<item name="android:textSize">14sp</item>
<item name="android:layout_width">0dp</item>
<item name="android:background">@drawable/edit_background</item>
<item name="android:layout_weight">3</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="instorage_btn_style">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/white</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_margin">5dp</item>
<item name="android:padding">10dp</item>
</style>
<style name="vertical_linearlayout">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">vertical</item>
</style>
<style name="h_linearlayout">
<item name="android:layout_marginTop">1dp</item>
<item name="android:background">@color/white</item>
<item name="android:padding">5dp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">horizontal</item>
</style>
<style name="constant_h_linearlayout">
<item name="android:padding">2dp</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">horizontal</item>
</style>
<style name="weight_1">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:background">@color/white</item>
<item name="android:layout_gravity">center</item>
<item name="android:orientation">horizontal</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="title_weight1_style">
<item name="android:layout_width">0dp</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">14sp</item>
<item name="android:layout_weight">1</item>
<item name="android:padding">5dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="recycler_weight1_style">
<item name="android:layout_width">0dp</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">14sp</item>
<item name="android:gravity">right</item>
<item name="android:layout_gravity">center</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="edit_weight1_right">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">3</item>
<item name="android:singleLine">true</item>
<item name="android:imeOptions">actionSearch</item>
<item name="android:padding">5dp</item>
<item name="android:textColor">@color/black</item>
<item name="android:textSize">17sp</item>
<item name="android:background">@drawable/edit_background</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="edit_weight3_right">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">3</item>
<item name="android:background">@drawable/edit_background</item>
<item name="android:padding">10dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:textColorHint">@color/gray</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="edit_weight2_right">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">3</item>
<item name="android:background">@drawable/edit_background</item>
<item name="android:padding">5dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:textColorHint">@color/gray</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="text_weight2_right">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">2</item>
<item name="android:padding">5dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="text_weight3_right">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">3</item>
<item name="android:padding">5dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="text_title_left">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:gravity">left</item>
<item name="android:padding">10dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="text_content_right">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">3</item>
<item name="android:padding">10dp</item>
<item name="android:layout_gravity">center</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/black</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="check_style">
<item name="android:layout_marginEnd">5dp</item>
<item name="android:padding">5dp</item>
<item name="android:button">@null</item>
<item name="android:gravity">center</item>
<item name="android:textColor">@color/white</item>
<item name="android:background">@drawable/check_select</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="btn_item_style">
<item name="android:layout_marginEnd">5dp</item>
<item name="android:padding">10dp</item>
<item name="android:textSize">14sp</item>
<item name="android:gravity">center</item>
<item name="android:textColor">@color/white</item>
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">wrap_content</item>
</style>
<style name="RatingBar" parent="Theme.AppCompat">
<item name="colorControlNormal">@color/Blue</item>
<item name="colorControlActivated">@color/red</item>
</style>
<style name="popwin_anim_style">
<item name="android:windowEnterAnimation">@anim/popup_in</item>
<item name="android:windowExitAnimation">@anim/popup_out</item>
</style>
<!--默认样式-->
<style name="picture.default.style" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<!--标题栏背景色-->
<item name="colorPrimary">@color/colorPrimary</item>
<!--状态栏背景色-->
<item name="colorPrimaryDark">@color/colorPrimary</item>
</style>
<style name="Animation">
       
<item name="android:activityOpenEnterAnimation">@null</item>
       
<item name="android:activityOpenExitAnimation">@null</item>
       
<item name="android:activityCloseEnterAnimation">@null</item>
       
<item name="android:activityCloseExitAnimation">@null</item>
       
<item name="android:taskOpenEnterAnimation">@null</item>
       
<item name="android:taskOpenExitAnimation">@null</item>
       
<item name="android:taskCloseEnterAnimation">@null</item>
       
<item name="android:taskCloseExitAnimation">@null</item>
       
<item name="android:taskToFrontEnterAnimation">@null</item>
       
<item name="android:taskToFrontExitAnimation">@null</item>
       
<item name="android:taskToBackEnterAnimation">@null</item>
     
<item name="android:taskToBackExitAnimation">@null</item>
   
</style>
<!-- 自定义Dialog样式 -->
<style name="custom_dialog" parent="android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:backgroundDimAmount">0.6</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<paths>
<!--解决7.0拍照权限问题-->
<external-path path="." name="camera_photos" />
</paths>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!--解除android p不能访问明文网址的问题-->
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
\ No newline at end of file
package com.roke.huayangproject;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
//被墙了逼不得已,放大招
maven{url'http://maven.aliyun.com/nexus/content/groups/public/'}
//是用greendao需要添加
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
//greendao添加依赖第一步
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
//被墙了逼不得已,放大招
maven{url'http://maven.aliyun.com/nexus/content/groups/public/'}
//是用greendao需要添加
mavenCentral()
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
#Mon Aug 02 13:52:37 CST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
include ':app'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment