Commit 70683b4e by lihuaikun

feat:1.0界面以及接口接入完毕 等待后台部署测试

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
.cxx
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Gradle Imported" enabled="true">
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.auto.service/auto-service/1.0-rc3/35c5d43b0332b8f94d473f9fee5fb1d74b5e0056/auto-service-1.0-rc3.jar" />
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/19.0/6ce200f6b23222af3d8abb6b6459e6c44f4bb0e9/guava-19.0.jar" />
<entry name="$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.google.auto/auto-common/0.3/4073ab16ab4aceb9a217273da6442166bf51ae16/auto-common-0.3.jar" />
</processorPath>
<module name="component-compiler" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="component-annotations" target="1.7" />
</bytecodeTargetLevel>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/baselib" />
<option value="$PROJECT_DIR$/component-annotations" />
<option value="$PROJECT_DIR$/component-compiler" />
<option value="$PROJECT_DIR$/imageselector" />
</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="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<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
/build
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion build_versions.compile_sdk
defaultConfig {
minSdkVersion build_versions.min_sdk
targetSdkVersion build_versions.target_sdk
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(":baselib")
annotationProcessor deps.butterknife.butterknife_compiler
}
\ No newline at end of file
# 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
\ No newline at end of file
package cn.dankal.yunlaboratory;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("cn.dankal.yunlaboratory", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.dankal.yunlaboratory">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:name="cn.dankal.basiclib.DankalApplication"
android:theme="@style/AppTheme">
<activity android:name=".ui.activity.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.activity.MainActivity"
android:screenOrientation="portrait"></activity>
<activity android:name=".ui.activity.GetSampleActivity"
android:screenOrientation="portrait"></activity>
<activity android:name=".ui.activity.StartTestActivity"
android:screenOrientation="portrait"></activity>
<activity android:name=".ui.activity.UploadResultActivity"
android:screenOrientation="portrait"></activity>
<activity android:name=".ui.activity.ChangeNicknameActivity"
android:screenOrientation="portrait"></activity>
<activity android:name=".ui.activity.ScanActivity"
android:screenOrientation="portrait"></activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
\ No newline at end of file
package cn.dankal.yunlaboratory.ui.activity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import api.UserServiceFactory;
import butterknife.BindView;
import butterknife.OnClick;
import cn.dankal.basiclib.DKUserManager;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.basiclib.bus.InfoChange;
import cn.dankal.basiclib.eventbus.AppBus;
import cn.dankal.basiclib.model.BaseModel;
import cn.dankal.basiclib.model.UserInfoBody;
import cn.dankal.basiclib.model.UserModel;
import cn.dankal.basiclib.rx.NormalSubscriber;
import cn.dankal.yunlaboratory.R;
import cn.dankal.yunlaboratory.ui.widget.MainButton;
import io.reactivex.disposables.Disposable;
public class ChangeNicknameActivity extends BaseActivity {
@BindView(R.id.iv_onback)
ImageView ivOnback;
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.et_result)
EditText etResult;
@BindView(R.id.btn_save)
MainButton btnSave;
@Override
public BasePresenter createPresenter() {
return null;
}
@Override
protected int getLayoutId() {
return R.layout.activity_change_nickname;
}
@Override
protected void initComponents() {
btnSave.setEnabled(true);
tvTitle.setText("昵称");
}
@OnClick({R.id.iv_onback, R.id.btn_save})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_onback:
finish();
break;
case R.id.btn_save:
String nameStr = etResult.getText().toString().trim();
if (!TextUtils.isEmpty(nameStr)){
updateName(nameStr);
}
break;
}
}
public void updateName(String name) {
UserInfoBody userInfoBody = new UserInfoBody();
userInfoBody.setUpdate_type("name");
userInfoBody.setName(name);
UserServiceFactory.updateInfo(userInfoBody, null).subscribe(new NormalSubscriber<BaseModel<UserModel>>() {
@Override
public void onSubscribe(Disposable d) {
showLoadingDialog();
}
@Override
public void onNext(BaseModel<UserModel> stringBaseModel) {
if (stringBaseModel.getData() != null) {
UserModel userModel = DKUserManager.getUserInfo();
userModel.setName(stringBaseModel.getData().getName());
DKUserManager.updateUserInfo(userModel);
AppBus.getInstance().post(new InfoChange());
}
}
@Override
public void onComplete() {
super.onComplete();
dismissLoadingDialog();
}
});
}
}
package cn.dankal.yunlaboratory.ui.activity;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.OnClick;
import cn.dankal.basiclib.DKUserManager;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.basiclib.model.SubmitRecordModel;
import cn.dankal.basiclib.model.UserModel;
import cn.dankal.basiclib.util.GlideUtils;
import cn.dankal.yunlaboratory.R;
import cn.dankal.yunlaboratory.ui.widget.MainButton;
/**
* 取回样本
*/
public class GetSampleActivity extends BaseActivity {
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.tv_person_name)
TextView tvPersonName;
@BindView(R.id.tv_person_no)
TextView tvPersonNo;
@BindView(R.id.tv_time)
TextView tvTime;
@BindView(R.id.tv_choose)
MainButton tvChoose;
private SubmitRecordModel recordModel;
@Override
public BasePresenter createPresenter() {
return null;
}
@Override
protected int getLayoutId() {
return R.layout.activity_get_sample;
}
@Override
protected void initComponents() {
recordModel= (SubmitRecordModel) getIntent().getSerializableExtra("data");
tvTitle.setText("取回样本");
tvChoose.setEnabled(true);
initView();
}
private void initView(){
if (DKUserManager.getUserInfo() != null) {
UserModel userModel = DKUserManager.getUserInfo();
tvPersonName.setText(userModel.getName());
tvPersonNo.setText(userModel.getEmployee_id());
tvTime.setText(recordModel.getCreated_at());
}
}
@OnClick({R.id.iv_onback, R.id.tv_choose})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_onback:
finish();
break;
case R.id.tv_choose:
Intent intent=new Intent(this,StartTestActivity.class);
intent.putExtra("data",recordModel);
startActivity(intent);
finish();
break;
}
}
}
package cn.dankal.yunlaboratory.ui.activity;
import android.content.Intent;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import api.UserServiceFactory;
import butterknife.BindView;
import butterknife.OnClick;
import cn.dankal.basiclib.DKUserManager;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.basiclib.model.BaseModel;
import cn.dankal.basiclib.model.LoginModel;
import cn.dankal.basiclib.rx.MapFunc;
import cn.dankal.basiclib.rx.NormalSubscriber;
import cn.dankal.basiclib.util.ToastUtils;
import cn.dankal.yunlaboratory.R;
import cn.dankal.yunlaboratory.ui.widget.MainButton;
import io.reactivex.disposables.Disposable;
public class LoginActivity extends BaseActivity {
@BindView(R.id.iv_onback)
ImageView ivOnback;
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.et_account)
EditText etAccount;
@BindView(R.id.et_pwd)
EditText etPwd;
@BindView(R.id.btn_login)
MainButton btnLogin;
@Override
public BasePresenter createPresenter() {
return null;
}
@Override
protected int getLayoutId() {
return R.layout.activity_login;
}
@Override
protected void initComponents() {
tvTitle.setText("检测平台");
TextWatcher textWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (etAccount.getText().length() > 0 && etPwd.getText().length() > 0) {
btnLogin.setEnabled(true);
} else {
btnLogin.setEnabled(false);
}
}
};
etAccount.addTextChangedListener(textWatcher);
etPwd.addTextChangedListener(textWatcher);
}
@OnClick({R.id.iv_onback, R.id.btn_login})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_onback:
break;
case R.id.btn_login:
String account = etAccount.getText().toString().trim();
String pwd = etPwd.getText().toString().trim();
if (TextUtils.isEmpty(account)) {
ToastUtils.showShort("请输入账号");
return;
}
if (TextUtils.isEmpty(pwd)) {
ToastUtils.showShort("请输入密码");
return;
}
UserServiceFactory.login(account, pwd).map(new MapFunc<>()).subscribe(new NormalSubscriber<BaseModel<LoginModel>>() {
@Override
public void onSubscribe(Disposable d) {
showLoadingDialog();
}
@Override
public void onNext(BaseModel<LoginModel> loginModelBaseModel) {
DKUserManager.saveUserInfo(loginModelBaseModel.getData());
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
}
@Override
public void onComplete() {
super.onComplete();
dismissLoadingDialog();
}
});
break;
}
}
}
package cn.dankal.yunlaboratory.ui.activity;
import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.yunlaboratory.R;
import cn.dankal.yunlaboratory.ui.fragment.PersonFragment;
import cn.dankal.yunlaboratory.ui.fragment.ScanFragment;
public class MainActivity extends BaseActivity {
@BindView(R.id.iv_scan)
ImageView ivScan;
@BindView(R.id.tv_scan)
TextView tvScan;
@BindView(R.id.linear_scan)
LinearLayout linearScan;
@BindView(R.id.iv_mine)
ImageView ivMine;
@BindView(R.id.tv_mine)
TextView tvMine;
@BindView(R.id.linear_mine)
LinearLayout linearMine;
private List<Fragment> fragments;
private int lastShowFragmentIndex = 0;
@Override
public BasePresenter createPresenter() {
return null;
}
@Override
protected int getLayoutId() {
return R.layout.activity_main;
}
@Override
protected void initComponents() {
fragments = new ArrayList<>();
fragments.add(ScanFragment.getInstance());
fragments.add(PersonFragment.getInstance());
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
for (int i = 0; i < fragments.size(); i++) {
transaction.add(R.id.frame, fragments.get(i));
transaction.hide(fragments.get(i));
}
transaction.show(fragments.get(0));
transaction.commit();
}
@OnClick({R.id.linear_scan, R.id.linear_mine})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.linear_scan:
changeFragment(0);
break;
case R.id.linear_mine:
changeFragment(1);
break;
}
}
private void changeFragment(int index) {
if (index == lastShowFragmentIndex)
return;
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.hide(fragments.get(lastShowFragmentIndex));
transaction.show(fragments.get(index));
transaction.commit();
lastShowFragmentIndex = index;
switch (index) {
case 0:
ivScan.setImageResource(R.drawable.ic_scan_press);
tvScan.setTextColor(getResources().getColor(R.color.color6fc3ff));
ivMine.setImageResource(R.drawable.ic_mine);
tvMine.setTextColor(getResources().getColor(R.color.colorABB2B7));
break;
case 1:
ivScan.setImageResource(R.drawable.ic_scan);
tvScan.setTextColor(getResources().getColor(R.color.colorABB2B7));
ivMine.setImageResource(R.drawable.ic_mine_press);
tvMine.setTextColor(getResources().getColor(R.color.color6fc3ff));
break;
case 2:
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (fragments != null) {
for (Fragment fragment : fragments) {
fragment.onActivityResult(requestCode, resultCode, data);
}
}
}
}
\ No newline at end of file
package cn.dankal.yunlaboratory.ui.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.SurfaceView;
import android.widget.TextView;
import com.king.zxing.CaptureHelper;
import com.king.zxing.OnCaptureCallback;
import com.king.zxing.ViewfinderView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.yunlaboratory.R;
public class ScanActivity extends BaseActivity implements OnCaptureCallback {
@BindView(R.id.surfaceView)
SurfaceView surfaceView;
@BindView(R.id.viewfinderView)
ViewfinderView viewfinderView;
@BindView(R.id.tv_title)
TextView tvTitle;
private CaptureHelper mCaptureHelper;
@Override
public BasePresenter createPresenter() {
return null;
}
@Override
protected int getLayoutId() {
return R.layout.activity_scan;
}
@Override
protected void initComponents() {
tvTitle.setText("扫一扫");
mCaptureHelper = new CaptureHelper(this,surfaceView,viewfinderView);
mCaptureHelper.setOnCaptureCallback(this);
mCaptureHelper.onCreate();
mCaptureHelper.vibrate(true)
.fullScreenScan(true)//全屏扫码
.supportVerticalCode(true)//支持扫垂直条码,建议有此需求时才使用。
.supportLuminanceInvert(true);//是否支持识别反色码(黑白反色的码),增加识别率
}
@Override
protected void onResume() {
super.onResume();
mCaptureHelper.onResume();
}
@Override
protected void onPause() {
super.onPause();
mCaptureHelper.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
mCaptureHelper.onDestroy();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
mCaptureHelper.onTouchEvent(event);
return super.onTouchEvent(event);
}
@OnClick(R.id.iv_onback)
public void onViewClicked() {
finish();
}
@Override
public boolean onResultCallback(String result) {
Intent intent=new Intent();
intent.putExtra("data",result);
setResult(Activity.RESULT_OK,intent);
finish();
return false;
}
}
package cn.dankal.yunlaboratory.ui.activity;
import android.content.Intent;
import android.view.View;
import android.widget.TextView;
import java.util.List;
import api.UserServiceFactory;
import butterknife.BindView;
import butterknife.OnClick;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.basiclib.model.BaseModel;
import cn.dankal.basiclib.model.ProjectModel;
import cn.dankal.basiclib.model.SubmitRecordModel;
import cn.dankal.basiclib.model.SubmitResultBody;
import cn.dankal.basiclib.rx.NormalSubscriber;
import cn.dankal.yunlaboratory.R;
import cn.dankal.yunlaboratory.ui.dialog.ChooseItemDialog;
import cn.dankal.yunlaboratory.ui.widget.MainButton;
import io.reactivex.disposables.Disposable;
public class StartTestActivity extends BaseActivity {
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.tv_project_name)
TextView tvProjectName;
@BindView(R.id.tv_machine_name)
TextView tvMachineName;
@BindView(R.id.btn_next)
MainButton btnNext;
private ChooseItemDialog chooseProjectDialog, chooseDeviceDialog;
private SubmitRecordModel recordModel;
private List<ProjectModel> projectModels;
private List<ProjectModel> deviceModels;
private int projectId=-1;
private int deviceId=-1;
private SubmitResultBody submitResultBody;
@Override
public BasePresenter createPresenter() {
return null;
}
@Override
protected int getLayoutId() {
return R.layout.activity_start_test;
}
@Override
protected void initComponents() {
tvTitle.setText("开始试验");
btnNext.setEnabled(true);
recordModel = (SubmitRecordModel) getIntent().getSerializableExtra("data");
chooseProjectDialog = new ChooseItemDialog(this);
chooseDeviceDialog = new ChooseItemDialog(this);
submitResultBody=new SubmitResultBody();
submitResultBody.setUpload_list_id(recordModel.getId());
getProjectList();
getDeviceList();
chooseProjectDialog.setViewClick(R.id.tv_positive, new View.OnClickListener() {
@Override
public void onClick(View v) {
int pos = chooseProjectDialog.getCurrentItem();
if (projectModels!=null&&pos<projectModels.size()){
tvProjectName.setText(projectModels.get(pos).getName());
projectId=projectModels.get(pos).getId();
}
}
});
chooseDeviceDialog.setViewClick(R.id.tv_positive, new View.OnClickListener() {
@Override
public void onClick(View v) {
int pos = chooseDeviceDialog.getCurrentItem();
if (deviceModels!=null&&pos<deviceModels.size()){
tvMachineName.setText(deviceModels.get(pos).getName());
deviceId=deviceModels.get(pos).getId();
}
}
});
}
@OnClick({R.id.iv_onback, R.id.card_choose_project, R.id.card_choose_machine, R.id.btn_next})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_onback:
finish();
break;
case R.id.card_choose_project:
chooseProjectDialog.show();
break;
case R.id.card_choose_machine:
chooseDeviceDialog.show();
break;
case R.id.btn_next:
if (projectId==-1){
showToast("请选择项目");
return;
}
if (deviceId==-1){
showToast("请选择仪器");
return;
}
submitResultBody.setProject_id(projectId);
submitResultBody.setDevice_id(deviceId);
Intent intent = new Intent(this, UploadResultActivity.class);
intent.putExtra("data",submitResultBody);
startActivity(intent);
finish();
break;
}
}
public void getProjectList() {
UserServiceFactory.getProjectList().subscribe(new NormalSubscriber<BaseModel<List<ProjectModel>>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(BaseModel<List<ProjectModel>> listBaseModel) {
if (listBaseModel.getData() != null && listBaseModel.getData().size() > 0) {
projectModels = listBaseModel.getData();
String[] titles = new String[projectModels.size()];
for (int i = 0; i < projectModels.size(); i++) {
ProjectModel projectModel = projectModels.get(i);
titles[i] = projectModel.getName();
}
chooseProjectDialog.setData(titles);
}
}
});
}
public void getDeviceList() {
UserServiceFactory.getProjectList().subscribe(new NormalSubscriber<BaseModel<List<ProjectModel>>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(BaseModel<List<ProjectModel>> listBaseModel) {
if (listBaseModel.getData() != null && listBaseModel.getData().size() > 0) {
deviceModels = listBaseModel.getData();
String[] titles = new String[deviceModels.size()];
for (int i = 0; i < deviceModels.size(); i++) {
ProjectModel projectModel = deviceModels.get(i);
titles[i] = projectModel.getName();
}
chooseDeviceDialog.setData(titles);
}
}
});
}
}
package cn.dankal.yunlaboratory.ui.activity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import api.UserServiceFactory;
import butterknife.BindView;
import butterknife.OnClick;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.basiclib.model.BaseModel;
import cn.dankal.basiclib.model.SubmitResultBody;
import cn.dankal.basiclib.rx.MapFunc;
import cn.dankal.basiclib.rx.NormalSubscriber;
import cn.dankal.yunlaboratory.R;
import cn.dankal.yunlaboratory.ui.widget.MainButton;
import io.reactivex.disposables.Disposable;
public class UploadResultActivity extends BaseActivity {
@BindView(R.id.tv_title)
TextView tvTitle;
@BindView(R.id.et_result)
EditText etResult;
@BindView(R.id.btn_upload)
MainButton btnUpload;
private SubmitResultBody body;
@Override
public BasePresenter createPresenter() {
return null;
}
@Override
protected int getLayoutId() {
return R.layout.activity_upload_result;
}
@Override
protected void initComponents() {
tvTitle.setText("结果录入");
body = (SubmitResultBody) getIntent().getSerializableExtra("data");
btnUpload.setEnabled(true);
}
@OnClick({R.id.iv_onback, R.id.btn_upload})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.iv_onback:
finish();
break;
case R.id.btn_upload:
String report=etResult.getText().toString();
if (!TextUtils.isEmpty(report)){
body.setContent(report);
UserServiceFactory.submitReport(body).map(new MapFunc<>()).subscribe(new NormalSubscriber<BaseModel<String>>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onNext(BaseModel<String> stringBaseModel) {
}
});
}else {
showToast("请填写样本检测报告");
}
break;
}
}
}
package cn.dankal.yunlaboratory.ui.dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import cn.dankal.basiclib.widget.dialog.BaseDialog;
import cn.dankal.basiclib.widget.dialog.CustomDialog;
import cn.dankal.yunlaboratory.R;
public class ChooseAvatarDialog extends BaseDialog {
public ChooseAvatarDialog(Context context) {
super(context);
}
@Override
public void initDialog() {
dialog = new CustomDialog.Builder(context).widthpx(-1).heightdp(133).gravity(Gravity.BOTTOM).view(R.layout.dialog_choose_avatar).build();
dialog.addViewOnclick(R.id.tv_negative, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
}
package cn.dankal.yunlaboratory.ui.dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import cn.dankal.basiclib.widget.dialog.BaseDialog;
import cn.dankal.basiclib.widget.dialog.CustomDialog;
import cn.dankal.basiclib.widget.wheelview.WheelView;
import cn.dankal.basiclib.widget.wheelview.adapters.ArrayWheelAdapter;
import cn.dankal.yunlaboratory.R;
public class ChooseItemDialog extends BaseDialog {
private WheelView wheelView;
public ChooseItemDialog(Context context) {
super(context);
}
@Override
public void initDialog() {
dialog = new CustomDialog.Builder(context).widthpx(-1).heightdp(300).gravity(Gravity.BOTTOM).view(R.layout.choose_item_wheel).build();
wheelView = (WheelView) dialog.getView(R.id.wheel_view);
dialog.addViewOnclick(R.id.tv_negative, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
public void setData(String[] title) {
wheelView.setViewAdapter(new ArrayWheelAdapter<String>(context, title));
}
public int getCurrentItem() {
return wheelView.getCurrentItem();
}
}
package cn.dankal.yunlaboratory.ui.dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import cn.dankal.basiclib.widget.dialog.BaseDialog;
import cn.dankal.basiclib.widget.dialog.CustomDialog;
import cn.dankal.yunlaboratory.R;
public class GetBackSampleDialog extends BaseDialog {
public GetBackSampleDialog(Context context) {
super(context);
}
@Override
public void initDialog() {
dialog = new CustomDialog.Builder(context).widthdp(345).heightdp(190).gravity(Gravity.CENTER).view(R.layout.dialog_get_back_sample).build();
dialog.addViewOnclick(R.id.tv_negative, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
dialog.addViewOnclick(R.id.tv_positive, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
}
package cn.dankal.yunlaboratory.ui.dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.EditText;
import cn.dankal.basiclib.widget.dialog.BaseDialog;
import cn.dankal.basiclib.widget.dialog.CustomDialog;
import cn.dankal.yunlaboratory.R;
public class InputPersonNoDialog extends BaseDialog {
private EditText etName;
public InputPersonNoDialog(Context context) {
super(context);
}
@Override
public void initDialog() {
dialog = new CustomDialog.Builder(context).widthdp(345).heightdp(250).gravity(Gravity.CENTER).view(R.layout.dialog_input_person_no).build();
dialog.addViewOnclick(R.id.tv_negative, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
etName = (EditText) dialog.getView(R.id.et_input);
}
public String getInputName() {
return etName.getText().toString().trim();
}
}
package cn.dankal.yunlaboratory.ui.dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
import cn.dankal.basiclib.widget.dialog.BaseDialog;
import cn.dankal.basiclib.widget.dialog.CustomDialog;
import cn.dankal.basiclib.widget.wheelview.WheelView;
import cn.dankal.basiclib.widget.wheelview.adapters.ArrayWheelAdapter;
import cn.dankal.yunlaboratory.R;
public class RenderDialog extends BaseDialog {
private WheelView wheelView;
public RenderDialog(Context context) {
super(context);
}
@Override
public void initDialog() {
dialog = new CustomDialog.Builder(context).widthpx(-1).heightdp(185).gravity(Gravity.BOTTOM).view(R.layout.dialog_choose_sex).build();
wheelView = (WheelView) dialog.getView(R.id.wheel_view);
dialog.addViewOnclick(R.id.tv_negative, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
dialog.addViewOnclick(R.id.tv_positive, new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
List<String> strings = new ArrayList<>();
strings.add("女");
strings.add("男");
String[] data = new String[strings.size()];
strings.toArray(data);
wheelView.setVisibleItems(2);
wheelView.setViewAdapter(new ArrayWheelAdapter<String>(context, data));
}
/**
* 性别 1男2女
*
* @return
*/
public int getCurrentSex() {
return wheelView.getCurrentItem() == 0 ? 2 : 1;
}
}
package cn.dankal.yunlaboratory.ui.fragment;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import com.tbruyelle.rxpermissions2.RxPermissions;
import api.UserServiceFactory;
import butterknife.BindView;
import butterknife.OnClick;
import cn.dankal.basiclib.base.fragment.BaseFragment;
import cn.dankal.basiclib.model.BaseModel;
import cn.dankal.basiclib.model.SampleModel;
import cn.dankal.basiclib.model.SubmitRecordModel;
import cn.dankal.basiclib.rx.MapFunc;
import cn.dankal.basiclib.rx.NormalSubscriber;
import cn.dankal.yunlaboratory.R;
import cn.dankal.yunlaboratory.ui.activity.GetSampleActivity;
import cn.dankal.yunlaboratory.ui.activity.ScanActivity;
import cn.dankal.yunlaboratory.ui.dialog.GetBackSampleDialog;
import cn.dankal.yunlaboratory.ui.dialog.InputPersonNoDialog;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
public class ScanFragment extends BaseFragment {
public static final int RC_SCAN = 0x3;
@BindView(R.id.tv_hello_name)
TextView tvHelloName;
@BindView(R.id.card_scan)
CardView cardScan;
private GetBackSampleDialog getBackSampleDialog;
private String codeResult;
private InputPersonNoDialog inputPersonNoDialog;
public static ScanFragment getInstance() {
ScanFragment scanFragment = new ScanFragment();
return scanFragment;
}
@Override
protected int getLayoutId() {
return R.layout.fragment_scan;
}
@Override
protected void initComponents() {
getBackSampleDialog = new GetBackSampleDialog(getContext());
inputPersonNoDialog = new InputPersonNoDialog(getContext());
getBackSampleDialog.setViewClick(R.id.tv_positive, new View.OnClickListener() {
@Override
public void onClick(View v) {
getBackSampleDialog.dismiss();
UserServiceFactory.sample(codeResult).map(new MapFunc<BaseModel<SampleModel>>()).subscribe(new NormalSubscriber<BaseModel<SampleModel>>() {
@Override
public void onSubscribe(Disposable d) {
showLoadingDialog();
}
@Override
public void onNext(BaseModel<SampleModel> sampleModelBaseModel) {
SampleModel sampleModel = sampleModelBaseModel.getData();
if (sampleModel.getType() == 1) {
inputPersonNoDialog.show();
} else {
Intent intent = new Intent(getContext(), GetSampleActivity.class);
intent.putExtra("data", sampleModel.getUpload_list());
getContext().startActivity(intent);
}
}
@Override
public void onComplete() {
super.onComplete();
dismissLoadingDialog();
}
}
);
}
});
inputPersonNoDialog.setViewClick(R.id.tv_positive, new View.OnClickListener() {
@Override
public void onClick(View v) {
String nameStr = inputPersonNoDialog.getInputName();
if (!TextUtils.isEmpty(nameStr)) {
inputPersonNoDialog.dismiss();
UserServiceFactory.sampleNext(nameStr).subscribe(new NormalSubscriber<BaseModel<SubmitRecordModel>>() {
@Override
public void onSubscribe(Disposable d) {
showLoadingDialog();
}
@Override
public void onNext(BaseModel<SubmitRecordModel> submitRecordModelBaseModel) {
SubmitRecordModel model = submitRecordModelBaseModel.getData();
Intent intent = new Intent(getContext(), GetSampleActivity.class);
intent.putExtra("data", model);
getContext().startActivity(intent);
}
@Override
public void onComplete() {
super.onComplete();
dismissLoadingDialog();
}
});
}
}
});
}
@OnClick(R.id.card_scan)
public void onViewClicked() {
new RxPermissions(getActivity()).request(Manifest.permission.CAMERA).subscribe(new Consumer<Boolean>() {
@Override
public void accept(Boolean aBoolean) throws Exception {
if (aBoolean) {
Intent intent = new Intent(getContext(), ScanActivity.class);
startActivityForResult(intent, RC_SCAN);
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK && requestCode == RC_SCAN) {
codeResult = data.getStringExtra("data");
getBackSampleDialog.show();
}
}
}
package cn.dankal.yunlaboratory.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Button;
import cn.dankal.yunlaboratory.R;
public class MainButton extends androidx.appcompat.widget.AppCompatButton {
public MainButton(Context context) {
this(context,null);
}
public MainButton(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public MainButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setBackgroundResource(R.drawable.selector_btn_back);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (enabled){
setTextColor(getResources().getColor(R.color.white));
}else {
setTextColor(getResources().getColor(R.color.color99));
}
}
}
<?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="#3DDC84"
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"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_btn_login_press" android:state_enabled="true"></item>
<item android:drawable="@drawable/ic_btn_login"></item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners android:radius="20dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorf8" />
<corners android:radius="8dp" />
</shape>
\ 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:background="@color/white"
android:orientation="vertical">
<include layout="@layout/title_bar"></include>
<EditText
android:id="@+id/et_result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:background="@drawable/shape_input_back"
android:gravity="start"
android:hint="建议至多8个字,不可使用特殊符号"
android:minHeight="94dp"
android:padding="10dp"
android:textColor="@color/color14"
android:textColorHint="#ffabb2b7"
android:textSize="14sp"></EditText>
<cn.dankal.yunlaboratory.ui.widget.MainButton
android:id="@+id/btn_save"
android:layout_width="match_parent"
android:layout_height="89dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:layout_marginRight="20dp"
android:enabled="true"
android:gravity="center"
android:text="保存"></cn.dankal.yunlaboratory.ui.widget.MainButton>
</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">
<include layout="@layout/title_bar"></include>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="110dp"
android:layout_margin="22dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="30dp"
android:paddingRight="30dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="员工姓名"
android:textColor="#ffabb2b7"
android:textSize="@dimen/sp14" />
<TextView
android:id="@+id/tv_person_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:textColor="#ff2d506b"
android:textSize="14sp"
tools:text="Travis" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="员工工号"
android:textColor="#ffabb2b7"
android:textSize="@dimen/sp14" />
<TextView
android:id="@+id/tv_person_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:textColor="#ff2d506b"
android:textSize="14sp"
tools:text="Travis" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="取回时间"
android:textColor="#ffabb2b7"
android:textSize="@dimen/sp14" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:textColor="#ff2d506b"
android:textSize="14sp"
tools:text="2020-06-09 12:30:12" />
</RelativeLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<cn.dankal.yunlaboratory.ui.widget.MainButton
android:id="@+id/tv_choose"
android:layout_width="match_parent"
android:layout_height="89dp"
android:layout_margin="20dp"
android:enabled="true"
android:gravity="center"
android:text="选择项目"></cn.dankal.yunlaboratory.ui.widget.MainButton>
</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:background="@color/white"
android:orientation="vertical">
<include layout="@layout/title_bar"></include>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/dp20"
android:paddingRight="@dimen/dp20">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:text="账号"
android:textColor="@color/color14"
android:textSize="@dimen/sp16" />
<EditText
android:id="@+id/et_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@null"
android:hint="请输入账号"
android:textColor="@color/color14"
android:textColorHint="@color/color33"
android:textSize="@dimen/sp14" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="12dp"
android:background="@color/colorcf" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:text="密码"
android:textColor="@color/color14"
android:textSize="@dimen/sp16" />
<EditText
android:id="@+id/et_pwd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:background="@null"
android:hint="请输入密码"
android:textColor="@color/color14"
android:textColorHint="@color/color33"
android:textSize="@dimen/sp14" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="12dp"
android:background="@color/colorcf" />
<cn.dankal.yunlaboratory.ui.widget.MainButton
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="89dp"
android:layout_marginTop="40dp"
android:gravity="center"
android:enabled="false"
android:text="登录"></cn.dankal.yunlaboratory.ui.widget.MainButton>
</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="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/linear_scan"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_scan"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/ic_scan_press">
</ImageView>
<TextView
android:id="@+id/tv_scan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="扫码"
android:textColor="@color/color6fc3ff"
android:textSize="11sp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/ic_register">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="出站登记"
android:textColor="@color/colorABB2B7"
android:textSize="11sp"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/linear_mine"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_mine"
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/ic_mine">
</ImageView>
<TextView
android:id="@+id/tv_mine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="个人中心"
android:textColor="@color/colorABB2B7"
android:textSize="11sp"
/>
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/bottom_bar"></FrameLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<SurfaceView
android:id="@+id/surfaceView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.king.zxing.ViewfinderView
android:id="@+id/viewfinderView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:labelText="请将二维码放入框内,即可自动扫描"
app:labelTextSize="@dimen/sp14"
app:laserColor="@color/color6fc3ff"
app:frameColor="@color/color6fc3ff"
app:cornerColor="#34A9FF"
app:resultPointColor="@color/color6fc3ff"
app:labelTextLocation="bottom"
app:laserStyle="grid"
app:gridHeight="0dp"/>
<include layout="@layout/title_bar"/>
</RelativeLayout>
\ 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/title_bar"></include>
<androidx.cardview.widget.CardView
android:id="@+id/card_choose_project"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="15dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView
android:id="@+id/tv_project_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="选择项目"
android:textColor="#ff2d506b"
android:textSize="16sp" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_grey_right_arrow"></ImageView>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/card_choose_machine"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<TextView
android:id="@+id/tv_machine_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="请选择仪器"
android:textColor="#ff2d506b"
android:textSize="16sp" />
<ImageView
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_grey_right_arrow"></ImageView>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<cn.dankal.yunlaboratory.ui.widget.MainButton
android:id="@+id/btn_next"
android:layout_width="match_parent"
android:layout_height="89dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:layout_marginRight="20dp"
android:enabled="true"
android:gravity="center"
android:text="下一步"></cn.dankal.yunlaboratory.ui.widget.MainButton>
</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:background="@color/white"
android:orientation="vertical">
<include layout="@layout/title_bar"></include>
<EditText
android:id="@+id/et_result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="30dp"
android:background="@drawable/shape_input_back"
android:gravity="start"
android:hint="请填写样本检测报告"
android:minHeight="94dp"
android:padding="10dp"
android:textColor="@color/color14"
android:textColorHint="#ffabb2b7"
android:textSize="14sp"></EditText>
<cn.dankal.yunlaboratory.ui.widget.MainButton
android:id="@+id/btn_upload"
android:layout_width="match_parent"
android:layout_height="89dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:layout_marginRight="20dp"
android:enabled="true"
android:gravity="center"
android:text="上传"></cn.dankal.yunlaboratory.ui.widget.MainButton>
</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="match_parent"
android:layout_height="79dp"
android:background="@drawable/selector_btn_back">
</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="300dp"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
android:id="@+id/tv_negative"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:gravity="center"
android:text="取消"
android:textColor="#ff999999"
android:textSize="@dimen/sp16" />
<TextView
android:id="@+id/tv_positive"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:gravity="center"
android:text="确定"
android:textColor="#ff108ee9"
android:textSize="@dimen/sp16" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/colorCF">
</View>
<cn.dankal.basiclib.widget.wheelview.WheelView
android:id="@+id/wheel_view"
android:layout_width="match_parent"
android:layout_height="match_parent"></cn.dankal.basiclib.widget.wheelview.WheelView>
</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="133dp"
android:orientation="vertical"
android:background="@color/white">
<TextView
android:id="@+id/tv_camera"
android:layout_width="match_parent"
android:layout_height="43dp"
android:text="拍摄"
android:gravity="center"
android:textColor="@color/color33"
android:textSize="@dimen/sp14"
/>
<TextView
android:id="@+id/tv_album"
android:layout_width="match_parent"
android:layout_height="43dp"
android:text="从相册中选择"
android:gravity="center"
android:textColor="@color/color33"
android:textSize="@dimen/sp14"
/>
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="#D8D8D8"></View>
<TextView
android:id="@+id/tv_negative"
android:layout_width="match_parent"
android:layout_height="42dp"
android:text="取消"
android:gravity="center"
android:textColor="@color/color33"
android:textSize="@dimen/sp14"
/>
</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="185dp"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp">
<TextView
android:id="@+id/tv_negative"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:gravity="center"
android:text="取消"
android:textColor="#ff999999"
android:textSize="@dimen/sp16" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:text="性别"
android:textColor="#ff2d343d"
android:textSize="18sp" />
<TextView
android:id="@+id/tv_positive"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:gravity="center"
android:text="确定"
android:textColor="#ff108ee9"
android:textSize="@dimen/sp16" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/colorCF">
</View>
<cn.dankal.basiclib.widget.wheelview.WheelView
android:id="@+id/wheel_view"
android:layout_width="match_parent"
android:layout_height="match_parent"></cn.dankal.basiclib.widget.wheelview.WheelView>
</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="match_parent"
android:layout_height="190dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/shape_dialog_background"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:text="是否确认取回样本?"
android:layout_centerHorizontal="true"
android:textColor="#ff2d506b"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_negative"
android:layout_width="0dp"
android:layout_height="89dp"
android:layout_weight="1"
android:background="@drawable/ic_dialog_negative"
android:gravity="center"
android:text="取消"
android:textColor="#ff2d506b"
android:textSize="17sp"></TextView>
<TextView
android:id="@+id/tv_positive"
android:layout_width="0dp"
android:layout_height="89dp"
android:layout_weight="1"
android:background="@drawable/ic_dialog_postive"
android:gravity="center"
android:text="确定"
android:textColor="@color/white"
android:textSize="17sp"></TextView>
</LinearLayout>
</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="match_parent"
android:layout_height="250dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@drawable/shape_dialog_background"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:text="请填写送样人员"
android:textColor="#ff2d506b"
android:textSize="18sp" />
<EditText
android:id="@+id/et_input"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="22dp"
android:layout_marginTop="80dp"
android:hint="请输入"
android:textColorHint="#ffabb2b7"
android:textColor="@color/color14"
android:paddingLeft="10dp"
android:gravity="center_vertical"
android:textSize="14sp"
android:layout_marginRight="22dp"
android:background="@drawable/shape_input_back"></EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_negative"
android:layout_width="0dp"
android:layout_height="89dp"
android:layout_weight="1"
android:background="@drawable/ic_dialog_negative"
android:gravity="center"
android:text="取消"
android:textColor="#ff2d506b"
android:textSize="17sp"></TextView>
<TextView
android:id="@+id/tv_positive"
android:layout_width="0dp"
android:layout_height="89dp"
android:layout_weight="1"
android:background="@drawable/ic_dialog_postive"
android:gravity="center"
android:text="确定"
android:textColor="@color/white"
android:textSize="17sp"></TextView>
</LinearLayout>
</RelativeLayout>
\ 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:background="@color/white"
android:orientation="vertical">
<include layout="@layout/title_bar"></include>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="225dp"
android:layout_margin="15dp"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:paddingLeft="@dimen/dp20">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="头像"
android:textColor="#ff2d506b"
android:textSize="@dimen/sp16" />
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="35dp"></ImageView>
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/ic_grey_right_arrow"></ImageView>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/colorCF"></View>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="52dp"
android:paddingLeft="@dimen/dp20">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="工号"
android:textColor="#ff2d506b"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="37dp"
android:textColor="#ffabb2b7"
android:textSize="@dimen/sp14"
tools:text="10001" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/colorCF"></View>
<RelativeLayout
android:id="@+id/linear_nickname"
android:layout_width="match_parent"
android:layout_height="52dp"
android:paddingLeft="@dimen/dp20">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="昵称"
android:textColor="#ff2d506b"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="37dp"
android:textColor="#ffabb2b7"
android:textSize="@dimen/sp14"
tools:text="Travis" />
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/ic_grey_right_arrow"></ImageView>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/colorCF"></View>
<RelativeLayout
android:id="@+id/linear_sex"
android:layout_width="match_parent"
android:layout_height="52dp"
android:paddingLeft="@dimen/dp20">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="性别"
android:textColor="#ff2d506b"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_sex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="37dp"
android:textColor="#ffabb2b7"
android:textSize="@dimen/sp14"
tools:text="10001" />
<ImageView
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:src="@drawable/ic_grey_right_arrow"></ImageView>
</RelativeLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
<cn.dankal.yunlaboratory.ui.widget.MainButton
android:id="@+id/btn_exit"
android:layout_width="match_parent"
android:layout_height="89dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="40dp"
android:text="退出登陆"
android:enabled="true"
android:gravity="center"
android:layout_marginRight="20dp"></cn.dankal.yunlaboratory.ui.widget.MainButton>
</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="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/ic_scan_background"
android:adjustViewBounds="true"></ImageView>
<TextView
android:id="@+id/tv_hello_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello,Kevin"
android:textColor="@color/white"
android:layout_marginTop="80dp"
android:layout_marginLeft="40dp"
android:textSize="@dimen/sp30"
/>
<androidx.cardview.widget.CardView
android:id="@+id/card_scan"
android:layout_width="match_parent"
android:layout_margin="24dp"
android:layout_height="300dp"
android:layout_below="@id/tv_hello_name"
app:cardCornerRadius="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_width="176dp"
android:layout_height="176dp"
android:src="@drawable/ic_saoyisao"></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="扫一扫二维码"
android:textColor="#ff2d506b"
android:textSize="18sp"
android:layout_marginTop="40dp"
/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@id/dk_title"
android:background="@android:color/white"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_onback"
android:layout_width="49dp"
android:layout_height="49dp"
android:layout_gravity="center_vertical"
android:background="@drawable/view_press_style"
android:padding="16dp"
android:src="@mipmap/ic_back_black"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="49dp"
android:layout_gravity="center"
android:gravity="center"
android:textColor="@android:color/black"
android:textSize="18sp"
tools:text="标题" />
<View
style="@style/divider"
android:layout_marginTop="49dp" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#fff</color>
<color name="colorPrimaryDark">#fff</color>
<color name="colorAccent">#fff</color>
<color name="color14">#141414</color>
<color name="color33">#333333</color>
<color name="colorcf">#CFCFCF</color>
<color name="color99">#999999</color>
<color name="color6fc3ff">#6fc3ff</color>
<color name="colorABB2B7">#ABB2B7</color>
<color name="colorf8">#f8f8f8</color>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="sp16">16sp</dimen>
<dimen name="sp14">14sp</dimen>
<dimen name="dp20">20dp</dimen>
<dimen name="sp30">30sp</dimen>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">云端实验室</string>
</resources>
\ No newline at end of file
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<paths>
<!-- 这个是保存拍照图片的路径,必须配置。 -->
<external-files-path
name="images"
path="Pictures" />
</paths>
</resources>
\ No newline at end of file
package cn.dankal.yunlaboratory;
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
apply plugin: 'com.android.library'
apply plugin: 'com.jakewharton.butterknife'
if (deps.constants.enableKotlin) {
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
}
android {
compileSdkVersion build_versions.compile_sdk
defaultConfig {
minSdkVersion build_versions.min_sdk
targetSdkVersion build_versions.target_sdk
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
//路由
javaCompileOptions.annotationProcessorOptions {
arguments = [moduleName: project.getName()]
}
}
lintOptions {
abortOnError false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
jniLibs.srcDirs = ['libs']
java.srcDirs += 'src/support/java'
res.srcDirs += 'src/support/res'
res.srcDirs += 'src/support/order_res'
res.srcDirs += 'src/support/personal_res'
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
testImplementation deps.test.junit
androidTestImplementation deps.atsl.runner
androidTestImplementation deps.espresso.core
implementation fileTree(include: ['*.jar'], dir: 'libs')
api deps.support.app_compat
api deps.support.annotations
api deps.support.design
api deps.support.v4
api deps.support.cardview
api deps.support.constraint_layout
api deps.rxjava2
api deps.rxAndroid
api deps.rxjavaAdapter
api deps.rxpermissions
api (deps.glide.runtime){
exclude group: "com.android.support"
}
api deps.widgets.photoview
api deps.butterknife.butterknife
// api deps.alibaba.arouter_api
api deps.alibaba.fastjson
api deps.alibaba.converter_fastjson
api deps.retrofit.runtime
api deps.glide.okhttp3
annotationProcessor deps.glide.compiler
annotationProcessor deps.butterknife.butterknife_compiler
annotationProcessor project(':component-compiler')
// annotationProcessor deps.alibaba.arouter_compiler
if (deps.constants.enableKotlin) {
kapt deps.glide.compiler
kapt deps.butterknife.butterknife_compiler
kapt project(':component-compiler')
kapt deps.alibaba.arouter_compiler
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation deps.kotlin.anko
}
// api project(':component-zxing')
api project(':component-annotations')
// api project(':component-easeui')
implementation 'org.aspectj:aspectjrt:1.8.9'
implementation files('libs/happy-dns-0.2.13.jar')
implementation files('libs/qiniu-android-sdk-7.3.12.jar')
// api project(':amaplib')
// api project(':banner')
// 扫码库
api 'com.king.zxing:zxing-lite:1.1.9-androidx'
// api project(':payutil')
// api project(':usharesdk')
// 下拉刷新
api 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'
// recyclerview adapter
api 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.0-beta5'
}
\ No newline at end of file
# 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 cn.dankal.basiclib;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("cn.dankal.basiclib.test", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="cn.dankal.basiclib">
<application android:maxAspectRatio="2.2">
<activity
android:name=".base.activity.BigPhotoActivity"
android:screenOrientation="portrait" />
<!-- <activity android:name="cn.dankal.packagename.wxapi.PayActivity"-->
<!-- android:exported="true"-->
<!-- android:screenOrientation="portrait"/>-->
<!-- <activity android:name="cn.dankal.packagename.wxapi.WXEntryActivity"-->
<!-- android:exported="true"-->
<!-- android:screenOrientation="portrait"/>-->
</application>
</manifest>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
package cn.dankal.basiclib;
public class Constants {
// 游客模式
public static final boolean VISITOR_MODE = true;
// 是否需要提示框去登录 true 提示框 false 直接登录
public static final boolean NEED_TIP_LOHIN = true;
}
package cn.dankal.basiclib;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import cn.dankal.basiclib.common.qiniu.QiniuConfigResponse;
import cn.dankal.basiclib.model.LoginModel;
import cn.dankal.basiclib.model.TokenModel;
import cn.dankal.basiclib.model.UserModel;
import cn.dankal.basiclib.pojo.UserInfoBean;
import cn.dankal.basiclib.pojo.UserResponseBody;
import cn.dankal.basiclib.util.PreferenceUtil;
/**
* @author vane
*/
public class DKUserManager {
private static Context mContext = DankalApplication.getContext();
private static SharedPreferences mSpUserInfo;
private static SharedPreferences mSpToken;
private static final String PreferenceUserInfo = "userinfo";
private static final String PreferenceToken = "token";
private static UserModel userInfo;
private static TokenModel userToken;
private static SharedPreferences mQiniuInfo;
private static final String PreferenceQiniuToken = "qiniu";
private static QiniuConfigResponse qiniuHeader;
static {
mSpUserInfo = mContext.getSharedPreferences(PreferenceUserInfo, Context.MODE_PRIVATE);
mSpToken = mContext.getSharedPreferences(PreferenceToken, Context.MODE_PRIVATE);
}
/**
* 最初mUserInfo各属性内容为空,
* 如登录后可更新当前的UserInfo和本地的缓存
*/
public static void saveUserInfo(LoginModel userResponseBody) {
UserModel userInfo = userResponseBody.getUser();
TokenModel token = userResponseBody.getToken();
if (userInfo != null) {
PreferenceUtil.updateBean(mSpUserInfo, getUserInfo(), userInfo);
}
if (token != null) {
PreferenceUtil.updateBean(mSpToken, getUserToken(), token);
}
}
public static void updateUserInfo(UserModel userInfo) {
if (userInfo != null) {
PreferenceUtil.updateBean(mSpUserInfo, getUserInfo(), userInfo);
}
}
public static void updateUserToken(TokenModel token) {
if (token != null) {
PreferenceUtil.updateBean(mSpToken, getUserToken(), token);
}
}
/**
* 如果从本地缓存中获取对象为空则实例化一个空对象
* 判断是否登录全程通过user_id是不是为0来判断而不是通过
* mUserInfo是否等于null,防止UserManager.getUserInfo出现空指针
*/
private static void readUserInfo() {
userInfo = (UserModel) PreferenceUtil.getBeanValue(mSpUserInfo, UserInfoBean.class);
if (userInfo == null) {
userInfo = new UserModel();
}
}
private static void readUserToken() {
userToken = (TokenModel) PreferenceUtil.getBeanValue(mSpToken,
UserResponseBody.TokenBean.class);
if (userToken == null) {
userToken = new TokenModel();
}
}
/**
* 清空缓存时调用
*/
public static void resetUserInfo() {
SharedPreferences.Editor editor = mSpUserInfo.edit();
editor.clear();
editor.apply();
userInfo = new UserModel();
}
public static void resetToken() {
SharedPreferences.Editor editor = mSpToken.edit();
editor.clear();
editor.apply();
userToken = new TokenModel();
}
/**
* 判断已经登录
*/
public static boolean isLogined() {
return !TextUtils.isEmpty(getUserToken().getAccess_token());
}
public static TokenModel getUserToken() {
if (userToken == null) {
readUserToken();
}
return userToken;
}
public static UserModel getUserInfo() {
if (userInfo == null) {
readUserInfo();
}
return userInfo;
}
private static void readQiniuheader() {
qiniuHeader = (QiniuConfigResponse) PreferenceUtil.getBeanValue(mQiniuInfo, QiniuConfigResponse.class);
if (qiniuHeader == null) {
qiniuHeader = new QiniuConfigResponse();
qiniuHeader.setToken("https://cdn.gdzhongchao.com/");
}
}
public static QiniuConfigResponse getQiniuHeader() {
if (qiniuHeader == null) {
readQiniuheader();
}
return qiniuHeader;
}
public static void updateQiniuHeader(QiniuConfigResponse response) {
if (response != null) {
PreferenceUtil.updateBean(mQiniuInfo, getQiniuHeader(), response);
}
}
}
package cn.dankal.basiclib;
import android.app.Application;
import android.content.Context;
import cn.dankal.basiclib.util.ActivityUtils;
import cn.dankal.basiclib.util.AppUtils;
import cn.dankal.basiclib.util.DensityAdaptationUtils;
import cn.dankal.basiclib.util.StringUtil;
import cn.dankal.basiclib.widget.dialog.TipToLoginDialog;
import cn.dankal.basiclib.widget.loadsir.EmptyCallback;
import cn.dankal.basiclib.widget.loadsir.LoadingCallback;
import cn.dankal.basiclib.widget.loadsir.RetryCallback;
import cn.dankal.basiclib.widget.loadsir.core.LoadSir;
/**
* @author Dankal Android Developer
* @since 2018/5/9
*/
public class DankalApplication extends Application {
//是否是开发环境
public static final boolean isDev = true;
private static DankalApplication context;
private TipToLoginDialog tipToLoginDialog;
@Override
public void onCreate() {
super.onCreate();
context = this;
// initARouter();
// initStetho();
initLoadSir();
//适配方案
DensityAdaptationUtils.setDensity(context, 375);
AppUtils.init(context);
}
/**
* 初始化阿里路由
*/
// private void initARouter() {
// if (BuildConfig.DEBUG) {
// // 打印日志
// ARouter.openLog();
// // 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险)
// ARouter.openDebug();
// }
// ARouter.init(this);
// }
private void initLoadSir() {
LoadSir.beginBuilder()
.addCallback(new RetryCallback())
.addCallback(new EmptyCallback())
.addCallback(new LoadingCallback())
// .setDefaultCallback(LoadingCallback.class)
.commit();
}
public static DankalApplication getContext() {
return context;
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// MultiDex.install(this);
}
private static boolean login;
public static void setLogin(boolean login) {
DankalApplication.login = login;
}
public static boolean isLogin() {
return login || (DKUserManager.getUserInfo() != null
&& StringUtil.isValid(DKUserManager.getUserToken().getAccess_token()));
}
public void tokenInvalidOperate() {
if (Constants.NEED_TIP_LOHIN) {
if (tipToLoginDialog != null) {
tipToLoginDialog.dismiss();
}
if (ActivityUtils.getTopActivity() != null) {
tipToLoginDialog = new TipToLoginDialog(ActivityUtils.getTopActivity());
tipToLoginDialog.show();
} else {
goLogin();
}
} else {
goLogin();
}
}
private void goLogin() {
DKUserManager.resetToken();
DKUserManager.resetUserInfo();
ActivityUtils.finishAllActivities();
// ARouter.getInstance().build(UserProtocol.ACTIVITY_LOGIN).navigation();
}
}
package cn.dankal.basiclib;
import android.content.Context;
import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
import com.bumptech.glide.load.DecodeFormat;
import com.bumptech.glide.load.engine.cache.ExternalPreferredCacheDiskCacheFactory;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.module.AppGlideModule;
import com.bumptech.glide.request.RequestOptions;
import java.io.InputStream;
import cn.dankal.basiclib.api.BaseApi;
/**
* @author vane
* @since 2018/7/20
*/
@GlideModule
public class DkAppGlideModule extends AppGlideModule {
@Override
public void applyOptions(Context context, GlideBuilder glideBuilder) {
/* 定义SD卡缓存大小和位置 */
int diskSize = 1024 * 1024 * 100;
// ExternalCacheDiskCacheFactory
// /sdcard/Android/data/<application package>/cache
glideBuilder.setDiskCache(new ExternalPreferredCacheDiskCacheFactory(context, "glide", diskSize));
/* 定义图片格式 */
glideBuilder.setDefaultRequestOptions(new RequestOptions()
.format(DecodeFormat.PREFER_RGB_565));
}
/**
* 注册源 Model 对应的 ModelLoader
*/
@Override
public void registerComponents(Context context, Glide glide, Registry registry) {
// 注册全局唯一OkHttp客户端(HttpClient初始化的情况)
OkHttpUrlLoader.Factory factory_glideurl;
try {
factory_glideurl = new OkHttpUrlLoader.Factory(BaseApi.getOkhttpInstance());
} catch (Exception e) {
factory_glideurl = new OkHttpUrlLoader.Factory();
}
registry.replace(GlideUrl.class, InputStream.class, factory_glideurl);
// // 注册视频获取缩略图的扩展
// VideoModelLoader.Factory factory_videourl = new VideoModelLoader.Factory();
// registry.replace(VideoUrl.class, InputStream.class, factory_videourl);
}
/**
* 清单解析是否开启 <br>
* 要注意避免重复添加 <br>
*/
@Override
public boolean isManifestParsingEnabled() {
return false;
}
}
package cn.dankal.basiclib.api;
import java.util.LinkedHashMap;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
import cn.dankal.basiclib.domain.HttpLoggingInterceptor;
import cn.dankal.basiclib.domain.TokenInterceptor;
import cn.dankal.basiclib.util.Logger;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.fastjson.FastJsonConverterFactory;
import static cn.dankal.basiclib.DankalApplication.isDev;
/**
* api地址
*
* @author vane
* @since 2018/3/24
*/
public class BaseApi {
public static final String BASE_URL = isDev ? "https://www.baidu.com"
: "https://www.google.com";
private static LinkedHashMap<String, Retrofit> linkedHashMap = new LinkedHashMap<>(3);
private BaseApi() {
}
public static Retrofit getRetrofit() {
if (linkedHashMap.isEmpty() || !linkedHashMap.containsKey(BASE_URL)) {
synchronized (BaseApi.class) {
if (linkedHashMap.isEmpty() || !linkedHashMap.containsKey(BASE_URL)) {
linkedHashMap.put(BASE_URL, new Retrofit.Builder().addConverterFactory(FastJsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.client(getOkhttpInstance())
.baseUrl(BASE_URL)
.build());
}
}
}
return linkedHashMap.get(BASE_URL);
}
public static Retrofit getRetrofit(String baseurl) {
if (linkedHashMap.isEmpty() || !linkedHashMap.containsKey(baseurl)) {
synchronized (BaseApi.class) {
if (linkedHashMap.isEmpty() || !linkedHashMap.containsKey(baseurl)) {
linkedHashMap.put(baseurl, new Retrofit.Builder()
//.addConverterFactory(FastJsonConverterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(getGson()))
.addConverterFactory(FastJsonConverterFactory.create())
.client(getOkhttpInstance())
.baseUrl(baseurl)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.build());
}
}
}
return linkedHashMap.get(baseurl);
}
public static OkHttpClient getOkhttpInstance() {
HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
@Override
public void log(String message) {
Logger.d(message);
}
});
httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient
okHttpClient = new OkHttpClient.Builder().readTimeout(7000, TimeUnit.MILLISECONDS)
.connectTimeout(7000, TimeUnit.MILLISECONDS)
.addInterceptor(new TokenInterceptor())
.addInterceptor(httpLoggingInterceptor)
.hostnameVerifier(new HostnameVerifier() {
/**
* Verify that the host name is an acceptable match with
* the server's authentication scheme.
*
* @param hostname the host name
* @param session SSLSession used on the connection to host
* @return true if the host name is acceptable
*/
//忽略证书
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
})
.build();
return okHttpClient;
}
}
package cn.dankal.basiclib.api;
import java.util.List;
import cn.dankal.annotations.ApiFactory;
import cn.dankal.basiclib.model.BaseModel;
import cn.dankal.basiclib.model.LoginModel;
import cn.dankal.basiclib.model.ProjectModel;
import cn.dankal.basiclib.model.SampleModel;
import cn.dankal.basiclib.model.SubmitRecordModel;
import cn.dankal.basiclib.model.SubmitResultBody;
import cn.dankal.basiclib.model.UserInfoBody;
import cn.dankal.basiclib.model.UserModel;
import io.reactivex.Observable;
import okhttp3.MultipartBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Query;
/**
* Date: 2018/7/27.
* Time: 17:44
* classDescription:
* 用户
* 接口文档地址 https://note.youdao.com/ynoteshare1/index.html?id=ad494beed9f8cb7f21ed68ae1f93d0d6&type=note
*
* @author fred
* @ApiFactory 会将当前类自动生成一个UserServiceFactory 所以在新建其他Service需要加@ApiFactory
*/
@ApiFactory(value = BaseApi.class)
public interface UserService {
/**
* 登录
*/
@POST("login")
@FormUrlEncoded
Observable<BaseModel<LoginModel>> login(@Field("username") String username, @Field("password") String password);
/**
* 取回样本
*/
@GET("sample")
Observable<BaseModel<SampleModel>> sample(@Query("sample_num") String sample_num);
/**
* 取样下一步
*/
@POST("sample/next")
@FormUrlEncoded
Observable<BaseModel<SubmitRecordModel>> sampleNext(@Field("ss_name") String ss_name);
/**
* 获取项目
*/
@GET("project")
Observable<BaseModel<List<ProjectModel>>> getProjectList();
/**
* 获取设备
*/
@GET("device")
Observable<BaseModel<List<ProjectModel>>> getDeviceList();
/**
* 提交报告
* upload_list_id int 是 1 上传列表id
* project_id int 是 1 项目id
* device_id int 是 1 设备仪器id
* content string 是 xxxxx 报告内容
*
* @return
*/
@POST("report")
Observable<BaseModel<String>> submitReport(@Body SubmitResultBody body);
// Observable<BaseModel<String>> submitReport(@Field("upload_list_id") int upload_list_id, @Field("project_id") int project_id, @Field("device_id") int device_id, @Field("content") String content);
/**
* 更新个人信息
* update_type avatar: 更新头像name:更新昵称sex:性别
* name 昵称
* sex 性别 1男2女
* file 头像图片
*
* @return
*/
@Multipart
@PUT("update/info")
Observable<BaseModel<UserModel>> updateInfo(@Part("body") UserInfoBody body, @Part MultipartBody.Part file);
/**
* 退出登录
*
* @return
*/
@GET("app/User/logout")
Observable<String> logout();
}
package cn.dankal.basiclib.base;
/**
* Date: 2018/7/30.
* Time: 14:37
* classDescription:
*
* @author fred
*/
public class BaseResult<T> {
T result;
public T getResult() {
return result;
}
public BaseResult setResult(T result) {
this.result = result;
return this;
}
}
package cn.dankal.basiclib.base;
import cn.dankal.basiclib.base.mvp.BaseView;
/**
* @author vane
* @since 2018/1/30
*/
public interface BaseStateView extends BaseView {
/**
* 需要替换的View
*/
Object contentView();
/**
* 加载重试界面
*/
void showRetry();
/**
* 加载空数据界面
*/
void showEmpty();
/**
* 加载内容界面
*/
void showContent();
/**
* 加载等待进度界面
*/
void showLoading();
}
package cn.dankal.basiclib.base.activity;
import android.app.Activity;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleRegistry;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import butterknife.ButterKnife;
import cn.dankal.basiclib.DankalApplication;
import cn.dankal.basiclib.R;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.basiclib.base.mvp.BaseView;
import cn.dankal.basiclib.base.lifecycle.LifeCycleUtil;
import cn.dankal.basiclib.base.lifecycle.LifecycleTransformer;
import cn.dankal.basiclib.base.lifecycle.MyLifeCycleObserver;
import cn.dankal.basiclib.util.TitleBarUtils;
import cn.dankal.basiclib.util.ToastUtils;
import cn.dankal.basiclib.widget.TipDialog;
import cn.dankal.basiclib.widget.statubar.QMUIStatusBarHelper;
import cn.dankal.basiclib.widget.titlebar.ITitleBar;
import cn.dankal.basiclib.widget.titlebar.SingleTextTitle;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
/**
* @author Dankal Android Developer
* @since 2018/7/3
*/
public abstract class BaseActivity<T extends BasePresenter> extends AppCompatActivity implements BaseView {
protected TipDialog loadingDialog;
private CompositeDisposable mDisposables = new CompositeDisposable();
private LifecycleRegistry lifecycleRegistry;
private MyLifeCycleObserver myLifeCycleObserver;
public T mPresenter;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
lifecycleRegistry = new LifecycleRegistry(this);
myLifeCycleObserver = new MyLifeCycleObserver();
lifecycleRegistry.addObserver(myLifeCycleObserver);
lifecycleRegistry.markState(Lifecycle.State.CREATED);
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_CREATE);
if (getLayoutId() != 0) {
setContentView(getLayoutId());
mPresenter = createPresenter();
if (mPresenter!=null){
mPresenter.attachView(this);
}
//ButterKnife绑定
ButterKnife.bind(this);
initStatusBar();
//初始化组件
initComponents();
obtainData();
}
}
protected void initStatusBar() {
// TitleBarUtils.compat(this, getResources().getColor(R.color.white));
QMUIStatusBarHelper.setStatusBarLightMode(this);
// QMUIStatusBarHelper.translucent(this);
}
public void setTranslucent(Activity context, View view) {
if (view != null) {
// QMUIStatusBarHelper.translucent(this);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
view.setPadding(0, QMUIStatusBarHelper.getStatusbarHeight(context), 0, 0);
}
}
}
public abstract T createPresenter();
/**
* setContentView(LayoutResId)
*
* @return LayoutResId
*/
@LayoutRes
protected abstract int getLayoutId();
/**
* 初始化组件
*/
protected abstract void initComponents();
/**
* 添加标题栏
*/
public void addTitleBar(ITitleBar iTitleBar) {
if (iTitleBar == null) return;
int titleBarResId = iTitleBar.getViewResId();
View toolbarContainer = TitleBarUtils.init(this, titleBarResId);
toolbarContainer.findViewById(R.id.iv_onback)
.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onBackPressed();
}
});
iTitleBar.onBindTitleBar(toolbarContainer);
}
public void addSindleTitleBar(String title) {
addTitleBar(new SingleTextTitle(title));
}
public void obtainData() {
}
@Override
public void showLoadingDialog() {
if (loadingDialog != null) {
loadingDialog.dismiss();
loadingDialog = null;
}
loadingDialog = new TipDialog.Builder(this)
.setIconType(TipDialog.Builder.ICON_TYPE_LOADING)
.setTipWord("正在加载")
.create();
loadingDialog.show();
}
@Override
public void dismissLoadingDialog() {
if (loadingDialog != null && loadingDialog.isShowing()) {
loadingDialog.dismiss();
}
}
@Override
public void showToast(String message) {
try {
ToastUtils.showShort(message);
} catch (Exception ignored) {
}
}
@Override
public void tokenInvalid() {
DankalApplication.getContext().tokenInvalidOperate();
}
@Override
public void addNetworkRequest(Disposable d) {
mDisposables.add(d);
}
@Override
protected void onStart() {
super.onStart();
lifecycleRegistry.markState(Lifecycle.State.STARTED);
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START);
}
@Override
protected void onResume() {
super.onResume();
lifecycleRegistry.markState(Lifecycle.State.RESUMED);
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_RESUME);
}
@Override
protected void onPause() {
super.onPause();
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_PAUSE);
}
@Override
protected void onRestart() {
super.onRestart();
lifecycleRegistry.markState(Lifecycle.State.STARTED);
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_START);
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mPresenter!=null){
mPresenter.detachView();
}
lifecycleRegistry.markState(Lifecycle.State.DESTROYED);
lifecycleRegistry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
if (mDisposables != null) mDisposables.clear();
}
}
package cn.dankal.basiclib.base.activity;
import android.os.Bundle;
import androidx.annotation.CallSuper;
import androidx.annotation.Nullable;
import android.view.View;
import cn.dankal.basiclib.base.BaseStateView;
import cn.dankal.basiclib.widget.loadsir.EmptyCallback;
import cn.dankal.basiclib.widget.loadsir.LoadingCallback;
import cn.dankal.basiclib.widget.loadsir.RetryCallback;
import cn.dankal.basiclib.widget.loadsir.callback.Callback;
import cn.dankal.basiclib.widget.loadsir.core.LoadService;
import cn.dankal.basiclib.widget.loadsir.core.LoadSir;
/**
* description: 具备 加载状态界面 的Activity基类
*
* @author Dankal Android Developer
* @since 2018/1/30
*/
public abstract class BaseStateActivity extends BaseActivity implements BaseStateView {
private LoadService loadService;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (contentView() != null) {
loadService = LoadSir.getDefault().register(contentView(), new Callback.OnReloadListener() {
@Override
public void onReload(View v) {
loadService.showCallback(LoadingCallback.class);
//do retry logic...
//callback
obtainData();
}
});
}
}
@Override
public void showRetry() {
if (loadService == null) return;
loadService.showCallback(RetryCallback.class);
}
@Override
public void showEmpty() {
if (loadService == null) return;
loadService.showCallback(EmptyCallback.class);
}
@Override
public void showContent() {
if (loadService == null) return;
loadService.showSuccess();
}
@Override
public void showLoading() {
if (loadService != null) {
loadService.showCallback(LoadingCallback.class);
}
}
}
package cn.dankal.basiclib.base.activity;
import android.graphics.Bitmap;
import android.view.ViewGroup;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import butterknife.BindView;
import cn.dankal.basiclib.R;
import cn.dankal.basiclib.R2;
import cn.dankal.basiclib.util.StringUtil;
import cn.dankal.basiclib.util.ToastUtils;
import cn.dankal.basiclib.util.WebViewUtil;
public abstract class BaseWebviewActivity extends BaseActivity {
@BindView(R2.id.wb)
public WebView wb;
public WebChromeClient webChromeClient;
@Override
public void initComponents() {
WebViewUtil.initWebViewSettings(wb, this);
webChromeClient = new WebChromeClient();
initData();
}
@Override
protected void onDestroy() {
destoryWebview(wb);
super.onDestroy();
}
protected void destoryWebview(WebView dkWebView) {
if (dkWebView != null) {
ViewGroup parent = (ViewGroup) dkWebView.getParent();
if (parent != null) {
parent.removeView(dkWebView);
}
dkWebView.removeAllViews();
dkWebView.destroy();
}
}
@Override
protected void onPause() {
ToastUtils.cancel();
super.onPause();
}
@Override
protected int getLayoutId() {
return R.layout.activity_base_webview;
}
public void initData() {
wb.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
showLoadingDialog();
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
dismissLoadingDialog();
super.onPageFinished(view, url);
}
});
webChromeClient = new WebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
setTitleFromWebView(title);
}
};
wb.setWebChromeClient(webChromeClient);
if (getUrl() != null) {
wb.loadUrl(getUrl());
}
if (getData() != null) {
WebViewUtil.loadData(wb, getData());
}
}
public String getUrl() {
return null;
}
protected void loadData(String data) {
if (StringUtil.isValid(data)) {
WebViewUtil.loadData(wb, data);
}
}
public String getData() {
return null;
}
public void setTitleFromWebView(String title) {
}
@Override
public void onBackPressed() {
if (wb.canGoBack()) {
wb.goBack();
return;
}
finish();
}
}
package cn.dankal.basiclib.base.activity;
import android.graphics.Bitmap;
import android.net.Uri;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import butterknife.BindView;
import butterknife.ButterKnife;
import cn.dankal.basiclib.R;
import cn.dankal.basiclib.R2;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.basiclib.util.TitleBarUtils;
import uk.co.senab.photoview.PhotoViewAttacher;
import static cn.dankal.basiclib.util.GlideUtils.DEFAULT_AVATAR_ERRORHOLDER_RESID;
import static cn.dankal.basiclib.util.GlideUtils.DEFAULT_AVATAR_PLACEHOLDER_RESID;
public class BigPhotoActivity extends BaseActivity {
public static final String URL = "url";
public static final String URLS = "urls";
public static final String PicIndex = "picindex";
public static boolean hasJump = false;
@BindView(R2.id.progressBar)
ProgressBar progressBar;
@BindView(R2.id.vp)
ViewPager viewPager;
@BindView(R2.id.tv_page_index)
TextView tvPageIndex;
int picIndex;
@Override
public BasePresenter createPresenter() {
return null;
}
@Override
protected int getLayoutId() {
return R.layout.activity_big_photo;
}
@Override
protected void initComponents() {
ButterKnife.bind(this);
TitleBarUtils.compat(this, getResources().getColor(R.color.color00));
hasJump = true;
//多张图片地址
String[] urls = getIntent().getStringArrayExtra(URLS);
picIndex=getIntent().getIntExtra(PicIndex,0);
if (urls==null){
urls=new String[1];
//单张图片地址
String stringExtra = getIntent().getStringExtra(URL);
urls[0]= stringExtra;
//点击网页
Uri data=getIntent().getData();
String imgUrl;
if (data!=null) {
imgUrl = data.getHost();
urls[0]= imgUrl;
}
}
if (urls.length>0) {
initViewPager(urls);
}
}
private ImageView loadImageVIew(String url) {
ImageView imageView =new ImageView(this);
PhotoViewAttacher photoViewAttacher = new PhotoViewAttacher(imageView);
photoViewAttacher.setOnViewTapListener((view, x, y) -> finish());
progressBar.setVisibility(View.VISIBLE);
RequestOptions requestOptions = new RequestOptions();
requestOptions.placeholder(DEFAULT_AVATAR_PLACEHOLDER_RESID);
requestOptions.error(DEFAULT_AVATAR_ERRORHOLDER_RESID);
Glide.with(this).asBitmap().apply(requestOptions).load(url).listener(new RequestListener<Bitmap>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Bitmap> target, boolean isFirstResource) {
progressBar.setVisibility(View.GONE);
return false;
}
@Override
public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target,
DataSource dataSource, boolean isFirstResource) {
progressBar.setVisibility(View.GONE);
photoViewAttacher.update();
return false;
}
}).into(imageView);
return imageView;
}
private void initViewPager(String[] urls) {
int length = urls.length;
SparseArray<ImageView> views=new SparseArray<>();
PagerAdapter pagerAdapter=new PagerAdapter() {
@Override
public int getCount() {
return length;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view==object;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = views.get(position);
if (imageView ==null){
imageView = loadImageVIew(urls[position]);
views.append(position, imageView);
}
container.addView(imageView);
return imageView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
View view = views.get(position);
if (view != null) {
views.removeAt(position);
container.removeView(view);
}
}
public int getItemPosition(Object object) {
return PagerAdapter.POSITION_NONE;
}
};
viewPager.setAdapter(pagerAdapter);
viewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
@Override
public void onPageSelected(int position) {
setPageIndex(position,length);
}
});
viewPager.setCurrentItem(picIndex);
if (urls.length>1){
setPageIndex(picIndex,length);
}
}
private void setPageIndex(int position,int length) {
tvPageIndex.setText((position+1)+"/"+length);
}
@Override
protected void onDestroy() {
hasJump = false;
super.onDestroy();
}
}
package cn.dankal.basiclib.base.callback;
/**
* Created by fred
* Date: 2017/11/29.
* Time: 15:46
* classDescription: 用于异步回调
*/
public interface DKCallBack {
void action();
}
package cn.dankal.basiclib.base.callback;
/**
* 具备判断条件的回调
*/
public interface DKCallBackBoolean {
int YES=1;
int NO=0;
void action(int type);
}
\ No newline at end of file
package cn.dankal.basiclib.base.callback;
/**
* 具备判断条件的回调
*/
public interface DKCallBackBooleanObject<T> {
int YES=1;
int NO=0;
void action(int type,T t);
}
\ 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.
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