项目和apk

master
shiyao 3 years ago
parent a8bdc1609d
commit ba2e3c0cfc

@ -0,0 +1,15 @@
*.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
local.properties

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

@ -0,0 +1,20 @@
<?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="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,50 @@
<?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="maven3" />
<option name="name" value="maven3" />
<option name="url" value="https://oss.sonatype.org/content/repositories/snapshots" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</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="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.fabric.io/public" />
</remote-repository>
<remote-repository>
<option name="id" value="maven4" />
<option name="name" value="maven4" />
<option name="url" value="https://developer.huawei.com/repo/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://jitpack.io" />
</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>
</component>
</project>

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.215625" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/drawable/btn_red_bg_4.xml" value="0.215625" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/drawable/corners_item_shape_white_202000.xml" value="0.215625" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/drawable/corners_org_item_shape.xml" value="0.215625" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/drawable/corners_org_item_with.xml" value="0.215625" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/drawable/ic_launcher_background.xml" value="0.215625" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/drawable/main_rbtn_textcolor.xml" value="0.215625" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/drawable/rounded_button.xml" value="0.215625" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/layout/activity_add_table.xml" value="0.1068840579710145" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/layout/activity_login.xml" value="0.1068840579710145" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/layout/base_activity_layout.xml" value="0.1068840579710145" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/layout/table_item_layout.xml" value="0.1068840579710145" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/layout/tip_dialog_layout.xml" value="0.1068840579710145" />
<entry key="..\:/Users/15240/Desktop/assistance/assistance/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.215625" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1,71 @@
plugins {
id 'com.android.application'
}
//apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.stu.assistant"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0.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
}
signingConfigs {
release {
storeFile file('I:\\code\\OtherAPP\\ScanCode\\standard.jks')
storePassword 'cpscapp'
keyAlias 'app'
keyPassword 'cpscapp'
}
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
// implementation 'com.android.support:multidex:1.0.2'
// implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.contrarywind:Android-PickerView:4.1.6'//
implementation 'com.androidkun:XTabLayout:1.1.3'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.lzy.net:okgo:3.0.4'
implementation 'com.lzy.net:okrx2:2.0.2'
implementation 'com.tencent.bugly:crashreport:latest.release'
implementation 'com.yanyusong.y_divideritemdecoration:y_divideritemdecoration:2.0'
// annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
// implementation 'com.jakewharton:butterknife:10.2.1'
implementation 'io.github.bmob:android-sdk:3.8.11'
implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
implementation 'com.squareup.okio:okio:2.2.2'
implementation 'com.google.code.gson:gson:2.8.5'
}

@ -0,0 +1,21 @@
# 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

@ -0,0 +1,26 @@
package com.stu.assistant;
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("com.stf.scancode", appContext.getPackageName());
}
}

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.stu.assistant">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许联网 -->
<uses-permission android:name="android.permission.INTERNET" /> <!-- 获取GSM2g、WCDMA联通3g等网络状态的信息 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 获取wifi网络状态的信息 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 保持CPU 运转,屏幕和键盘灯有可能是关闭的,用于文件上传和下载 -->
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- 获取sd卡写的权限用于文件上传和下载 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 允许读取手机状态 用于创建BmobInstallation -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission
android:name="android.permission.READ_LOGS"
tools:ignore="ProtectedPermissions" />
<application
android:name=".base.BaseApplion"
android:allowBackup="true"
android:icon="@mipmap/ic_logo"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:resizeableActivity="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.ScanCode">
<activity android:name=".activity.AddTableDialogActivity"/>
<activity android:name=".activity.TaskListActivity"/>
<activity android:name=".activity.AddTaskActivity"/>
<activity android:name=".activity.AddTableActivity" />
<activity android:name=".activity.SettingActivity"/>
<activity android:name=".activity.TableListActivity"/>
<activity android:name=".activity.MainActivity"/>
<activity android:name=".activity.LoginActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.RegisterActivity"/>
<provider
android:name="cn.bmob.v3.util.BmobContentProvider"
android:authorities="${applicationId}.BmobContentProvider" />
</application>
</manifest>

@ -0,0 +1,333 @@
package com.stu.assistant.activity;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.SaveListener;
import android.content.Intent;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.stu.assistant.R;
import com.stu.assistant.adapter.TableListAdapter;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.AllTableListBean;
import com.stu.assistant.bean.TableBean;
import com.stu.assistant.constants.ConstansTableItemManager;
import com.stu.assistant.uitls.CalendarUtil;
import com.stu.assistant.uitls.DividerItemDecoration0Util;
import com.stu.assistant.uitls.LogUtils;
import com.stu.assistant.uitls.MyToast;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedNoClearUtil;
import com.stu.assistant.uitls.SharedUtil;
import com.stu.assistant.view.MySwipeRefreshLayout;
import java.util.ArrayList;
import java.util.List;
//添加课程表的页面
public class AddTableActivity extends BaseActivity {
private RecyclerView mrv;
private TableListAdapter adapter;
private MySwipeRefreshLayout swip;
private Handler handler;
private ArrayList<TableBean> mList1;
private ArrayList<TableBean> mList2;
private ArrayList<TableBean> mList3;
private ArrayList<TableBean> mList4;
private ArrayList<TableBean> mList5;
private TextView okBtn;
private AllTableListBean bean;
private int index = -1;//是否存在课程表id 的下标
private LinearLayout backLay, lay;
private TextView titleTv;
private String tableIdMsg;
@Override
protected int getLayoutId() {
return R.layout.activity_add_table;
}
@Override
protected void initView() {
Intent intent = getIntent();
bean = (AllTableListBean) intent.getSerializableExtra("bean");
swip = findViewById(R.id.swip_rf);
mrv = findViewById(R.id.mrv);
okBtn = findViewById(R.id.other_tv);
titleTv = findViewById(R.id.title_tv);
backLay = findViewById(R.id.back_lay);
lay = findViewById(R.id.lay);
handler = new Handler();
if (bean == null) {
titleTv.setText("新建课表");
tableIdMsg = CalendarUtil.getInstance().getYMDHMSLine();
} else {
titleTv.setText("课表详情");
tableIdMsg = bean.getTableIdMsg();
}
}
@Override
protected void initData() {
LinearLayoutManager manager = new LinearLayoutManager(this);
manager.setOrientation(LinearLayoutManager.VERTICAL);
mrv.addItemDecoration(new DividerItemDecoration0Util(this, false));
mrv.setLayoutManager(manager);
String string = SharedNoClearUtil.create(BaseApplion.application).getString(SharedConfig.isBg, SharedConfig.isBg_1);
if (string.equals(SharedConfig.isBg_1)) {
lay.setBackgroundResource(R.mipmap.ic_bg_1);
}
if (string.equals(SharedConfig.isBg_2)) {
lay.setBackgroundResource(R.mipmap.ic_bg_2);
}
if (string.equals(SharedConfig.isBg_3)) {
lay.setBackgroundResource(R.mipmap.ic_bg_3);
}
if (string.equals(SharedConfig.isBg_4)) {
lay.setBackgroundResource(R.mipmap.ic_bg_4);
}
getData();
}
@Override
protected void initListener() {
// 刷新数据
swip.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// 这里的作用是防止下拉刷新的时候还可以上拉加载
getData();
}
});
okBtn.setOnClickListener(new View.OnClickListener() {
private String tableIdMsg;
@Override
public void onClick(View view) {
saveData(2);
}
});
backLay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showBackDialog();
}
});
}
//保存数据
private void saveData(int num) {
ArrayList<TableBean> allList = new ArrayList<>();
allList.addAll(mList1);
allList.addAll(mList2);
allList.addAll(mList3);
allList.addAll(mList4);
allList.addAll(mList5);
for (int i = 0; i < allList.size(); i++) {
String tableIdMsg = allList.get(i).getTableIdMsg();
if (!TextUtils.isEmpty(tableIdMsg)) {
index = i;
break;
}
}
if (num == 2) {
if (index == -1) {
MyToast.show("请添加课程");
return;
}
} else {
if (index == -1) {
finish();
return;
}
}
if (index != -1) {
String tableIdMsg = allList.get(index).getTableIdMsg();
showProDialog("正在提交");
AllTableListBean allTableListBean = new AllTableListBean();
allTableListBean.setTableIdMsg(tableIdMsg);
allTableListBean.setStuId(SharedUtil.create(BaseApplion.application).getString(SharedConfig.objectId));
allTableListBean.save(new SaveListener<String>() {
@Override
public void done(String s, BmobException e) {
dismissProDialog();
if (e == null) {
MyToast.show("成功");
setResult(12);
finish();
} else {
MyToast.show("失败:" + e.getMessage() + "," + e.getErrorCode());
}
}
});
}
}
private void getData() {
getNewData();//初始化课程表数据
if (bean == null) {//新建
setAdapter(mList1, mList2, mList3, mList4, mList5);
} else {//查看详情
showProDialog("正在查询");
BmobQuery<TableBean> query = new BmobQuery<>();
query.addWhereEqualTo("tableIdMsg", bean.getTableIdMsg());
query.findObjects(new FindListener<TableBean>() {
@Override
public void done(List<TableBean> list, BmobException e) {
LogUtils.i("list", "-stuId-findObjects-->" + new Gson().toJson(list));
dismissProDialog();
if (list == null) {
MyToast.show("暂无数据");
} else {
optList(list);
}
}
});
}
}
//初始化数据
private void getNewData() {
mList1 = new ArrayList<>();
mList2 = new ArrayList<>();
mList3 = new ArrayList<>();
mList4 = new ArrayList<>();
mList5 = new ArrayList<>();
TableBean tableBean = new TableBean();
tableBean.setTableNameMsg("");
tableBean.setTeacherName("");
tableBean.setAddress("");
tableBean.setTeacherId("");
for (int i = 0; i < 8; i++) {
mList1.add(tableBean);
mList2.add(tableBean);
mList3.add(tableBean);
mList4.add(tableBean);
mList5.add(tableBean);
}
}
// 拼装成课程表需要的格式
private void optList(List<TableBean> list) {
for (int i = 0; i < list.size(); i++) {
TableBean bean = list.get(i);
if (bean.getDay() == ConstansTableItemManager.item_1) {
mList1.set(bean.getPos(), bean);
}
if (bean.getDay() == ConstansTableItemManager.item_2) {
mList2.set(bean.getPos(), bean);
}
if (bean.getDay() == ConstansTableItemManager.item_3) {
mList3.set(bean.getPos(), bean);
}
if (bean.getDay() == ConstansTableItemManager.item_4) {
mList4.set(bean.getPos(), bean);
}
if (bean.getDay() == ConstansTableItemManager.item_5) {
mList5.set(bean.getPos(), bean);
}
}
setAdapter((ArrayList<TableBean>) mList1, (ArrayList<TableBean>) mList2, (ArrayList<TableBean>) mList3, (ArrayList<TableBean>) mList4, (ArrayList<TableBean>) mList5);
}
public void setAdapter(ArrayList<TableBean> mList1, ArrayList<TableBean> mList2, ArrayList<TableBean> mList3, ArrayList<TableBean> mList4, ArrayList<TableBean> mList5) {
if (adapter == null) {
adapter = new TableListAdapter(this);
adapter.setList(mList1, mList2, mList3, mList4, mList5);
mrv.setAdapter(adapter);
adapter.setOnItemClickListeners(new TableListAdapter.OnItemClickListeners() {
@Override
public void itemBean(int pos, TableBean tableBean, int day) {
tableBean.setDay(day);
tableBean.setPos(pos);
Intent intent = new Intent(AddTableActivity.this, AddTableDialogActivity.class);
if (bean == null) {//新增 是相对课程表说的
intent.putExtra("title", "1");
} else {//编辑
intent.putExtra("title", "2");
}
if (TextUtils.isEmpty(tableBean.getTableNameMsg())) {//新增 相当于 item说的
intent.putExtra("item", "1");
} else {//编辑
intent.putExtra("item", "2");
}
tableBean.setTableIdMsg(tableIdMsg);
intent.putExtra("bean", tableBean);
startActivityForResult(intent, 202);
}
});
} else {
adapter.setList(mList1, mList2, mList3, mList4, mList5);
adapter.notifyDataSetChanged();
handler.postDelayed(new Runnable() {
@Override
public void run() {
swip.setRefreshing(false);
}
}, 1000);
}
}
@Override
public void onBackPressed() {
showBackDialog();
}
private void showBackDialog() {
if (bean != null) {
finish();
return;
}
saveData(1);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 202) {
if (resultCode == 12) {
TableBean bean = (TableBean) data.getSerializableExtra("bean");
int day = bean.getDay();
int pos = bean.getPos();
if (day == ConstansTableItemManager.item_1) {
mList1.set(pos, bean);
}
if (day == ConstansTableItemManager.item_2) {
mList2.set(pos, bean);
}
if (day == ConstansTableItemManager.item_3) {
mList3.set(pos, bean);
}
if (day == ConstansTableItemManager.item_4) {
mList4.set(pos, bean);
}
if (day == ConstansTableItemManager.item_5) {
mList5.set(pos, bean);
}
setAdapter(mList1, mList2, mList3, mList4, mList5);
}
}
}
}

@ -0,0 +1,218 @@
package com.stu.assistant.activity;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import com.google.gson.Gson;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.TableBean;
import com.stu.assistant.bean.TableTimeBean;
import com.stu.assistant.bean.UserInfoBean;
import com.stu.assistant.constants.ConstansUserManager;
import com.stu.assistant.uitls.CalendarUtil;
import com.stu.assistant.uitls.MyToast;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import java.sql.Array;
import java.util.ArrayList;
import java.util.List;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.UpdateListener;
//添加具体的节课的页面
public class AddTableDialogActivity extends BaseActivity {
private EditText tableNameEdit;
private EditText addressEdit, markEdit;
private Spinner spinner, spinnerDay, teacherNameSpinner;
private TableBean bean;
private ArrayList<UserInfoBean> teacherList;
private TextView btn;
private String item = "1";
@Override
protected int getLayoutId() {
return R.layout.activity_add_table_dialog;
}
@Override
protected void initView() {
Intent intent = getIntent();
String title = intent.getStringExtra("title");
item = intent.getStringExtra("item");
String titleMsg = "";
bean = (TableBean) intent.getSerializableExtra("bean");
if (title.equals("1")) {
titleMsg = "新增课程";
} else {
titleMsg = "编辑课程";
}
setTitleLay(R.id.title_tv, R.id.back_lay, titleMsg);
setTextMsg(R.id.OnPushClick, titleMsg);
tableNameEdit = findViewById(R.id.edit_table_name);
teacherNameSpinner = findViewById(R.id.edit_teacherName);
addressEdit = findViewById(R.id.edit_address);
markEdit = findViewById(R.id.edit_mark);
spinner = findViewById(R.id.spinner_time);
spinnerDay = findViewById(R.id.spinner_day);
btn = findViewById(R.id.OnPushClick);
spinner.setEnabled(false);
spinnerDay.setEnabled(false);
}
@Override
protected void initData() {
spinnerDay.setSelection(bean.getDay());
spinner.setSelection(bean.getPos() + 1);
if (!TextUtils.isEmpty(bean.getAddress())) {
addressEdit.setText(bean.getAddress());
}
if (!TextUtils.isEmpty(bean.getTableNameMsg())) {
tableNameEdit.setText(bean.getTableNameMsg());
}
if (!TextUtils.isEmpty(bean.getMark())) {
markEdit.setText(bean.getMark());
}
showProDialog("正在查询老师信息");
BmobQuery<UserInfoBean> query = new BmobQuery<>();
query.addWhereEqualTo("userLevel", ConstansUserManager.Level_3);
query.order("-createdAt")
.findObjects(new FindListener<UserInfoBean>() {
@Override
public void done(List<UserInfoBean> list, BmobException e) {
dismissProDialog();
teacherList = (ArrayList<UserInfoBean>) list;
setSpinner(teacherList);
}
});
}
private void setSpinner(ArrayList<UserInfoBean> list) {
UserInfoBean userInfoBean = new UserInfoBean();
userInfoBean.setUsername("请选择老师");
list.add(0, userInfoBean);
String[] mItems = new String[list.size()];
for (int i = 0; i < list.size(); i++) {
mItems[i] = list.get(i).getUsername();
}
ArrayAdapter<String> _Adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mItems);
teacherNameSpinner.setAdapter(_Adapter);
//默认选择带过来的老师信息
if (!TextUtils.isEmpty(bean.getTeacherId())) {
for (int i = 0; i < list.size(); i++) {
String objectId = list.get(i).getObjectId();
if (!TextUtils.isEmpty(objectId)) {
if (objectId.equals(bean.getTeacherId())) {
teacherNameSpinner.setSelection(i);
break;
}
}
}
}
}
@Override
protected void initListener() {
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String tableNameMsg = tableNameEdit.getText().toString();
String addressMsg = addressEdit.getText().toString();
String markMsg = markEdit.getText().toString();
int teacherName = teacherNameSpinner.getSelectedItemPosition();
int selectedItemPosition = spinner.getSelectedItemPosition();
int selectedItemPosition1 = spinnerDay.getSelectedItemPosition();
if (teacherList == null) {
MyToast.show("请重新加载老师信息");
return;
}
if (TextUtils.isEmpty(tableNameMsg)) {
MyToast.show(tableNameEdit.getHint().toString());
return;
}
if (TextUtils.isEmpty(addressMsg)) {
MyToast.show(addressEdit.getHint().toString());
return;
}
if (teacherName == 0) {
MyToast.show("请选择老师");
return;
}
if (selectedItemPosition == 0) {
MyToast.show("请选择周数");
return;
}
if (selectedItemPosition1 == 0) {
MyToast.show("请选择节次");
return;
}
bean.setTeacherId(teacherList.get(teacherName).getObjectId());
bean.setTeacherName(teacherList.get(teacherName).getUsername());
bean.setAddress(addressMsg);
bean.setTableNameMsg(tableNameMsg);
bean.setStuId(SharedUtil.create(BaseApplion.application).getString(SharedConfig.objectId));
bean.setMark(markMsg);
// Log.i("hx","--item-->"+item);
// Log.i("hx","--bean-->"+new Gson().toJson(bean));
if (TextUtils.isEmpty(item) || item.equals("1")) {//直接返回一块更新
showProDialog("正在保存");
bean.save(new SaveListener<String>() {
@Override
public void done(String s, BmobException e) {
dismissProDialog();
if (e == null) {
Intent intent = new Intent();
bean.setObjectId(s);
intent.putExtra("bean", bean);
setResult(12, intent);
finish();
} else {
MyToast.show("保存失败" + e.getMessage());
}
}
});
} else {//单独更新
showProDialog("正在更新");
bean.update(bean.getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
dismissProDialog();
if (e == null) {
Intent intent = new Intent();
intent.putExtra("bean", bean);
setResult(12, intent);
finish();
} else {
MyToast.show("失败" + e.getMessage());
}
}
});
}
}
});
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}

@ -0,0 +1,158 @@
package com.stu.assistant.activity;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.google.gson.Gson;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.TaskBean;
import com.stu.assistant.dialog.DiaogUtil;
import com.stu.assistant.uitls.MyToast;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;
import cn.bmob.v3.listener.UpdateListener;
//添加作业页面
public class AddTaskActivity extends BaseActivity {
private EditText taskNameEdit;
private EditText msgEdit;
private TaskBean bean;
private TextView btn, timeTv;
@Override
protected int getLayoutId() {
return R.layout.activity_add_task_dialog;
}
@Override
protected void initView() {
Intent intent = getIntent();
String title = intent.getStringExtra("title");
String titleMsg = "";
bean = (TaskBean) intent.getSerializableExtra("bean");
if (bean == null) {
titleMsg = "新增作业";
} else {
titleMsg = "编辑作业";
}
setTitleLay(R.id.title_tv, R.id.back_lay, titleMsg);
setTextMsg(R.id.OnPushClick, titleMsg);
taskNameEdit = findViewById(R.id.edit_task_name);
msgEdit = findViewById(R.id.edit_msg);
timeTv = findViewById(R.id.tv_time);
btn = findViewById(R.id.OnPushClick);
}
@Override
protected void initData() {
if (bean != null) {
if (!TextUtils.isEmpty(bean.getTaskMsg())) {
msgEdit.setText(bean.getTaskMsg());
}
if (!TextUtils.isEmpty(bean.getTableNameMsg())) {
taskNameEdit.setText(bean.getTableNameMsg());
}
if (!TextUtils.isEmpty(bean.getTime())) {
timeTv.setText(bean.getTime());
}
}
}
@Override
protected void initListener() {
timeTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DiaogUtil.showSelectTimeDialog(AddTaskActivity.this, new DiaogUtil.OnSelectLisenter() {
@Override
public void OnOkBtn(String time) {
timeTv.setText(time);
}
});
}
});
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String tableNameMsg = taskNameEdit.getText().toString();
String taskMsg = msgEdit.getText().toString();
String timeMsg = timeTv.getText().toString();
if (TextUtils.isEmpty(tableNameMsg)) {
MyToast.show(taskNameEdit.getHint().toString());
return;
}
if (TextUtils.isEmpty(timeMsg)) {
MyToast.show(timeTv.getHint().toString());
return;
}
if (TextUtils.isEmpty(taskMsg)) {
MyToast.show(msgEdit.getHint().toString());
return;
}
if (bean == null) {//直接返回一块更新
TaskBean bean = new TaskBean();
bean.setTaskMsg(taskMsg);
bean.setTime(timeMsg);
bean.setTableNameMsg(tableNameMsg);
bean.setStuId(SharedUtil.create(BaseApplion.application).getString(SharedConfig.objectId));
Log.i("hx", "--bean-->" + new Gson().toJson(bean));
showProDialog("正在保存");
bean.save(new SaveListener<String>() {
@Override
public void done(String s, BmobException e) {
dismissProDialog();
if (e == null) {
Intent intent = new Intent();
bean.setObjectId(s);
intent.putExtra("bean", bean);
setResult(12, intent);
finish();
} else {
MyToast.show("保存失败" + e.getMessage());
}
}
});
} else {//单独更新
showProDialog("正在更新");
bean.setTaskMsg(taskMsg);
bean.setTime(timeMsg);
bean.setTableNameMsg(tableNameMsg);
bean.setStuId(SharedUtil.create(BaseApplion.application).getString(SharedConfig.objectId));
Log.i("hx", "--bean-->" + new Gson().toJson(bean));
bean.update(bean.getObjectId(), new UpdateListener() {
@Override
public void done(BmobException e) {
dismissProDialog();
if (e == null) {
Intent intent = new Intent();
intent.putExtra("bean", bean);
setResult(12, intent);
finish();
} else {
MyToast.show("失败" + e.getMessage());
}
}
});
}
}
});
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}

@ -0,0 +1,111 @@
package com.stu.assistant.activity;
import android.content.Intent;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.UserInfoBean;
import com.stu.assistant.presenter.LoginPresenter;
import com.stu.assistant.uitls.AppTools;
import com.stu.assistant.uitls.ChenJingEditUil;
import com.stu.assistant.uitls.MyToast;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import androidx.annotation.Nullable;
import cn.bmob.v3.BmobUser;
//登录页面
public class LoginActivity extends BaseActivity {
private EditText usertNameEdit;
private EditText usertPasswordEdit;
private LoginPresenter loginPresenter;
private TextView loginBtn, versionNameTv;
@Override
protected int getLayoutId() {
return R.layout.activity_login;
}
@Override
protected void initView() {
ChenJingEditUil.assistActivity(this);
usertNameEdit = findViewById(R.id.tv_username);
usertPasswordEdit = findViewById(R.id.tv_userpassword);
loginBtn = findViewById(R.id.button_login);
versionNameTv = findViewById(R.id.version_name);
loginPresenter = new LoginPresenter(this);
}
@Override
protected void initData() {
versionNameTv.setText(AppTools.getVersionName(this));
}
@Override
protected void initListener() {
boolean aBoolean = SharedUtil.create(BaseApplion.application).getBoolean(SharedConfig.isLogin, false);
if (aBoolean) {
if (BmobUser.isLogin()) {
UserInfoBean user = BmobUser.getCurrentUser(UserInfoBean.class);
loginPresenter.saveUser(user);
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
} else {
login();
}
} else {
login();
}
}
private void login() {
loginBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
loginPresenter.loginIn(usertNameEdit.getText().toString(), usertPasswordEdit.getText().toString(), new LoginPresenter.OnLoginResultListener() {
@Override
public void isSucLogin(UserInfoBean bean) {
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
@Override
public void errorMsg(String msg) {
MyToast.show(msg);
}
});
}
});
}
public void OnRegister(View view) {
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
intent.putExtra("type", "1");
startActivityForResult(intent, 99);
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 99) {
if (resultCode == 2) {
UserInfoBean userBean = (UserInfoBean) data.getSerializableExtra("userBean");
usertNameEdit.setText(userBean.getUsername());
usertPasswordEdit.setText("");
}
}
}
}

@ -0,0 +1,102 @@
package com.stu.assistant.activity;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.LinearLayout;
import com.stu.assistant.R;
import com.stu.assistant.adapter.HomeGvAdapter;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.MainModuleBean;
import com.stu.assistant.constants.ConstansItemManager;
import com.stu.assistant.presenter.MainPresenter;
import com.stu.assistant.uitls.MyToast;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import androidx.annotation.Nullable;
//主页面
public class MainActivity extends BaseActivity {
private LinearLayout lay;
private GridView gridView;
private MainPresenter mainPresenter;
@Override
protected int getLayoutId() {
return R.layout.activity_main;
}
@Override
protected void initView() {
setTitleLay(R.id.title_tv, R.id.back_lay, "学习助手");
findViewById(R.id.back_lay).setVisibility(View.INVISIBLE);
gridView = findViewById(R.id.main_gridview);
lay = findViewById(R.id.lay);
}
@Override
protected void initData() {
mainPresenter = new MainPresenter();
}
@Override
protected void initListener() {
HomeGvAdapter homeGvAdapter = new HomeGvAdapter(this, mainPresenter.getData());
gridView.setAdapter(homeGvAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int i, long l) {
MainModuleBean moduleBean = ((MainModuleBean) parent.getAdapter().getItem(i));
int itemFlag = moduleBean.getItemFlag();
switch (itemFlag) {
case ConstansItemManager.item_1:
Intent intent1 = new Intent(mContext, TableListActivity.class);
intent1.putExtra("userLevel", SharedUtil.create(BaseApplion.application).getString(SharedConfig.userLevel));
intent1.putExtra("title", "课表");
intent1.putExtra("itemType", itemFlag);
startActivityForResult(intent1, 201);//查看课表
break;
case ConstansItemManager.item_2:
Intent intent = new Intent(mContext, TaskListActivity.class);
intent.putExtra("userLevel", SharedUtil.create(BaseApplion.application).getString(SharedConfig.userLevel));
intent.putExtra("title", "作业");
intent.putExtra("itemType", itemFlag);
startActivityForResult(intent, 202);//查看课表
break;
case ConstansItemManager.item_3:
Intent intent3 = new Intent(mContext, SettingActivity.class);
startActivity(intent3);//设置
finish();
break;
default:
break;
}
}
});
}
// 两次点击按钮之间的点击间隔不能少于1000毫秒
private static final int MIN_CLICK_DELAY_TIME = 2000;
private static long lastClickTime;
public void outApp() {
long curClickTime = System.currentTimeMillis();
if ((curClickTime - lastClickTime) >= MIN_CLICK_DELAY_TIME) {
MyToast.show("再按一次退出");
lastClickTime = curClickTime;
} else {
BaseApplion.getActivityManage().finishAll();
}
}
@Override
public void onBackPressed() {
outApp();
}
}

@ -0,0 +1,75 @@
package com.stu.assistant.activity;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.bean.UserInfoBean;
import com.stu.assistant.constants.ConstansUserManager;
import com.stu.assistant.presenter.RegisterPresenter;
import com.stu.assistant.uitls.MyToast;
//账号注册学生,老师信息 数据库中写死的
public class RegisterActivity extends BaseActivity {
private EditText userNameEdit, passwordEdit;
private RegisterPresenter presenter;
@Override
protected int getLayoutId() {
return R.layout.activity_register;
}
@Override
protected void initView() {
setTitleLay(R.id.title_tv, R.id.back_lay, "注册");
setTextMsg(R.id.btn_register,"注册");
userNameEdit = findViewById(R.id.tv_username);
passwordEdit = findViewById(R.id.tv_userpassword);
}
@Override
protected void initData() {
presenter = new RegisterPresenter(this);
}
@Override
protected void initListener() {
}
public void btnRegisterOnClick(View view) {
String userName = userNameEdit.getText().toString();
String password = passwordEdit.getText().toString();
if (TextUtils.isEmpty(userName)) {
MyToast.show(userNameEdit.getHint().toString());
return;
}
if (TextUtils.isEmpty(password)) {
MyToast.show(passwordEdit.getHint().toString());
return;
}
UserInfoBean userBean = new UserInfoBean();
userBean.setUsername(userName);
userBean.setPassword(password);
userBean.setUserLevel(ConstansUserManager.Level_4);
userBean.setUserType(ConstansUserManager.UserType_2);
presenter.registerUser(userBean, new RegisterPresenter.OnRegisterListener() {
@Override
public void registerListener(UserInfoBean userInfoBean) {
Intent intent = new Intent();
intent.putExtra("userBean", userBean);
setResult(2, intent);
finish();
}
});
}
}

@ -0,0 +1,95 @@
package com.stu.assistant.activity;
import android.content.Intent;
import android.content.res.Resources;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.dialog.DiaogUtil;
import com.stu.assistant.dialog.PopWindowUtils;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import cn.bmob.v3.BmobUser;
//设置页面
public class SettingActivity extends BaseActivity {
private TextView accountTv, titleTv;
private LinearLayout lay, backLay;
@Override
protected int getLayoutId() {
return R.layout.activity_setting;
}
@Override
protected void initView() {
accountTv = findViewById(R.id.tv_account);
titleTv = findViewById(R.id.title_tv);
titleTv.setText("设置");
backLay = findViewById(R.id.back_lay);
lay = findViewById(R.id.lay);
}
@Override
protected void initData() {
accountTv.setText("登录账号:" + SharedUtil.create(SettingActivity.this).getString(SharedConfig.loginName));
}
@Override
protected void initListener() {
backLay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(SettingActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
});
}
public void BtnOutOnClick(View view) {
BaseApplion.getActivityManage().finishAll();
SharedUtil.create(BaseApplion.application).clear();
BmobUser.logOut();
}
@Override
public void onBackPressed() {
Intent intent = new Intent(SettingActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
public void OnColorClick(View view) {
DiaogUtil.showSelectColorDialog(SettingActivity.this, lay, "", new DiaogUtil.OnNickNameLisenter() {
@Override
public void OnOkBtn(String msg, PopWindowUtils popWindow) {
//自己跳转自己 ,关掉动画 无感处理
Intent mIntent = getIntent();
finish();
//关掉栈中其他的activity ,但主页的不能关掉
BaseApplion.getActivityManage().finishAct();
overridePendingTransition(0, 0);
startActivity(mIntent);
}
});
}
public void OnBgClick(View view) {
DiaogUtil.showSelectBgDialog(SettingActivity.this, lay, new DiaogUtil.OnNickNameLisenter() {
@Override
public void OnOkBtn(String msg, PopWindowUtils popWindow) {
Intent intent = new Intent(SettingActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
});
}
}

@ -0,0 +1,144 @@
package com.stu.assistant.activity;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
import android.content.Intent;
import android.os.Handler;
import android.view.View;
import android.widget.Toast;
import com.google.gson.Gson;
import com.stu.assistant.R;
import com.stu.assistant.adapter.TableAllListAdapter;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.AllTableListBean;
import com.stu.assistant.uitls.DividerItemDecorationUtil;
import com.stu.assistant.uitls.LogUtils;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import com.stu.assistant.view.MySwipeRefreshLayout;
import java.util.ArrayList;
import java.util.List;
//课程列表
public class TableListActivity extends BaseActivity {
private RecyclerView mrv;
private TableAllListAdapter adapter;
private MySwipeRefreshLayout swip;
private Handler handler;
private String userLevel, title;
private int itemType;
@Override
protected int getLayoutId() {
return R.layout.activity_table_list;
}
@Override
protected void initView() {
swip = findViewById(R.id.swip_rf);
mrv = findViewById(R.id.mrv);
handler = new Handler();
}
@Override
protected void initData() {
LinearLayoutManager manager = new LinearLayoutManager(this);
manager.setOrientation(LinearLayoutManager.VERTICAL);
mrv.addItemDecoration(new DividerItemDecorationUtil(this, false));
mrv.setLayoutManager(manager);
Intent intent = getIntent();
userLevel = intent.getStringExtra("userLevel");
title = intent.getStringExtra("title");
itemType = intent.getIntExtra("itemType", 0);
setTitleLay(R.id.title_tv, R.id.back_lay, title);
setTextMsg(R.id.btn_register, "添加" + title);
getData();
}
@Override
protected void initListener() {
// 刷新数据
swip.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// 这里的作用是防止下拉刷新的时候还可以上拉加载
getData();
}
});
}
private void getData() {
showProDialog("正在查询");
BmobQuery<AllTableListBean> query = new BmobQuery<>();
query.addWhereEqualTo("stuId", SharedUtil.create(BaseApplion.application).getString(SharedConfig.objectId));
query.findObjects(new FindListener<AllTableListBean>() {
@Override
public void done(List<AllTableListBean> list, BmobException e) {
LogUtils.i("list", "-stuId-findObjects-->" + new Gson().toJson(list));
dismissProDialog();
setAdapter((ArrayList<AllTableListBean>) list);
}
});
}
public void setAdapter(ArrayList<AllTableListBean> mList) {
if (mList == null) {
mList = new ArrayList<>();
}
setTitleLay(R.id.title_tv, R.id.back_lay, title + "(" + mList.size() + ")");
if (adapter == null) {
adapter = new TableAllListAdapter(this, mList);
mrv.setAdapter(adapter);
adapter.setOnItemClickListeners(new TableAllListAdapter.OnItemClickListeners() {
@Override
public void itemBean(int pos, AllTableListBean tableListBean) {
Intent intent = new Intent(TableListActivity.this, AddTableActivity.class);
intent.putExtra("bean",tableListBean);
startActivityForResult(intent, 201);
}
});
} else {
adapter.setList(mList);
adapter.notifyDataSetChanged();
handler.postDelayed(new Runnable() {
@Override
public void run() {
swip.setRefreshing(false);
}
}, 1000);
if (mList.size() == 0) {
Toast.makeText(this, "暂无数据", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
public void BtnAddOnClick(View view) {
Intent intent = new Intent(TableListActivity.this, AddTableActivity.class);
startActivityForResult(intent, 201);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 201) {
if (resultCode == 12) {
getData();
}
}
}
}

@ -0,0 +1,144 @@
package com.stu.assistant.activity;
import android.content.Intent;
import android.os.Handler;
import android.view.View;
import android.widget.Toast;
import com.google.gson.Gson;
import com.stu.assistant.R;
import com.stu.assistant.adapter.TaskAllListAdapter;
import com.stu.assistant.base.BaseActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.TaskBean;
import com.stu.assistant.uitls.DividerItemDecorationUtil;
import com.stu.assistant.uitls.LogUtils;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import com.stu.assistant.view.MySwipeRefreshLayout;
import java.util.ArrayList;
import java.util.List;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import cn.bmob.v3.BmobQuery;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.FindListener;
//作业列表
public class TaskListActivity extends BaseActivity {
private RecyclerView mrv;
private TaskAllListAdapter adapter;
private MySwipeRefreshLayout swip;
private Handler handler;
private String userLevel, title;
private int itemType;
@Override
protected int getLayoutId() {
return R.layout.activity_table_list;
}
@Override
protected void initView() {
swip = findViewById(R.id.swip_rf);
mrv = findViewById(R.id.mrv);
handler = new Handler();
}
@Override
protected void initData() {
LinearLayoutManager manager = new LinearLayoutManager(this);
manager.setOrientation(LinearLayoutManager.VERTICAL);
mrv.addItemDecoration(new DividerItemDecorationUtil(this, false));
mrv.setLayoutManager(manager);
Intent intent = getIntent();
userLevel = intent.getStringExtra("userLevel");
title = intent.getStringExtra("title");
itemType = intent.getIntExtra("itemType", 0);
setTitleLay(R.id.title_tv, R.id.back_lay, title);
setTextMsg(R.id.btn_register, "添加" + title);
getData();
}
@Override
protected void initListener() {
// 刷新数据
swip.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// 这里的作用是防止下拉刷新的时候还可以上拉加载
getData();
}
});
}
private void getData() {
showProDialog("正在查询");
BmobQuery<TaskBean> query = new BmobQuery<>();
query.addWhereEqualTo("stuId", SharedUtil.create(BaseApplion.application).getString(SharedConfig.objectId));
query.findObjects(new FindListener<TaskBean>() {
@Override
public void done(List<TaskBean> list, BmobException e) {
LogUtils.i("list", "-stuId-findObjects-->" + new Gson().toJson(list));
dismissProDialog();
setAdapter((ArrayList<TaskBean>) list);
}
});
}
public void setAdapter(ArrayList<TaskBean> mList) {
if (mList == null) {
mList = new ArrayList<>();
}
setTitleLay(R.id.title_tv, R.id.back_lay, title + "(" + mList.size() + ")");
if (adapter == null) {
adapter = new TaskAllListAdapter(this, mList);
mrv.setAdapter(adapter);
adapter.setOnItemClickListeners(new TaskAllListAdapter.OnItemClickListeners() {
@Override
public void itemBean(int pos, TaskBean tableListBean) {
Intent intent = new Intent(TaskListActivity.this, AddTaskActivity.class);
intent.putExtra("bean",tableListBean);
startActivityForResult(intent, 201);
}
});
} else {
adapter.setList(mList);
adapter.notifyDataSetChanged();
handler.postDelayed(new Runnable() {
@Override
public void run() {
swip.setRefreshing(false);
}
}, 1000);
if (mList.size() == 0) {
Toast.makeText(this, "暂无数据", Toast.LENGTH_SHORT).show();
}
}
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
public void BtnAddOnClick(View view) {
Intent intent = new Intent(TaskListActivity.this, AddTaskActivity.class);
startActivityForResult(intent, 201);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 201) {
if (resultCode == 12) {
getData();
}
}
}
}

@ -0,0 +1,67 @@
package com.stu.assistant.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.MainModuleBean;
import com.stu.assistant.uitls.ImageUtil;
import java.util.ArrayList;
public class HomeGvAdapter extends BaseAdapter {
private Context mContext;
private ViewHolder holder;
private ArrayList<MainModuleBean> list;
public HomeGvAdapter(Context context, ArrayList<MainModuleBean> moduleBeansList) {
mContext = context;
this.list = moduleBeansList;
}
@Override
public int getCount() {
return list == null ? 0 : list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.item_gridview, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
ImageUtil.showImageView(BaseApplion.application,list.get(position).getImageView(), holder.mImageView);
holder.mTextView.setText(list.get(position).getName());
return convertView;
}
class ViewHolder {
private ImageView mImageView;
private TextView mTextView;
public ViewHolder(View convertView) {
mImageView = (ImageView) convertView.findViewById(R.id.img_into);
mTextView = (TextView) convertView.findViewById(R.id.tv);
}
}
}

@ -0,0 +1,93 @@
package com.stu.assistant.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.stu.assistant.R;
import com.stu.assistant.bean.AllTableListBean;
import com.stu.assistant.constants.ConstansTableItemManager;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class TableAllListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
ArrayList<AllTableListBean> list1 = new ArrayList<>();
Context mContext;
private String userLevel;
private int itemType;
public TableAllListAdapter(Context mContext, ArrayList<AllTableListBean> list1) {
this.mContext = mContext;
this.list1 = list1;
}
public void setList(ArrayList<AllTableListBean> list1) {
this.list1 = list1;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ItemViewHodler sectionViewHodler = null;
sectionViewHodler = new ItemViewHodler(LayoutInflater.from(mContext).inflate(R.layout.table_all_list_item_layout, parent, false), viewType);
return sectionViewHodler;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
ItemViewHodler itemViewHodler = (ItemViewHodler) holder;
itemViewHodler.nameTv.setText("课程表" + (position + 1) + "\n创建时间:" + list1.get(position).getCreatedAt());
setOnItem(itemViewHodler.nameTv, position, list1.get(position));
}
private void setOnItem(TextView time1Tv, int position, AllTableListBean AllTableListBean) {
time1Tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listeners.itemBean(position, AllTableListBean);
}
});
// if (position % 2 == 0) {
// time1Tv.setBackgroundResource(R.color.mistyrose);
// } else {
// time1Tv.setBackgroundResource(R.color.light_blue_50);
// }
}
@Override
public int getItemCount() {
return list1.size();
}
public class ItemViewHodler extends RecyclerView.ViewHolder {
public TextView nameTv;
public int viewType;
public ItemViewHodler(@NonNull View itemView, int viewType) {
super(itemView);
this.viewType = viewType;
nameTv = itemView.findViewById(R.id.name_tv);
}
public int getViewType() {
return viewType;
}
}
public interface OnItemClickListeners {
void itemBean(int pos, AllTableListBean AllTableListBean);
}
public OnItemClickListeners listeners;
public void setOnItemClickListeners(OnItemClickListeners listener) {
this.listeners = listener;
}
}

@ -0,0 +1,127 @@
package com.stu.assistant.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioGroup;
import android.widget.TextView;
import com.stu.assistant.R;
import com.stu.assistant.bean.TableBean;
import com.stu.assistant.constants.ConstansTableItemManager;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class TableListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
ArrayList<TableBean> list1 = new ArrayList<>();
ArrayList<TableBean> list2 = new ArrayList<>();
ArrayList<TableBean> list3 = new ArrayList<>();
ArrayList<TableBean> list4 = new ArrayList<>();
ArrayList<TableBean> list5 = new ArrayList<>();
Context mContext;
private String userLevel;
private int itemType;
public TableListAdapter(Context mContext) {
this.mContext = mContext;
}
public void setList(ArrayList<TableBean> list1, ArrayList<TableBean> list2, ArrayList<TableBean> list3, ArrayList<TableBean> list4, ArrayList<TableBean> list5) {
this.list1 = list1;
this.list2 = list2;
this.list3 = list3;
this.list4 = list4;
this.list5 = list5;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ItemViewHodler sectionViewHodler = null;
sectionViewHodler = new ItemViewHodler(LayoutInflater.from(mContext).inflate(R.layout.table_item_layout, parent, false), viewType);
return sectionViewHodler;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
ItemViewHodler itemViewHodler = (ItemViewHodler) holder;
itemViewHodler.time1Tv.setText(list1.get(position).getTableNameMsg() + "[" +list1.get(position).getTeacherName()+","+ list1.get(position).getAddress()+"]");
itemViewHodler.time2Tv.setText(list2.get(position).getTableNameMsg() + "[" + list2.get(position).getTeacherName()+","+list2.get(position).getAddress()+"]");
itemViewHodler.time3Tv.setText(list3.get(position).getTableNameMsg() + "[" + list3.get(position).getTeacherName()+","+list3.get(position).getAddress()+"]");
itemViewHodler.time4Tv.setText(list4.get(position).getTableNameMsg() + "[" + list4.get(position).getTeacherName()+","+list4.get(position).getAddress()+"]");
itemViewHodler.time5Tv.setText(list5.get(position).getTableNameMsg() + "[" + list5.get(position).getTeacherName()+","+list5.get(position).getAddress()+"]");
itemViewHodler.timeTv.setText("" + (position + 1));
itemViewHodler.time1Tv.setText(itemViewHodler.time1Tv.getText().toString().replace("[,]",""));
itemViewHodler.time2Tv.setText(itemViewHodler.time2Tv.getText().toString().replace("[,]",""));
itemViewHodler.time3Tv.setText(itemViewHodler.time3Tv.getText().toString().replace("[,]",""));
itemViewHodler.time4Tv.setText(itemViewHodler.time4Tv.getText().toString().replace("[,]",""));
itemViewHodler.time5Tv.setText(itemViewHodler.time5Tv.getText().toString().replace("[,]",""));
setOnItem(itemViewHodler.time1Tv, position,list1.get(position), ConstansTableItemManager.item_1);
setOnItem(itemViewHodler.time2Tv, position,list2.get(position), ConstansTableItemManager.item_2);
setOnItem(itemViewHodler.time3Tv, position,list3.get(position), ConstansTableItemManager.item_3);
setOnItem(itemViewHodler.time4Tv, position,list4.get(position), ConstansTableItemManager.item_4);
setOnItem(itemViewHodler.time5Tv, position, list5.get(position),ConstansTableItemManager.item_5);
setOnItem(itemViewHodler.timeTv, position,list1.get(position), ConstansTableItemManager.item_99);
}
private void setOnItem(TextView time1Tv, int position,TableBean tableBean, int item_1) {
time1Tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(item_1 != ConstansTableItemManager.item_99){
listeners.itemBean(position,tableBean, item_1);
}
}
});
// if (position % 2 == 0) {
// time1Tv.setBackgroundResource(R.color.mistyrose);
// } else {
// time1Tv.setBackgroundResource(R.color.light_blue_50);
// }
}
@Override
public int getItemCount() {
return list1.size();
}
public class ItemViewHodler extends RecyclerView.ViewHolder {
public TextView time1Tv, time2Tv, time3Tv, time4Tv, time5Tv, timeTv;
public int viewType;
public ItemViewHodler(@NonNull View itemView, int viewType) {
super(itemView);
this.viewType = viewType;
time1Tv = itemView.findViewById(R.id.tv_time1);
time2Tv = itemView.findViewById(R.id.tv_time2);
time3Tv = itemView.findViewById(R.id.tv_time3);
time4Tv = itemView.findViewById(R.id.tv_time4);
time5Tv = itemView.findViewById(R.id.tv_time5);
timeTv = itemView.findViewById(R.id.tv_time);
}
public int getViewType() {
return viewType;
}
}
public interface OnItemClickListeners {
void itemBean(int pos,TableBean tableBean, int day);
}
public OnItemClickListeners listeners;
public void setOnItemClickListeners(OnItemClickListeners listener) {
this.listeners = listener;
}
}

@ -0,0 +1,87 @@
package com.stu.assistant.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.stu.assistant.R;
import com.stu.assistant.bean.TaskBean;
import java.util.ArrayList;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
public class TaskAllListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
ArrayList<TaskBean> list1 = new ArrayList<>();
Context mContext;
private String userLevel;
private int itemType;
public TaskAllListAdapter(Context mContext, ArrayList<TaskBean> list1) {
this.mContext = mContext;
this.list1 = list1;
}
public void setList(ArrayList<TaskBean> list1) {
this.list1 = list1;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
ItemViewHodler sectionViewHodler = null;
sectionViewHodler = new ItemViewHodler(LayoutInflater.from(mContext).inflate(R.layout.table_all_list_item_layout, parent, false), viewType);
return sectionViewHodler;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
ItemViewHodler itemViewHodler = (ItemViewHodler) holder;
itemViewHodler.nameTv.setText("课程名称:" + list1.get(position).getTableNameMsg() + "\n截止时间:" + list1.get(position).getTime());
setOnItem(itemViewHodler.nameTv, position, list1.get(position));
}
private void setOnItem(TextView time1Tv, int position, TaskBean TaskBean) {
time1Tv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listeners.itemBean(position, TaskBean);
}
});
}
@Override
public int getItemCount() {
return list1.size();
}
public class ItemViewHodler extends RecyclerView.ViewHolder {
public TextView nameTv;
public int viewType;
public ItemViewHodler(@NonNull View itemView, int viewType) {
super(itemView);
this.viewType = viewType;
nameTv = itemView.findViewById(R.id.name_tv);
}
public int getViewType() {
return viewType;
}
}
public interface OnItemClickListeners {
void itemBean(int pos, TaskBean TaskBean);
}
public OnItemClickListeners listeners;
public void setOnItemClickListeners(OnItemClickListeners listener) {
this.listeners = listener;
}
}

@ -0,0 +1,82 @@
package com.stu.assistant.base;
import android.app.Activity;
import android.util.Log;
import java.util.ArrayList;
import java.util.Stack;
/**
* @ClassName ActivityManage
* @Description Activity
* @Author kaiguo
* @Date 2020/3/17 11:10
*/
public class ActivityManage {
//保存所有创建的Activity
// private ArrayList<Activity> allActivities = new ArrayList<>();
private Stack<Activity> allActivities = new Stack<>();
/**
* Activity
*
* @param activity activity
*/
public void addActivity(Activity activity) {
if (activity != null) {
allActivities.add(activity);
}
}
/**
* Activity
*
* @param activity activity
*/
public void removeActivity(Activity activity) {
if (activity != null) {
allActivities.remove(activity);
activity.finish();
}
}
/**
* Activity
*/
public void finishAll() {
for (Activity activity : allActivities) {
activity.finish();
}
}
public void finishAct() {
for (Activity activity : allActivities) {
Log.i("hx","--activity.getLocalClassName()-->"+activity.getLocalClassName());
if (!"activity.SettingActivity".equals(activity.getLocalClassName())) {
activity.finish();
}
}
}
/**
* Activity
*/
public Activity getCurrentActivity() {
return allActivities.lastElement();
}
public ArrayList<Activity> getAllActivities() {
ArrayList<Activity> list = new ArrayList<>();
if (allActivities.size() > 0) {
for (Activity a : allActivities) {
list.add(a);
}
}
return list;
}
}

@ -0,0 +1,138 @@
package com.stu.assistant.base;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.gyf.immersionbar.ImmersionBar;
import com.stu.assistant.R;
import com.stu.assistant.uitls.Config;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedNoClearUtil;
import com.stu.assistant.uitls.SharedUtil;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import cn.bmob.v3.util.V;
public abstract class BaseActivity extends FragmentActivity {
public static Context mContext;
private Config config;
private ProgressDialog progressDialog;
@SuppressLint("SourceLockedOrientationActivity")
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
String string = SharedNoClearUtil.create(BaseApplion.application).getString(SharedConfig.isTheme, SharedConfig.isThemeSys);
if (string.equals(SharedConfig.isThemeSys)) {
setTheme(R.style.AppTheme);
} else {
setTheme(R.style.MyAppTheme);
}
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//设置activity只能竖屏
mContext = this;
//沉浸式状态栏
initImmersionBar();
//加入Activity管理器l
BaseApplion.application.getActivityManage().addActivity(this);
//加载当前页面
setContentView(R.layout.base_activity_layout);
((ViewGroup) findViewById(R.id.fl_content)).addView(getLayoutInflater().inflate(getLayoutId(), null));
Html.fromHtml("&yen");
}
public void showProDialog(String msg) {
progressDialog = ProgressDialog.show(this, null, msg, true, true);
progressDialog.show();
}
public void dismissProDialog() {
if (progressDialog != null) {
progressDialog.dismiss();
}
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
initView();
initData();
initListener();
}
public Config getConfig() {
if (config == null) {
config = new Config();
}
return config;
}
protected void setTextMsg(int id, String msg) {
TextView textView = (TextView) findViewById(id);
textView.setVisibility(View.VISIBLE);
textView.setText(msg);
}
protected void setTitleLayView(int id) {
LinearLayout backLay = (LinearLayout) findViewById(id);
backLay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
protected void setTitleLay(int tvId, int layId, String msg) {
setTextMsg(tvId, msg);
setTitleLayView(layId);
}
/**
*
*/
protected void initImmersionBar() {
ImmersionBar.with(this)
.transparentStatusBar() //透明状态栏,不写默认透明色
.fitsSystemWindows(false) //解决状态栏和布局重叠问题任选其一默认为false当为true时一定要指定statusBarColor(),不然状态栏为透明色,还有一些重载方法
.init(); //必须
}
@Override
protected void onStop() {
super.onStop();
dismissProDialog();
}
protected abstract int getLayoutId();
protected abstract void initView();
protected abstract void initData();
protected abstract void initListener();
}

@ -0,0 +1,41 @@
package com.stu.assistant.base;
import android.app.Application;
import com.stu.assistant.BuildConfig;
import com.stu.assistant.net.OkGoConfig;
import com.stu.assistant.uitls.CrashHandler;
import com.stu.assistant.uitls.CrashHandlerManage;
import com.stu.assistant.uitls.ShowClassNameCallBack;
import com.tencent.bugly.crashreport.CrashReport;
import cn.bmob.v3.Bmob;
public class BaseApplion extends Application {
public static BaseApplion application;
public static ActivityManage activityManage;
@Override
public void onCreate() {
super.onCreate();
application = this;
OkGoConfig.initOkGo(this);
if (BuildConfig.DEBUG) {
registerActivityLifecycleCallbacks(new ShowClassNameCallBack());
CrashHandlerManage.getInstance()
.init(getApplicationContext());
CrashHandler.getInstance().setDelayTime(1000 * 60 * 1).init(getApplicationContext());
}
CrashReport.initCrashReport(getApplicationContext(), "6e238eccba", false);
Bmob.initialize(this, "76a343b680dc028081fb0dd8b028a08d");
}
public static ActivityManage getActivityManage() {
if (activityManage == null) {
activityManage = new ActivityManage();
}
return activityManage;
}
}

@ -0,0 +1,8 @@
package com.stu.assistant.base;
import java.io.Serializable;
import cn.bmob.v3.BmobObject;
public class BaseBean extends BmobObject implements Serializable {
}

@ -0,0 +1,15 @@
package com.stu.assistant.base;
import com.stu.assistant.uitls.Config;
public abstract class BasePresenter {
private Config config;
public Config getConfig() {
if (config == null) {
config = new Config();
}
return config;
}
}

@ -0,0 +1,27 @@
package com.stu.assistant.bean;
import com.stu.assistant.base.BaseBean;
public class AllTableListBean extends BaseBean {
private String tableIdMsg;//整个课程表的唯一id
private String stuId;
public AllTableListBean() {
}
public String getStuId() {
return stuId;
}
public void setStuId(String stuId) {
this.stuId = stuId;
}
public String getTableIdMsg() {
return tableIdMsg;
}
public void setTableIdMsg(String tableIdMsg) {
this.tableIdMsg = tableIdMsg;
}
}

@ -0,0 +1,54 @@
package com.stu.assistant.bean;
import java.io.Serializable;
public class CodeBean implements Serializable {
private String codeType;//订单号,货架号
private String upCode;//提交使用的
private String showCode;//展示使用的
private String showDingDanNum;//展示使用的
private String scanCode;//扫描code
public CodeBean() {
}
public String getShowDingDanNum() {
return showDingDanNum;
}
public void setShowDingDanNum(String showDingDanNum) {
this.showDingDanNum = showDingDanNum;
}
public String getScanCode() {
return scanCode;
}
public void setScanCode(String scanCode) {
this.scanCode = scanCode;
}
public String getCodeType() {
return codeType;
}
public void setCodeType(String codeType) {
this.codeType = codeType;
}
public String getUpCode() {
return upCode;
}
public void setUpCode(String upCode) {
this.upCode = upCode;
}
public String getShowCode() {
return showCode;
}
public void setShowCode(String showCode) {
this.showCode = showCode;
}
}

@ -0,0 +1,51 @@
package com.stu.assistant.bean;
/**
* Created by stf on 2018-07-25.
*/
public class MainModuleBean {
private String name;
private int imageView;
private int itemFlag;
private String other;
public MainModuleBean(String name, int itemFlag, int imageView) {
this.name = name;
this.imageView = imageView;
this.itemFlag = itemFlag;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getImageView() {
return imageView;
}
public void setImageView(int imageView) {
this.imageView = imageView;
}
public int getItemFlag() {
return itemFlag;
}
public void setItemFlag(int itemFlag) {
this.itemFlag = itemFlag;
}
public String getOther() {
return other;
}
public void setOther(String other) {
this.other = other;
}
}

@ -0,0 +1,92 @@
package com.stu.assistant.bean;
import com.stu.assistant.base.BaseBean;
public class TableBean extends BaseBean {
private String tableNameMsg;
private String teacherName;
private String teacherId;
private String stuId;
private String Address;
private int day;//周几
private int pos;//第几节
private String tableIdMsg;//整个课程表的唯一id
private String mark;//注意事项
public TableBean() {
}
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark;
}
public String getTableIdMsg() {
return tableIdMsg;
}
public void setTableIdMsg(String tableIdMsg) {
this.tableIdMsg = tableIdMsg;
}
public String getStuId() {
return stuId;
}
public void setStuId(String stuId) {
this.stuId = stuId;
}
public String getTeacherId() {
return teacherId;
}
public void setTeacherId(String teacherId) {
this.teacherId = teacherId;
}
public int getPos() {
return pos;
}
public void setPos(int pos) {
this.pos = pos;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public String getTableNameMsg() {
return tableNameMsg;
}
public void setTableNameMsg(String tableNameMsg) {
this.tableNameMsg = tableNameMsg;
}
public String getTeacherName() {
return teacherName;
}
public void setTeacherName(String teacherName) {
this.teacherName = teacherName;
}
public String getAddress() {
return Address;
}
public void setAddress(String address) {
Address = address;
}
}

@ -0,0 +1,60 @@
package com.stu.assistant.bean;
import com.stu.assistant.base.BaseBean;
public class TableTimeBean extends BaseBean {
private String time;//具体的某一天
private String day;//周几
private int tableMsg;//第几节
private String mark;
private String teacherId;
private String teacherName;
public int getTableMsg() {
return tableMsg;
}
public void setTableMsg(int tableMsg) {
this.tableMsg = tableMsg;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getDay() {
return day;
}
public void setDay(String day) {
this.day = day;
}
public String getMark() {
return mark;
}
public void setMark(String mark) {
this.mark = mark;
}
public String getTeacherId() {
return teacherId;
}
public void setTeacherId(String teacherId) {
this.teacherId = teacherId;
}
public String getTeacherName() {
return teacherName;
}
public void setTeacherName(String teacherName) {
this.teacherName = teacherName;
}
}

@ -0,0 +1,54 @@
package com.stu.assistant.bean;
import com.stu.assistant.base.BaseBean;
public class TaskBean extends BaseBean {
private String tableNameMsg;//课程名称
private String tableIdMsg;//课程名称 id
private String taskMsg;//作业内容
private String time;//时间
private String stuId;//学生
public TaskBean() {
}
public String getTableIdMsg() {
return tableIdMsg;
}
public void setTableIdMsg(String tableIdMsg) {
this.tableIdMsg = tableIdMsg;
}
public String getTableNameMsg() {
return tableNameMsg;
}
public void setTableNameMsg(String tableNameMsg) {
this.tableNameMsg = tableNameMsg;
}
public String getTaskMsg() {
return taskMsg;
}
public void setTaskMsg(String taskMsg) {
this.taskMsg = taskMsg;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getStuId() {
return stuId;
}
public void setStuId(String stuId) {
this.stuId = stuId;
}
}

@ -0,0 +1,76 @@
package com.stu.assistant.bean;
import java.util.ArrayList;
import cn.bmob.v3.BmobUser;
public class UserInfoBean extends BmobUser {
private String nickName;
public String userId;
public String age;
public String address;
public String userLevel;//等级
public String userType;//用户角色
public String evaluate;//评分
public UserInfoBean() {
}
public String getEvaluate() {
return evaluate;
}
public void setEvaluate(String evaluate) {
this.evaluate = evaluate;
}
public String getUserLevel() {
return userLevel;
}
public void setUserLevel(String userLevel) {
this.userLevel = userLevel;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}

@ -0,0 +1,7 @@
package com.stu.assistant.constants;
public class ConstansItemManager {
public static final int item_1 = 1; //课表
public static final int item_2 = 2; //作业
public static final int item_3 = 3; //设置
}

@ -0,0 +1,13 @@
package com.stu.assistant.constants;
public class ConstansTableItemManager {
public static final int item_1 = 1;
public static final int item_2 = 2;
public static final int item_3 = 3;
public static final int item_4 = 4;
public static final int item_5 = 5;
public static final int item_6 = 6;
public static final int item_7 = 7;
public static final int item_99 = 99;
}

@ -0,0 +1,10 @@
package com.stu.assistant.constants;
public class ConstansUserManager {
public static final String Level_1 = "10"; //管理员
public static final String Level_2 = "20";//部门管理
public static final String Level_3 = "30";//学生
public static final String Level_4 = "40";//大众用户
public static final String UserType_1 = "1";//管理员
public static final String UserType_2 = "2";//用户
}

@ -0,0 +1,318 @@
package com.stu.assistant.dialog;
import android.app.Activity;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
//import com.bigkoo.pickerview.builder.TimePickerBuilder;
//import com.bigkoo.pickerview.listener.OnTimeSelectListener;
//import com.bigkoo.pickerview.view.TimePickerView;
//import com.wwdw.easytimeapplication.R;
//import com.wwdw.easytimeapplication.contants.AddMoneyBeanType;
//import com.wwdw.easytimeapplication.uitls.AppTools;
//import com.wwdw.easytimeapplication.uitls.CalendarUtil;
//import com.wwdw.easytimeapplication.uitls.MyToast;
//import com.wwdw.easytimeapplication.uitls.ScriptEngineUtils;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.TimePickerView;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.uitls.AppTools;
import com.stu.assistant.uitls.CalendarUtil;
import com.stu.assistant.uitls.MyToast;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedNoClearUtil;
import com.stu.assistant.uitls.SharedUtil;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DiaogUtil {
private PopWindowUtils popWindowUtils;
public static void showInputDialog(final Activity activity, View parent_view, final String title, final OnShowInputLisenter lisenter) {
final PopWindowUtils popWindowUtils = new PopWindowUtils(activity);
popWindowUtils.setFocusables(true);
// popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity));
popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity) - AppTools.dip2px(activity, 20));
popWindowUtils.setOnViewClickListener(new PopWindowUtils.ContentView() {
@Override
public void getContentView(View contentView, PopWindowUtils popWindow) {
}
}).setConView(R.layout.input_dialog_layout).showInCenter(parent_view);
}
public static void showDelDialog(Activity activity, View parent_view, final String msg, final OnNickNameLisenter lisenter) {
final PopWindowUtils popWindowUtils = new PopWindowUtils(activity);
popWindowUtils.setFocusables(true);
// popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity));
popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity) - AppTools.dip2px(activity, 20));
popWindowUtils.setOnViewClickListener(new PopWindowUtils.ContentView() {
@Override
public void getContentView(View contentView, final PopWindowUtils popWindow) {
TextView canTv = contentView.findViewById(R.id.tv_can);
TextView okTv = contentView.findViewById(R.id.tv_ok);
final TextView editText = contentView.findViewById(R.id.mark_edit);
if (!TextUtils.isEmpty(msg)) {
editText.setText("确定要删除" + msg + "吗?");
}
canTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popWindow.dismiss();
}
});
okTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popWindow.dismiss();
lisenter.OnOkBtn(msg, popWindow);
}
});
}
}).setConView(R.layout.select_color_dialog_layout).showInCenter(parent_view);
}
public static void showOutAppDialog(Activity activity, View parent_view, final String msg, final OnNickNameLisenter lisenter) {
final PopWindowUtils popWindowUtils = new PopWindowUtils(activity);
popWindowUtils.setFocusables(true);
// popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity));
popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity) - AppTools.dip2px(activity, 20));
popWindowUtils.setOnViewClickListener(new PopWindowUtils.ContentView() {
@Override
public void getContentView(View contentView, final PopWindowUtils popWindow) {
TextView canTv = contentView.findViewById(R.id.tv_can);
TextView okTv = contentView.findViewById(R.id.tv_ok);
final TextView editText = contentView.findViewById(R.id.mark_edit);
editText.setText("确定退出?");
canTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popWindow.dismiss();
}
});
okTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popWindow.dismiss();
lisenter.OnOkBtn(msg, popWindow);
}
});
}
}).setConView(R.layout.select_color_dialog_layout).showInCenter(parent_view);
}
public static void showSelectColorDialog(Activity activity, View parent_view, final String msg, final OnNickNameLisenter lisenter) {
final PopWindowUtils popWindowUtils = new PopWindowUtils(activity);
popWindowUtils.setFocusables(true);
// popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity));
popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity) - AppTools.dip2px(activity, 20));
popWindowUtils.setOnViewClickListener(new PopWindowUtils.ContentView() {
@Override
public void getContentView(View contentView, final PopWindowUtils popWindow) {
TextView canTv = contentView.findViewById(R.id.tv_can);
TextView okTv = contentView.findViewById(R.id.tv_ok);
RadioGroup radioGroup = contentView.findViewById(R.id.rg);
canTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popWindow.dismiss();
}
});
okTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int checkedRadioButtonId = radioGroup.getCheckedRadioButtonId();
if (checkedRadioButtonId == R.id.rb_1) {
SharedNoClearUtil.create(BaseApplion.application).putString(SharedConfig.isTheme,SharedConfig.isThemeMy);
lisenter.OnOkBtn(msg, popWindow);
}
if (checkedRadioButtonId == R.id.rb_2) {
SharedNoClearUtil.create(BaseApplion.application).putString(SharedConfig.isTheme,SharedConfig.isThemeSys);
lisenter.OnOkBtn(msg, popWindow);
}
popWindow.dismiss();
}
});
}
}).setConView(R.layout.select_color_dialog_layout).showInCenter(parent_view);
}
public static void showSelectBgDialog(Activity activity, View parent_view, final OnNickNameLisenter lisenter) {
final PopWindowUtils popWindowUtils = new PopWindowUtils(activity);
popWindowUtils.setFocusables(true);
// popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity));
popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity) - AppTools.dip2px(activity, 20));
popWindowUtils.setOnViewClickListener(new PopWindowUtils.ContentView() {
@Override
public void getContentView(View contentView, final PopWindowUtils popWindow) {
TextView canTv = contentView.findViewById(R.id.tv_can);
TextView okTv = contentView.findViewById(R.id.tv_ok);
RadioGroup radioGroup = contentView.findViewById(R.id.rg);
canTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
popWindow.dismiss();
}
});
okTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int checkedRadioButtonId = radioGroup.getCheckedRadioButtonId();
if (checkedRadioButtonId == R.id.rb_1) {
SharedNoClearUtil.create(BaseApplion.application).putString(SharedConfig.isBg,SharedConfig.isBg_1);
}
if (checkedRadioButtonId == R.id.rb_2) {
SharedNoClearUtil.create(BaseApplion.application).putString(SharedConfig.isBg,SharedConfig.isBg_2);
}
if (checkedRadioButtonId == R.id.rb_3) {
SharedNoClearUtil.create(BaseApplion.application).putString(SharedConfig.isBg,SharedConfig.isBg_3);
}
if (checkedRadioButtonId == R.id.rb_4) {
SharedNoClearUtil.create(BaseApplion.application).putString(SharedConfig.isBg,SharedConfig.isBg_4);
}
lisenter.OnOkBtn("", popWindow);
popWindow.dismiss();
}
});
}
}).setConView(R.layout.select_bg_dialog_layout).showInCenter(parent_view);
}
public static void showTipDialog(Activity activity, View parent_view, final String msg, final OnNickNameLisenter lisenter) {
final PopWindowUtils popWindowUtils = new PopWindowUtils(activity);
popWindowUtils.setFocusables(true);
popWindowUtils.setEditDissmiss(false);
// popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity));
popWindowUtils.setWidthSize(AppTools.getScreenWidth(activity) - AppTools.dip2px(activity, 20));
popWindowUtils.setOnViewClickListener(new PopWindowUtils.ContentView() {
@Override
public void getContentView(View contentView, final PopWindowUtils popWindow) {
TextView canTv = contentView.findViewById(R.id.tv_can);
TextView okTv = contentView.findViewById(R.id.tv_ok);
final EditText editText = contentView.findViewById(R.id.mark_edit);
okTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String ymd = new CalendarUtil().getYMD3();
Log.i("hx", "--ymd-->" + ymd);
int num = Integer.parseInt(ymd.substring(ymd.length() - 1, ymd.length())) + 3;
Log.i("hx", "--num-->" + num);
String pwd = ymd + ymd.substring(ymd.length() - 2, ymd.length()) + num;
Log.i("hx", "--pwd-->" + pwd);
String msgNew = editText.getText().toString();
if (TextUtils.isEmpty(msgNew)) {
MyToast.show("请输入密码");
return;
}
String uidFromBase64 = AppTools.getUidFromBase64(msgNew);
Log.i("hx", "--msgNew--->" + msgNew + "-uidFromBase64-->" + uidFromBase64);
if (uidFromBase64.equals(pwd) || uidFromBase64.equals("10001")) {
popWindowUtils.setEditDissmiss(true);
if (uidFromBase64.equals("10001")) {
String addDay = new CalendarUtil().setAddDay(new Date(), 365 * 10);
SharedNoClearUtil.create(BaseApplion.application).putString(SharedConfig.initTime, addDay);
} else {
String addDay = new CalendarUtil().setAddDay(new Date(), 3);
SharedNoClearUtil.create(BaseApplion.application).putString(SharedConfig.initTime, addDay);
}
popWindow.dismiss();
lisenter.OnOkBtn(msgNew, popWindow);
} else {
MyToast.show("密码错误");
}
}
});
}
}).setConView(R.layout.tip_dialog_layout).showInCenter(parent_view);
}
public static void showSelectTimeDialog(Activity activity, final OnSelectLisenter lisenter) {
Calendar selectedDate = Calendar.getInstance();
CalendarUtil instance = CalendarUtil.getInstance();
Date date1 = instance.strToDate2(instance.getYMDHM());
Date date = instance.setAddYear2(date1, 10);
Calendar instance1 = Calendar.getInstance();
instance1.setTime(date);
selectedDate.setTime(date1);
final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
boolean[] booleans = {true, true, true, true, true, false};
TimePickerView pvTime = new TimePickerBuilder(activity, new OnTimeSelectListener() {
@Override
public void onTimeSelect(Date date, View v1) {
String time = dateFormat.format(date);
lisenter.OnOkBtn(time);
}
}).setDecorView((ViewGroup) activity.getWindow().getDecorView().findViewById(android.R.id.content))
.setSubmitColor(R.color.app_yellow)
.setCancelColor(R.color.app_yellow)
.setDate(selectedDate)
.setType(booleans)
.isCyclic(true)
.build();
pvTime.show();
}
public interface OnSelectLisenter {
void OnOkBtn(String time);
}
private static void clickListener(final TextView callTv, final TextView moneyTv) {
callTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String moneyMsg = getMoney(moneyTv);
String s = getNum(callTv);
String msg = moneyMsg + s;
Log.i("stf", "-clickListener-->" + msg + "-s-->" + s + "-moneyMsg-->" + moneyMsg);
if (!TextUtils.isEmpty(msg)) {
if ((msg.endsWith("+")) || (msg.endsWith("-"))) {
} else {
setMoney(msg, moneyTv);
}
} else {
setMoney(s, moneyTv);
}
}
});
}
private static String getMoney(TextView textView) {
return textView.getText().toString().trim().replace(" ", "");
}
private static String getNum(TextView textView) {
return textView.getText().toString().trim().replace(" ", "");
}
private static void setMoney(String msg, TextView textView) {
textView.setText(msg);
}
public interface OnShowInputLisenter {
void OnOkBtn(String moneyMsg, String markMsg, String time);
}
public interface OnNickNameLisenter {
void OnOkBtn(String msg, PopWindowUtils popWindow);
}
public interface OnSelectTypeLisenter {
void OnOkBtn(int type);
}
}

@ -0,0 +1,268 @@
package com.stu.assistant.dialog;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.PopupWindow;
import com.stu.assistant.R;
import com.stu.assistant.uitls.AppTools;
public class PopWindowUtils extends PopupWindow {
private Activity mActivity;
private ContentView conV;
private View view;
private boolean canable = true;
private boolean isDissmiss = true;//是否关闭弹窗标识
public PopWindowUtils(Activity activity) {
super(activity);
mActivity = activity;
setWidth(AppTools.getScreenWidth(activity) - AppTools.dip2px(activity, 66));
setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
setFocusable(false);
setOutsideTouchable(false);
setCanable(canable);
isDissmiss = true;
//添加弹出、弹入的动画
setAnimationStyle(R.style.popupwindow);
setBackgroundDrawable(new ColorDrawable(-00000));
}
public PopWindowUtils setCanable(boolean canable) {
this.canable = canable;
return this;
}
public PopWindowUtils setWidthSize(int width) {
setWidth(width);
return this;
}
public PopWindowUtils setHeightSize(int height) {
setHeight(height);
return this;
}
public PopWindowUtils setFocusables(boolean focus) {
setFocusable(focus);
return this;
}
public PopWindowUtils setConView(int contentView) {
view = LayoutInflater.from(mActivity).inflate(contentView, null);
setContentView(view);
if (conV != null) {
conV.getContentView(view, this);
}
return this;
}
public PopWindowUtils setConView(View contentView) {
setContentView(contentView);
conV.getContentView(contentView, this);
return this;
}
//添加 布局的时候 同时绘制 宽高
public PopWindowUtils setConViewMeasureSpec(int layId) {
View mContentView = LayoutInflater.from(mActivity).inflate(layId, null);
mContentView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
setContentView(mContentView);
if (conV != null) {
conV.getContentView(mContentView, this);
}
return this;
}
public int getMeasuredHeight() {
return this.getContentView().getMeasuredHeight();
}
public int getMeasuredWidth() {
return this.getContentView().getMeasuredWidth();
}
public void showInCenter(View view) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 0.5f;
mActivity.getWindow().setAttributes(lp);
if (AppTools.getModelXDL()){//演示设备
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
}
showAtLocation(view, Gravity.CENTER, 0, 0);
}
public void showDropDown(View view) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 0.5f;
mActivity.getWindow().setAttributes(lp);
if (AppTools.getModelXDL()){//演示设备
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
}
setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
showAsDropDown(view);
}
public void showDropDownAlpha1(View view) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 1f;
mActivity.getWindow().setAttributes(lp);
if (AppTools.getModelXDL()){//演示设备
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
}
setWidth(AppTools.getScreenWidth(mActivity)/2);
// setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
showAsDropDown(view);
}
public void showDropDownFilt(View view) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 0.5f;
// if (bgAlpha == 1) {
// //不移除该Flag的话,在有视频的页面上的视频会出现黑屏的bug
// activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
// } else {
// //此行代码主要是解决在华为手机上半透明效果无效的bug
// activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
// }
mActivity.getWindow().setAttributes(lp);
int[] location = new int[2];
view.getLocationOnScreen(location);
WindowManager wm = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE);
int screenHeight = wm.getDefaultDisplay().getHeight();
setHeight(screenHeight - location[1] - view.getHeight());
setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
showAtLocation(view, Gravity.NO_GRAVITY, 0, location[1] + view.getHeight());
}
public void showBottom(View view) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 0.5f;
if (AppTools.getModelXDL()){//演示设备
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
}
mActivity.getWindow().setAttributes(lp);
showAtLocation(view, Gravity.BOTTOM, 0, 0);
}
/**
* v(v)
*
* @param v
*/
public void showUp2(View v) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 0.5f;
mActivity.getWindow().setAttributes(lp);
if (AppTools.getModelXDL()){//演示设备
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
}
//获取需要在其上方显示的控件的位置信息
//获取自身的长宽高
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int popupHeight = view.getMeasuredHeight();
int popupWidth = view.getMeasuredWidth();
int[] location = new int[2];
v.getLocationOnScreen(location);
//在控件上方显示
showAtLocation(v, Gravity.NO_GRAVITY, (location[0]) - popupWidth / 2, location[1]);
}
/**
*
*/
public void showViewRight(Context context, View view) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 0.5f;
if (AppTools.getModelXDL()){//演示设备
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
}
mActivity.getWindow().setAttributes(lp);
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
showAtLocation(view, Gravity.NO_GRAVITY, 100, 0);
// showAsDropDown(view, mShowMorePopupWindowWidth, mShowMorePopupWindowHeight,Gravity.NO_GRAVITY);
}
public void showBrowseImgnCenter(View view) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 0f;
mActivity.getWindow().setAttributes(lp);
showAtLocation(view, Gravity.CENTER, 0, 0);
}
/**
* app
*/
public void showPwdCenter(View view) {
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 0.5f;
if (AppTools.getModelXDL()){//演示设备
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);//此行代码主要是解决在华为手机上半透明效果无效的bug
}
mActivity.getWindow().setAttributes(lp);
setCanable(false);
setFocusables(true);
setOutsideTouchable(false);
showAtLocation(view, Gravity.CENTER, 0, 0);
}
/**
*
* popupwindowedittext
* true
*/
public void setEditDissmiss(boolean isDissmissFlag) {
isDissmiss = isDissmissFlag;
}
@Override
public void dismiss() {
if (isDissmiss) {//这里做标识 是为了控制点击外部是否关闭弹窗
super.dismiss();
WindowManager.LayoutParams lp = mActivity.getWindow().getAttributes();
lp.alpha = 1f;
mActivity.getWindow().setAttributes(lp);
}
}
public PopWindowUtils setOnViewClickListener(ContentView conV) {
this.conV = conV;
return this;
}
//
// public PopWindowUtils setConView(int contentView, String title) {
// view = LayoutInflater.from(mActivity).inflate(contentView, null);
// if (!TextUtils.isEmpty(title)) {
// TextView textView = view.findViewById(R.id.tv_title);
// textView.setText(title);
// }
// setContentView(view);
//
// if (conV != null) {
// conV.getContentView(view, this);
// }
// return this;
// }
public interface ContentView {
void getContentView(View contentView, PopWindowUtils popWindow);
}
}

@ -0,0 +1,61 @@
package com.stu.assistant.net;
/**
* @ClassName Api
* @Description
* @Author kaiguo
* @Date 2020/3/17 11:01
*/
public interface Api {
/**
*
*/
String LOGIN = "user/login";
/**
* @Description: () id
* @author stf
* @date 2021/11/30
*/
String getShelvedById = "whManage/getShelvedById";
/**
* @Description: () id
* @author stf
* @date 2021/11/30
*/
String getDetailById = "inOut/getDetailById";
/**
* @Description: ()
* @author stf
* @date 2021/11/30
*/
String batchWarehousing = "whApp/batchWarehousing";
/**
* @Description: ()
* @author stf
* @date 2021/11/30
*/
String batchExWarehouse = "whApp/batchExWarehouse";
/**
* @Description: ()
* @author stf
* @date 2021/11/30
*/
String emptyShelves = "whApp/emptyShelves";
}

@ -0,0 +1,46 @@
package com.stu.assistant.net;
public class NetConfig {
/**
*
*/
public static final String SERVER_URL = "http://47.102.116.226/api/";
/**
* key
*/
public class Code {
public static final String SUCCESS = "success";
public static final String MSG = "errorMsg";
public static final String CODE = "errorCode";
public static final String MODEL = "data";
}
/**
* Url
*/
public static class Url {
//服务器地址
interface BaseUrl {
/**
*
*/
String SERVER_PRODUCTION = "http://47.102.116.226:28890/wh/";
}
/**
*
*/
public static String getBaseUrl(String url) {
return BaseUrl.SERVER_PRODUCTION + url;
}
}
public static final String NetError = "暂无网络连接";
public static final String ConnectError = "服务器连接失败";
public static final String DataError = "数据返回异常";
public static final int Success = 200;
public static final int OutApp = 401;
}

@ -0,0 +1,111 @@
package com.stu.assistant.net;
import android.app.Application;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheEntity;
import com.lzy.okgo.cache.CacheMode;
import com.lzy.okgo.cookie.CookieJarImpl;
import com.lzy.okgo.cookie.store.DBCookieStore;
import com.lzy.okgo.https.HttpsUtils;
import com.lzy.okgo.interceptor.HttpLoggingInterceptor;
import com.lzy.okgo.model.HttpHeaders;
import com.lzy.okgo.model.HttpParams;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import okhttp3.OkHttpClient;
/**
* @ClassName OkgoUtil
* @Description
* @Author kaiguo
* @Date 2020/3/17 14:15
*/
public class OkGoConfig {
private static final int REQUEST_GET = 0;
private static final int REQUEST_POST = 1;
private static final int REQUEST_JSON = 2;
private String baseUrl;
public static void initOkGo(Application context) {
/*公共请求头,header不支持中文不允许有特殊字符*/
HttpHeaders headers = new HttpHeaders();
/*公共请求参数,param支持中文,直接传,不要自己编码*/
HttpParams params = new HttpParams();
headers.put("Accept", "application/json");
// headers.put("x-originCode", SharedPreNoClearUtils.create(context).getString(SharedPreConfig.ORIGINCODE, ""));//用户域编号
// headers.put("x-platform", "Android");//设备平台
// headers.put("x-deviceId", DeviceUtils.getDeviceId(context));//设备id
// headers.put("x-deviceBrand", DeviceUtils.getPhoneBrand());//设备品牌
// headers.put("x-deviceType", DeviceUtils.getPhoneModel());//设备型号
// headers.put("x-systemVersion", DeviceUtils.getBuildVersion());//系统版本
// headers.put("x-appVersion", DeviceUtils.getVersionName(context) + "." + DeviceUtils.getReleaseTime(context));//app版本
//
// headers.put("x-buildVersion", DeviceUtils.getReleaseTime(context));
// headers.put("x-appType", "doctor");
// long timestamp = System.currentTimeMillis();
// params.put("_v", timestamp);
/*配置日志*/
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor("HX");
loggingInterceptor.setPrintLevel(HttpLoggingInterceptor.Level.BODY);
loggingInterceptor.setColorLevel(Level.INFO);
/*
cookie, cookie(session), :
: cookie
CookieJarImpl dbCookieJar1 = new CookieJarImpl(new DBCookieStore(this));
SharedPreference: cookie
CookieJarImpl spCookieJar = new CookieJarImpl(new SPCookieStore(this));
: app退cookie
CookieJarImpl memCookieJar = new CookieJarImpl(new MemoryCookieStore());
*/
CookieJarImpl dbCookieJar1 = new CookieJarImpl(new DBCookieStore(context));
/*
HTTPS
,
HttpsUtils.SSLParams sslParams1 = HttpsUtils.getSslSocketFactory();
HttpsUtils.SSLParams sslParams2 = HttpsUtils.getSslSocketFactory(new SafeTrustManager());
使
HttpsUtils.SSLParams sslParams3 = HttpsUtils.getSslSocketFactory(getAssets().open("srca
.cer"));
使bks使
HttpsUtils.SSLParams sslParams4 = HttpsUtils.getSslSocketFactory(getAssets().open("xxx
.bks"), "123456", getAssets().open("yyy.cer"));
*/
HttpsUtils.SSLParams sslParams1 = HttpsUtils.getSslSocketFactory();
/*Http
, , builder.hostnameVerifier()*/
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.addInterceptor(loggingInterceptor)
.readTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS)
.writeTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS)
.connectTimeout(OkGo.DEFAULT_MILLISECONDS, TimeUnit.MILLISECONDS)
.cookieJar(dbCookieJar1)
.sslSocketFactory(sslParams1.sSLSocketFactory, sslParams1.trustManager);
// 其他统一的配置(GitHub文档https://github.com/jeasonlzy/)
OkGo.getInstance().init(context)
//建议设置OkHttpClient不设置会使用默认的
.setOkHttpClient(builder.build())
//全局统一缓存模式,默认不使用缓存,可以不传
.setCacheMode(CacheMode.NO_CACHE)
//全局统一缓存时间,默认永不过期,可以不传
.setCacheTime(CacheEntity.CACHE_NEVER_EXPIRE)
//全局统一超时重连次数,默 认为三次那么最差的情况会请求4次(1次原始请求3次重连请求不需要可以设置为0)
.setRetryCount(3)
//全局公共头
.addCommonHeaders(headers)
//全局公共参数
.addCommonParams(params);
}
}

@ -0,0 +1,405 @@
package com.stu.assistant.net;
import android.content.Context;
import android.util.Log;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.HttpHeaders;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.model.Response;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.uitls.LogUtils;
import com.stu.assistant.uitls.NetworkUtil;
import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
public class OkGoNetUtil {
public static OkGoNetUtil okGoUtil;
public static Context mContext;
//
// public static OkGoNetUtil getInstance(Application context) {
// mContext = context;
// OkGoConfig.initOkGo(context);
// if (okGoUtil == null) {
// okGoUtil = new OkGoNetUtil();
// }
// return okGoUtil;
// }
/**
* @Description: ()
* @author stf msg application/json
* @date 2020/4/27
*/
public static void setHeard(String msg) {
HttpHeaders header = OkGo.getInstance().getCommonHeaders();
header.put("wh_token", msg);
OkGo.getInstance().addCommonHeaders(header);
}
//get 请求
public static <T> void getParam(final Class<T> tClass, final String url, final OnResultListener<T> responseOnListener) {
if (mContext == null) {
mContext = BaseApplion.application;
}
boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext);
if (!netWorkAvailable) {
responseOnListener.onError(NetConfig.NetError);
return;
}
OkGo.<String>get(url).tag(mContext).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
try {
String body = response.body();
// LogUtils.i("HX", "-getParam-->" + url + "-->\r\n" + body);
if (body != null) {
try {
T t = new Gson().fromJson(body, tClass);
responseOnListener.onSuccess(t, body);
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(NetConfig.DataError);
}
} else {
responseOnListener.onError(NetConfig.DataError);
}
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(e.getMessage());
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
responseOnListener.onConnectFail(NetConfig.ConnectError, response);
}
});
}
//post 请求
public static <T> void postParam(final Class<T> tClass, final String url, HashMap<String, String> map, final OnResultListener<T> responseOnListener) {
if (mContext == null) {
mContext = BaseApplion.application;
}
boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext);
if (!netWorkAvailable) {
responseOnListener.onError(NetConfig.NetError);
return;
}
JSONObject jsonObject = new JSONObject(map);
OkGo.<String>post(url).tag(mContext).upJson(jsonObject.toString()).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
String body = response.body();
LogUtils.i("HX", "-postParam-->" + url + "-->\r\n" + body);
if (body != null) {
try {
T t = new Gson().fromJson(body, tClass);
responseOnListener.onSuccess(t, body);
} catch (Exception e) {
e.fillInStackTrace();
Log.i("stf","---cuowu--->"+e.fillInStackTrace());
responseOnListener.onError(NetConfig.DataError);
}
} else {
Log.i("stf","---cuowu--->");
responseOnListener.onError(NetConfig.DataError);
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
responseOnListener.onConnectFail(NetConfig.ConnectError, response);
}
});
}
//post 请求
public static <T> void postParamString(final Class<T> tClass, HttpHeaders headers , final String url, HttpParams map, final OnResultListener<T> responseOnListener) {
if (mContext == null) {
mContext = BaseApplion.application;
}
boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext);
if (!netWorkAvailable) {
responseOnListener.onError(NetConfig.NetError);
return;
}
OkGo.<String>post(url).headers(headers).tag(mContext).params(map).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
String body = response.body();
LogUtils.i("HX", "-postParam-->" + url + "-->\r\n" + body);
if (body != null) {
try {
T t = new Gson().fromJson(body, tClass);
responseOnListener.onSuccess(t, body);
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(NetConfig.DataError);
}
} else {
responseOnListener.onError(NetConfig.DataError);
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
responseOnListener.onConnectFail(NetConfig.ConnectError, response);
}
});
}
public static <T> void postParam2(final Class<T> tClass, final String url, HashMap<String, Object> map, final OnResultListener<T> responseOnListener) {
if (mContext == null) {
mContext = BaseApplion.application;
}
boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext);
if (!netWorkAvailable) {
responseOnListener.onError(NetConfig.NetError);
return;
}
JSONObject jsonObject = new JSONObject(map);
OkGo.<String>post(url).tag(mContext).upJson(jsonObject.toString()).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
try {
String body = response.body();
LogUtils.i("HX", "-postParam-->" + url + "-->\r\n" + body);
if (body != null) {
try {
T t = new Gson().fromJson(body, tClass);
responseOnListener.onSuccess(t, body);
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(NetConfig.DataError);
}
} else {
responseOnListener.onError(NetConfig.DataError);
}
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(e.getMessage()!=null?e.getMessage():"");
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
responseOnListener.onConnectFail(NetConfig.ConnectError, response);
}
});
}
public static <T> void postParam3(final Class<T> tClass, final String url, String map, final OnResultListener<T> responseOnListener) {
if (mContext == null) {
mContext = BaseApplion.application;
}
boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext);
if (!netWorkAvailable) {
responseOnListener.onError(NetConfig.NetError);
return;
}
OkGo.<String>post(url).tag(mContext).upJson(map).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
try {
String body = response.body();
if (body != null) {
try {
T t = new Gson().fromJson(body, tClass);
responseOnListener.onSuccess(t, body);
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(NetConfig.DataError);
}
} else {
responseOnListener.onError(NetConfig.DataError);
}
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(e.getMessage());
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
responseOnListener.onConnectFail(NetConfig.ConnectError, response);
}
});
}
// 上传图片
public static <T> void postImgParam(final Class<T> tClass, final String url, ArrayList<File> list, final OnResultListener<T> responseOnListener) {
if (mContext == null) {
mContext = BaseApplion.application;
}
boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext);
if (!netWorkAvailable) {
responseOnListener.onError(NetConfig.NetError);
return;
}
OkGo.<String>post(url).tag(mContext).isMultipart(true).addFileParams("files", list).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
try {
String body = response.body();
if (body != null) {
try {
T t = new Gson().fromJson(body, tClass);
responseOnListener.onSuccess(t, body);
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(NetConfig.DataError);
}
} else {
responseOnListener.onError(NetConfig.DataError);
}
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(e.getMessage());
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
responseOnListener.onConnectFail(NetConfig.ConnectError, response);
}
});
}
// put 请求
public static <T> void putParam(final Class<T> tClass, final String url, HashMap<String, Object> map, final OnResultListener<T> responseOnListener) {
if (mContext == null) {
mContext = BaseApplion.application;
}
boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext);
if (!netWorkAvailable) {
responseOnListener.onError(NetConfig.NetError);
return;
}
JSONObject jsonObject = new JSONObject(map);
OkGo.<String>put(url).tag(mContext).upJson(jsonObject.toString()).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
try {
String body = response.body();
if (body != null) {
try {
T t = new Gson().fromJson(body, tClass);
responseOnListener.onSuccess(t, body);
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(NetConfig.DataError);
}
} else {
responseOnListener.onError(NetConfig.DataError);
}
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(e.getMessage());
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
responseOnListener.onConnectFail(NetConfig.ConnectError, response);
}
});
}
/**
*
* */
public static <T> void postThirdAppParam(final Class<T> tClass, final String url, HashMap map, final OnResultListener<T> responseOnListener) {
if (mContext == null) {
mContext = BaseApplion.application;
}
boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext);
if (!netWorkAvailable) {
responseOnListener.onError(NetConfig.NetError);
return;
}
JSONObject jsonObject = new JSONObject(map);
OkGo.<String>post(url).tag(mContext).upJson(jsonObject.toString()).execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
String body = response.body();
LogUtils.i("HX", "-postParam-->" + url + "-->\r\n" + body);
if (body != null) {
try {
T t = new Gson().fromJson(body, tClass);
responseOnListener.onSuccess(t, body);
} catch (Exception e) {
e.fillInStackTrace();
responseOnListener.onError(NetConfig.DataError);
}
} else {
responseOnListener.onError(NetConfig.DataError);
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
responseOnListener.onConnectFail(NetConfig.ConnectError, response);
}
});
}
public interface OnResultListener<T> {
void onSuccess(T bean, String json);
void onError(String e);
void onConnectFail(String msg, Response<String> response);
void onOutApp(String json);
}
}

@ -0,0 +1,11 @@
package com.stu.assistant.net.imp;
import com.lzy.okgo.model.Response;
public interface OnModleResultListener<T> {
void onSuccess(T bean);
void onError(String e);
void onConnectFail(String msg, Response<String> response);
}

@ -0,0 +1,77 @@
package com.stu.assistant.presenter;
import android.text.TextUtils;
import com.google.gson.Gson;
import com.stu.assistant.activity.LoginActivity;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.base.BasePresenter;
import com.stu.assistant.bean.UserInfoBean;
import com.stu.assistant.uitls.LogUtils;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import cn.bmob.v3.BmobUser;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;
public class LoginPresenter extends BasePresenter {
private LoginActivity activity;
public LoginPresenter(LoginActivity mAct) {
this.activity = mAct;
}
public void saveUser(UserInfoBean bean) {
SharedUtil.create(BaseApplion.application).putString(SharedConfig.loginName, bean.getUsername());
SharedUtil.create(BaseApplion.application).putString(SharedConfig.nickName, bean.getNickName());
SharedUtil.create(BaseApplion.application).putString(SharedConfig.whToken, bean.getSessionToken());
SharedUtil.create(BaseApplion.application).putString(SharedConfig.objectId, bean.getObjectId());
SharedUtil.create(BaseApplion.application).putString(SharedConfig.userLevel, bean.getUserLevel());
SharedUtil.create(BaseApplion.application).putString(SharedConfig.userType, bean.getUserType());
SharedUtil.create(BaseApplion.application).putBoolean(SharedConfig.isLogin, true);
}
public boolean getIsLogin() {
return SharedUtil.create(BaseApplion.application).getBoolean(SharedConfig.isLogin, false);
}
public void loginIn(String usertNameEditMsg, String usertPasswordEditMsg, OnLoginResultListener loginResultListener) {
if (TextUtils.isEmpty(usertNameEditMsg)) {
loginResultListener.errorMsg("请输入账号");
return;
}
if (TextUtils.isEmpty(usertPasswordEditMsg)) {
loginResultListener.errorMsg("请输入密码");
return;
}
activity.showProDialog("正在登录,请稍后...");
UserInfoBean userInfoBean = new UserInfoBean();
userInfoBean.setUsername(usertNameEditMsg);
userInfoBean.setPassword(usertPasswordEditMsg);
userInfoBean.login(new SaveListener<UserInfoBean>() {
@Override
public void done(UserInfoBean userInfoBean1, BmobException e) {
activity.dismissProDialog();
if (e == null) {
UserInfoBean user = BmobUser.getCurrentUser(UserInfoBean.class);
LogUtils.i("hx","-UserInfoBean--->"+new Gson().toJson(user));
saveUser(user);
loginResultListener.isSucLogin(user);
} else {
LogUtils.i("hx","-登录失败--->"+e.getMessage());
loginResultListener.errorMsg("用户或密码不正确");
}
}
});
}
public interface OnLoginResultListener {
void isSucLogin(UserInfoBean bean);
void errorMsg(String msg);
}
}

@ -0,0 +1,21 @@
package com.stu.assistant.presenter;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseApplion;
import com.stu.assistant.bean.MainModuleBean;
import com.stu.assistant.constants.ConstansItemManager;
import com.stu.assistant.constants.ConstansUserManager;
import com.stu.assistant.uitls.SharedConfig;
import com.stu.assistant.uitls.SharedUtil;
import java.util.ArrayList;
public class MainPresenter {
public ArrayList<MainModuleBean> getData() {
ArrayList moduleBeansList = new ArrayList<>();
moduleBeansList.add(new MainModuleBean("课表", ConstansItemManager.item_1, R.mipmap.ic_timetable));
moduleBeansList.add(new MainModuleBean("作业", ConstansItemManager.item_2, R.mipmap.ic_task));
moduleBeansList.add(new MainModuleBean("设置", ConstansItemManager.item_3, R.mipmap.ic_setting));
return moduleBeansList;
}
}

@ -0,0 +1,38 @@
package com.stu.assistant.presenter;
import com.stu.assistant.activity.RegisterActivity;
import com.stu.assistant.base.BasePresenter;
import com.stu.assistant.bean.UserInfoBean;
import com.stu.assistant.uitls.MyToast;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;
public class RegisterPresenter extends BasePresenter {
RegisterActivity mActivity;
public RegisterPresenter(RegisterActivity mActivity) {
this.mActivity = mActivity;
}
public void registerUser(UserInfoBean userBean, OnRegisterListener listener) {
mActivity.showProDialog("正在注册....");
userBean.signUp(new SaveListener<UserInfoBean>() {
@Override
public void done(UserInfoBean objectId, BmobException e) {
mActivity.dismissProDialog();
if (e == null) {
MyToast.show("注册成功");
listener.registerListener(userBean);
} else {
MyToast.show("注册失败:" + e.getMessage());
}
}
});
}
public interface OnRegisterListener {
void registerListener(UserInfoBean userInfoBean);
}
}

@ -0,0 +1,852 @@
package com.stu.assistant.uitls;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.ViewConfiguration;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* app
*
* @author Administrator
*/
@SuppressLint("SimpleDateFormat")
public class AppTools {
/**
*
*/
public static int getCurrentMonthDay() {
Calendar a = Calendar.getInstance();
a.set(Calendar.DATE, 1);
a.roll(Calendar.DATE, -1);
int maxDate = a.get(Calendar.DATE);
return maxDate;
}
/**
*
*/
public static int getDate() {
Calendar a = Calendar.getInstance();
return a.get(Calendar.DATE);
}
/**
* applicationmeta-data
*
* @return ( )
*/
public static String getAppMetaData(Context ctx, String key) {
if (ctx == null || TextUtils.isEmpty(key)) {
return null;
}
String resultData = null;
try {
PackageManager packageManager = ctx.getPackageManager();
if (packageManager != null) {
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(ctx.getPackageName(), PackageManager.GET_META_DATA);
if (applicationInfo != null) {
if (applicationInfo.metaData != null) {
resultData = applicationInfo.metaData.getString(key);
}
}
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return resultData;
}
// 32MD5加密
public static String getMD5(String plainText) {
String re_md5 = new String();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(plainText.getBytes());
byte b[] = md.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0) {
i += 256;
}
if (i < 16) {
buf.append("0");
}
buf.append(Integer.toHexString(i));
}
re_md5 = buf.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return re_md5;
}
/**
*
*
* @param timestamp yyyy-MM-dd HH:mm:ss
* @return
*/
public static String timestampTotime(long timestamp, String type) {
timestamp = timestamp * 1000;
SimpleDateFormat sdf = new SimpleDateFormat(type);
Date date = new Date(timestamp);
return sdf.format(date);
}
/**
*
*
* @param timestamp yyyy-MM-dd HH:mm:ss
* @return
*/
public static String timestampTotimeData(long timestamp, String type) {
SimpleDateFormat sdf = new SimpleDateFormat(type);
Date date = new Date(timestamp);
return sdf.format(date);
}
/**
*
*
* @param format yyyy-MM-dd HH:mm:ss
* @return
*/
public static long date2TimeStamp(String date_str, String format) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
long a = sdf.parse(date_str).getTime() / 1000;
return a;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
/**
*
*
* @param format yyyy-MM-dd HH:mm:ss
* @return
*/
public static long dateTimeStamp(String date_str, String format) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(format);
long a = sdf.parse(date_str).getTime();
return a;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
/**
*
*
* @param
* @return
*/
public static long getCurrentTimeStamp(String date_str) {
//设置时间格式
SimpleDateFormat formatter = new SimpleDateFormat(date_str);//得到当前时间
String currentTime = formatter.format(new Date());
Date date = null;
try {
date = formatter.parse(currentTime);
} catch (ParseException e) {
e.printStackTrace();
}
//当前时间戳
return date.getTime();
}
// 获取接口名,读取asset文件名
public static String urlToFilename(String url) {
String[] apiName = url.split("/");
String api_h = apiName[apiName.length - 1];
return api_h.replace("html", "xml");
}
// 判断字符串是否为空
public static boolean checkStringNoNull(String paramString) {
return paramString != null && paramString.length() > 0;
}
// 验证邮箱
public static boolean checkEmail(String email) {
String regex = "\\w+@\\w+\\.[a-z]+(\\.[a-z]+)?";
return Pattern.matches(regex, email);
}
// 科学计数法转换成数字 保留两位小数
public static String scienceTwoNum(Double value) {
DecimalFormat df = new DecimalFormat("0.00");
return df.format(value);
}
// 科学计数法转换成数字 保留一位小数
public static String scienceOne(Double value) {
DecimalFormat df = new DecimalFormat("##0.0");
return df.format(value);
}
/**
*
*
* @EditTime 2007-8-13 11:45:28
*/
public static byte[] getBytesFromFile(File f) {
if (f == null) {
return null;
}
try {
FileInputStream stream = new FileInputStream(f);
ByteArrayOutputStream out = new ByteArrayOutputStream(1000);
byte[] b = new byte[1000];
int n;
while ((n = stream.read(b)) != -1) {
out.write(b, 0, n);
}
stream.close();
out.close();
return out.toByteArray();
} catch (IOException e) {
}
return null;
}
// 判断手机号是否合法
public static boolean checkIphoneNumber(String name) {
/*
* 134135136137138139150151157(TD)158159187188
* 130131132152155156185186 1331531801891349
* 135780-9
*/
String telRegex = "[1][12345789]\\d{9}";// "[1]"代表第1位为数字1"[358]"代表第二位可以为3、5、8中的一个"\\d{9}"代表后面是可以是09的数字有9位。
if (TextUtils.isEmpty(name)) {
return false;
} else {
return name.matches(telRegex);
}
}
// 固定电话正则
public static boolean checkTelephoneNumber(String name) {
String telRegex1 = "[0]\\d{11}";
String telRegex2 = "[0]\\d{10}";// [1]"代表第1位为数字1"[358]"代表第二位可以为3、5、8中的一个"\\d{9}"代表后面是可以是09的数字有9位。
if (TextUtils.isEmpty(name)) {
return false;
} else {
return name.matches(telRegex1) || name.matches(telRegex2);
}
}
// 邮编的正则
public static boolean checkPostcode(String name) {
String telRegex = "[1-9]\\d{5}";//
if (TextUtils.isEmpty(name)) {
return false;
} else {
return name.matches(telRegex);
}
}
// 正则表达式判断用户名是否合法
public static boolean checkPwd(String name) {
if (name.length() >= 8 && name.length() <= 16) {
Pattern p1 = Pattern.compile("[a-zA-Z]+");
Pattern p2 = Pattern.compile("[0-9]+");
Matcher m = p1.matcher(name);
if (!m.find()) {
return false;
} else {
// m = p2.matcher(name);
m.reset().usePattern(p2);
return m.find();
}
} else {
return false;
}
}
// 正则表达式判断用户名是否合法
public static boolean checkrealPwd(String name) {
if (name.length() >= 5 && name.length() <= 15) {
Pattern p1 = Pattern.compile("[a-zA-Z]+");
Pattern p2 = Pattern.compile("[0-9]+");
Matcher m = p1.matcher(name);
if (!m.find()) {
return false;
} else {
// m = p2.matcher(name);
m.reset().usePattern(p2);
return m.find();
}
} else {
return false;
}
}
// 判断名字是否正确
public static boolean checkRealName(String email) {
String regex = "[\u4E00-\u9FA5]{2,}";
return Pattern.matches(regex, email);
}
// 获取转换后的img
public static Drawable getDrawable(Context context, int Rid) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.RGB_565;
opt.inPurgeable = true;
opt.inInputShareable = true;
opt.inSampleSize = 2;
InputStream is = context.getResources().openRawResource(Rid);
Bitmap bm = BitmapFactory.decodeStream(is, null, opt);
BitmapDrawable bd = new BitmapDrawable(context.getResources(), bm);
return bd;
}
/**
*
*
* @param pid
* @return
*/
public static String getProcessName(int pid) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader("/proc/" + pid + "/cmdline"));
String processName = reader.readLine();
if (!TextUtils.isEmpty(processName)) {
processName = processName.trim();
}
return processName;
} catch (Throwable throwable) {
throwable.printStackTrace();
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException exception) {
exception.printStackTrace();
}
}
return null;
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static boolean hasSoftKeys(WindowManager windowManager) {
Display d = windowManager.getDefaultDisplay();
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
d.getRealMetrics(realDisplayMetrics);
int realHeight = realDisplayMetrics.heightPixels;
int realWidth = realDisplayMetrics.widthPixels;
DisplayMetrics displayMetrics = new DisplayMetrics();
d.getMetrics(displayMetrics);
int displayHeight = displayMetrics.heightPixels;
int displayWidth = displayMetrics.widthPixels;
return (realWidth - displayWidth) > 0 || (realHeight - displayHeight) > 0;
}
public static int getVersionCode(Context context) {
PackageManager manager = context.getPackageManager();
int code = 0;
try {
PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
code = info.versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return code;
}
//base64编码
public static String makeUidToBase64(String uid) {
String enUid = new String(Base64.encode(uid.getBytes(), Base64.DEFAULT));
return enUid;
}
//解码
public static String getUidFromBase64(String base64Id) {
String result = "";
if (!TextUtils.isEmpty(base64Id)) {
if (!TextUtils.isEmpty(base64Id)) {
result = new String(Base64.decode(base64Id.getBytes(), Base64.DEFAULT));
}
}
return result;
}
//提取出字符串里的数字改变数字的大小和颜色
public static SpannableStringBuilder setNumColor(String str) {
SpannableStringBuilder style = new SpannableStringBuilder(str);
for (int i = 0; i < str.length(); i++) {
char a = str.charAt(i);
if (a >= '0' && a <= '9') {
style.setSpan(new ForegroundColorSpan(Color.RED), i, i + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
// style.setSpan(new RelativeSizeSpan(3.0f), i, i + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
return style;
}
/**
*
*/
@SuppressWarnings("deprecation")
public static int getScreenWidth(Context context) {
WindowManager manager = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
return display.getWidth();
}
/**
*
*/
@SuppressWarnings("deprecation")
public static int getScreenHeight(Context context) {
WindowManager manager = (WindowManager) context
.getSystemService(Context.WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
return display.getHeight();
}
public static int getScreenHeightTotal(Context context) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics dm = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(dm);
return dm.heightPixels;
}
/**
* dp px()
*/
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
*
*
* @param packageName
* @return
*/
public static boolean isInstalled(Context mContext, String packageName) {
PackageManager manager = mContext.getPackageManager();
//获取所有已安装程序的包信息
List<PackageInfo> installedPackages = manager.getInstalledPackages(0);
if (installedPackages != null) {
for (PackageInfo info : installedPackages) {
if (info.packageName.equals(packageName)) {
return true;
}
}
}
return false;
}
/*
*
* */
public static void copy(Context context, String txt) {
try {
ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData mClipData = ClipData.newPlainText("Label", txt);
cm.setPrimaryClip(mClipData);
Toast.makeText(context, "复制成功", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Toast.makeText(context, "复制失败,请重新尝试", Toast.LENGTH_SHORT).show();
}
}
/*
*
* */
public static void callTel(Context context, String phone) {
try {
Intent intent = new Intent(Intent.ACTION_DIAL);
Uri data = Uri.parse("tel:" + phone);
intent.setData(data);
context.startActivity(intent);
} catch (Exception e) {
Toast.makeText(context, "拨打失败", Toast.LENGTH_SHORT).show();
}
}
public static Date strToDate(String time) {
SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy-MM-dd");
try {
Date beginTime = CurrentTime.parse(time);
return beginTime;
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public static String getYMD() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public static int getM() {
SimpleDateFormat dff = new SimpleDateFormat("MM");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return Integer.parseInt(dateString);
}
/**
* @author stf
* @time 2019-03-14 15:39
* @remark
* 0
* date1 date2 -1
* date1 date2 1
*/
public static int timeCompare(Date d1, Date d2) {
int i = 0;
if (d1.compareTo(d2) > 0) {
i = 1;
} else if (d1.compareTo(d2) < 0) {
i = -1;
} else if (d1.compareTo(d2) == 0) {
i = 0;
}
return i;
}
//获取是否存在NavigationBar
public static boolean checkDeviceHasNavigationBar(Activity context) {
//通过判断设备是否有返回键、菜单键(不是虚拟键,是手机屏幕外的按键)来确定是否有navigation bar
boolean hasMenuKey = ViewConfiguration.get(context)
.hasPermanentMenuKey();
boolean hasBackKey = KeyCharacterMap
.deviceHasKey(KeyEvent.KEYCODE_BACK);
if (!hasMenuKey && !hasBackKey) {
// 做任何你需要做的,这个设备有一个导航栏
return true;
}
return false;
}
/**
*
*/
public static synchronized String getAppName(Context context) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(
context.getPackageName(), 0);
int labelRes = packageInfo.applicationInfo.labelRes;
return context.getResources().getString(labelRes);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* []
*
* @param context
* @return
*/
public static synchronized String getVersionName(Context context) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(
context.getPackageName(), 0);
return packageInfo.versionName;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* []
*
* @param context
* @return
*/
public static synchronized String getPackageName(Context context) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(
context.getPackageName(), 0);
return packageInfo.packageName;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* bitmap
*
* @param context
*/
public static synchronized Bitmap getBitmap(Context context) {
PackageManager packageManager = null;
ApplicationInfo applicationInfo = null;
try {
packageManager = context.getApplicationContext()
.getPackageManager();
applicationInfo = packageManager.getApplicationInfo(
context.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
applicationInfo = null;
}
Drawable d = packageManager.getApplicationIcon(applicationInfo); //xxx根据自己的情况获取drawable
BitmapDrawable bd = (BitmapDrawable) d;
Bitmap bm = bd.getBitmap();
return bm;
}
public static int getStatusBarHeight(Context context) {
Class<?> c = null;
Object obj = null;
java.lang.reflect.Field field = null;
int x = 0;
int statusBarHeight = 0;
try {
c = Class.forName(context.getPackageName());
obj = c.newInstance();
field = c.getField("status_bar_height");
x = Integer.parseInt(field.get(obj).toString());
statusBarHeight = context.getResources().getDimensionPixelSize(x);
return statusBarHeight;
} catch (Exception e) {
e.printStackTrace();
}
return statusBarHeight;
}
/**
* 1 man 2 girl
*/
public static int isSex(String idCard) {
if (!TextUtils.isEmpty(idCard) && idCard.length() == 18) {
if (Integer.parseInt(idCard.substring(16, 17)) % 2 == 0) {
return 2;
} else {
return 1;
}
}
return 0;
}
public static String getRunningActivityName(Activity context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
String runningActivity = activityManager.getRunningTasks(1).get(0).topActivity.getClassName();
return runningActivity;
}
/**
* ArrayList
*/
public static ArrayList singleElement(ArrayList al) {
ArrayList newAl = new ArrayList();
for (Iterator it = al.iterator(); it.hasNext(); ) {
Object obj = it.next();
if (!newAl.contains(obj)) {
newAl.add(obj);
}
}
return newAl;
}
/**
* @Description: ()
* @author Bowen
* @date 2021/5/14
*/
public static Boolean getModelXDL() {
String model = Build.MODEL;
if (model.indexOf("3280") != -1) {
return true;
} else {
return false;
}
}
/**
* @Description: ()使X5WebView
* @author Bowen
* @date 2021/5/14
*/
private static final Boolean useX5Webview = false;
public static Boolean isUseX5Webview() {
if ((Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) && useX5Webview) {
return true;
} else {
return false;
}
}
/**
* activity
*
* @return true false
*/
public static boolean isActivityTop(Context context, Class cls) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
String name = manager.getRunningTasks(1).get(0).topActivity.getClassName();
return name.equals(cls.getName());
}
/**
* @Description: ()
* @author stf
* @date 2021/9/2
*/
public static boolean isTabletDevice(Context context) {
boolean isFlag = (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >=
Configuration.SCREENLAYOUT_SIZE_LARGE;
return isFlag;
}
public static void setTvIcn(Context mContext, TextView tv, int id) {
try {
Drawable drawable = mContext.getResources().getDrawable(id);
tv.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
tv.setCompoundDrawablePadding(dip2px(mContext, 10));
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tv.getLayoutParams();
lp.topMargin = AppTools.dip2px(mContext, 10);
tv.setLayoutParams(lp);
} catch (Exception e) {
e.fillInStackTrace();
}
}
public static int strIncludeMsgCount(String str, String s) {
int count = 0; // 初始值
//一共有str.length()的循环次数
for (int i = 0; i < str.length(); ) {
int c = -1;
c = str.indexOf(s);
//如果有S这样的子串。则C的值不是-1.
if (c != -1) { // 如果c=-1则说明不在在
//这里的c+1 而不是 c+ s.length();这是因为。如果str的字符串是“aaaa” s = “aa”则结果是2个。但是实际上是3个子字符串
//将剩下的字符冲洗取出放到str中
str = str.substring(c + 1); // 从存在的那个下标后一位开始
count++;
} else {
break;
}
}
return count;
}
}

@ -0,0 +1,19 @@
package com.stu.assistant.uitls;
import android.util.Log;
public class BtnClickUtil {
// 两次点击按钮之间的点击间隔不能少于1000毫秒
private static final int MIN_CLICK_DELAY_TIME = 1000;
private static long lastClickTime;
public static boolean getIsOk(){
long curClickTime = System.currentTimeMillis();
Log.i("stf","-BtnClickUtil--->"+(curClickTime - lastClickTime));
if((curClickTime - lastClickTime) >= MIN_CLICK_DELAY_TIME) {
// 超过点击间隔后再将lastClickTime重置为当前点击时间
lastClickTime = curClickTime;
return true;
}
return false;
}
}

@ -0,0 +1,805 @@
package com.stu.assistant.uitls;
import android.annotation.SuppressLint;
import android.text.TextUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
/**
*
*/
public class CalendarUtil {
private static CalendarUtil calendarUtil;
public static CalendarUtil getInstance() {
if (calendarUtil == null) {
synchronized (CalendarUtil.class) {
if (calendarUtil == null) {
calendarUtil = new CalendarUtil();
}
}
}
return calendarUtil;
}
public String getTime(Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return format.format(date);
}
public String getTime2(Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
return format.format(date);
}
public String longToStr(long time) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date(time);
return format.format(date);
}
public String getYMDHMS() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
// return "2021-09-23 "+getMDS();
return dateString;
}
public String getYMDHM() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd HH:mm");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public String getYMD() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public String getYMD3() {
SimpleDateFormat dff = new SimpleDateFormat("yyyyMMdd");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
// return "2021-09-23";
return dateString;
}
public String getYMD2() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy年MM月");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public String getMD() {
SimpleDateFormat dff = new SimpleDateFormat("MM-dd");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public String getMDS() {
SimpleDateFormat dff = new SimpleDateFormat("HH:mm:ss");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public String getTimeYMDHM(Date date) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
return format.format(date);
}
public int getS() {
SimpleDateFormat dff = new SimpleDateFormat("ss");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return Integer.parseInt(dateString);
}
public int getY() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return Integer.parseInt(dateString);
}
public String getY2() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public int getDataY() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy");
String dateString = dff.format(
new Date(System.currentTimeMillis()));
return Integer.parseInt(dateString);
}
public int getM() {
SimpleDateFormat dff = new SimpleDateFormat("mm");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return Integer.parseInt(dateString);
}
public int getM2() {
SimpleDateFormat dff = new SimpleDateFormat("MM");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return Integer.parseInt(dateString);
}
public String getYMDHM(String addTime) {
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd HH:mm");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
try {
int add = Integer.parseInt(addTime);
Date date = dff.parse(dateString);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MINUTE, add);
Date time = calendar.getTime();
String format = dff.format(time);
return format;
} catch (Exception e) {
e.printStackTrace();
return dateString;
}
}
public String getDHMS() {
SimpleDateFormat dff = new SimpleDateFormat("dd-HH-mm-ss");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public String getYMDHMSLine() {
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
return dateString;
}
public String dateFormtHMS(String time) {
try {
SimpleDateFormat dff = new SimpleDateFormat("HH:mm:ss");
return dff.format(time);
} catch (Exception e) {
e.fillInStackTrace();
return time;
}
}
public String dateFormtHms(Date time) {
SimpleDateFormat dff = new SimpleDateFormat("HH:mm:ss");
try {
return dff.format(time);
} catch (Exception e) {
e.fillInStackTrace();
return dff.format(time);
}
}
public String dateFormtHM(Date time) {
SimpleDateFormat dff = new SimpleDateFormat("HH:mm");
try {
return dff.format(new Date());
} catch (Exception e) {
e.fillInStackTrace();
return dff.format(time);
}
}
public String dateFormtH(Date time) {
SimpleDateFormat dff = new SimpleDateFormat("HH");
try {
return dff.format(time);
} catch (Exception e) {
e.fillInStackTrace();
return dff.format(time);
}
}
public String dateFormtYMD(String time) {
try {
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd");
return dff.format(time);
} catch (Exception e) {
e.fillInStackTrace();
return time;
}
}
public String dateFormtYMD2(Date time) {
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd");
try {
return dff.format(time);
} catch (Exception e) {
e.fillInStackTrace();
return dff.format(time);
}
}
public String dateFormtHours(long time) {
Date date = new Date(time);
int hours = date.getHours();
return hours + "";
}
public String dateFormtH(String time) {
try {
SimpleDateFormat dff = new SimpleDateFormat("HH");
return dff.format(time);
} catch (Exception e) {
e.fillInStackTrace();
return time;
}
}
/**
* @author stf
* @time 2019-03-14 15:39
* @remark
* 0
* date1 date2 -1
* date1 date2 1
*/
public int timeCompare(Date d1, Date d2) {
int i = 0;
if (d1.compareTo(d2) > 0) {
i = 1;
} else if (d1.compareTo(d2) < 0) {
i = -1;
} else if (d1.compareTo(d2) == 0) {
i = 0;
}
return i;
}
/**
* @author stf
* @time 2019-03-14 15:45
* @remark 0
* date1 date2 -1
* date1 date2 1
*/
public static int timeCompare(String date1, String date2) {
try {
SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date beginTime = CurrentTime.parse(date1);// 它在后面的时候使用第一个token
Date endTime = CurrentTime.parse(date2); // 它在后面的时候使用第二个token
int i = 0;
if (beginTime.compareTo(endTime) > 0) {
i = 1;
} else if (beginTime.compareTo(endTime) < 0) {
i = -1;
} else if (beginTime.compareTo(endTime) == 0) {
i = 0;
}
return i;
} catch (Exception e) {
e.fillInStackTrace();
return -1;
}
}
public int timeCompareYMDHM(String date1, String date2) {
try {
SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Date beginTime = CurrentTime.parse(date1);// 它在后面的时候使用第一个token
Date endTime = CurrentTime.parse(date2); // 它在后面的时候使用第二个token
int i = 0;
if (beginTime.compareTo(endTime) > 0) {
i = 1;
} else if (beginTime.compareTo(endTime) < 0) {
i = -1;
} else if (beginTime.compareTo(endTime) == 0) {
i = 0;
}
return i;
} catch (Exception e) {
e.fillInStackTrace();
return -1;
}
}
public int timeCompareYMD(String date1, String date2) {
try {
SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy-MM-dd");
Date beginTime = CurrentTime.parse(date1);// 它在后面的时候使用第一个token
Date endTime = CurrentTime.parse(date2); // 它在后面的时候使用第二个token
int i = 0;
if (beginTime.compareTo(endTime) > 0) {
i = 1;
} else if (beginTime.compareTo(endTime) < 0) {
i = -1;
} else if (beginTime.compareTo(endTime) == 0) {
i = 0;
}
return i;
} catch (Exception e) {
e.fillInStackTrace();
return -1;
}
}
public int timeCompares(String date1, String date2) {
try {
SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy-MM-dd");
Date beginTime = CurrentTime.parse(date1);// 它在后面的时候使用第一个token
Date endTime = CurrentTime.parse(date2); // 它在后面的时候使用第二个token
int i = 0;
if (beginTime.compareTo(endTime) > 0) {
i = 1;
} else if (beginTime.compareTo(endTime) < 0) {
i = -1;
} else if (beginTime.compareTo(endTime) == 0) {
i = 0;
}
return i;
} catch (Exception e) {
e.fillInStackTrace();
return -1;
}
}
/**
* @author stf
* @time 2019-03-27 22:46
* @remark
*/
public Boolean isIntime(String time) {
// 两个时间做对比
String ymdhms = CalendarUtil.getInstance().getYMDHMS();
return (CalendarUtil.getInstance().timeCompare(time, ymdhms) == 1);
}
/**
* @author stf
* @time 2019-04-05 00:14
* @remark date
*/
public Date strToDate(String time) {
SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date beginTime = CurrentTime.parse(time);
return beginTime;
} catch (ParseException e) {
e.printStackTrace();
return strToDate(getYMDHMS());
}
}
public Date strToDate2(String time2) {
SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy-MM-dd");
try {
Date beginTime = CurrentTime.parse(time2);
return beginTime;
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public Date strToDate3(String time2) {
SimpleDateFormat CurrentTime = new SimpleDateFormat("HH:mm");
try {
Date beginTime = CurrentTime.parse(time2);
return beginTime;
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
public Date strToDateYMDHM(String time) {
SimpleDateFormat CurrentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date beginTime = CurrentTime.parse(time);
return beginTime;
} catch (ParseException e) {
e.printStackTrace();
return strToDate(getYMDHM());
}
}
/**
* @author stf
* @time 2019-04-05 00:11
* @remark
*/
public String getBeforeDay(Date date, int day) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (day == 99) {
calendar.add(Calendar.MONTH, -1);
} else {
calendar.add(Calendar.DAY_OF_MONTH, day);
}
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
}
/**
* @author stf
* @time 2019-04-05 00:11
* @remark
*/
public Date getBeforeDayTime(Date date, int day) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (day == 99) {
calendar.add(Calendar.MONTH, -1);
} else {
calendar.add(Calendar.DAY_OF_MONTH, day);
}
Date time = calendar.getTime();
return time;
}
public String setAddYear(Date date, int year) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.YEAR, year);
calendar.add(Calendar.DAY_OF_YEAR, -1);
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
}
public Date setAddYear2(Date date, int year) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.YEAR, year);
calendar.add(Calendar.DAY_OF_YEAR, -1);
Date time = calendar.getTime();
return time;
}
public String setAddYear(String nowTime, int year) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
try {
date = formatter.parse(nowTime);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.YEAR, year);
calendar.add(Calendar.DAY_OF_YEAR, -1);
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public String setJianYear(Date date, int year) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.YEAR, -year);
calendar.add(Calendar.DAY_OF_YEAR, 1);
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
}
public String setJianMonth(Date date, int month) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, -month);
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
}
public String setJianMonth2(Date date, int month) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, -month);
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
}
public String setAddDay(Date date, int day) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, day);
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
}
public String setJianDay(Date date, int day) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, -day);
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
}
public String getBeforeDay(String date1, int day) {
Date date = strToDate(date1);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (day == 99) {
calendar.add(Calendar.MONTH, -1);
} else {
calendar.add(Calendar.DAY_OF_MONTH, day);
}
Date time = calendar.getTime();
String format = formatter.format(time);
return format;
}
/**
* @author stf
* @time 2019-04-05 00:22
* @remark
*/
public long getTimeOfWeekStart() {
Calendar ca = Calendar.getInstance();
ca.set(Calendar.HOUR_OF_DAY, 0);
ca.clear(Calendar.MINUTE);
ca.clear(Calendar.SECOND);
ca.clear(Calendar.MILLISECOND);
ca.set(Calendar.DAY_OF_WEEK, (ca.getFirstDayOfWeek() + Calendar.SUNDAY));
return ca.getTimeInMillis();
}
/**
* @author stf
* @time 2019-04-05 00:22
* @remark
*/
public long getTimeOfMonthStart() {
Calendar ca = Calendar.getInstance();
ca.set(Calendar.HOUR_OF_DAY, 0);
ca.clear(Calendar.MINUTE);
ca.clear(Calendar.SECOND);
ca.clear(Calendar.MILLISECOND);
ca.set(Calendar.DAY_OF_MONTH, 1);
return ca.getTimeInMillis();
}
//获取本周当于本周属于本地第几周
public int getTimeOfMonth() {
Calendar cal = Calendar.getInstance();//这一句必须要设置,否则美国认为第一天是周日,而我国认为是周一,对计算当期日期是第几周会有错误
cal.setFirstDayOfWeek(Calendar.MONDAY); // 设置每周的第一天为星期一
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);// 每周从周一开始
cal.setMinimalDaysInFirstWeek(7); // 设置每周最少为7天
cal.setTime(new Date());
int weeks = cal.get(Calendar.WEEK_OF_MONTH);
return weeks;
}
/**
* @author stf
* @time 2019-04-05 00:22
* @remark
*/
public long getTimeOfYearStart() {
Calendar ca = Calendar.getInstance();
ca.set(Calendar.HOUR_OF_DAY, 0);
ca.clear(Calendar.MINUTE);
ca.clear(Calendar.SECOND);
ca.clear(Calendar.MILLISECOND);
ca.set(Calendar.DAY_OF_YEAR, 1);
return ca.getTimeInMillis();
}
public int getTimeOfYear() {
Calendar cal = Calendar.getInstance();//这一句必须要设置,否则美国认为第一天是周日,而我国认为是周一,对计算当期日期是第几周会有错误
cal.setFirstDayOfWeek(Calendar.MONDAY); // 设置每周的第一天为星期一
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);// 每周从周一开始
cal.setMinimalDaysInFirstWeek(7); // 设置每周最少为7天
cal.setTime(new Date());
int weeks = cal.get(Calendar.WEEK_OF_YEAR);
return weeks;
}
//获得本周一0点时间
@SuppressLint("WrongConstant")
public int getTimesWeekmorning() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
return (int) (cal.getTimeInMillis() / 1000);
}
//获得本周日24点时间
@SuppressLint("WrongConstant")
public int getTimesWeeknight() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
return (int) ((cal.getTime().getTime() + (7 * 24 * 60 * 60 * 1000)) / 1000);
}
//获得本月第一天0点时间
@SuppressLint("WrongConstant")
public int getTimesMonthmorning() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
return (int) (cal.getTimeInMillis() / 1000);
}
//获得本月最后一天24点时间
@SuppressLint("WrongConstant")
public int getTimesMonthnight() {
Calendar cal = Calendar.getInstance();
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONDAY), cal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
cal.set(Calendar.HOUR_OF_DAY, 24);
return (int) (cal.getTimeInMillis() / 1000);
}
//获得当天0点时间
public int getTimesmorning() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return (int) (cal.getTimeInMillis() / 1000);
}
//获得当天24点时间
public long getTimesnight() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 24);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTimeInMillis();
}
/**
* 18
*
* @return
* @throws Exception
*/
public static Map<String, String> getCarInfo(String CardCode)
throws Exception {
Map<String, String> map = new HashMap<String, String>();
if (TextUtils.isEmpty(CardCode)) return map;
String year = CardCode.substring(6).substring(0, 4);// 得到年份
String yue = CardCode.substring(10).substring(0, 2);// 得到月份
String day = CardCode.substring(12).substring(0, 2);//得到日
String sex;
if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
sex = "女";
} else {
sex = "男";
}
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
// Date date = new Date();// 得到当前的系统时间
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String fyear = dateString.substring(0, 4);// 当前年份
String fyue = dateString.substring(5, 7);// 月份
// String fday=format.format(date).substring(8,10);
int age = 0;
if (Integer.parseInt(fyue) <= Integer.parseInt(yue)) { // 当前月份大于用户出身的月份表示已过生
age = Integer.parseInt(fyear) - Integer.parseInt(year) - 1;
} else {// 当前用户还没过生
age = Integer.parseInt(fyear) - Integer.parseInt(year);
}
map.put("sex", sex);
if (sex.equals("男")) {
map.put("sexType", "1");
} else {
map.put("sexType", "2");
}
map.put("age", age + "");
map.put("year", year + "-" + yue + "-" + day);
return map;
}
/**
* 15
*
* @param
* @throws Exception
*/
public static Map<String, String> getCarInfo15W(String card)
throws Exception {
Map<String, String> map = new HashMap<String, String>();
String uyear = "19" + card.substring(6, 8);// 年份
String uyue = card.substring(8, 10);// 月份
// String uday=card.substring(10, 12);//日
String usex = card.substring(14, 15);// 用户的性别
String sex;
if (Integer.parseInt(usex) % 2 == 0) {
sex = "女";
} else {
sex = "男";
}
SimpleDateFormat dff = new SimpleDateFormat("yyyy-MM-dd");
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String dateString = dff.format(new Date());
// Date date = new Date();// 得到当前的系统时间
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String fyear = dateString.substring(0, 4);// 当前年份
String fyue = dateString.substring(5, 7);// 月份
// String fday=format.format(date).substring(8,10);
int age = 0;
if (Integer.parseInt(uyue) <= Integer.parseInt(fyue)) { // 当前月份大于用户出身的月份表示已过生
// age = Integer.parseInt(fyear) - Integer.parseInt(uyear);
age = Integer.parseInt(fyear) - Integer.parseInt(uyear) + 1;
} else {// 当前用户还没过生
age = Integer.parseInt(fyear) - Integer.parseInt(uyear);
}
map.put("sex", sex);
map.put("age", age + "");
return map;
}
public static int getAge(String idNo) {
int age = 0;
try {
Map<String, String> carInfo = getCarInfo(idNo);
age = Integer.parseInt(carInfo.get("age"));
} catch (Exception e) {
e.printStackTrace();
return 0;
}
return age;
}
}

@ -0,0 +1,92 @@
package com.stu.assistant.uitls;
import android.app.Activity;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
/**
*
*
* */
public class ChenJingEditUil {
public static void assistActivity(Activity activity) {
new ChenJingEditUil(activity);
}
private Activity activity;
private View mChildOfContent;
private int usableHeightPrevious;
private FrameLayout.LayoutParams frameLayoutParams;
private int contentHeight;//获取setContentView本来view的高度
private boolean isfirst = true;//只用获取一次
private int statusBarHeight;//状态栏高度
private ChenJingEditUil(Activity activity) {
this.activity = activity;
//1、找到Activity的最外层布局控件它其实是一个DecorView,它所用的控件就是FrameLayout
FrameLayout content = (FrameLayout) activity.findViewById(android.R.id.content);
//2、获取到setContentView放进去的View
mChildOfContent = content.getChildAt(0);
//3、给Activity的xml布局设置View树监听当布局有变化如键盘弹出或收起时都会回调此监听
mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
//4、软键盘弹起会使GlobalLayout发生变化
public void onGlobalLayout() {
if (isfirst) {
contentHeight = mChildOfContent.getHeight();//兼容华为等机型
isfirst = false;
}
//5、当前布局发生变化时对Activity的xml布局进行重绘
possiblyResizeChildOfContent();
}
});
//6、获取到Activity的xml布局的放置参数
frameLayoutParams = (FrameLayout.LayoutParams) mChildOfContent.getLayoutParams();
}
// 获取界面可用高度如果软键盘弹起后Activity的xml布局可用高度需要减去键盘高度
private void possiblyResizeChildOfContent() {
//1、获取当前界面可用高度键盘弹起后当前界面可用布局会减少键盘的高度
int usableHeightNow = computeUsableHeight(activity);
//2、如果当前可用高度和原始值不一样
if (usableHeightNow != usableHeightPrevious) {
//3、获取Activity中xml中布局在当前界面显示的高度
int usableHeightSansKeyboard = mChildOfContent.getRootView().getHeight();
//4、Activity中xml布局的高度-当前可用高度
int heightDifference = usableHeightSansKeyboard - usableHeightNow;
//5、高度差大于屏幕1/4时说明键盘弹出
if (heightDifference > (usableHeightSansKeyboard / 4)) {
// 6、键盘弹出了Activity的xml布局高度应当减去键盘高度
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference + statusBarHeight;
} else {
frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
}
} else {
frameLayoutParams.height=contentHeight;
}
//7、 重绘Activity的xml布局
mChildOfContent.requestLayout();
usableHeightPrevious = usableHeightNow;
}
}
private int computeUsableHeight(Activity activity) {
Rect frame = new Rect();
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int statusBarHeight = frame.top;
Rect r = new Rect();
mChildOfContent.getWindowVisibleDisplayFrame(r);
//这个判断是为了解决19之后的版本在弹出软键盘时键盘和推上去的布局adjustResize之间有白色区域的问题
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return (r.bottom - r.top) + statusBarHeight;
}
return (r.bottom - r.top);
}
}

@ -0,0 +1,48 @@
package com.stu.assistant.uitls;
import android.content.Context;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
public class CodeConfig {
private static CodeConfig newIns;
private Context mContext;
private CodeConfig(Context context) {
mContext = context;
}
public static CodeConfig newInstance(Context context) {
if (newIns == null) {
synchronized (CodeConfig.class) {
if (newIns == null) {
newIns = new CodeConfig(context);
}
}
}
return newIns;
}
public void setEcitTextviewClickListener(final EditText mEditText, final OnEcitTextviewClickListener listener) {
mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEND
|| actionId == EditorInfo.IME_ACTION_DONE
|| (event != null && KeyEvent.KEYCODE_ENTER == event.getKeyCode() && KeyEvent.ACTION_DOWN == event.getAction())) {
listener.OnEcitTextviewClickListener(v);
}
return false;
}
});
}
public interface OnEcitTextviewClickListener {
void OnEcitTextviewClickListener(View view);
}
}

@ -0,0 +1,101 @@
package com.stu.assistant.uitls;
import android.annotation.TargetApi;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.os.Build;
import android.os.Handler;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import com.stu.assistant.base.BaseApplion;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import androidx.annotation.RequiresApi;
public class Config {
ExecutorService fixedThreadPool = Executors.newFixedThreadPool(5);
Handler handler = new Handler();
public void search(final Todo todo) {
fixedThreadPool.execute(new Runnable() {
@Override
public void run() {
todo.onInOhter();
handler.post(new Runnable() {
@Override
public void run() {
todo.onInMain();
}
});
}
});
}
public interface Todo {
void onInOhter();
String onInMain();
}
public void outAppInfo() {
SharedUtil.create(BaseApplion.application).clear();
BaseApplion.getActivityManage().finishAll();
}
/**
* author : stf
* created: 2017-04-26 20:27
* acts on: editview PDA
*/
public static void colseKey(final EditText editText) {
Boolean isPda = SharedNoClearUtil.create(BaseApplion.application).getBoolean(SharedConfig.isPda, true);
Log.i("hx","---colseKey---->"+isPda);
if(isPda){
setFocuse(editText);
}
editText.setOnTouchListener(new View.OnTouchListener() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public boolean onTouch(View v, MotionEvent event) {
if (isPda) {
editText.setShowSoftInputOnFocus(false); // true 可以正常输入fasle editview 点击不显示软件盘,但是显示光标,关闭软件盘
} else {
editText.setShowSoftInputOnFocus(true);
}
return false;
}
});
}
@RequiresApi(api = Build.VERSION_CODES.M)
public void setFocuse(EditText fitsted, EditText seconded, Context mContext) {
fitsted.clearFocus();
seconded.setFocusable(true);
seconded.setFocusableInTouchMode(true);
seconded.requestFocus();
seconded.requestFocusFromTouch();
InputMethodManager inputManager = (InputMethodManager) seconded.getContext().getSystemService(mContext.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(seconded, 0);
}
/**
* author : stf
* created: 2017-04-13 10:24
* acts on:
* @param editview
*/
public static void setFocuse(EditText editview) {
editview.setFocusable(true);
editview.setFocusableInTouchMode(true);
editview.requestFocus();
editview.requestFocusFromTouch();
}
}

@ -0,0 +1,256 @@
package com.stu.assistant.uitls;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.reflect.Field;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Created by stf on 2018-11-05.
*/
public class CrashHandler implements Thread.UncaughtExceptionHandler {
public String TAG = "CrashHandler";
// 系统默认的UncaughtException处理类
private Thread.UncaughtExceptionHandler mDefaultHandler;
// CrashHandler实例
private static CrashHandler INSTANCE;
// 程序的Context对象
private Context mContext;
// 用来存储设备信息和异常信息
private Map<String, String> infos = new HashMap<String, String>();
//显示时间
private long time;
//文件夹地址
private String pathCrashHandler = "CrashLog";
/**
* CrashHandler
*/
private CrashHandler() {
}
/**
* CrashHandler ,
*/
public static CrashHandler getInstance() {
if (INSTANCE == null) {
INSTANCE = new CrashHandler();
}
return INSTANCE;
}
/**
*
*/
public CrashHandler setDelayTime(long time) {
this.time = time;
return this;
}
public CrashHandler setTAG(String TAG) {
this.TAG = TAG;
return this;
}
public CrashHandler setPath(String pathCrashHandler) {
this.pathCrashHandler = pathCrashHandler;
return this;
}
// public CrashHandler setPath() {
// this.pathCrashHandler = AppConfig.Path_Crash;
// return this;
// }
public void init(Context context) {
mContext = context;
if (isAppDeBug()) {
Log.i("stf", "-app在-debug->");
// 获取系统默认的UncaughtException处理器
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
// 设置该CrashHandler为程序的默认处理器
Thread.setDefaultUncaughtExceptionHandler(this);
} else {
Log.i("stf", "-app在-realse->");
}
}
/**
* UncaughtException
*/
@Override
public void uncaughtException(Thread thread, Throwable ex) {
if (!handleException(ex) && mDefaultHandler != null) {
// 如果用户没有处理则让系统默认的异常处理器来处理
mDefaultHandler.uncaughtException(thread, ex);
} else {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
Log.e(TAG, " error : " + e);
}
// 退出程序
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}
}
/**
* , .
*
* @param ex
* @return true:;false.
*/
private boolean handleException(Throwable ex) {
if (ex == null) {
return false;
}
ex.printStackTrace();
// 使用Toast来显示异常信息
new Thread() {
@Override
public void run() {
Looper.prepare();
try {
Toast.makeText(mContext, "程序出现异常,清理app进程后,可清除此卡顿", Toast.LENGTH_LONG).show();
}catch (Exception e){
e.fillInStackTrace();
}
Looper.loop();
}
}.start();
// 收集设备参数信息
collectDeviceInfo(mContext);
// 保存日志文件
saveCrashInfo2File(ex);
return true;
}
/**
*
*
* @param ctx
*/
public void collectDeviceInfo(Context ctx) {
try {
PackageManager pm = ctx.getPackageManager();
PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(),
PackageManager.GET_ACTIVITIES);
if (pi != null) {
String versionName = pi.versionName == null ? "null" : pi.versionName;
String versionCode = pi.versionCode + "";
infos.put("versionName", versionName);
infos.put("versionCode", versionCode);
}
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "an error occured when collect package info" + e);
}
Field[] fields = Build.class.getDeclaredFields();
for (Field field : fields) {
try {
field.setAccessible(true);
infos.put(field.getName(), field.get(null).toString());
Log.e(TAG, field.getName() + " : " + field.get(null));
} catch (Exception e) {
Log.e(TAG, "an error occured when collect crash info" + e);
}
}
}
/**
*
*
* @param ex
* @return , 便
*/
private String saveCrashInfo2File(Throwable ex) {
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
StringBuffer sb = new StringBuffer();
for (Map.Entry<String, String> entry : infos.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
sb.append(key + "=" + value + "\n");
}
Writer writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
ex.printStackTrace(printWriter);
Throwable cause = ex.getCause();
while (cause != null) {
cause.printStackTrace(printWriter);
cause = cause.getCause();
}
printWriter.close();
String result = writer.toString();
sb.append(result);
try {
long timestamp = System.currentTimeMillis();
String time = formatter.format(new Date());
String fileName = "log-" + time + "-" + timestamp + ".log";
if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
String path = Environment.getExternalStorageState() + "/" + pathCrashHandler + "/log";
File dir = new File(path);
if (!dir.exists()) {
dir.mkdirs();
}
Log.e(TAG, "错误日志记录位置=" + dir.getAbsolutePath());
FileOutputStream fos = new FileOutputStream(path + "/" + fileName);
fos.write(sb.toString().getBytes());
fos.close();
}
return fileName;
} catch (Exception e) {
Log.e(TAG, "an error occured while writing file..." + e);
}
return null;
}
// 判断app 是不是 debug模式
public boolean isAppDeBug() {
if (mContext == null) {
return false;
}
try {
if (TextUtils.isEmpty(mContext.getPackageName())) {
return false;
}
} catch (Exception e) {
e.fillInStackTrace();
return false;
}
try {
PackageManager pm = mContext.getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(mContext.getPackageName(), 0);
return ai != null && (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return false;
}
}
}

@ -0,0 +1,161 @@
package com.stu.assistant.uitls;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.util.Log;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.Thread.UncaughtExceptionHandler;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName CrashHandlerManage
* @Description UncaughtException,Uncaught,,.
* @Author kaiguo
* @Date 2020/3/17 11:01
*/
@SuppressLint("StaticFieldLeak")
public class CrashHandlerManage implements UncaughtExceptionHandler {
private static final String TAG = "CrashHandlerManage";
private UncaughtExceptionHandler mDefaultHandler;// 系统默认的UncaughtException处理类
private static CrashHandlerManage INSTANCE;
private Context mContext;// 程序的Context对象
private Map<String, String> info = new HashMap<>();// 用来存储设备信息和异常信息
/**
* CrashHandler
*/
private CrashHandlerManage() {
}
public synchronized static CrashHandlerManage getInstance() {
if (INSTANCE == null) {
INSTANCE = new CrashHandlerManage();
}
return INSTANCE;
}
/**
*
*/
public void init(Context context) {
mContext = context;
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();// 获取系统默认的UncaughtException处理器
Thread.setDefaultUncaughtExceptionHandler(this);// 设置该CrashHandler为程序的默认处理器
}
/**
* UncaughtException
*/
public void uncaughtException(Thread thread, Throwable ex) {
if (!handleException(ex) && mDefaultHandler != null) {
// 如果自定义的没有处理则让系统默认的异常处理器来处理
mDefaultHandler.uncaughtException(thread, ex);
} else {
try {
Thread.sleep(3000);// 如果处理了让程序继续运行3秒再退出保证文件保存并上传到服务器
} catch (InterruptedException e) {
e.printStackTrace();
}
// 退出程序
// ActivityContainer.newInstance().exit();
}
}
/**
* , .
*
* @param ex
* @return true ;false.
*/
public boolean handleException(Throwable ex) {
if (ex == null) {
return false;
}
// 收集设备参数信息
collectDeviceInfo(mContext);
// 保存日志文件
saveCrashInfo2File(ex);
return true;
}
/**
*
*/
public void collectDeviceInfo(Context context) {
try {
PackageManager pm = context.getPackageManager();// 获得包管理器
PackageInfo pi = pm.getPackageInfo(context.getPackageName(),
PackageManager.GET_ACTIVITIES);// 得到该应用的信息即主Activity
if (pi != null) {
String versionName = pi.versionName == null ? "null"
: pi.versionName;
String versionCode = pi.versionCode + "";
info.put("versionName", versionName);
info.put("versionCode", versionCode);
}
} catch (NameNotFoundException e) {
e.printStackTrace();
// Logger.e("获取设置信息失败");
}
Field[] fields = Build.class.getDeclaredFields();// 反射机制
for (Field field : fields) {
try {
field.setAccessible(true);
info.put(field.getName(), field.get("").toString());
Log.e("stf",field.getName() + ":" + field.get(""));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
private String saveCrashInfo2File(Throwable ex) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : info.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
sb.append(key).append("=").append(value).append("\r\n");
}
Writer writer = new StringWriter();
PrintWriter pw = new PrintWriter(writer);
ex.printStackTrace(pw);
Throwable cause = ex.getCause();
// 循环着把所有的异常信息写入writer中
while (cause != null) {
cause.printStackTrace(pw);
cause = cause.getCause();
}
pw.close();// 记得关闭
String result = writer.toString();
sb.append(result);
// 保存文件
// String fileName = "crash-" + DateUtils.getCurrentDateStr() + "-" + DateUtils.getCurrentTimeStamp() + ".log";
// if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
// try {
// File file = new File(FileUtils.getAppCrashPath(), fileName);
// FileOutputStream fos = new FileOutputStream(file);
// fos.write(sb.toString().getBytes());
// fos.close();
// return fileName;
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
return null;
}
}

@ -0,0 +1,53 @@
package com.stu.assistant.uitls;
import android.content.Context;
import com.yanyusong.y_divideritemdecoration.Y_Divider;
import com.yanyusong.y_divideritemdecoration.Y_DividerBuilder;
import com.yanyusong.y_divideritemdecoration.Y_DividerItemDecoration;
public class DividerItemDecoration0Util extends Y_DividerItemDecoration {
private boolean isPackage;
private int width, height;
public DividerItemDecoration0Util(Context context, boolean pac) {
super(context);
isPackage = pac;
if (isPackage) {
width = 5;
height = 10;
} else {
width=0;
height = 1;
}
}
@Override
public Y_Divider getDivider(int itemPosition) {
Y_Divider divider = null;
switch (itemPosition % 2) {
case 0:
//每一行第一个显示rignt和bottom
divider = new Y_DividerBuilder()
.setRightSideLine(true, 0x00F6F6F6, width, 0, 0)
.setBottomSideLine(true, 0x00F6F6F6, height, 0, 0)
.create();
break;
case 1:
//第二个显示Left和bottom
divider = new Y_DividerBuilder()
.setLeftSideLine(true, 0x00F6F6F6, width, 0, 0)
.setBottomSideLine(true, 0x00F6F6F6, height, 0, 0)
.create();
break;
default:
break;
}
return divider;
}
}

@ -0,0 +1,53 @@
package com.stu.assistant.uitls;
import android.content.Context;
import com.yanyusong.y_divideritemdecoration.Y_Divider;
import com.yanyusong.y_divideritemdecoration.Y_DividerBuilder;
import com.yanyusong.y_divideritemdecoration.Y_DividerItemDecoration;
public class DividerItemDecorationUtil extends Y_DividerItemDecoration {
private boolean isPackage;
private int width, height;
public DividerItemDecorationUtil(Context context, boolean pac) {
super(context);
isPackage = pac;
if (isPackage) {
width = 5;
height = 10;
} else {
width=0;
height = 10;
}
}
@Override
public Y_Divider getDivider(int itemPosition) {
Y_Divider divider = null;
switch (itemPosition % 2) {
case 0:
//每一行第一个显示rignt和bottom
divider = new Y_DividerBuilder()
.setRightSideLine(true, 0x00F6F6F6, width, 0, 0)
.setBottomSideLine(true, 0x00F6F6F6, height, 0, 0)
.create();
break;
case 1:
//第二个显示Left和bottom
divider = new Y_DividerBuilder()
.setLeftSideLine(true, 0x00F6F6F6, width, 0, 0)
.setBottomSideLine(true, 0x00F6F6F6, height, 0, 0)
.create();
break;
default:
break;
}
return divider;
}
}

@ -0,0 +1,107 @@
package com.stu.assistant.uitls;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import androidx.appcompat.widget.AppCompatTextView;
public class DragTextView extends AppCompatTextView {
private int parentHeight;
protected int parentWidth;
private int lastX;
private int lastY;
private boolean isDrag;
private ViewGroup parent;
public DragTextView(Context context) {
super(context);
}
public DragTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public DragTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int rawX = (int) event.getRawX();
int rawY = (int) event.getRawY();
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
this.setAlpha(0.9F);
this.setPressed(true);
this.isDrag = false;
this.getParent().requestDisallowInterceptTouchEvent(true);
this.lastX = rawX;
this.lastY = rawY;
if (this.getParent() != null) {
this.parent = (ViewGroup) this.getParent();
this.parentHeight = this.parent.getHeight();
this.parentWidth = this.parent.getWidth();
}
break;
case MotionEvent.ACTION_UP:
if (!this.isNotDrag()) {
this.setPressed(false);
this.moveHide(rawX);
}
break;
case MotionEvent.ACTION_MOVE:
if ((double) this.parentHeight > 0.2D && (double) this.parentWidth > 0.2D) {
this.isDrag = true;
this.setAlpha(0.9F);
int dx = rawX - this.lastX;
int dy = rawY - this.lastY;
int distance = (int) Math.sqrt((double) (dx * dx + dy * dy));
if (distance < 2) {
this.isDrag = false;
} else {
float x = this.getX() + (float) dx;
float y = this.getY() + (float) dy;
x = x < 0.0F ? 0.0F : (x > (float) (this.parentWidth - this.getWidth()) ? (float) (this.parentWidth - this.getWidth()) : x);
y = this.getY() < 0.0F ? 0.0F : (this.getY() + (float) this.getHeight() > (float) this.parentHeight ? (float) (this.parentHeight - this.getHeight()) : y);
this.setX(x);
this.setY(y);
this.lastX = rawX;
this.lastY = rawY;
Log.i("aa", "isDrag=" + this.isDrag + "getX=" + this.getX() + ";getY=" + this.getY() + ";parentWidth=" + this.parentWidth);
}
} else {
this.isDrag = false;
}
}
return !this.isNotDrag() || super.onTouchEvent(event);
}
private boolean isNotDrag() {
return !this.isDrag && (this.getX() == 0.0F || this.getX() == (float) (this.parentWidth - this.getWidth() - getMarginEnd()) || this.getX() == (float) (this.parentWidth - this.getWidth()));
}
private int getMarginEnd() {
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) getLayoutParams();
int endMargin = params.getMarginEnd();
return endMargin;
}
protected void moveHide(int rawX) {
if (rawX >= this.parentWidth / 2) {
this.animate().setInterpolator(new DecelerateInterpolator()).setDuration(500L).xBy((float) (this.parentWidth - this.getWidth()) - this.getX()).start();
} else {
ObjectAnimator oa = ObjectAnimator.ofFloat(this, "x", new float[]{this.getX(), 0.0F});
oa.setInterpolator(new DecelerateInterpolator());
oa.setDuration(500L);
oa.start();
}
}
}

@ -0,0 +1,527 @@
package com.stu.assistant.uitls;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.stu.assistant.R;
import com.stu.assistant.base.BaseApplion;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class ImageUtil {
public static void showImageView(Context context, int url,
ImageView imgeview) {
Glide.with(context).load(url).into(imgeview);
}
public static void showImageView(Context context, String url,
ImageView imgeview, int error) {
RequestOptions options = new RequestOptions();
options.error(error);
Glide.with(context).load(url).apply(options).into(imgeview);
}
public static void showThumbnailImageView(Context context, String url,
ImageView imgeview, int error) {
RequestOptions options = new RequestOptions();
options.error(error);
// Glide.with(context).load(url).apply(options).thumbnail(Glide.with(context).load(R.mipmap.gif_ic)).into(imgeview);
}
public static void showImageView(Context context, String url,
ImageView imgeview) {
try {
RequestOptions options = new RequestOptions();
options.error(R.mipmap.loadfail_img);
Glide.with(context).load(TextUtils.isEmpty(url) == true ? "":url).apply(options).into(imgeview);
}catch (Exception e){
e.fillInStackTrace();
}
}
public static void showImageViewRadius(Context context, String url,
ImageView imgeview,int radus) {
RoundedCorners roundedCorners= new RoundedCorners(radus);
RequestOptions options=RequestOptions.bitmapTransform(roundedCorners);
options.error(R.mipmap.loadfail_img);
Glide.with(context).load(url).apply(options).into(imgeview);
}
public static void showImageViewNotErr(Context context, String url,
ImageView imgeview) {
RequestOptions options = new RequestOptions();
Glide.with(context).load(url).apply(options).into(imgeview);
}
public static void showImageView(Context context, String url, int error,
ImageView imgeview, boolean isCircle) {
if (isCircle) {
Glide
.with(context)
.load(url)
.apply(new RequestOptions().circleCrop().placeholder(error))
.into(imgeview);
} else {
Glide
.with(context)
.load(url)
.apply(new RequestOptions().placeholder(error))
.into(imgeview);
}
}
public static void showImageViewCircle(int url, ImageView imgeview) {
Glide
.with(BaseApplion.application)
.load(url)
.apply(new RequestOptions().circleCrop().placeholder(R.mipmap.loadfail_img))
.into(imgeview);
}
public static Bitmap getBitmapFormUri(Context context, Uri uri) throws FileNotFoundException, IOException {
InputStream input = context.getContentResolver().openInputStream(uri);
//这一段代码是不加载文件到内存中也得到bitmap的真是宽高主要是设置inJustDecodeBounds为true
BitmapFactory.Options onlyBoundsOptions = new BitmapFactory.Options();
onlyBoundsOptions.inJustDecodeBounds = true;//不加载到内存
onlyBoundsOptions.inDither = true;//optional
onlyBoundsOptions.inPreferredConfig = Bitmap.Config.RGB_565;//optional
BitmapFactory.decodeStream(input, null, onlyBoundsOptions);
input.close();
int originalWidth = onlyBoundsOptions.outWidth;
int originalHeight = onlyBoundsOptions.outHeight;
if ((originalWidth == -1) || (originalHeight == -1)) {
return null;
}
//图片分辨率以480x800为标准
float hh = 1920f;//这里设置高度为800f
float ww = 1080f;//这里设置宽度为480f
//缩放比,由于是固定比例缩放,只用高或者宽其中一个数据进行计算即可
int be = 1;//be=1表示不缩放
if (originalWidth > originalHeight && originalWidth > ww) {//如果宽度大的话根据宽度固定大小缩放
be = (int) (originalWidth / ww);
} else if (originalWidth < originalHeight && originalHeight > hh) {//如果高度高的话根据宽度固定大小缩放
be = (int) (originalHeight / hh);
}
if (be <= 0) {
be = 1;
}
//比例压缩
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
bitmapOptions.inSampleSize = be;//设置缩放比例
bitmapOptions.inDither = true;
bitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;
input = context.getContentResolver().openInputStream(uri);
Bitmap bitmap = BitmapFactory.decodeStream(input, null, bitmapOptions);
input.close();
return compressImage(bitmap);//再进行质量压缩
}
public static Bitmap compressImage(Bitmap image) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
image.compress(Bitmap.CompressFormat.JPEG, 100, baos);//质量压缩方法这里100表示不压缩把压缩后的数据存放到baos中
int options = 100;
while (baos.toByteArray().length / 1024 > 500) { //循环判断如果压缩后图片是否大于100kb,大于继续压缩
baos.reset();//重置baos即清空baos
//第一个参数 :图片格式 ,第二个参数: 图片质量100为最高0为最差 ,第三个参数:保存压缩后的数据的流
image.compress(Bitmap.CompressFormat.JPEG, options, baos);//这里压缩options把压缩后的数据存放到baos中
options -= 10;//每次都减少10
if (options <= 0) {
break;
}
}
ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());//把压缩后的数据baos存放到ByteArrayInputStream中
Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);//把ByteArrayInputStream数据生成图片
return bitmap;
}
public static File saveFile(Bitmap bm, String path) throws IOException {//将Bitmap类型的图片转化成file类型便于上传到服务器
File myCaptureFile = new File(path);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bm.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
return myCaptureFile;
}
//照片加水印
public File saveFile2(Bitmap bitmap, String path) throws IOException {//将Bitmap类型的图片转化成file类型便于上传到服务器
File myCaptureFile = new File(path);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(myCaptureFile));
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, bos);
bos.flush();
bos.close();
return myCaptureFile;
}
private String getWaterMarkMsg() {
SimpleDateFormat dff = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
String date = "";
try {
dff.setTimeZone(TimeZone.getTimeZone("GMT+08"));
date = dff.format(new Date());
} catch (Exception e) {
e.fillInStackTrace();
long currentTime = System.currentTimeMillis();
SimpleDateFormat formatter = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
date = formatter.format(currentTime);
}
return date;
}
public static synchronized String getAppName(Context context) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = packageManager.getPackageInfo(
context.getPackageName(), 0);
int labelRes = packageInfo.applicationInfo.labelRes;
return context.getResources().getString(labelRes);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
*
*
* @param
*/
// public static void showBigImg(final Context context, final List<String> imglist, View parent_view, final int position) {
// pop = new PopWindowUtils((Activity) context);
// pop.setFocusable(true);
// pop.setOutsideTouchable(true);
// pop.setOnViewClickListener(new PopWindowUtils.ContentView() {
// @Override
// public void getContentView(View contentView, PopWindowUtils popWindow) {
// pop.setWidth(AppTools.getScreenWidth(context));
// pop.setHeight(AppTools.getScreenHeight(context));
// ViewPager imgviewPager = contentView.findViewById(R.id.imgviewPager);
// ImgPagerAdapter imgPagerAdapter = new ImgPagerAdapter(context, imglist);
// imgviewPager.setAdapter(imgPagerAdapter);
// imgviewPager.setCurrentItem(position);
// imgviewPager.setOffscreenPageLimit(1);//限定预加载
// imgPagerAdapter.setImgItemCliclListener(position1 -> pop.dismiss());
// //返回
// imgPagerAdapter.setBackCliclListener(() -> pop.dismiss());
//
// }
//
//
// }).setConView(R.layout.browse_bigimg_view).showBrowseImgnCenter(parent_view);
//
// }
/**
*
*
* @param path
* @return degree
*/
public static int readPictureDegree(String path) {
int degree = -1;
try {
ExifInterface exifInterface = new ExifInterface(path);
int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
default:
degree = 0;
break;
}
} catch (IOException e) {
e.printStackTrace();
degree = -1;
}
return degree;
}
/***
*
* @param angle
* @param bitmap
* @return
*/
public static Bitmap rotaingImageView(int angle, Bitmap bitmap) {
//旋转图片 动作
Matrix matrix = new Matrix();
matrix.postRotate(angle);
// 创建新的图片
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}
/**
* Base64
*/
public static String imageToBase64(String path) {
if (TextUtils.isEmpty(path)) {
return null;
}
InputStream is = null;
byte[] data = null;
String result = null;
try {
is = new FileInputStream(path);
//创建一个字符流大小的数组。
data = new byte[is.available()];
//写入数组
is.read(data);
//用默认的编码格式进行编码
result = Base64.encodeToString(data, Base64.DEFAULT);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != is) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return result;
}
/**
* base64
*
* @param file
* @return
*/
public static String fileToBase64(File file) {
String base64 = null;
InputStream in = null;
try {
in = new FileInputStream(file);
byte[] bytes = new byte[in.available()];
int length = in.read(bytes);
base64 = Base64.encodeToString(bytes, 0, length, Base64.DEFAULT);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return base64;
}
/**
* Drawable
*
* @drawable Drawable
* @w
* @h
*/
public static Drawable zoomDrawable(Drawable drawable, int w, int h, Context mContext, DisplayMetrics metrics) {
//获取原来Drawable的宽高
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
//将Drawable转换成Bitmap
Bitmap oldbmp = drawableToBitmap(drawable);
//计算scale
Matrix matrix = new Matrix();
float scaleWidth = ((float) w / width);
float scaleHeight = ((float) h / height);
matrix.postScale(scaleWidth, scaleHeight);
//生成新的Bitmap
Bitmap newbmp = Bitmap.createBitmap(oldbmp, 0, 0, width, height, matrix, true);
//设置bitmap转成drawable后尺寸不变
//这个很关键后面解释!!
Resources resources = new Resources(mContext.getAssets(), metrics, null);
return new BitmapDrawable(resources, newbmp);
}
/**
* DrawableBitmap
*
* @param drawable
* @return
*/
private static Bitmap drawableToBitmap(Drawable drawable) {
//取drawable的宽高
int width = drawable.getIntrinsicWidth();
int height = drawable.getIntrinsicHeight();
//取drawable的颜色格式
Bitmap.Config config = drawable.getOpacity() != PixelFormat.OPAQUE
? Bitmap.Config.ARGB_8888
: Bitmap.Config.RGB_565;
//创建对应的bitmap
Bitmap bitmap = Bitmap.createBitmap(width, height, config);
//创建对应的bitmap的画布
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, width, height);
//把drawable内容画到画布中
drawable.draw(canvas);
return bitmap;
}
public static String getNetFileSizeDescription(long size) {
StringBuffer bytes = new StringBuffer();
DecimalFormat format = new DecimalFormat("###.0");
if (size >= 1024 * 1024 * 1024) {
double i = (size / (1024.0 * 1024.0 * 1024.0));
bytes.append(format.format(i)).append("GB");
} else if (size >= 1024 * 1024) {
double i = (size / (1024.0 * 1024.0));
bytes.append(format.format(i)).append("MB");
} else if (size >= 1024) {
double i = (size / (1024.0));
bytes.append(format.format(i)).append("KB");
} else if (size < 1024) {
if (size <= 0) {
bytes.append("0B");
} else {
bytes.append((int) size).append("B");
}
}
return bytes.toString();
}
public static Bitmap readGrayBitMap(Context context, int resId) {
Bitmap bitmap = readBitmap(context, resId);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
Bitmap grayImg = null;
try {
grayImg = Bitmap.createBitmap(width, height,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(grayImg);
Paint paint = new Paint();
ColorMatrix colorMatrix = new ColorMatrix();//仰仗这玩意了
colorMatrix.setSaturation(0);
ColorMatrixColorFilter colorMatrixFilter = new ColorMatrixColorFilter(
colorMatrix);
paint.setColorFilter(colorMatrixFilter);
canvas.drawBitmap(bitmap, 0, 0, paint);
} catch (Exception e) {
e.printStackTrace();
}
return grayImg;
}
public static Bitmap readBitmap(Context context, int id) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.ARGB_8888;
opt.inInputShareable = true;
opt.inPurgeable = true;
InputStream is = context.getResources().openRawResource(id);
return BitmapFactory.decodeStream(is, null, opt);
}
/**
* bitmap
*/
public static void saveBitmapToLocal(Context mContext, Bitmap bitmap) {
// 先将图片保存到文件
File imageDir = new File(Environment.getExternalStorageDirectory(), "xcyh");
if (!imageDir.exists()) {
imageDir.mkdir();
}
//以保存时间为文件名
Date date = new Date(System.currentTimeMillis());
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String filename = "xcyh"+sdf.format(date)+".jpg";
File file = new File(imageDir, filename);
try {
FileOutputStream fos = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
MyToast.show("保存成功");
} catch (IOException e) {
e.printStackTrace();
MyToast.show("保存失败");
}
// 再通知图库更新数据库
Uri uri = Uri.fromFile(file);
mContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
}
}

@ -0,0 +1,120 @@
package com.stu.assistant.uitls;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONObject;
/**
* Created by stf on 2019-03-18.
*/
public class LogUtils {
public static final String LINE_SEPARATOR = System.getProperty("line.separator");
private static boolean isPrintLog = true;
private static int LOG_MAXLENGTH = 2000;
public static void i(String msg) {
if (isPrintLog) {
int strLength = msg.length();
int start = 0;
int end = LOG_MAXLENGTH;
for (int i = 0; i < 100; i++) {
if (strLength > end) {
Log.i("日志:" + i, msg.substring(start, end));
start = end;
end = end + LOG_MAXLENGTH;
} else {
Log.i("日志:" + i, msg.substring(start, strLength));
break;
}
}
}
}
public static void i(String type, String msg) {
if (isPrintLog) {
int strLength = msg.length();
int start = 0;
int end = LOG_MAXLENGTH;
for (int i = 0; i < 8000; i++) {
if (strLength > end) {
Log.i(type + "日志:" + i, msg.substring(start, end));
start = end;
end = end + LOG_MAXLENGTH;
} else {
Log.i(type + "日志:" + i, msg.substring(start, strLength));
break;
}
}
}
}
private static void printLine(String tag, boolean isTop) {
if (isTop) {
Log.i(tag, "╔═══════════════════════════════════════════════════════════════════════════════════════");
} else {
Log.i(tag, "╚═══════════════════════════════════════════════════════════════════════════════════════");
}
}
public static void printJson(String tag, String msg, String headString) {
String message;
try {
if (msg.startsWith("{")) {
JSONObject jsonObject = new JSONObject(msg);
message = jsonObject.toString(4);//最重要的方法就一行返回格式化的json字符串其中的数字4是缩进字符数
} else if (msg.startsWith("[")) {
JSONArray jsonArray = new JSONArray(msg);
message = jsonArray.toString(4);
} else {
message = msg;
}
} catch (Exception e) {
message = msg;
}
try {
printLine(tag, true);
message = headString + LINE_SEPARATOR + message;
String[] lines = message.split(LINE_SEPARATOR);
for (String line : lines) {
Log.i(tag, "║ " + line);
}
printLine(tag, false);
} catch (Exception e) {
e.printStackTrace();
i(tag, message);
}
}
/**
*
* @param msg
*/
public static void e(String tag, String msg) {
if (tag == null || tag.length() == 0
|| msg == null || msg.length() == 0) {
return;
}
int segmentSize = 3 * 1024;
long length = msg.length();
if (length <= segmentSize ) {// 长度小于等于限制直接打印
Log.e(tag, msg);
}else {
while (msg.length() > segmentSize ) {// 循环分段打印日志
String logContent = msg.substring(0, segmentSize );
msg = msg.replace(logContent, "");
Log.e(tag, logContent);
}
Log.e(tag, msg);// 打印剩余日志
}
}
}

@ -0,0 +1,15 @@
package com.stu.assistant.uitls;
import android.content.Context;
import android.widget.Toast;
import com.stu.assistant.base.BaseApplion;
public class MyToast {
public static void show(Context context,String content){
Toast.makeText(context, content, Toast.LENGTH_SHORT).show();
}
public static void show(String content){
Toast.makeText(BaseApplion.application, content, Toast.LENGTH_SHORT).show();
}
}

@ -0,0 +1,51 @@
package com.stu.assistant.uitls;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* @ClassName MoneyUtils
* @Description
* @Author kaiguo
* @Date 2020/3/17 14:57
*/
public class NetworkUtil {
public static boolean isNetWorkAvailable2(Context context) {
ConnectivityManager manager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (manager != null) {
NetworkInfo info = manager.getActiveNetworkInfo();
if (info != null && info.isConnected()) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/**
*
*
* @param context context
* @return
*/
public static boolean isNetworkAvailable(Context context) {
ConnectivityManager connectivity = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null) {
for (int i = 0; i < info.length; i++) {
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
}
return false;
}
}

@ -0,0 +1,98 @@
package com.stu.assistant.uitls;
import android.util.Log;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import com.stu.assistant.base.BaseApplion;
import java.util.List;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
public class RgToFmUtils {
private int showindex = 0;
private int hideindex = 0;
private List<Fragment> fragmentList;
private FragmentManager supportFragmentManager;
private int id;
private RadioGroup radioGroup;
private FragmentTransaction transaction;
private Fragment fragment, currentFragment;
public RgToFmUtils() {
}
private static RgToFmUtils mInstance;
public static RgToFmUtils getInstance() {
if (mInstance == null) {
//实例化对象
//加上一个同步锁,只能有一个执行路径进入
synchronized (RgToFmUtils.class) {
if (mInstance == null) {
mInstance = new RgToFmUtils();
}
}
}
return mInstance;
}
public void showTabToFragment(List<Fragment> fragmentList, RadioGroup radioGroup, FragmentManager supportFragmentManager, int id) {
this.radioGroup = radioGroup;
this.id = id;
this.fragmentList = fragmentList;
this.supportFragmentManager = supportFragmentManager;
((RadioButton) radioGroup.getChildAt(0)).setChecked(true);//初始化选中第一个
addFragment(String.valueOf(0));
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton radioButton = (RadioButton) group.findViewById(checkedId);
radioButton.setChecked(true);
int i = group.indexOfChild(radioButton);
addFragment(String.valueOf(i));
}
});
}
private void addFragment(String fTag) {
try {
//判断这个标签是否存在Fragment对象,如果存在则返回不存在返回null
fragment = supportFragmentManager.findFragmentByTag(fTag);
Log.i("stf","---fragment--->"+fragment);
// 如果这个fragment不存于栈中
if (fragment == null) {
//初始化Fragment事物
transaction = supportFragmentManager.beginTransaction();
//根据RaioButton点击的Button传入的tag实例化添加显示不同的Fragment
fragment = fragmentList.get(Integer.parseInt(fTag));
//在添加之前先将上一个Fragment隐藏掉
if (currentFragment != null) {
transaction.hide(currentFragment);
}
transaction.add(id, fragment, fTag);
transaction.commit();
//更新可见
currentFragment = fragment;
} else {
//如果添加的Fragment已经存在则将隐藏掉的Fragment再次显示,其余当前
transaction = supportFragmentManager.beginTransaction();
transaction.show(fragment);
transaction.hide(currentFragment);
transaction.commit();
//更新可见
currentFragment = fragment;
}
}catch (Exception e){
e.fillInStackTrace();
BaseApplion.getActivityManage().finishAll();
}
}
}

@ -0,0 +1,98 @@
package com.stu.assistant.uitls;
import android.util.Log;
import com.stu.assistant.bean.UserInfoBean;
import com.stu.assistant.constants.ConstansUserManager;
import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;
public class SaveUserData {
public void saveData(){
StringBuilder stringBuilder = new StringBuilder();
UserInfoBean userInfoBean = new UserInfoBean();
userInfoBean.setUsername("100");
userInfoBean.setPassword("123456");
userInfoBean.setNickName("管理员");
userInfoBean.setUserLevel(ConstansUserManager.Level_1);
userInfoBean.setUserType(ConstansUserManager.UserType_1);
userInfoBean.setEvaluate("");
userInfoBean.signUp(new SaveListener<UserInfoBean>() {
@Override
public void done(UserInfoBean objectId, BmobException e) {
stringBuilder.append("添加管理员");
if (e == null) {
stringBuilder.append("objectId:" + objectId);
} else {
stringBuilder.append("创建数据失败:" + e.getMessage());
}
stringBuilder.append(",");
}
});
UserInfoBean userInfoBean2 = new UserInfoBean();
userInfoBean2.setUsername("201");
userInfoBean2.setPassword("123456");
userInfoBean2.setNickName("部门管理员");
userInfoBean2.setUserLevel(ConstansUserManager.Level_2);
userInfoBean2.setUserType(ConstansUserManager.UserType_1);
userInfoBean2.setEvaluate("");
userInfoBean2.signUp(new SaveListener<UserInfoBean>() {
@Override
public void done(UserInfoBean objectId, BmobException e) {
stringBuilder.append("部门管理员");
if (e == null) {
stringBuilder.append("objectId:" + objectId);
} else {
stringBuilder.append("创建数据失败:" + e.getMessage());
}
stringBuilder.append(",");
}
});
UserInfoBean userInfoBean3 = new UserInfoBean();
userInfoBean3.setUsername(ConstansUserManager.Level_3+"1");
userInfoBean3.setPassword("123456");
userInfoBean3.setNickName("学生1");
userInfoBean3.setUserLevel(ConstansUserManager.Level_3);
userInfoBean3.setUserType(ConstansUserManager.UserType_2);
userInfoBean3.setEvaluate("");
userInfoBean3.signUp(new SaveListener<UserInfoBean>() {
@Override
public void done(UserInfoBean objectId, BmobException e) {
stringBuilder.append("维修员1");
if (e == null) {
stringBuilder.append("objectId:" + objectId);
} else {
stringBuilder.append("创建数据失败:" + e.getMessage());
}
stringBuilder.append(",");
}
});
UserInfoBean userInfoBean4 = new UserInfoBean();
userInfoBean4.setUsername(ConstansUserManager.Level_3 + "2");
userInfoBean4.setPassword("123456");
userInfoBean4.setNickName("学生2");
userInfoBean4.setUserLevel(ConstansUserManager.Level_3);
userInfoBean4.setUserType(ConstansUserManager.UserType_2);
userInfoBean4.setEvaluate("");
userInfoBean4.signUp(new SaveListener<UserInfoBean>() {
@Override
public void done(UserInfoBean objectId, BmobException e) {
stringBuilder.append("维修员2");
if (e == null) {
stringBuilder.append("objectId:" + objectId);
} else {
stringBuilder.append("创建数据失败:" + e.getMessage());
}
stringBuilder.append(",");
}
});
}
}

@ -0,0 +1,24 @@
package com.stu.assistant.uitls;
public class SharedConfig {
//用户信息
public static String loginName = "loginName";
public static String nickName = "nickName";
public static String whToken = "whToken";
public static String objectId = "objectId";
public static String userLevel = "userLevel";
public static String userType = "userType";
public static String type = "type";
public static String isLogin = "isLogin";
public static String isPda = "isPda";
public static String isTheme = "isTheme";
public static String isBg = "isBg";
public static String isBg_1 = "1";
public static String isBg_2 = "2";
public static String isBg_3 = "3";
public static String isBg_4 = "4";
public static String isThemeSys = "1";
public static String isThemeMy = "2";
public static String initTimeValue = "2021-12-07";
public static String initTime = "initTime";
}

@ -0,0 +1,157 @@
package com.stu.assistant.uitls;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Base64;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.List;
/**
* Created by stf on 2018-10-15.
*/
public class SharedNoClearUtil {
private String path = "configno";
private final SharedPreferences sp;
private static SharedNoClearUtil sharedPreUtils;
public SharedNoClearUtil(Context context) {
this.sp = context.getSharedPreferences(this.path, context.MODE_PRIVATE);
}
public static SharedNoClearUtil create(Context context) {
if (sharedPreUtils == null) {
Class var1 = SharedNoClearUtil.class;
synchronized (SharedNoClearUtil.class) {
if (sharedPreUtils == null) {
sharedPreUtils = new SharedNoClearUtil(context);
}
}
}
return sharedPreUtils;
}
public void setPath(String path) {
this.path = path;
}
public void putBoolean(String key, boolean value) {
this.sp.edit().putBoolean(key, value).apply();
}
public boolean getBoolean(String key, boolean defValue) {
return this.sp.getBoolean(key, defValue);
}
public void putString(String key, String value) {
this.sp.edit().putString(key, value).apply();
}
public String getString(String key, String defValue) {
return this.sp.getString(key, defValue);
}
public String getString(String key) {
return this.sp.getString(key,"");
}
public void putInt(String key, int value) {
this.sp.edit().putInt(key, value).apply();
}
public int getInt(String key, int defValue) {
return this.sp.getInt(key, defValue);
}
public void remove(String key) {
this.sp.edit().remove(key).apply();
}
public void clear() {
if (this.sp != null) {
this.sp.edit().clear().apply();
}
}
/**
* List
*
* @param key
* @param list
*/
public void putList(String key, List<? extends Serializable> list) {
try {
put( key, list);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* List
*
* @param key
* @param <E>
* @return List
*/
public <E extends Serializable> List<E> getList(String key) {
try {
return (List<E>) get(key);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
*
*/
private void put(String key, Object obj)
throws IOException {
if (obj == null) {//判断对象是否为空
return;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = null;
oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
// 将对象放到OutputStream中
// 将对象转换成byte数组并将其进行base64编码
String objectStr = new String(Base64.encode(baos.toByteArray(), Base64.DEFAULT));
baos.close();
oos.close();
putString(key, objectStr);
}
/**
*
*/
private Object get(String key)
throws IOException, ClassNotFoundException {
String wordBase64 = getString(key);
// 将base64格式字符串还原成byte数组
if (TextUtils.isEmpty(wordBase64)) { //不可少否则在下面会报java.io.StreamCorruptedException
return null;
}
byte[] objBytes = Base64.decode(wordBase64.getBytes(), Base64.DEFAULT);
ByteArrayInputStream bais = new ByteArrayInputStream(objBytes);
ObjectInputStream ois = new ObjectInputStream(bais);
// 将byte数组转换成product对象
Object obj = ois.readObject();
bais.close();
ois.close();
return obj;
}
}

@ -0,0 +1,157 @@
package com.stu.assistant.uitls;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.util.Base64;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.List;
/**
* Created by stf on 2018-10-15.
*/
public class SharedUtil {
private String path = "config";
private final SharedPreferences sp;
private static SharedUtil sharedPreUtils;
public SharedUtil(Context context) {
this.sp = context.getSharedPreferences(this.path, context.MODE_PRIVATE);
}
public static SharedUtil create(Context context) {
if (sharedPreUtils == null) {
Class var1 = SharedUtil.class;
synchronized (SharedUtil.class) {
if (sharedPreUtils == null) {
sharedPreUtils = new SharedUtil(context);
}
}
}
return sharedPreUtils;
}
public void setPath(String path) {
this.path = path;
}
public void putBoolean(String key, boolean value) {
this.sp.edit().putBoolean(key, value).apply();
}
public boolean getBoolean(String key, boolean defValue) {
return this.sp.getBoolean(key, defValue);
}
public void putString(String key, String value) {
this.sp.edit().putString(key, value).apply();
}
public String getString(String key, String defValue) {
return this.sp.getString(key, defValue);
}
public String getString(String key) {
return this.sp.getString(key,"");
}
public void putInt(String key, int value) {
this.sp.edit().putInt(key, value).apply();
}
public int getInt(String key, int defValue) {
return this.sp.getInt(key, defValue);
}
public void remove(String key) {
this.sp.edit().remove(key).apply();
}
public void clear() {
if (this.sp != null) {
this.sp.edit().clear().apply();
}
}
/**
* List
*
* @param key
* @param list
*/
public void putList(String key, List<? extends Serializable> list) {
try {
put( key, list);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* List
*
* @param key
* @param <E>
* @return List
*/
public <E extends Serializable> List<E> getList(String key) {
try {
return (List<E>) get(key);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
*
*/
private void put(String key, Object obj)
throws IOException {
if (obj == null) {//判断对象是否为空
return;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = null;
oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
// 将对象放到OutputStream中
// 将对象转换成byte数组并将其进行base64编码
String objectStr = new String(Base64.encode(baos.toByteArray(), Base64.DEFAULT));
baos.close();
oos.close();
putString(key, objectStr);
}
/**
*
*/
private Object get(String key)
throws IOException, ClassNotFoundException {
String wordBase64 = getString(key);
// 将base64格式字符串还原成byte数组
if (TextUtils.isEmpty(wordBase64)) { //不可少否则在下面会报java.io.StreamCorruptedException
return null;
}
byte[] objBytes = Base64.decode(wordBase64.getBytes(), Base64.DEFAULT);
ByteArrayInputStream bais = new ByteArrayInputStream(objBytes);
ObjectInputStream ois = new ObjectInputStream(bais);
// 将byte数组转换成product对象
Object obj = ois.readObject();
bais.close();
ois.close();
return obj;
}
}

@ -0,0 +1,76 @@
package com.stu.assistant.uitls;
import android.app.Activity;
import android.app.Application;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class ShowClassNameCallBack implements Application.ActivityLifecycleCallbacks {
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
}
@Override
public void onActivityStarted(@NonNull Activity activity) {
if (activity == null) {
return;
}
if (activity.getWindow() == null) {
return;
}
if (activity.getWindow().getDecorView() == null) {
return;
}
String activitySimpleName = activity.getClass().getSimpleName();
Log.i("clazz",activity.getClass().getName());
DragTextView textView = new DragTextView(activity);
textView.setText(activitySimpleName);
textView.setTextSize(18f);
textView.setTextColor(Color.parseColor("#FF0000"));
textView.setPadding(0, 50, 0, 0);
textView.setClickable(true);
View decorView= activity.getWindow().getDecorView();
FrameLayout frameLayout= decorView.findViewById(android.R.id.content);
textView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
textView.setGravity(Gravity.CENTER);
frameLayout.addView(textView);
}
@Override
public void onActivityResumed(@NonNull Activity activity) {
}
@Override
public void onActivityPaused(@NonNull Activity activity) {
}
@Override
public void onActivityStopped(@NonNull Activity activity) {
}
@Override
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
}
@Override
public void onActivityDestroyed(@NonNull Activity activity) {
}
}

@ -0,0 +1,30 @@
package com.stu.assistant.view;
import android.content.Context;
import android.util.AttributeSet;
import com.stu.assistant.R;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
public class MySwipeRefreshLayout extends SwipeRefreshLayout {
public MySwipeRefreshLayout(@NonNull Context context) {
super(context);
init();
}
public MySwipeRefreshLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
setColorSchemeResources(
R.color.app_yellow,
R.color.app_yellow,
R.color.app_yellow,
R.color.app_yellow);
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="200"
android:fromYDelta="100"
android:toYDelta="0" />
<alpha
android:duration="200"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="200"
android:fromYDelta="0"
android:toYDelta="100" />
<alpha
android:duration="200"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="20dp"
android:shape="rectangle">
<solid android:color="?attr/colortheme" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
</shape>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="20dp"
android:shape="rectangle">
<solid android:color="?attr/colortheme" />
<corners android:radius="8dp" />
</shape>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="20dp"
android:shape="rectangle">
<solid android:color="@color/bg" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
</shape>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colortheme" />
<corners android:radius="4dp" />
</shape>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:shape="rectangle"
tools:ignore="MissingDefaultResource">
<solid android:color="@color/white" />
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp"
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
/>
</shape>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners android:radius="8dp" />
<stroke
android:width="1dp"
android:color="?attr/colortheme"/>
</shape>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners android:radius="4dp" />
<stroke
android:width="1dp"
android:color="?attr/colortheme"/>
</shape>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners android:radius="8dp" />
<stroke
android:width="1dp"
android:color="@color/white"/>
</shape>

@ -0,0 +1,170 @@
<?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>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/colortheme" android:state_checked="true" />
<!-- not selected -->
<item android:color="@color/black" android:state_checked="false" />
</selector>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="20dp"
android:shape="rectangle">
<solid android:color="?attr/colortheme" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
</shape>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="20dp"
android:shape="rectangle">
<solid android:color="?attr/colortheme" />
<corners android:radius="8dp" />
</shape>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="20dp"
android:shape="rectangle">
<solid android:color="@color/bg" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
</shape>

@ -0,0 +1,118 @@
<?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:id="@+id/lay"
android:orientation="vertical"
tools:context=".activity.AddTableActivity">
<include layout="@layout/base_heard_layout" />
<LinearLayout
android:id="@+id/title_time_view"
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<TextView
android:id="@+id/time"
android:layout_width="30dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="时间"
android:textColor="@color/color_1e1f20_45"
android:textSize="14sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/white" />
<TextView
android:id="@+id/time1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周一"
android:textColor="@color/color_1e1f20_45"
android:textSize="14sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/white" />
<TextView
android:id="@+id/time2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周二"
android:textColor="@color/color_1e1f20_45"
android:textSize="14sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/white" />
<TextView
android:id="@+id/time3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周三"
android:textColor="@color/color_1e1f20_45"
android:textSize="14sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/white" />
<TextView
android:id="@+id/time4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周四"
android:textColor="@color/color_1e1f20_45"
android:textSize="14sp" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/white" />
<TextView
android:id="@+id/time5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="周五"
android:textColor="@color/color_1e1f20_45"
android:textSize="14sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/white" />
<com.stu.assistant.view.MySwipeRefreshLayout
android:id="@+id/swip_rf"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mrv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.stu.assistant.view.MySwipeRefreshLayout>
</LinearLayout>

@ -0,0 +1,230 @@
<?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"
tools:context=".activity.AddTableDialogActivity">
<include layout="@layout/base_heard_layout" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="课程名字"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colortheme" />
<EditText
android:id="@+id/edit_table_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入课程名字"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="上课地点"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colortheme" />
<EditText
android:id="@+id/edit_address"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入上课地点"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="任课老师"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colortheme" />
<Spinner
android:id="@+id/edit_teacherName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:entries="@array/teacher"
android:gravity="center|left"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="课程周数"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colortheme" />
<Spinner
android:id="@+id/spinner_day"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:entries="@array/week"
android:gravity="center|left"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="课程节次"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colortheme" />
<Spinner
android:id="@+id/spinner_time"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:entries="@array/time"
android:gravity="center"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="注意事项"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colortheme" />
<EditText
android:id="@+id/edit_mark"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入注意事项"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/OnPushClick"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_red_bg_4"
android:gravity="center"
android:text="添加"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>

@ -0,0 +1,120 @@
<?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"
tools:context=".activity.AddTableDialogActivity">
<include layout="@layout/base_heard_layout" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="课程名字"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colortheme" />
<EditText
android:id="@+id/edit_task_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入课程名字"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="截止时间"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="?attr/colortheme" />
<TextView
android:id="@+id/tv_time"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请选择截止时间"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:minHeight="50dp"
android:orientation="horizontal">
<EditText
android:id="@+id/edit_msg"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="top|left"
android:hint="请输入作业内容"
android:paddingLeft="12dp"
android:paddingTop="10dp"
android:paddingRight="12dp"
android:paddingBottom="12dp"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/OnPushClick"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_red_bg_4"
android:gravity="center"
android:text="添加"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>

@ -0,0 +1,154 @@
<?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"
tools:context=".activity.LoginActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@color/black" />
<TextView
android:id="@+id/app_name"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="@string/app_name"
android:textColor="@color/black"
android:textSize="24sp"
android:textStyle="bold"
android:visibility="invisible" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@mipmap/ic_big" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="30dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="账号"
android:visibility="gone"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:visibility="gone"
android:background="@color/colorBlue" />
<EditText
android:id="@+id/tv_username"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入账号"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="密码"
android:visibility="gone"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:visibility="gone"
android:background="@color/colorBlue" />
<EditText
android:id="@+id/tv_userpassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入密码"
android:password="true"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right|center_vertical"
android:onClick="OnRegister"
android:paddingTop="15dp"
android:paddingRight="16dp"
android:paddingBottom="10dp"
android:text="注册账号" />
<TextView
android:id="@+id/button_login"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="40dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="30dp"
android:background="@drawable/btn_red_bg_4"
android:gravity="center"
android:text="登录"
android:textColor="@color/white"
android:textSize="16sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="技术支持"
android:visibility="invisible"
android:textColor="@color/text_color_999999"
android:textSize="12sp" />
<TextView
android:id="@+id/version_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="111111"
android:visibility="invisible"
android:textColor="@color/text_color_999999"
android:textSize="12sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>

@ -0,0 +1,22 @@
<?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:id="@+id/lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.MainActivity">
<include layout="@layout/base_heard_layout" />
<include layout="@layout/include_top_toolbar" android:visibility="gone"/>
<GridView
android:id="@+id/main_gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="3"
android:paddingTop="10dp"
android:verticalSpacing="10dp" />
</LinearLayout>

@ -0,0 +1,219 @@
<?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/base_heard_layout" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="15dp"
android:paddingRight="16dp"
android:textColor="?attr/colortheme"
android:textSize="17sp"
android:textStyle="bold"
android:visibility="invisible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="60dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="昵称"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="@color/colorBlue" />
<EditText
android:id="@+id/tv_nickname"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入昵称"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="账号"
android:textSize="16sp"
android:visibility="gone" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="@color/colorBlue"
android:visibility="gone" />
<EditText
android:id="@+id/tv_username"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入账号"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="密码"
android:textSize="16sp"
android:visibility="gone" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="@color/colorBlue"
android:visibility="gone" />
<EditText
android:id="@+id/tv_userpassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入密码"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="年龄"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="@color/colorBlue" />
<EditText
android:id="@+id/tv_userAge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入年龄"
android:inputType="number"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/corners_orange_shape"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="80dp"
android:layout_height="match_parent"
android:focusable="false"
android:gravity="center"
android:text="地址"
android:textSize="16sp" />
<TextView
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:background="@color/colorBlue" />
<EditText
android:id="@+id/tv_userAddress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:background="@null"
android:gravity="center|left"
android:hint="请输入地址"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/btn_register"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_red_bg_4"
android:gravity="center"
android:onClick="btnRegisterOnClick"
android:text="注册"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>

@ -0,0 +1,104 @@
<?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:id="@+id/lay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg"
android:orientation="vertical"
tools:context=".activity.SettingActivity">
<include layout="@layout/base_heard_layout" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="10dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="10dp"
android:background="@drawable/corners_org_item_with"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_account"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:text="账号:"
android:textColor="@color/black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="4dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="10dp"
android:background="@drawable/corners_org_item_with"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableRight="@mipmap/ic_right"
android:drawablePadding="16dp"
android:onClick="OnColorClick"
android:paddingLeft="12dp"
android:text="主题色变更"
android:textColor="@color/black"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="4dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="10dp"
android:background="@drawable/corners_org_item_with"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableRight="@mipmap/ic_right"
android:drawablePadding="16dp"
android:onClick="OnBgClick"
android:paddingLeft="12dp"
android:text="更改课表壁纸"
android:textColor="@color/black"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<TextView
android:id="@+id/btn_register"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="50dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_red_bg_4"
android:gravity="center"
android:onClick="BtnOutOnClick"
android:text="退出"
android:textColor="@color/white"
android:textSize="16sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="50dp" />
</LinearLayout>

@ -0,0 +1,50 @@
<?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/bg"
android:orientation="vertical"
tools:context=".activity.TableListActivity">
<include layout="@layout/base_heard_layout" />
<com.stu.assistant.view.MySwipeRefreshLayout
android:id="@+id/swip_rf"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:paddingLeft="12dp"
android:paddingRight="12dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mrv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</com.stu.assistant.view.MySwipeRefreshLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:gravity="center"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<TextView
android:id="@+id/btn_register"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/btn_red_bg_4"
android:gravity="center"
android:onClick="BtnAddOnClick"
android:text="添加课表"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,10 @@
<?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:fitsSystemWindows="false"
android:orientation="vertical">
<include layout="@layout/fragment_base" />
</LinearLayout>

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title_lay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colortheme"
android:orientation="vertical"
android:paddingLeft="12dp"
android:paddingRight="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="30dp"
android:gravity="center">
<TextView
android:id="@+id/back_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|left"
android:text="返回"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone" />
<LinearLayout
android:id="@+id/back_lay"
android:layout_width="60dp"
android:layout_height="60dp"
android:gravity="center|left">
<ImageView
android:layout_width="36dp"
android:layout_height="36dp"
android:background="@mipmap/ic_back" />
</LinearLayout>
<TextView
android:id="@+id/title_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="60dp"
android:layout_height="60dp"
android:gravity="center|left">
<TextView
android:id="@+id/other_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center|right"
android:text="其他"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="invisible" />
</LinearLayout>
<ImageView
android:id="@+id/other_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/title_lay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colortheme"
android:orientation="vertical"
android:paddingLeft="12dp"
android:paddingRight="12dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@color/white"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:text="温馨提示"
android:textColor="@color/black"
android:textSize="16sp" />
<include layout="@layout/line_layout" />
<EditText
android:id="@+id/mark_edit"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_margin="10dp"
android:background="@drawable/corners_orange_shape"
android:gravity="center|left"
android:hint="请输入处理内容"
android:paddingLeft="10dp"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHint="@color/black"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_can"
style="@style/input_dialog_itemStyle"
android:background="@color/color_1e1f20_4"
android:text="取消" />
<TextView
android:id="@+id/tv_ok"
style="@style/input_dialog_itemStyle"
android:background="?attr/colortheme"
android:text="确定"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save