diff --git a/.gitignore b/.gitignore index ec2481e..aa724b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,15 @@ -# ---> Vim -# Swap -[._]*.s[a-v][a-z] -!*.svg # comment out if you don't need vector files -[._]*.sw[a-p] -[._]s[a-rt-v][a-z] -[._]ss[a-gi-z] -[._]sw[a-p] - -# Session -Session.vim -Sessionx.vim - -# Temporary -.netrwhist -*~ -# Auto-generated tag files -tags -# Persistent undo -[._]*.un~ - +*.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 diff --git a/src/assistance/.gitignore b/src/.gitignore similarity index 100% rename from src/assistance/.gitignore rename to src/.gitignore diff --git a/src/assistance/.idea/.gitignore b/src/.idea/.gitignore similarity index 100% rename from src/assistance/.idea/.gitignore rename to src/.idea/.gitignore diff --git a/src/assistance/.idea/.name b/src/.idea/.name similarity index 100% rename from src/assistance/.idea/.name rename to src/.idea/.name diff --git a/src/assistance/.idea/compiler.xml b/src/.idea/compiler.xml similarity index 100% rename from src/assistance/.idea/compiler.xml rename to src/.idea/compiler.xml diff --git a/src/assistance/.idea/gradle.xml b/src/.idea/gradle.xml similarity index 100% rename from src/assistance/.idea/gradle.xml rename to src/.idea/gradle.xml diff --git a/src/assistance/.idea/jarRepositories.xml b/src/.idea/jarRepositories.xml similarity index 100% rename from src/assistance/.idea/jarRepositories.xml rename to src/.idea/jarRepositories.xml diff --git a/src/assistance/.idea/misc.xml b/src/.idea/misc.xml similarity index 100% rename from src/assistance/.idea/misc.xml rename to src/.idea/misc.xml diff --git a/src/assistance/app/.gitignore b/src/app/.gitignore similarity index 100% rename from src/assistance/app/.gitignore rename to src/app/.gitignore diff --git a/src/assistance/app/build.gradle b/src/app/build.gradle similarity index 100% rename from src/assistance/app/build.gradle rename to src/app/build.gradle diff --git a/src/assistance/app/proguard-rules.pro b/src/app/proguard-rules.pro similarity index 100% rename from src/assistance/app/proguard-rules.pro rename to src/app/proguard-rules.pro diff --git a/src/androidTest/java/com/stu/assistant/ExampleInstrumentedTest.java b/src/app/src/androidTest/java/com/stu/assistant/ExampleInstrumentedTest.java similarity index 100% rename from src/androidTest/java/com/stu/assistant/ExampleInstrumentedTest.java rename to src/app/src/androidTest/java/com/stu/assistant/ExampleInstrumentedTest.java diff --git a/src/assistance/app/src/main/AndroidManifest.xml b/src/app/src/main/AndroidManifest.xml similarity index 100% rename from src/assistance/app/src/main/AndroidManifest.xml rename to src/app/src/main/AndroidManifest.xml diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/AddTableActivity.java b/src/app/src/main/java/com/stu/assistant/activity/AddTableActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/AddTableActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/AddTableActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/AddTableDialogActivity.java b/src/app/src/main/java/com/stu/assistant/activity/AddTableDialogActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/AddTableDialogActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/AddTableDialogActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/AddTaskActivity.java b/src/app/src/main/java/com/stu/assistant/activity/AddTaskActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/AddTaskActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/AddTaskActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/LoginActivity.java b/src/app/src/main/java/com/stu/assistant/activity/LoginActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/LoginActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/LoginActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/MainActivity.java b/src/app/src/main/java/com/stu/assistant/activity/MainActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/MainActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/MainActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/RegisterActivity.java b/src/app/src/main/java/com/stu/assistant/activity/RegisterActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/RegisterActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/RegisterActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/SettingActivity.java b/src/app/src/main/java/com/stu/assistant/activity/SettingActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/SettingActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/SettingActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/TableListActivity.java b/src/app/src/main/java/com/stu/assistant/activity/TableListActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/TableListActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/TableListActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/activity/TaskListActivity.java b/src/app/src/main/java/com/stu/assistant/activity/TaskListActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/activity/TaskListActivity.java rename to src/app/src/main/java/com/stu/assistant/activity/TaskListActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/adapter/HomeGvAdapter.java b/src/app/src/main/java/com/stu/assistant/adapter/HomeGvAdapter.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/adapter/HomeGvAdapter.java rename to src/app/src/main/java/com/stu/assistant/adapter/HomeGvAdapter.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/adapter/TableAllListAdapter.java b/src/app/src/main/java/com/stu/assistant/adapter/TableAllListAdapter.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/adapter/TableAllListAdapter.java rename to src/app/src/main/java/com/stu/assistant/adapter/TableAllListAdapter.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/adapter/TableListAdapter.java b/src/app/src/main/java/com/stu/assistant/adapter/TableListAdapter.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/adapter/TableListAdapter.java rename to src/app/src/main/java/com/stu/assistant/adapter/TableListAdapter.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/adapter/TaskAllListAdapter.java b/src/app/src/main/java/com/stu/assistant/adapter/TaskAllListAdapter.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/adapter/TaskAllListAdapter.java rename to src/app/src/main/java/com/stu/assistant/adapter/TaskAllListAdapter.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/base/ActivityManage.java b/src/app/src/main/java/com/stu/assistant/base/ActivityManage.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/base/ActivityManage.java rename to src/app/src/main/java/com/stu/assistant/base/ActivityManage.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/base/BaseActivity.java b/src/app/src/main/java/com/stu/assistant/base/BaseActivity.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/base/BaseActivity.java rename to src/app/src/main/java/com/stu/assistant/base/BaseActivity.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/base/BaseApplion.java b/src/app/src/main/java/com/stu/assistant/base/BaseApplion.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/base/BaseApplion.java rename to src/app/src/main/java/com/stu/assistant/base/BaseApplion.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/base/BaseBean.java b/src/app/src/main/java/com/stu/assistant/base/BaseBean.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/base/BaseBean.java rename to src/app/src/main/java/com/stu/assistant/base/BaseBean.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/base/BasePresenter.java b/src/app/src/main/java/com/stu/assistant/base/BasePresenter.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/base/BasePresenter.java rename to src/app/src/main/java/com/stu/assistant/base/BasePresenter.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/bean/AllTableListBean.java b/src/app/src/main/java/com/stu/assistant/bean/AllTableListBean.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/bean/AllTableListBean.java rename to src/app/src/main/java/com/stu/assistant/bean/AllTableListBean.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/bean/CodeBean.java b/src/app/src/main/java/com/stu/assistant/bean/CodeBean.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/bean/CodeBean.java rename to src/app/src/main/java/com/stu/assistant/bean/CodeBean.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/bean/MainModuleBean.java b/src/app/src/main/java/com/stu/assistant/bean/MainModuleBean.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/bean/MainModuleBean.java rename to src/app/src/main/java/com/stu/assistant/bean/MainModuleBean.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/bean/TableBean.java b/src/app/src/main/java/com/stu/assistant/bean/TableBean.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/bean/TableBean.java rename to src/app/src/main/java/com/stu/assistant/bean/TableBean.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/bean/TableTimeBean.java b/src/app/src/main/java/com/stu/assistant/bean/TableTimeBean.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/bean/TableTimeBean.java rename to src/app/src/main/java/com/stu/assistant/bean/TableTimeBean.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/bean/TaskBean.java b/src/app/src/main/java/com/stu/assistant/bean/TaskBean.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/bean/TaskBean.java rename to src/app/src/main/java/com/stu/assistant/bean/TaskBean.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/bean/UserInfoBean.java b/src/app/src/main/java/com/stu/assistant/bean/UserInfoBean.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/bean/UserInfoBean.java rename to src/app/src/main/java/com/stu/assistant/bean/UserInfoBean.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/constants/ConstansItemManager.java b/src/app/src/main/java/com/stu/assistant/constants/ConstansItemManager.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/constants/ConstansItemManager.java rename to src/app/src/main/java/com/stu/assistant/constants/ConstansItemManager.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/constants/ConstansTableItemManager.java b/src/app/src/main/java/com/stu/assistant/constants/ConstansTableItemManager.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/constants/ConstansTableItemManager.java rename to src/app/src/main/java/com/stu/assistant/constants/ConstansTableItemManager.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/constants/ConstansUserManager.java b/src/app/src/main/java/com/stu/assistant/constants/ConstansUserManager.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/constants/ConstansUserManager.java rename to src/app/src/main/java/com/stu/assistant/constants/ConstansUserManager.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/dialog/DiaogUtil.java b/src/app/src/main/java/com/stu/assistant/dialog/DiaogUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/dialog/DiaogUtil.java rename to src/app/src/main/java/com/stu/assistant/dialog/DiaogUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/dialog/PopWindowUtils.java b/src/app/src/main/java/com/stu/assistant/dialog/PopWindowUtils.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/dialog/PopWindowUtils.java rename to src/app/src/main/java/com/stu/assistant/dialog/PopWindowUtils.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/net/Api.java b/src/app/src/main/java/com/stu/assistant/net/Api.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/net/Api.java rename to src/app/src/main/java/com/stu/assistant/net/Api.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/net/NetConfig.java b/src/app/src/main/java/com/stu/assistant/net/NetConfig.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/net/NetConfig.java rename to src/app/src/main/java/com/stu/assistant/net/NetConfig.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/net/OkGoConfig.java b/src/app/src/main/java/com/stu/assistant/net/OkGoConfig.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/net/OkGoConfig.java rename to src/app/src/main/java/com/stu/assistant/net/OkGoConfig.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/net/OkGoNetUtil.java b/src/app/src/main/java/com/stu/assistant/net/OkGoNetUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/net/OkGoNetUtil.java rename to src/app/src/main/java/com/stu/assistant/net/OkGoNetUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/net/imp/OnModleResultListener.java b/src/app/src/main/java/com/stu/assistant/net/imp/OnModleResultListener.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/net/imp/OnModleResultListener.java rename to src/app/src/main/java/com/stu/assistant/net/imp/OnModleResultListener.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/presenter/LoginPresenter.java b/src/app/src/main/java/com/stu/assistant/presenter/LoginPresenter.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/presenter/LoginPresenter.java rename to src/app/src/main/java/com/stu/assistant/presenter/LoginPresenter.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/presenter/MainPresenter.java b/src/app/src/main/java/com/stu/assistant/presenter/MainPresenter.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/presenter/MainPresenter.java rename to src/app/src/main/java/com/stu/assistant/presenter/MainPresenter.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/presenter/RegisterPresenter.java b/src/app/src/main/java/com/stu/assistant/presenter/RegisterPresenter.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/presenter/RegisterPresenter.java rename to src/app/src/main/java/com/stu/assistant/presenter/RegisterPresenter.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/AppTools.java b/src/app/src/main/java/com/stu/assistant/uitls/AppTools.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/AppTools.java rename to src/app/src/main/java/com/stu/assistant/uitls/AppTools.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/BtnClickUtil.java b/src/app/src/main/java/com/stu/assistant/uitls/BtnClickUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/BtnClickUtil.java rename to src/app/src/main/java/com/stu/assistant/uitls/BtnClickUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/CalendarUtil.java b/src/app/src/main/java/com/stu/assistant/uitls/CalendarUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/CalendarUtil.java rename to src/app/src/main/java/com/stu/assistant/uitls/CalendarUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/ChenJingEditUil.java b/src/app/src/main/java/com/stu/assistant/uitls/ChenJingEditUil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/ChenJingEditUil.java rename to src/app/src/main/java/com/stu/assistant/uitls/ChenJingEditUil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/CodeConfig.java b/src/app/src/main/java/com/stu/assistant/uitls/CodeConfig.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/CodeConfig.java rename to src/app/src/main/java/com/stu/assistant/uitls/CodeConfig.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/Config.java b/src/app/src/main/java/com/stu/assistant/uitls/Config.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/Config.java rename to src/app/src/main/java/com/stu/assistant/uitls/Config.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/CrashHandler.java b/src/app/src/main/java/com/stu/assistant/uitls/CrashHandler.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/CrashHandler.java rename to src/app/src/main/java/com/stu/assistant/uitls/CrashHandler.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/CrashHandlerManage.java b/src/app/src/main/java/com/stu/assistant/uitls/CrashHandlerManage.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/CrashHandlerManage.java rename to src/app/src/main/java/com/stu/assistant/uitls/CrashHandlerManage.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/DividerItemDecoration0Util.java b/src/app/src/main/java/com/stu/assistant/uitls/DividerItemDecoration0Util.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/DividerItemDecoration0Util.java rename to src/app/src/main/java/com/stu/assistant/uitls/DividerItemDecoration0Util.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/DividerItemDecorationUtil.java b/src/app/src/main/java/com/stu/assistant/uitls/DividerItemDecorationUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/DividerItemDecorationUtil.java rename to src/app/src/main/java/com/stu/assistant/uitls/DividerItemDecorationUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/DragTextView.java b/src/app/src/main/java/com/stu/assistant/uitls/DragTextView.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/DragTextView.java rename to src/app/src/main/java/com/stu/assistant/uitls/DragTextView.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/ImageUtil.java b/src/app/src/main/java/com/stu/assistant/uitls/ImageUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/ImageUtil.java rename to src/app/src/main/java/com/stu/assistant/uitls/ImageUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/LogUtils.java b/src/app/src/main/java/com/stu/assistant/uitls/LogUtils.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/LogUtils.java rename to src/app/src/main/java/com/stu/assistant/uitls/LogUtils.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/MyToast.java b/src/app/src/main/java/com/stu/assistant/uitls/MyToast.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/MyToast.java rename to src/app/src/main/java/com/stu/assistant/uitls/MyToast.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/NetworkUtil.java b/src/app/src/main/java/com/stu/assistant/uitls/NetworkUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/NetworkUtil.java rename to src/app/src/main/java/com/stu/assistant/uitls/NetworkUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/RgToFmUtils.java b/src/app/src/main/java/com/stu/assistant/uitls/RgToFmUtils.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/RgToFmUtils.java rename to src/app/src/main/java/com/stu/assistant/uitls/RgToFmUtils.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/SaveUserData.java b/src/app/src/main/java/com/stu/assistant/uitls/SaveUserData.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/SaveUserData.java rename to src/app/src/main/java/com/stu/assistant/uitls/SaveUserData.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/SharedConfig.java b/src/app/src/main/java/com/stu/assistant/uitls/SharedConfig.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/SharedConfig.java rename to src/app/src/main/java/com/stu/assistant/uitls/SharedConfig.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/SharedNoClearUtil.java b/src/app/src/main/java/com/stu/assistant/uitls/SharedNoClearUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/SharedNoClearUtil.java rename to src/app/src/main/java/com/stu/assistant/uitls/SharedNoClearUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/SharedUtil.java b/src/app/src/main/java/com/stu/assistant/uitls/SharedUtil.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/SharedUtil.java rename to src/app/src/main/java/com/stu/assistant/uitls/SharedUtil.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/uitls/ShowClassNameCallBack.java b/src/app/src/main/java/com/stu/assistant/uitls/ShowClassNameCallBack.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/uitls/ShowClassNameCallBack.java rename to src/app/src/main/java/com/stu/assistant/uitls/ShowClassNameCallBack.java diff --git a/src/assistance/app/src/main/java/com/stu/assistant/view/MySwipeRefreshLayout.java b/src/app/src/main/java/com/stu/assistant/view/MySwipeRefreshLayout.java similarity index 100% rename from src/assistance/app/src/main/java/com/stu/assistant/view/MySwipeRefreshLayout.java rename to src/app/src/main/java/com/stu/assistant/view/MySwipeRefreshLayout.java diff --git a/src/assistance/app/src/main/res/anim/pop_enter_anim.xml b/src/app/src/main/res/anim/pop_enter_anim.xml similarity index 100% rename from src/assistance/app/src/main/res/anim/pop_enter_anim.xml rename to src/app/src/main/res/anim/pop_enter_anim.xml diff --git a/src/assistance/app/src/main/res/anim/pop_exit_anim.xml b/src/app/src/main/res/anim/pop_exit_anim.xml similarity index 100% rename from src/assistance/app/src/main/res/anim/pop_exit_anim.xml rename to src/app/src/main/res/anim/pop_exit_anim.xml diff --git a/src/assistance/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/src/app/src/main/res/drawable-v24/ic_launcher_foreground.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable-v24/ic_launcher_foreground.xml rename to src/app/src/main/res/drawable-v24/ic_launcher_foreground.xml diff --git a/src/assistance/app/src/main/res/drawable-v24/rounded_button.xml b/src/app/src/main/res/drawable-v24/rounded_button.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable-v24/rounded_button.xml rename to src/app/src/main/res/drawable-v24/rounded_button.xml diff --git a/src/assistance/app/src/main/res/drawable-v24/rounded_button_org.xml b/src/app/src/main/res/drawable-v24/rounded_button_org.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable-v24/rounded_button_org.xml rename to src/app/src/main/res/drawable-v24/rounded_button_org.xml diff --git a/src/assistance/app/src/main/res/drawable-v24/rounded_edittext.xml b/src/app/src/main/res/drawable-v24/rounded_edittext.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable-v24/rounded_edittext.xml rename to src/app/src/main/res/drawable-v24/rounded_edittext.xml diff --git a/src/assistance/app/src/main/res/drawable/btn_red_bg_4.xml b/src/app/src/main/res/drawable/btn_red_bg_4.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/btn_red_bg_4.xml rename to src/app/src/main/res/drawable/btn_red_bg_4.xml diff --git a/src/assistance/app/src/main/res/drawable/corners_item_shape_white_202000.xml b/src/app/src/main/res/drawable/corners_item_shape_white_202000.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/corners_item_shape_white_202000.xml rename to src/app/src/main/res/drawable/corners_item_shape_white_202000.xml diff --git a/src/assistance/app/src/main/res/drawable/corners_orange_shape.xml b/src/app/src/main/res/drawable/corners_orange_shape.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/corners_orange_shape.xml rename to src/app/src/main/res/drawable/corners_orange_shape.xml diff --git a/src/assistance/app/src/main/res/drawable/corners_org_item_shape.xml b/src/app/src/main/res/drawable/corners_org_item_shape.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/corners_org_item_shape.xml rename to src/app/src/main/res/drawable/corners_org_item_shape.xml diff --git a/src/assistance/app/src/main/res/drawable/corners_org_item_with.xml b/src/app/src/main/res/drawable/corners_org_item_with.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/corners_org_item_with.xml rename to src/app/src/main/res/drawable/corners_org_item_with.xml diff --git a/src/assistance/app/src/main/res/drawable/ic_launcher_background.xml b/src/app/src/main/res/drawable/ic_launcher_background.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/ic_launcher_background.xml rename to src/app/src/main/res/drawable/ic_launcher_background.xml diff --git a/src/assistance/app/src/main/res/drawable/main_rbtn_textcolor.xml b/src/app/src/main/res/drawable/main_rbtn_textcolor.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/main_rbtn_textcolor.xml rename to src/app/src/main/res/drawable/main_rbtn_textcolor.xml diff --git a/src/assistance/app/src/main/res/drawable/rounded_button.xml b/src/app/src/main/res/drawable/rounded_button.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/rounded_button.xml rename to src/app/src/main/res/drawable/rounded_button.xml diff --git a/src/assistance/app/src/main/res/drawable/rounded_button_org.xml b/src/app/src/main/res/drawable/rounded_button_org.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/rounded_button_org.xml rename to src/app/src/main/res/drawable/rounded_button_org.xml diff --git a/src/assistance/app/src/main/res/drawable/rounded_edittext.xml b/src/app/src/main/res/drawable/rounded_edittext.xml similarity index 100% rename from src/assistance/app/src/main/res/drawable/rounded_edittext.xml rename to src/app/src/main/res/drawable/rounded_edittext.xml diff --git a/src/assistance/app/src/main/res/layout/activity_add_table.xml b/src/app/src/main/res/layout/activity_add_table.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/activity_add_table.xml rename to src/app/src/main/res/layout/activity_add_table.xml diff --git a/src/assistance/app/src/main/res/layout/activity_add_table_dialog.xml b/src/app/src/main/res/layout/activity_add_table_dialog.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/activity_add_table_dialog.xml rename to src/app/src/main/res/layout/activity_add_table_dialog.xml diff --git a/src/assistance/app/src/main/res/layout/activity_add_task_dialog.xml b/src/app/src/main/res/layout/activity_add_task_dialog.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/activity_add_task_dialog.xml rename to src/app/src/main/res/layout/activity_add_task_dialog.xml diff --git a/src/assistance/app/src/main/res/layout/activity_login.xml b/src/app/src/main/res/layout/activity_login.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/activity_login.xml rename to src/app/src/main/res/layout/activity_login.xml diff --git a/src/assistance/app/src/main/res/layout/activity_main.xml b/src/app/src/main/res/layout/activity_main.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/activity_main.xml rename to src/app/src/main/res/layout/activity_main.xml diff --git a/src/assistance/app/src/main/res/layout/activity_register.xml b/src/app/src/main/res/layout/activity_register.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/activity_register.xml rename to src/app/src/main/res/layout/activity_register.xml diff --git a/src/assistance/app/src/main/res/layout/activity_setting.xml b/src/app/src/main/res/layout/activity_setting.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/activity_setting.xml rename to src/app/src/main/res/layout/activity_setting.xml diff --git a/src/assistance/app/src/main/res/layout/activity_table_list.xml b/src/app/src/main/res/layout/activity_table_list.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/activity_table_list.xml rename to src/app/src/main/res/layout/activity_table_list.xml diff --git a/src/assistance/app/src/main/res/layout/base_activity_layout.xml b/src/app/src/main/res/layout/base_activity_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/base_activity_layout.xml rename to src/app/src/main/res/layout/base_activity_layout.xml diff --git a/src/assistance/app/src/main/res/layout/base_heard_layout.xml b/src/app/src/main/res/layout/base_heard_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/base_heard_layout.xml rename to src/app/src/main/res/layout/base_heard_layout.xml diff --git a/src/assistance/app/src/main/res/layout/base_heard_layout2.xml b/src/app/src/main/res/layout/base_heard_layout2.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/base_heard_layout2.xml rename to src/app/src/main/res/layout/base_heard_layout2.xml diff --git a/src/assistance/app/src/main/res/layout/edit_stock_dialog_layout.xml b/src/app/src/main/res/layout/edit_stock_dialog_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/edit_stock_dialog_layout.xml rename to src/app/src/main/res/layout/edit_stock_dialog_layout.xml diff --git a/src/assistance/app/src/main/res/layout/empty_layout.xml b/src/app/src/main/res/layout/empty_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/empty_layout.xml rename to src/app/src/main/res/layout/empty_layout.xml diff --git a/src/assistance/app/src/main/res/layout/evaluate_item_layout.xml b/src/app/src/main/res/layout/evaluate_item_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/evaluate_item_layout.xml rename to src/app/src/main/res/layout/evaluate_item_layout.xml diff --git a/src/assistance/app/src/main/res/layout/evaluate_user_item_layout.xml b/src/app/src/main/res/layout/evaluate_user_item_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/evaluate_user_item_layout.xml rename to src/app/src/main/res/layout/evaluate_user_item_layout.xml diff --git a/src/assistance/app/src/main/res/layout/fragment_base.xml b/src/app/src/main/res/layout/fragment_base.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/fragment_base.xml rename to src/app/src/main/res/layout/fragment_base.xml diff --git a/src/assistance/app/src/main/res/layout/include_top_toolbar.xml b/src/app/src/main/res/layout/include_top_toolbar.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/include_top_toolbar.xml rename to src/app/src/main/res/layout/include_top_toolbar.xml diff --git a/src/assistance/app/src/main/res/layout/input_dialog_layout.xml b/src/app/src/main/res/layout/input_dialog_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/input_dialog_layout.xml rename to src/app/src/main/res/layout/input_dialog_layout.xml diff --git a/src/assistance/app/src/main/res/layout/item_gridview.xml b/src/app/src/main/res/layout/item_gridview.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/item_gridview.xml rename to src/app/src/main/res/layout/item_gridview.xml diff --git a/src/assistance/app/src/main/res/layout/line_layout.xml b/src/app/src/main/res/layout/line_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/line_layout.xml rename to src/app/src/main/res/layout/line_layout.xml diff --git a/src/assistance/app/src/main/res/layout/select_bg_dialog_layout.xml b/src/app/src/main/res/layout/select_bg_dialog_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/select_bg_dialog_layout.xml rename to src/app/src/main/res/layout/select_bg_dialog_layout.xml diff --git a/src/assistance/app/src/main/res/layout/select_color_dialog_layout.xml b/src/app/src/main/res/layout/select_color_dialog_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/select_color_dialog_layout.xml rename to src/app/src/main/res/layout/select_color_dialog_layout.xml diff --git a/src/assistance/app/src/main/res/layout/table_all_list_item_layout.xml b/src/app/src/main/res/layout/table_all_list_item_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/table_all_list_item_layout.xml rename to src/app/src/main/res/layout/table_all_list_item_layout.xml diff --git a/src/assistance/app/src/main/res/layout/table_item_layout.xml b/src/app/src/main/res/layout/table_item_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/table_item_layout.xml rename to src/app/src/main/res/layout/table_item_layout.xml diff --git a/src/assistance/app/src/main/res/layout/tip_dialog_layout.xml b/src/app/src/main/res/layout/tip_dialog_layout.xml similarity index 100% rename from src/assistance/app/src/main/res/layout/tip_dialog_layout.xml rename to src/app/src/main/res/layout/tip_dialog_layout.xml diff --git a/src/assistance/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/src/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml similarity index 100% rename from src/assistance/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to src/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml diff --git a/src/assistance/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/src/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml similarity index 100% rename from src/assistance/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml rename to src/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml diff --git a/src/assistance/app/src/main/res/mipmap-hdpi/ic_1.png b/src/app/src/main/res/mipmap-hdpi/ic_1.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-hdpi/ic_1.png rename to src/app/src/main/res/mipmap-hdpi/ic_1.png diff --git a/src/assistance/app/src/main/res/mipmap-hdpi/ic_2.png b/src/app/src/main/res/mipmap-hdpi/ic_2.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-hdpi/ic_2.png rename to src/app/src/main/res/mipmap-hdpi/ic_2.png diff --git a/src/assistance/app/src/main/res/mipmap-hdpi/ic_3.png b/src/app/src/main/res/mipmap-hdpi/ic_3.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-hdpi/ic_3.png rename to src/app/src/main/res/mipmap-hdpi/ic_3.png diff --git a/src/assistance/app/src/main/res/mipmap-hdpi/ic_app_bg.png b/src/app/src/main/res/mipmap-hdpi/ic_app_bg.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-hdpi/ic_app_bg.png rename to src/app/src/main/res/mipmap-hdpi/ic_app_bg.png diff --git a/src/assistance/app/src/main/res/mipmap-hdpi/ic_launcher.png b/src/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to src/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/src/assistance/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/src/app/src/main/res/mipmap-hdpi/ic_launcher_round.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-hdpi/ic_launcher_round.png rename to src/app/src/main/res/mipmap-hdpi/ic_launcher_round.png diff --git a/src/assistance/app/src/main/res/mipmap-hdpi/water_icn.jpg b/src/app/src/main/res/mipmap-hdpi/water_icn.jpg similarity index 100% rename from src/assistance/app/src/main/res/mipmap-hdpi/water_icn.jpg rename to src/app/src/main/res/mipmap-hdpi/water_icn.jpg diff --git a/src/assistance/app/src/main/res/mipmap-mdpi/ic_launcher.png b/src/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to src/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/src/assistance/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/src/app/src/main/res/mipmap-mdpi/ic_launcher_round.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-mdpi/ic_launcher_round.png rename to src/app/src/main/res/mipmap-mdpi/ic_launcher_round.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/bg_no_data.png b/src/app/src/main/res/mipmap-xhdpi/bg_no_data.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/bg_no_data.png rename to src/app/src/main/res/mipmap-xhdpi/bg_no_data.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/bg_no_net.png b/src/app/src/main/res/mipmap-xhdpi/bg_no_net.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/bg_no_net.png rename to src/app/src/main/res/mipmap-xhdpi/bg_no_net.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/head_icn.png b/src/app/src/main/res/mipmap-xhdpi/head_icn.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/head_icn.png rename to src/app/src/main/res/mipmap-xhdpi/head_icn.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_1.png b/src/app/src/main/res/mipmap-xhdpi/ic_1.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_1.png rename to src/app/src/main/res/mipmap-xhdpi/ic_1.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_2.png b/src/app/src/main/res/mipmap-xhdpi/ic_2.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_2.png rename to src/app/src/main/res/mipmap-xhdpi/ic_2.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_3.png b/src/app/src/main/res/mipmap-xhdpi/ic_3.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_3.png rename to src/app/src/main/res/mipmap-xhdpi/ic_3.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_bg_1.jpg b/src/app/src/main/res/mipmap-xhdpi/ic_bg_1.jpg similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_bg_1.jpg rename to src/app/src/main/res/mipmap-xhdpi/ic_bg_1.jpg diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_bg_2.jpg b/src/app/src/main/res/mipmap-xhdpi/ic_bg_2.jpg similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_bg_2.jpg rename to src/app/src/main/res/mipmap-xhdpi/ic_bg_2.jpg diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_bg_3.jpg b/src/app/src/main/res/mipmap-xhdpi/ic_bg_3.jpg similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_bg_3.jpg rename to src/app/src/main/res/mipmap-xhdpi/ic_bg_3.jpg diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_bg_4.jpg b/src/app/src/main/res/mipmap-xhdpi/ic_bg_4.jpg similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_bg_4.jpg rename to src/app/src/main/res/mipmap-xhdpi/ic_bg_4.jpg diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_del_b.png b/src/app/src/main/res/mipmap-xhdpi/ic_del_b.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_del_b.png rename to src/app/src/main/res/mipmap-xhdpi/ic_del_b.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/src/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to src/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/src/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png rename to src/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_logo.png b/src/app/src/main/res/mipmap-xhdpi/ic_logo.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_logo.png rename to src/app/src/main/res/mipmap-xhdpi/ic_logo.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_right.png b/src/app/src/main/res/mipmap-xhdpi/ic_right.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_right.png rename to src/app/src/main/res/mipmap-xhdpi/ic_right.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_setting.png b/src/app/src/main/res/mipmap-xhdpi/ic_setting.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_setting.png rename to src/app/src/main/res/mipmap-xhdpi/ic_setting.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_task.png b/src/app/src/main/res/mipmap-xhdpi/ic_task.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_task.png rename to src/app/src/main/res/mipmap-xhdpi/ic_task.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/ic_timetable.png b/src/app/src/main/res/mipmap-xhdpi/ic_timetable.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/ic_timetable.png rename to src/app/src/main/res/mipmap-xhdpi/ic_timetable.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/loadfail_img.png b/src/app/src/main/res/mipmap-xhdpi/loadfail_img.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/loadfail_img.png rename to src/app/src/main/res/mipmap-xhdpi/loadfail_img.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/login_state_bg.png b/src/app/src/main/res/mipmap-xhdpi/login_state_bg.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/login_state_bg.png rename to src/app/src/main/res/mipmap-xhdpi/login_state_bg.png diff --git a/src/assistance/app/src/main/res/mipmap-xhdpi/login_top_bg.png b/src/app/src/main/res/mipmap-xhdpi/login_top_bg.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xhdpi/login_top_bg.png rename to src/app/src/main/res/mipmap-xhdpi/login_top_bg.png diff --git a/src/assistance/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/src/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to src/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/src/assistance/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/src/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png rename to src/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png diff --git a/src/assistance/app/src/main/res/mipmap-xxhdpi/login_top_bg.png b/src/app/src/main/res/mipmap-xxhdpi/login_top_bg.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xxhdpi/login_top_bg.png rename to src/app/src/main/res/mipmap-xxhdpi/login_top_bg.png diff --git a/src/assistance/app/src/main/res/mipmap-xxxhdpi/ic_back.png b/src/app/src/main/res/mipmap-xxxhdpi/ic_back.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xxxhdpi/ic_back.png rename to src/app/src/main/res/mipmap-xxxhdpi/ic_back.png diff --git a/src/assistance/app/src/main/res/mipmap-xxxhdpi/ic_big.png b/src/app/src/main/res/mipmap-xxxhdpi/ic_big.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xxxhdpi/ic_big.png rename to src/app/src/main/res/mipmap-xxxhdpi/ic_big.png diff --git a/src/assistance/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/src/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to src/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/src/assistance/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/src/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png similarity index 100% rename from src/assistance/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png rename to src/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png diff --git a/src/assistance/app/src/main/res/values-night/themes.xml b/src/app/src/main/res/values-night/themes.xml similarity index 100% rename from src/assistance/app/src/main/res/values-night/themes.xml rename to src/app/src/main/res/values-night/themes.xml diff --git a/src/assistance/app/src/main/res/values/attr.xml b/src/app/src/main/res/values/attr.xml similarity index 100% rename from src/assistance/app/src/main/res/values/attr.xml rename to src/app/src/main/res/values/attr.xml diff --git a/src/assistance/app/src/main/res/values/colors.xml b/src/app/src/main/res/values/colors.xml similarity index 100% rename from src/assistance/app/src/main/res/values/colors.xml rename to src/app/src/main/res/values/colors.xml diff --git a/src/assistance/app/src/main/res/values/dimens.xml b/src/app/src/main/res/values/dimens.xml similarity index 100% rename from src/assistance/app/src/main/res/values/dimens.xml rename to src/app/src/main/res/values/dimens.xml diff --git a/src/assistance/app/src/main/res/values/strings.xml b/src/app/src/main/res/values/strings.xml similarity index 100% rename from src/assistance/app/src/main/res/values/strings.xml rename to src/app/src/main/res/values/strings.xml diff --git a/src/assistance/app/src/main/res/values/styles.xml b/src/app/src/main/res/values/styles.xml similarity index 100% rename from src/assistance/app/src/main/res/values/styles.xml rename to src/app/src/main/res/values/styles.xml diff --git a/src/assistance/app/src/main/res/values/themes.xml b/src/app/src/main/res/values/themes.xml similarity index 100% rename from src/assistance/app/src/main/res/values/themes.xml rename to src/app/src/main/res/values/themes.xml diff --git a/src/assistance/app/src/main/res/xml/network_security_config.xml b/src/app/src/main/res/xml/network_security_config.xml similarity index 100% rename from src/assistance/app/src/main/res/xml/network_security_config.xml rename to src/app/src/main/res/xml/network_security_config.xml diff --git a/src/assistance/app/src/test/java/com/stu/assistant/ExampleUnitTest.java b/src/app/src/test/java/com/stu/assistant/ExampleUnitTest.java similarity index 100% rename from src/assistance/app/src/test/java/com/stu/assistant/ExampleUnitTest.java rename to src/app/src/test/java/com/stu/assistant/ExampleUnitTest.java diff --git a/src/assistance/app/src/androidTest/java/com/stu/assistant/ExampleInstrumentedTest.java b/src/assistance/app/src/androidTest/java/com/stu/assistant/ExampleInstrumentedTest.java deleted file mode 100644 index e88e9ee..0000000 --- a/src/assistance/app/src/androidTest/java/com/stu/assistant/ExampleInstrumentedTest.java +++ /dev/null @@ -1,26 +0,0 @@ -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 Testing documentation - */ -@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()); - } -} \ No newline at end of file diff --git a/src/assistance/build.gradle b/src/build.gradle similarity index 100% rename from src/assistance/build.gradle rename to src/build.gradle diff --git a/src/assistance/gradle.properties b/src/gradle.properties similarity index 100% rename from src/assistance/gradle.properties rename to src/gradle.properties diff --git a/src/assistance/gradle/wrapper/gradle-wrapper.jar b/src/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from src/assistance/gradle/wrapper/gradle-wrapper.jar rename to src/gradle/wrapper/gradle-wrapper.jar diff --git a/src/assistance/gradle/wrapper/gradle-wrapper.properties b/src/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from src/assistance/gradle/wrapper/gradle-wrapper.properties rename to src/gradle/wrapper/gradle-wrapper.properties diff --git a/src/assistance/gradlew b/src/gradlew similarity index 100% rename from src/assistance/gradlew rename to src/gradlew diff --git a/src/assistance/gradlew.bat b/src/gradlew.bat similarity index 100% rename from src/assistance/gradlew.bat rename to src/gradlew.bat diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml deleted file mode 100644 index 7838783..0000000 --- a/src/main/AndroidManifest.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/AddTableActivity.java b/src/main/java/com/stu/assistant/activity/AddTableActivity.java deleted file mode 100644 index ed0ae5a..0000000 --- a/src/main/java/com/stu/assistant/activity/AddTableActivity.java +++ /dev/null @@ -1,333 +0,0 @@ -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 mList1; - private ArrayList mList2; - private ArrayList mList3; - private ArrayList mList4; - private ArrayList 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 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() { - @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 query = new BmobQuery<>(); - query.addWhereEqualTo("tableIdMsg", bean.getTableIdMsg()); - query.findObjects(new FindListener() { - @Override - public void done(List 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 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) mList1, (ArrayList) mList2, (ArrayList) mList3, (ArrayList) mList4, (ArrayList) mList5); - } - - public void setAdapter(ArrayList mList1, ArrayList mList2, ArrayList mList3, ArrayList mList4, ArrayList 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); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/AddTableDialogActivity.java b/src/main/java/com/stu/assistant/activity/AddTableDialogActivity.java deleted file mode 100644 index c9e76a6..0000000 --- a/src/main/java/com/stu/assistant/activity/AddTableDialogActivity.java +++ /dev/null @@ -1,218 +0,0 @@ -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 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 query = new BmobQuery<>(); - query.addWhereEqualTo("userLevel", ConstansUserManager.Level_3); - query.order("-createdAt") - .findObjects(new FindListener() { - @Override - public void done(List list, BmobException e) { - dismissProDialog(); - teacherList = (ArrayList) list; - setSpinner(teacherList); - } - }); - } - - private void setSpinner(ArrayList 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 _Adapter = new ArrayAdapter(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() { - @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(); - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/AddTaskActivity.java b/src/main/java/com/stu/assistant/activity/AddTaskActivity.java deleted file mode 100644 index 6c73d8d..0000000 --- a/src/main/java/com/stu/assistant/activity/AddTaskActivity.java +++ /dev/null @@ -1,158 +0,0 @@ -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() { - @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(); - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/LoginActivity.java b/src/main/java/com/stu/assistant/activity/LoginActivity.java deleted file mode 100644 index a56e4dc..0000000 --- a/src/main/java/com/stu/assistant/activity/LoginActivity.java +++ /dev/null @@ -1,111 +0,0 @@ -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(""); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/MainActivity.java b/src/main/java/com/stu/assistant/activity/MainActivity.java deleted file mode 100644 index 6e3948e..0000000 --- a/src/main/java/com/stu/assistant/activity/MainActivity.java +++ /dev/null @@ -1,102 +0,0 @@ -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(); - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/RegisterActivity.java b/src/main/java/com/stu/assistant/activity/RegisterActivity.java deleted file mode 100644 index fdb5457..0000000 --- a/src/main/java/com/stu/assistant/activity/RegisterActivity.java +++ /dev/null @@ -1,75 +0,0 @@ -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(); - } - }); - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/SettingActivity.java b/src/main/java/com/stu/assistant/activity/SettingActivity.java deleted file mode 100644 index 4353f8f..0000000 --- a/src/main/java/com/stu/assistant/activity/SettingActivity.java +++ /dev/null @@ -1,95 +0,0 @@ -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(); - } - }); - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/TableListActivity.java b/src/main/java/com/stu/assistant/activity/TableListActivity.java deleted file mode 100644 index 5718283..0000000 --- a/src/main/java/com/stu/assistant/activity/TableListActivity.java +++ /dev/null @@ -1,144 +0,0 @@ -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 query = new BmobQuery<>(); - query.addWhereEqualTo("stuId", SharedUtil.create(BaseApplion.application).getString(SharedConfig.objectId)); - query.findObjects(new FindListener() { - @Override - public void done(List list, BmobException e) { - LogUtils.i("list", "-stuId-findObjects-->" + new Gson().toJson(list)); - dismissProDialog(); - setAdapter((ArrayList) list); - } - }); - } - - public void setAdapter(ArrayList 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(); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/activity/TaskListActivity.java b/src/main/java/com/stu/assistant/activity/TaskListActivity.java deleted file mode 100644 index 283e085..0000000 --- a/src/main/java/com/stu/assistant/activity/TaskListActivity.java +++ /dev/null @@ -1,144 +0,0 @@ -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 query = new BmobQuery<>(); - query.addWhereEqualTo("stuId", SharedUtil.create(BaseApplion.application).getString(SharedConfig.objectId)); - query.findObjects(new FindListener() { - @Override - public void done(List list, BmobException e) { - LogUtils.i("list", "-stuId-findObjects-->" + new Gson().toJson(list)); - dismissProDialog(); - setAdapter((ArrayList) list); - } - }); - } - - public void setAdapter(ArrayList 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(); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/adapter/HomeGvAdapter.java b/src/main/java/com/stu/assistant/adapter/HomeGvAdapter.java deleted file mode 100644 index 48090a9..0000000 --- a/src/main/java/com/stu/assistant/adapter/HomeGvAdapter.java +++ /dev/null @@ -1,67 +0,0 @@ -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 list; - - public HomeGvAdapter(Context context, ArrayList 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); - } - } -} diff --git a/src/main/java/com/stu/assistant/adapter/TableAllListAdapter.java b/src/main/java/com/stu/assistant/adapter/TableAllListAdapter.java deleted file mode 100644 index f37252c..0000000 --- a/src/main/java/com/stu/assistant/adapter/TableAllListAdapter.java +++ /dev/null @@ -1,93 +0,0 @@ -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 { - ArrayList list1 = new ArrayList<>(); - Context mContext; - private String userLevel; - private int itemType; - - public TableAllListAdapter(Context mContext, ArrayList list1) { - this.mContext = mContext; - this.list1 = list1; - } - - - public void setList(ArrayList 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; - } -} diff --git a/src/main/java/com/stu/assistant/adapter/TableListAdapter.java b/src/main/java/com/stu/assistant/adapter/TableListAdapter.java deleted file mode 100644 index 26f08ae..0000000 --- a/src/main/java/com/stu/assistant/adapter/TableListAdapter.java +++ /dev/null @@ -1,127 +0,0 @@ -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 { - ArrayList list1 = new ArrayList<>(); - ArrayList list2 = new ArrayList<>(); - ArrayList list3 = new ArrayList<>(); - ArrayList list4 = new ArrayList<>(); - ArrayList list5 = new ArrayList<>(); - Context mContext; - private String userLevel; - private int itemType; - - public TableListAdapter(Context mContext) { - this.mContext = mContext; - } - - - public void setList(ArrayList list1, ArrayList list2, ArrayList list3, ArrayList list4, ArrayList 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; - } -} diff --git a/src/main/java/com/stu/assistant/adapter/TaskAllListAdapter.java b/src/main/java/com/stu/assistant/adapter/TaskAllListAdapter.java deleted file mode 100644 index e1415c4..0000000 --- a/src/main/java/com/stu/assistant/adapter/TaskAllListAdapter.java +++ /dev/null @@ -1,87 +0,0 @@ -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 { - ArrayList list1 = new ArrayList<>(); - Context mContext; - private String userLevel; - private int itemType; - - public TaskAllListAdapter(Context mContext, ArrayList list1) { - this.mContext = mContext; - this.list1 = list1; - } - - - public void setList(ArrayList 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; - } -} diff --git a/src/main/java/com/stu/assistant/base/ActivityManage.java b/src/main/java/com/stu/assistant/base/ActivityManage.java deleted file mode 100644 index 968029f..0000000 --- a/src/main/java/com/stu/assistant/base/ActivityManage.java +++ /dev/null @@ -1,82 +0,0 @@ -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 allActivities = new ArrayList<>(); - private Stack 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 getAllActivities() { - ArrayList list = new ArrayList<>(); - if (allActivities.size() > 0) { - for (Activity a : allActivities) { - list.add(a); - } - } - return list; - } -} diff --git a/src/main/java/com/stu/assistant/base/BaseActivity.java b/src/main/java/com/stu/assistant/base/BaseActivity.java deleted file mode 100644 index 07b9e63..0000000 --- a/src/main/java/com/stu/assistant/base/BaseActivity.java +++ /dev/null @@ -1,138 +0,0 @@ -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("¥"); - } - - 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(); -} diff --git a/src/main/java/com/stu/assistant/base/BaseApplion.java b/src/main/java/com/stu/assistant/base/BaseApplion.java deleted file mode 100644 index 34bc886..0000000 --- a/src/main/java/com/stu/assistant/base/BaseApplion.java +++ /dev/null @@ -1,41 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/base/BaseBean.java b/src/main/java/com/stu/assistant/base/BaseBean.java deleted file mode 100644 index 2df78b8..0000000 --- a/src/main/java/com/stu/assistant/base/BaseBean.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.stu.assistant.base; - -import java.io.Serializable; - -import cn.bmob.v3.BmobObject; - -public class BaseBean extends BmobObject implements Serializable { -} diff --git a/src/main/java/com/stu/assistant/base/BasePresenter.java b/src/main/java/com/stu/assistant/base/BasePresenter.java deleted file mode 100644 index 665e0c5..0000000 --- a/src/main/java/com/stu/assistant/base/BasePresenter.java +++ /dev/null @@ -1,15 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/bean/AllTableListBean.java b/src/main/java/com/stu/assistant/bean/AllTableListBean.java deleted file mode 100644 index d375c14..0000000 --- a/src/main/java/com/stu/assistant/bean/AllTableListBean.java +++ /dev/null @@ -1,27 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/bean/CodeBean.java b/src/main/java/com/stu/assistant/bean/CodeBean.java deleted file mode 100644 index b12d8e1..0000000 --- a/src/main/java/com/stu/assistant/bean/CodeBean.java +++ /dev/null @@ -1,54 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/bean/MainModuleBean.java b/src/main/java/com/stu/assistant/bean/MainModuleBean.java deleted file mode 100644 index 9c19579..0000000 --- a/src/main/java/com/stu/assistant/bean/MainModuleBean.java +++ /dev/null @@ -1,51 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/bean/TableBean.java b/src/main/java/com/stu/assistant/bean/TableBean.java deleted file mode 100644 index 3353c73..0000000 --- a/src/main/java/com/stu/assistant/bean/TableBean.java +++ /dev/null @@ -1,92 +0,0 @@ -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; - } - - -} diff --git a/src/main/java/com/stu/assistant/bean/TableTimeBean.java b/src/main/java/com/stu/assistant/bean/TableTimeBean.java deleted file mode 100644 index 2bca592..0000000 --- a/src/main/java/com/stu/assistant/bean/TableTimeBean.java +++ /dev/null @@ -1,60 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/bean/TaskBean.java b/src/main/java/com/stu/assistant/bean/TaskBean.java deleted file mode 100644 index b28fdc2..0000000 --- a/src/main/java/com/stu/assistant/bean/TaskBean.java +++ /dev/null @@ -1,54 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/bean/UserInfoBean.java b/src/main/java/com/stu/assistant/bean/UserInfoBean.java deleted file mode 100644 index 0f11d18..0000000 --- a/src/main/java/com/stu/assistant/bean/UserInfoBean.java +++ /dev/null @@ -1,76 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/constants/ConstansItemManager.java b/src/main/java/com/stu/assistant/constants/ConstansItemManager.java deleted file mode 100644 index 53f9c18..0000000 --- a/src/main/java/com/stu/assistant/constants/ConstansItemManager.java +++ /dev/null @@ -1,7 +0,0 @@ -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; //设置 -} diff --git a/src/main/java/com/stu/assistant/constants/ConstansTableItemManager.java b/src/main/java/com/stu/assistant/constants/ConstansTableItemManager.java deleted file mode 100644 index 4562fa3..0000000 --- a/src/main/java/com/stu/assistant/constants/ConstansTableItemManager.java +++ /dev/null @@ -1,13 +0,0 @@ -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; - -} diff --git a/src/main/java/com/stu/assistant/constants/ConstansUserManager.java b/src/main/java/com/stu/assistant/constants/ConstansUserManager.java deleted file mode 100644 index 4569185..0000000 --- a/src/main/java/com/stu/assistant/constants/ConstansUserManager.java +++ /dev/null @@ -1,10 +0,0 @@ -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";//用户 -} diff --git a/src/main/java/com/stu/assistant/dialog/DiaogUtil.java b/src/main/java/com/stu/assistant/dialog/DiaogUtil.java deleted file mode 100644 index b8cb997..0000000 --- a/src/main/java/com/stu/assistant/dialog/DiaogUtil.java +++ /dev/null @@ -1,318 +0,0 @@ -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); - } -} diff --git a/src/main/java/com/stu/assistant/dialog/PopWindowUtils.java b/src/main/java/com/stu/assistant/dialog/PopWindowUtils.java deleted file mode 100644 index bc21d99..0000000 --- a/src/main/java/com/stu/assistant/dialog/PopWindowUtils.java +++ /dev/null @@ -1,268 +0,0 @@ -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); - } - - /** - * 点击弹窗以外的地方 控制是否关闭弹窗 - * 注:这里主要用来做popupwindow里放edittext 焦点问题 - * 该方法为不调用的话 默认为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); - } -} diff --git a/src/main/java/com/stu/assistant/net/Api.java b/src/main/java/com/stu/assistant/net/Api.java deleted file mode 100644 index 81feac1..0000000 --- a/src/main/java/com/stu/assistant/net/Api.java +++ /dev/null @@ -1,61 +0,0 @@ -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"; - -} diff --git a/src/main/java/com/stu/assistant/net/NetConfig.java b/src/main/java/com/stu/assistant/net/NetConfig.java deleted file mode 100644 index a8d4491..0000000 --- a/src/main/java/com/stu/assistant/net/NetConfig.java +++ /dev/null @@ -1,46 +0,0 @@ -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; - -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/net/OkGoConfig.java b/src/main/java/com/stu/assistant/net/OkGoConfig.java deleted file mode 100644 index 5f9f783..0000000 --- a/src/main/java/com/stu/assistant/net/OkGoConfig.java +++ /dev/null @@ -1,111 +0,0 @@ -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); - } - - - -} diff --git a/src/main/java/com/stu/assistant/net/OkGoNetUtil.java b/src/main/java/com/stu/assistant/net/OkGoNetUtil.java deleted file mode 100644 index 9575b95..0000000 --- a/src/main/java/com/stu/assistant/net/OkGoNetUtil.java +++ /dev/null @@ -1,405 +0,0 @@ -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 void getParam(final Class tClass, final String url, final OnResultListener responseOnListener) { - - if (mContext == null) { - mContext = BaseApplion.application; - } - - boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext); - if (!netWorkAvailable) { - responseOnListener.onError(NetConfig.NetError); - return; - } - - OkGo.get(url).tag(mContext).execute(new StringCallback() { - @Override - public void onSuccess(Response 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 response) { - super.onError(response); - responseOnListener.onConnectFail(NetConfig.ConnectError, response); - } - }); - } - - //post 请求 - public static void postParam(final Class tClass, final String url, HashMap map, final OnResultListener 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.post(url).tag(mContext).upJson(jsonObject.toString()).execute(new StringCallback() { - - @Override - public void onSuccess(Response 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 response) { - super.onError(response); - responseOnListener.onConnectFail(NetConfig.ConnectError, response); - } - }); - } - - - //post 请求 - public static void postParamString(final Class tClass, HttpHeaders headers , final String url, HttpParams map, final OnResultListener responseOnListener) { - - if (mContext == null) { - mContext = BaseApplion.application; - } - - boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext); - if (!netWorkAvailable) { - responseOnListener.onError(NetConfig.NetError); - return; - } - OkGo.post(url).headers(headers).tag(mContext).params(map).execute(new StringCallback() { - @Override - public void onSuccess(Response 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 response) { - super.onError(response); - responseOnListener.onConnectFail(NetConfig.ConnectError, response); - } - }); - } - - public static void postParam2(final Class tClass, final String url, HashMap map, final OnResultListener 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.post(url).tag(mContext).upJson(jsonObject.toString()).execute(new StringCallback() { - @Override - public void onSuccess(Response 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 response) { - super.onError(response); - responseOnListener.onConnectFail(NetConfig.ConnectError, response); - } - }); - } - - - public static void postParam3(final Class tClass, final String url, String map, final OnResultListener responseOnListener) { - - if (mContext == null) { - mContext = BaseApplion.application; - } - - boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext); - if (!netWorkAvailable) { - responseOnListener.onError(NetConfig.NetError); - return; - } - - - OkGo.post(url).tag(mContext).upJson(map).execute(new StringCallback() { - @Override - public void onSuccess(Response 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 response) { - super.onError(response); - responseOnListener.onConnectFail(NetConfig.ConnectError, response); - } - }); - } - - - // 上传图片 - public static void postImgParam(final Class tClass, final String url, ArrayList list, final OnResultListener responseOnListener) { - if (mContext == null) { - mContext = BaseApplion.application; - } - - boolean netWorkAvailable = NetworkUtil.isNetWorkAvailable2(mContext); - if (!netWorkAvailable) { - responseOnListener.onError(NetConfig.NetError); - return; - } - - OkGo.post(url).tag(mContext).isMultipart(true).addFileParams("files", list).execute(new StringCallback() { - @Override - public void onSuccess(Response 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 response) { - super.onError(response); - responseOnListener.onConnectFail(NetConfig.ConnectError, response); - } - }); - } - - // put 请求 - public static void putParam(final Class tClass, final String url, HashMap map, final OnResultListener 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.put(url).tag(mContext).upJson(jsonObject.toString()).execute(new StringCallback() { - @Override - public void onSuccess(Response 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 response) { - super.onError(response); - responseOnListener.onConnectFail(NetConfig.ConnectError, response); - } - }); - } - - - - - /** - * 适配第三方接口(如预约挂号等) - * */ - public static void postThirdAppParam(final Class tClass, final String url, HashMap map, final OnResultListener 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.post(url).tag(mContext).upJson(jsonObject.toString()).execute(new StringCallback() { - @Override - public void onSuccess(Response 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 response) { - super.onError(response); - responseOnListener.onConnectFail(NetConfig.ConnectError, response); - } - }); - } - - - public interface OnResultListener { - void onSuccess(T bean, String json); - - void onError(String e); - - void onConnectFail(String msg, Response response); - - void onOutApp(String json); - - } -} diff --git a/src/main/java/com/stu/assistant/net/imp/OnModleResultListener.java b/src/main/java/com/stu/assistant/net/imp/OnModleResultListener.java deleted file mode 100644 index e581d84..0000000 --- a/src/main/java/com/stu/assistant/net/imp/OnModleResultListener.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.stu.assistant.net.imp; - -import com.lzy.okgo.model.Response; - -public interface OnModleResultListener { - void onSuccess(T bean); - - void onError(String e); - - void onConnectFail(String msg, Response response); -} diff --git a/src/main/java/com/stu/assistant/presenter/LoginPresenter.java b/src/main/java/com/stu/assistant/presenter/LoginPresenter.java deleted file mode 100644 index 538f1bb..0000000 --- a/src/main/java/com/stu/assistant/presenter/LoginPresenter.java +++ /dev/null @@ -1,77 +0,0 @@ -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() { - @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); - } -} diff --git a/src/main/java/com/stu/assistant/presenter/MainPresenter.java b/src/main/java/com/stu/assistant/presenter/MainPresenter.java deleted file mode 100644 index 26b8c97..0000000 --- a/src/main/java/com/stu/assistant/presenter/MainPresenter.java +++ /dev/null @@ -1,21 +0,0 @@ -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 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; - } -} diff --git a/src/main/java/com/stu/assistant/presenter/RegisterPresenter.java b/src/main/java/com/stu/assistant/presenter/RegisterPresenter.java deleted file mode 100644 index 59960fc..0000000 --- a/src/main/java/com/stu/assistant/presenter/RegisterPresenter.java +++ /dev/null @@ -1,38 +0,0 @@ -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() { - @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); - } -} diff --git a/src/main/java/com/stu/assistant/uitls/AppTools.java b/src/main/java/com/stu/assistant/uitls/AppTools.java deleted file mode 100644 index 25cd991..0000000 --- a/src/main/java/com/stu/assistant/uitls/AppTools.java +++ /dev/null @@ -1,852 +0,0 @@ -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); - } - - - /** - * 获取application中指定的meta-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) { - /* - * 移动:134、135、136、137、138、139、150、151、157(TD)、158、159、187、188 - * 联通:130、131、132、152、155、156、185、186 电信:133、153、180、189、(1349卫通) - * 总结起来就是第一位必定为1,第二位必定为3或5或7或8,其他位置的可以为0-9 - */ - String telRegex = "[1][12345789]\\d{9}";// "[1]"代表第1位为数字1,"[358]"代表第二位可以为3、5、8中的一个,"\\d{9}"代表后面是可以是0~9的数字,有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}"代表后面是可以是0~9的数字,有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 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; - } -} diff --git a/src/main/java/com/stu/assistant/uitls/BtnClickUtil.java b/src/main/java/com/stu/assistant/uitls/BtnClickUtil.java deleted file mode 100644 index e7989ba..0000000 --- a/src/main/java/com/stu/assistant/uitls/BtnClickUtil.java +++ /dev/null @@ -1,19 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/uitls/CalendarUtil.java b/src/main/java/com/stu/assistant/uitls/CalendarUtil.java deleted file mode 100644 index 2f7b9b0..0000000 --- a/src/main/java/com/stu/assistant/uitls/CalendarUtil.java +++ /dev/null @@ -1,805 +0,0 @@ -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 getCarInfo(String CardCode) - throws Exception { - Map map = new HashMap(); - 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 getCarInfo15W(String card) - throws Exception { - Map map = new HashMap(); - 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 carInfo = getCarInfo(idNo); - age = Integer.parseInt(carInfo.get("age")); - - } catch (Exception e) { - e.printStackTrace(); - return 0; - } - - return age; - } - -} diff --git a/src/main/java/com/stu/assistant/uitls/ChenJingEditUil.java b/src/main/java/com/stu/assistant/uitls/ChenJingEditUil.java deleted file mode 100644 index 771fc49..0000000 --- a/src/main/java/com/stu/assistant/uitls/ChenJingEditUil.java +++ /dev/null @@ -1,92 +0,0 @@ -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); - } - -} diff --git a/src/main/java/com/stu/assistant/uitls/CodeConfig.java b/src/main/java/com/stu/assistant/uitls/CodeConfig.java deleted file mode 100644 index 9d973d7..0000000 --- a/src/main/java/com/stu/assistant/uitls/CodeConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -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); - } -} diff --git a/src/main/java/com/stu/assistant/uitls/Config.java b/src/main/java/com/stu/assistant/uitls/Config.java deleted file mode 100644 index dc7fcb2..0000000 --- a/src/main/java/com/stu/assistant/uitls/Config.java +++ /dev/null @@ -1,101 +0,0 @@ -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(); - } -} diff --git a/src/main/java/com/stu/assistant/uitls/CrashHandler.java b/src/main/java/com/stu/assistant/uitls/CrashHandler.java deleted file mode 100644 index d274424..0000000 --- a/src/main/java/com/stu/assistant/uitls/CrashHandler.java +++ /dev/null @@ -1,256 +0,0 @@ -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 infos = new HashMap(); - //显示时间 - 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 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; - } - } -} diff --git a/src/main/java/com/stu/assistant/uitls/CrashHandlerManage.java b/src/main/java/com/stu/assistant/uitls/CrashHandlerManage.java deleted file mode 100644 index b9cf0d9..0000000 --- a/src/main/java/com/stu/assistant/uitls/CrashHandlerManage.java +++ /dev/null @@ -1,161 +0,0 @@ -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 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 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; - } -} diff --git a/src/main/java/com/stu/assistant/uitls/DividerItemDecoration0Util.java b/src/main/java/com/stu/assistant/uitls/DividerItemDecoration0Util.java deleted file mode 100644 index e069179..0000000 --- a/src/main/java/com/stu/assistant/uitls/DividerItemDecoration0Util.java +++ /dev/null @@ -1,53 +0,0 @@ -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; - } -} - - diff --git a/src/main/java/com/stu/assistant/uitls/DividerItemDecorationUtil.java b/src/main/java/com/stu/assistant/uitls/DividerItemDecorationUtil.java deleted file mode 100644 index 130d254..0000000 --- a/src/main/java/com/stu/assistant/uitls/DividerItemDecorationUtil.java +++ /dev/null @@ -1,53 +0,0 @@ -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; - } -} - - diff --git a/src/main/java/com/stu/assistant/uitls/DragTextView.java b/src/main/java/com/stu/assistant/uitls/DragTextView.java deleted file mode 100644 index d844c7f..0000000 --- a/src/main/java/com/stu/assistant/uitls/DragTextView.java +++ /dev/null @@ -1,107 +0,0 @@ -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(); - } - } -} diff --git a/src/main/java/com/stu/assistant/uitls/ImageUtil.java b/src/main/java/com/stu/assistant/uitls/ImageUtil.java deleted file mode 100644 index f557ca7..0000000 --- a/src/main/java/com/stu/assistant/uitls/ImageUtil.java +++ /dev/null @@ -1,527 +0,0 @@ -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 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); - } - - /** - * 将Drawable转换为Bitmap - * - * @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)); - } -} diff --git a/src/main/java/com/stu/assistant/uitls/LogUtils.java b/src/main/java/com/stu/assistant/uitls/LogUtils.java deleted file mode 100644 index 4b70c04..0000000 --- a/src/main/java/com/stu/assistant/uitls/LogUtils.java +++ /dev/null @@ -1,120 +0,0 @@ -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);// 打印剩余日志 - } - } -} \ No newline at end of file diff --git a/src/main/java/com/stu/assistant/uitls/MyToast.java b/src/main/java/com/stu/assistant/uitls/MyToast.java deleted file mode 100644 index 9e72120..0000000 --- a/src/main/java/com/stu/assistant/uitls/MyToast.java +++ /dev/null @@ -1,15 +0,0 @@ -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(); - } -} diff --git a/src/main/java/com/stu/assistant/uitls/NetworkUtil.java b/src/main/java/com/stu/assistant/uitls/NetworkUtil.java deleted file mode 100644 index 54214b2..0000000 --- a/src/main/java/com/stu/assistant/uitls/NetworkUtil.java +++ /dev/null @@ -1,51 +0,0 @@ -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; - } -} diff --git a/src/main/java/com/stu/assistant/uitls/RgToFmUtils.java b/src/main/java/com/stu/assistant/uitls/RgToFmUtils.java deleted file mode 100644 index 739796a..0000000 --- a/src/main/java/com/stu/assistant/uitls/RgToFmUtils.java +++ /dev/null @@ -1,98 +0,0 @@ -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 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 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(); - } - } -} diff --git a/src/main/java/com/stu/assistant/uitls/SaveUserData.java b/src/main/java/com/stu/assistant/uitls/SaveUserData.java deleted file mode 100644 index 8158715..0000000 --- a/src/main/java/com/stu/assistant/uitls/SaveUserData.java +++ /dev/null @@ -1,98 +0,0 @@ -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() { - @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() { - @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() { - @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() { - @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(","); - } - }); - - } -} diff --git a/src/main/java/com/stu/assistant/uitls/SharedConfig.java b/src/main/java/com/stu/assistant/uitls/SharedConfig.java deleted file mode 100644 index e3aeff3..0000000 --- a/src/main/java/com/stu/assistant/uitls/SharedConfig.java +++ /dev/null @@ -1,24 +0,0 @@ -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"; -} diff --git a/src/main/java/com/stu/assistant/uitls/SharedNoClearUtil.java b/src/main/java/com/stu/assistant/uitls/SharedNoClearUtil.java deleted file mode 100644 index c48633d..0000000 --- a/src/main/java/com/stu/assistant/uitls/SharedNoClearUtil.java +++ /dev/null @@ -1,157 +0,0 @@ -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 list) { - try { - put( key, list); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 获取List集合 - * - * @param key 键 - * @param 指定泛型 - * @return List集合 - */ - public List getList(String key) { - try { - return (List) 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; - } - -} diff --git a/src/main/java/com/stu/assistant/uitls/SharedUtil.java b/src/main/java/com/stu/assistant/uitls/SharedUtil.java deleted file mode 100644 index 24b0e36..0000000 --- a/src/main/java/com/stu/assistant/uitls/SharedUtil.java +++ /dev/null @@ -1,157 +0,0 @@ -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 list) { - try { - put( key, list); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 获取List集合 - * - * @param key 键 - * @param 指定泛型 - * @return List集合 - */ - public List getList(String key) { - try { - return (List) 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; - } - -} diff --git a/src/main/java/com/stu/assistant/uitls/ShowClassNameCallBack.java b/src/main/java/com/stu/assistant/uitls/ShowClassNameCallBack.java deleted file mode 100644 index ed8178c..0000000 --- a/src/main/java/com/stu/assistant/uitls/ShowClassNameCallBack.java +++ /dev/null @@ -1,76 +0,0 @@ -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) { - - } -} diff --git a/src/main/java/com/stu/assistant/view/MySwipeRefreshLayout.java b/src/main/java/com/stu/assistant/view/MySwipeRefreshLayout.java deleted file mode 100644 index 92d3516..0000000 --- a/src/main/java/com/stu/assistant/view/MySwipeRefreshLayout.java +++ /dev/null @@ -1,30 +0,0 @@ -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); - } -} diff --git a/src/main/res/anim/pop_enter_anim.xml b/src/main/res/anim/pop_enter_anim.xml deleted file mode 100644 index a60101a..0000000 --- a/src/main/res/anim/pop_enter_anim.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/main/res/anim/pop_exit_anim.xml b/src/main/res/anim/pop_exit_anim.xml deleted file mode 100644 index 1578eb0..0000000 --- a/src/main/res/anim/pop_exit_anim.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/main/res/drawable-v24/ic_launcher_foreground.xml b/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d1..0000000 --- a/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/drawable-v24/rounded_button.xml b/src/main/res/drawable-v24/rounded_button.xml deleted file mode 100644 index 2245373..0000000 --- a/src/main/res/drawable-v24/rounded_button.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/main/res/drawable-v24/rounded_button_org.xml b/src/main/res/drawable-v24/rounded_button_org.xml deleted file mode 100644 index 5510fcd..0000000 --- a/src/main/res/drawable-v24/rounded_button_org.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/main/res/drawable-v24/rounded_edittext.xml b/src/main/res/drawable-v24/rounded_edittext.xml deleted file mode 100644 index da5b6d5..0000000 --- a/src/main/res/drawable-v24/rounded_edittext.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/btn_red_bg_4.xml b/src/main/res/drawable/btn_red_bg_4.xml deleted file mode 100644 index 2f4f345..0000000 --- a/src/main/res/drawable/btn_red_bg_4.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/corners_item_shape_white_202000.xml b/src/main/res/drawable/corners_item_shape_white_202000.xml deleted file mode 100644 index 076152f..0000000 --- a/src/main/res/drawable/corners_item_shape_white_202000.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/corners_orange_shape.xml b/src/main/res/drawable/corners_orange_shape.xml deleted file mode 100644 index b29e88f..0000000 --- a/src/main/res/drawable/corners_orange_shape.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/corners_org_item_shape.xml b/src/main/res/drawable/corners_org_item_shape.xml deleted file mode 100644 index acf4cd7..0000000 --- a/src/main/res/drawable/corners_org_item_shape.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/corners_org_item_with.xml b/src/main/res/drawable/corners_org_item_with.xml deleted file mode 100644 index 9c5a2dd..0000000 --- a/src/main/res/drawable/corners_org_item_with.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/ic_launcher_background.xml b/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9..0000000 --- a/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/res/drawable/main_rbtn_textcolor.xml b/src/main/res/drawable/main_rbtn_textcolor.xml deleted file mode 100644 index 3dace46..0000000 --- a/src/main/res/drawable/main_rbtn_textcolor.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/rounded_button.xml b/src/main/res/drawable/rounded_button.xml deleted file mode 100644 index 2245373..0000000 --- a/src/main/res/drawable/rounded_button.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/rounded_button_org.xml b/src/main/res/drawable/rounded_button_org.xml deleted file mode 100644 index 5510fcd..0000000 --- a/src/main/res/drawable/rounded_button_org.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/main/res/drawable/rounded_edittext.xml b/src/main/res/drawable/rounded_edittext.xml deleted file mode 100644 index da5b6d5..0000000 --- a/src/main/res/drawable/rounded_edittext.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/main/res/layout/activity_add_table.xml b/src/main/res/layout/activity_add_table.xml deleted file mode 100644 index 3d4b911..0000000 --- a/src/main/res/layout/activity_add_table.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/activity_add_table_dialog.xml b/src/main/res/layout/activity_add_table_dialog.xml deleted file mode 100644 index 44165f7..0000000 --- a/src/main/res/layout/activity_add_table_dialog.xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/activity_add_task_dialog.xml b/src/main/res/layout/activity_add_task_dialog.xml deleted file mode 100644 index 83b4faf..0000000 --- a/src/main/res/layout/activity_add_task_dialog.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/activity_login.xml b/src/main/res/layout/activity_login.xml deleted file mode 100644 index d01cb0c..0000000 --- a/src/main/res/layout/activity_login.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/activity_main.xml b/src/main/res/layout/activity_main.xml deleted file mode 100644 index e7de751..0000000 --- a/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/activity_register.xml b/src/main/res/layout/activity_register.xml deleted file mode 100644 index 4b4c5b6..0000000 --- a/src/main/res/layout/activity_register.xml +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/activity_setting.xml b/src/main/res/layout/activity_setting.xml deleted file mode 100644 index 1eff912..0000000 --- a/src/main/res/layout/activity_setting.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/activity_table_list.xml b/src/main/res/layout/activity_table_list.xml deleted file mode 100644 index 020b604..0000000 --- a/src/main/res/layout/activity_table_list.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/base_activity_layout.xml b/src/main/res/layout/base_activity_layout.xml deleted file mode 100644 index ff817c6..0000000 --- a/src/main/res/layout/base_activity_layout.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/base_heard_layout.xml b/src/main/res/layout/base_heard_layout.xml deleted file mode 100644 index 197eeeb..0000000 --- a/src/main/res/layout/base_heard_layout.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/base_heard_layout2.xml b/src/main/res/layout/base_heard_layout2.xml deleted file mode 100644 index cd408ac..0000000 --- a/src/main/res/layout/base_heard_layout2.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/edit_stock_dialog_layout.xml b/src/main/res/layout/edit_stock_dialog_layout.xml deleted file mode 100644 index 1af92a3..0000000 --- a/src/main/res/layout/edit_stock_dialog_layout.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/empty_layout.xml b/src/main/res/layout/empty_layout.xml deleted file mode 100644 index 336e65a..0000000 --- a/src/main/res/layout/empty_layout.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - diff --git a/src/main/res/layout/evaluate_item_layout.xml b/src/main/res/layout/evaluate_item_layout.xml deleted file mode 100644 index bc0eb4a..0000000 --- a/src/main/res/layout/evaluate_item_layout.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/evaluate_user_item_layout.xml b/src/main/res/layout/evaluate_user_item_layout.xml deleted file mode 100644 index ebae9de..0000000 --- a/src/main/res/layout/evaluate_user_item_layout.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/res/layout/fragment_base.xml b/src/main/res/layout/fragment_base.xml deleted file mode 100644 index 15cc49e..0000000 --- a/src/main/res/layout/fragment_base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/src/main/res/layout/include_top_toolbar.xml b/src/main/res/layout/include_top_toolbar.xml deleted file mode 100644 index e57ba61..0000000 --- a/src/main/res/layout/include_top_toolbar.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - -