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.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.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
<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>
<?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
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
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