| @@ -1 +1 @@ | |||
| WebEBook | |||
| WebScreen | |||
| @@ -0,0 +1,17 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <project version="4"> | |||
| <component name="deploymentTargetDropDown"> | |||
| <runningDeviceTargetSelectedWithDropDown> | |||
| <Target> | |||
| <type value="RUNNING_DEVICE_TARGET" /> | |||
| <deviceKey> | |||
| <Key> | |||
| <type value="VIRTUAL_DEVICE_PATH" /> | |||
| <value value="C:\Users\Administrator\.android\avd\EScreen_API_27.avd" /> | |||
| </Key> | |||
| </deviceKey> | |||
| </Target> | |||
| </runningDeviceTargetSelectedWithDropDown> | |||
| <timeTargetWasSelectedWithDropDown value="2022-04-24T07:25:04.726554600Z" /> | |||
| </component> | |||
| </project> | |||
| @@ -5,6 +5,8 @@ | |||
| <map> | |||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/btn_select.xml" value="0.321" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/selector_btn_read_setting.xml" value="0.321" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/shape_corner.xml" value="0.268" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/shape_corner_plain.xml" value="0.331" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/switch_ios_thumb.xml" value="0.372" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/switch_ios_track_off.xml" value="0.372" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/drawable/switch_ios_track_on.xml" value="0.372" /> | |||
| @@ -17,12 +19,16 @@ | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/activity_web.xml" value="0.30483112441214194" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_exit.xml" value="0.30483112441214194" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_leave.xml" value="0.5" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/dialog_test.xml" value="0.29827742520398914" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/fragment_home.xml" value="0.6594650205761317" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/fragment_my.xml" value="0.45940721649484534" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/layout_empty.xml" value="0.37135416666666665" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/layout_leave_step.xml" value="0.4681549573210768" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/layout_leave_table.xml" value="0.41030092592592593" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/layout_loading.xml" value="0.30483112441214194" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/leave_dialog_title.xml" value="0.37135416666666665" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/layout/version_dialog.xml" value="0.30483112441214194" /> | |||
| <entry key="..\:/work/escreen/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.331" /> | |||
| </map> | |||
| </option> | |||
| </component> | |||
| @@ -16,8 +16,8 @@ android { | |||
| // minSdkVersion 26 | |||
| minSdkVersion 21 | |||
| targetSdkVersion 25 | |||
| versionCode 3 | |||
| versionName "2.0.1" | |||
| versionCode 5 | |||
| versionName "2.0.3" | |||
| testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
| // ndk { | |||
| @@ -33,7 +33,7 @@ | |||
| android:name="com.yzx.escreen.MainActivity" | |||
| android:configChanges="orientation|keyboard" | |||
| android:launchMode="singleTask" | |||
| android:windowSoftInputMode="adjustResize|stateHidden" | |||
| android:windowSoftInputMode="adjustPan|stateHidden" | |||
| android:screenOrientation="landscape"> | |||
| <intent-filter> | |||
| <action android:name="android.intent.action.MAIN" /> | |||
| @@ -4,10 +4,12 @@ import android.app.Application | |||
| import com.blankj.utilcode.util.Utils | |||
| import com.lzy.okgo.OkGo | |||
| import com.lzy.okgo.model.HttpHeaders | |||
| import com.lzy.okgo.model.HttpParams | |||
| import com.tencent.smtt.export.external.TbsCoreSettings | |||
| import com.tencent.smtt.sdk.QbSdk | |||
| import com.umeng.analytics.MobclickAgent | |||
| import com.umeng.commonsdk.UMConfigure | |||
| import com.yzx.escreen.config.Config | |||
| import com.yzx.escreen.model.User | |||
| @@ -29,8 +31,11 @@ class App : Application() { | |||
| val user = User.getUser() | |||
| headers.put("phone",user.phone) | |||
| headers.put("token",user.token) | |||
| val params = HttpParams() | |||
| params.put("app_id",Config.APP_ID) | |||
| OkGo.getInstance() | |||
| .addCommonHeaders(headers) | |||
| .addCommonParams(params) | |||
| .init(this) | |||
| @@ -1,40 +1,76 @@ | |||
| package com.yzx.escreen | |||
| import android.annotation.SuppressLint | |||
| import android.app.Dialog | |||
| import android.content.Context | |||
| import android.content.Intent | |||
| import android.text.InputType | |||
| import android.util.Log | |||
| import android.view.KeyEvent | |||
| import android.view.View | |||
| import android.widget.TextView | |||
| import androidx.appcompat.app.AppCompatActivity | |||
| import androidx.core.widget.ContentLoadingProgressBar | |||
| import androidx.fragment.app.Fragment | |||
| import androidx.viewpager2.adapter.FragmentStateAdapter | |||
| import androidx.viewpager2.widget.ViewPager2 | |||
| import com.allenliu.versionchecklib.v2.AllenVersionChecker | |||
| import com.allenliu.versionchecklib.v2.builder.UIData | |||
| import com.allenliu.versionchecklib.v2.callback.CustomDownloadingDialogListener | |||
| import com.blankj.utilcode.constant.PermissionConstants | |||
| import com.blankj.utilcode.util.* | |||
| import com.flyco.tablayout.listener.CustomTabEntity | |||
| import com.flyco.tablayout.listener.OnTabSelectListener | |||
| import com.google.gson.Gson | |||
| import com.google.gson.reflect.TypeToken | |||
| import com.lzy.okgo.OkGo | |||
| import com.lzy.okgo.callback.StringCallback | |||
| import com.lzy.okgo.model.Response | |||
| import com.qmuiteam.qmui.widget.dialog.QMUIDialog | |||
| import com.yzx.escreen.activity.WebActivity | |||
| import com.yzx.escreen.activity.base.BaseActivity | |||
| import com.yzx.escreen.config.Config | |||
| import com.yzx.escreen.fragment.HomeFragment | |||
| import com.yzx.escreen.fragment.MyFragment | |||
| import com.yzx.escreen.model.BaseBean | |||
| import com.yzx.escreen.model.TabEntity | |||
| import com.yzx.escreen.model.User | |||
| import com.yzx.escreen.model.Version | |||
| import com.yzx.escreen.presenter.base.BasePresenter | |||
| import com.yzx.escreen.utils.hideNavigationBar | |||
| import com.yzx.escreen.widget.BaseDialog | |||
| import kotlinx.android.synthetic.main.activity_main.* | |||
| import org.jetbrains.anko.find | |||
| import org.jetbrains.anko.toast | |||
| import java.util.* | |||
| import kotlin.system.exitProcess | |||
| /** | |||
| * Yun.Lei | |||
| * 2020年5月6日14:49:10 | |||
| */ | |||
| class MainActivity : BaseActivity<BasePresenter<*>>() { | |||
| class MainActivity : BaseActivity<BasePresenter<*>>(), NetworkUtils.OnNetworkStatusChangedListener { | |||
| override val inflateId: Int | |||
| get() = R.layout.activity_main | |||
| var netLoadingDialog:QMUIDialog? = null | |||
| var netErrorDialog:QMUIDialog? = null | |||
| private val netLoadingRun = Runnable { | |||
| showNetworkError() | |||
| } | |||
| override fun initView() { | |||
| if (!User.isLogin()) { | |||
| WebActivity.active(this, "${Config.OA_URL}/login") | |||
| finish() | |||
| if(NetworkUtils.isConnected()){ | |||
| if (!User.isLogin()) { | |||
| WebActivity.active(this, "${Config.OA_URL}/login") | |||
| finish() | |||
| } | |||
| checkVersion() | |||
| }else{ | |||
| showNetworkLoading() //显示网络检查中 | |||
| } | |||
| val tabData = arrayListOf<CustomTabEntity>() | |||
| tabData.add(TabEntity("首页", R.mipmap.home_select, R.mipmap.home_unselect)) | |||
| @@ -51,6 +87,7 @@ class MainActivity : BaseActivity<BasePresenter<*>>() { | |||
| tabLayout.setOnTabSelectListener(object : OnTabSelectListener { | |||
| override fun onTabSelect(position: Int) { | |||
| viewPager2.currentItem = position | |||
| KeyboardUtils.hideSoftInput( viewPager2) | |||
| } | |||
| override fun onTabReselect(position: Int) { | |||
| @@ -60,10 +97,55 @@ class MainActivity : BaseActivity<BasePresenter<*>>() { | |||
| } | |||
| override fun initData() { | |||
| NetworkUtils.registerNetworkStatusChangedListener(this) | |||
| PermissionUtils.permissionGroup(PermissionConstants.STORAGE) | |||
| .rationale { activity, shouldRequest -> | |||
| }.callback(object : PermissionUtils.FullCallback { | |||
| override fun onGranted(granted: MutableList<String>) { | |||
| LogUtils.d("权限通过", granted) | |||
| } | |||
| override fun onDenied( | |||
| deniedForever: MutableList<String>, | |||
| denied: MutableList<String> | |||
| ) { | |||
| LogUtils.d("权限拒绝", denied) | |||
| } | |||
| }).theme { activity -> ScreenUtils.setFullScreen(activity) } | |||
| .request() | |||
| } | |||
| private fun showNetworkError(){ | |||
| val builder = QMUIDialog.MessageDialogBuilder(this) | |||
| builder.setMessage("你还没有连接网络,请先连接网络!") | |||
| .setTitle("温馨提示") | |||
| .addAction("去设置" | |||
| ) { dialog, index -> | |||
| NetworkUtils.openWirelessSettings() | |||
| } | |||
| .setCancelable(false) | |||
| .setCanceledOnTouchOutside(false) | |||
| netErrorDialog = builder.show() | |||
| netErrorDialog?.hideNavigationBar() | |||
| } | |||
| private fun showNetworkLoading(){ | |||
| val builder = QMUIDialog.MessageDialogBuilder(this) | |||
| builder.setMessage("网络检查中,请稍后...") | |||
| .setTitle("温馨提示") | |||
| .setCancelable(false) | |||
| .setCanceledOnTouchOutside(false) | |||
| netLoadingDialog = builder.show() | |||
| netLoadingDialog?.hideNavigationBar() | |||
| viewPager2.postDelayed(netLoadingRun,5000) | |||
| } | |||
| override fun initPresenter(): BasePresenter<*>? { | |||
| return null | |||
| } | |||
| @@ -83,6 +165,129 @@ class MainActivity : BaseActivity<BasePresenter<*>>() { | |||
| } | |||
| return super.onKeyUp(keyCode, event) | |||
| } | |||
| override fun onDisconnected() { | |||
| showNetworkError() | |||
| } | |||
| override fun onConnected(networkType: NetworkUtils.NetworkType?) { | |||
| netLoadingDialog?.apply { | |||
| if(isShowing){ | |||
| dismiss() | |||
| } | |||
| } | |||
| netErrorDialog?.apply { | |||
| if(isShowing){ | |||
| dismiss() | |||
| } | |||
| } | |||
| if (!User.isLogin()) { | |||
| WebActivity.active(this, "${Config.OA_URL}/login?logout=1") | |||
| finish() | |||
| } | |||
| checkVersion() | |||
| } | |||
| private fun checkVersion(userCheck: Boolean = false): Unit { | |||
| val BASE_URL = Config.BASE_URL | |||
| OkGo.post<String>("$BASE_URL/parent/common/getInkBottleMaxVersion") | |||
| .tag(this) | |||
| .params("app_id",Config.APP_ID) | |||
| .execute(object : StringCallback() { | |||
| override fun onSuccess(response: Response<String>) { | |||
| val json = response.body() | |||
| Log.d("checkVersion", "onSuccess: ${json}") | |||
| val resultType = object : TypeToken<BaseBean<Version>>() {}.type | |||
| val gson = Gson() | |||
| val res = gson.fromJson<BaseBean<Version>>(json, resultType) | |||
| if (res.code == 0) { | |||
| val appVersion = AppUtils.getAppVersionName() | |||
| val appVersionCode = AppUtils.getAppVersionCode() | |||
| val versionCode = res?.data?.version_code ?: 0 | |||
| val curr = Date().time | |||
| val lastTipTime = SPUtils.getInstance() | |||
| .getLong("last_tip_time${res.data.version_code}", 0) | |||
| if (versionCode > appVersionCode) { //有新版本 | |||
| when { | |||
| res.data.type == 1 -> { //强制升级 | |||
| updateApp(res.data) | |||
| } | |||
| curr - lastTipTime > 24 * 60 * 60 * 1000 -> { //非强制一天以内提示一次 | |||
| updateApp(res.data) | |||
| } | |||
| userCheck -> { // | |||
| updateApp(res.data) | |||
| } | |||
| } | |||
| } else { | |||
| if (userCheck) { | |||
| toast("已经是最新版本了!") | |||
| } | |||
| } | |||
| } | |||
| } | |||
| }) | |||
| } | |||
| private fun updateApp(version: Version) { | |||
| AllenVersionChecker | |||
| .getInstance() | |||
| .downloadOnly( | |||
| UIData.create() | |||
| .setTitle("检测到新版本") | |||
| .setContent(version.explain) | |||
| .setDownloadUrl(version.app_src) | |||
| ) | |||
| .setCustomVersionDialogListener { context, versionBundle -> | |||
| val dialog = BaseDialog(context, R.style.BaseDialog, R.layout.version_dialog) | |||
| val title = dialog.find<TextView>(R.id.tv_title) | |||
| title.text = "检测到新版本" | |||
| val content = dialog.find<TextView>(R.id.tv_msg) | |||
| content.text = version.explain | |||
| val cancelBtn = dialog.find<View>(R.id.cancel_btn) | |||
| if (version.type == 1) { | |||
| cancelBtn.visibility = View.GONE | |||
| } | |||
| dialog.hideNavigationBar() | |||
| return@setCustomVersionDialogListener dialog | |||
| } | |||
| .setOnCancelListener { | |||
| SPUtils.getInstance().put("last_tip_time${version.version_code}", Date().time) | |||
| } | |||
| .setCustomDownloadingDialogListener(object : CustomDownloadingDialogListener { | |||
| @SuppressLint("SetTextI18n") | |||
| override fun updateUI(dialog: Dialog?, progress: Int, versionBundle: UIData?) { | |||
| val tvProgress: TextView = dialog!!.findViewById(R.id.tv_progress) | |||
| val progressBar: ContentLoadingProgressBar = dialog.findViewById(R.id.pb) | |||
| progressBar.progress = progress | |||
| tvProgress.text = "$progress%" | |||
| Log.d("checkVersion", "onSuccess: ${progress}") | |||
| } | |||
| override fun getCustomDownloadingDialog( | |||
| context: Context?, | |||
| progress: Int, | |||
| versionBundle: UIData? | |||
| ): Dialog { | |||
| val downDialog = BaseDialog( | |||
| context!!, | |||
| R.style.BaseDialog, | |||
| R.layout.download_dialog | |||
| ) | |||
| downDialog.hideNavigationBar() | |||
| return downDialog | |||
| } | |||
| }) | |||
| .executeMission(this) | |||
| } | |||
| } | |||
| class HomePagerAdapter(act: AppCompatActivity) : FragmentStateAdapter(act) { | |||
| @@ -43,11 +43,12 @@ abstract class BaseActivity<out P : BasePresenter<*>> : AppCompatActivity() { | |||
| override fun onCreate(savedInstanceState: Bundle?) { | |||
| super.onCreate(savedInstanceState) | |||
| hideBottomUIMenu() | |||
| setContentView(inflateId) | |||
| initView() | |||
| initData() | |||
| setStatusBar() | |||
| hideBottomUIMenu() | |||
| } | |||
| open fun setStatusBar() { | |||
| @@ -66,6 +67,15 @@ abstract class BaseActivity<out P : BasePresenter<*>> : AppCompatActivity() { | |||
| params.systemUiVisibility = | |||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_IMMERSIVE | |||
| window.attributes = params | |||
| // window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |||
| // window.decorView.setOnSystemUiVisibilityChangeListener { | |||
| // val uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or | |||
| // View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or | |||
| // View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or | |||
| // View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |||
| // window.decorView.systemUiVisibility = uiOptions | |||
| // } | |||
| } | |||
| @@ -7,4 +7,5 @@ object Config { | |||
| var APP_NAME = BuildConfig.APP_NAME | |||
| var M_URL = BuildConfig.M_URL | |||
| var OA_URL = BuildConfig.OA_URL | |||
| val APP_ID = 602 | |||
| } | |||
| @@ -5,12 +5,17 @@ import android.content.res.ColorStateList | |||
| import android.graphics.Color | |||
| import android.os.Handler | |||
| import android.os.Looper | |||
| import android.text.Editable | |||
| import android.text.TextWatcher | |||
| import android.view.KeyEvent | |||
| import android.view.View | |||
| import android.widget.ImageView | |||
| import android.widget.TextView | |||
| import androidx.core.widget.addTextChangedListener | |||
| import androidx.recyclerview.widget.LinearLayoutManager | |||
| import androidx.recyclerview.widget.RecyclerView | |||
| import com.blankj.utilcode.util.KeyboardUtils | |||
| import com.blankj.utilcode.util.NetworkUtils | |||
| import com.blankj.utilcode.util.SPUtils | |||
| import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton | |||
| import com.yzx.escreen.R | |||
| @@ -23,16 +28,21 @@ import com.yzx.escreen.adapter.HomeListAdapter | |||
| import com.yzx.escreen.model.LeaveID | |||
| import com.yzx.escreen.presenter.HomePresenter | |||
| import com.yzx.escreen.presenter.HomeView | |||
| import com.yzx.escreen.utils.hideNavigationBar | |||
| import com.yzx.escreen.utils.setSrc | |||
| import com.yzx.escreen.utils.toTime | |||
| import com.yzx.escreen.widget.BaseDialog | |||
| import kotlinx.android.synthetic.main.activity_main.* | |||
| import kotlinx.android.synthetic.main.fragment_home.* | |||
| import kotlinx.android.synthetic.main.layout_loading.* | |||
| import kotlinx.android.synthetic.main.layout_loading.view.* | |||
| import org.jetbrains.anko.find | |||
| import org.jetbrains.anko.support.v4.act | |||
| import org.jetbrains.anko.support.v4.ctx | |||
| import org.jetbrains.anko.textColor | |||
| class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| class HomeFragment : BaseFragment<HomePresenter>(), HomeView, | |||
| NetworkUtils.OnNetworkStatusChangedListener { | |||
| companion object { | |||
| @@ -63,15 +73,19 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| mHandler.postDelayed(this, 2000) | |||
| } | |||
| } | |||
| private val refreshRun = Runnable { | |||
| refreshData() | |||
| } | |||
| override val inflateId: Int | |||
| get() = R.layout.fragment_home | |||
| override fun initView() { | |||
| NetworkUtils.registerNetworkStatusChangedListener(this) | |||
| recyclerView.layoutManager = | |||
| LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) | |||
| recyclerView.adapter = mAdapter | |||
| mAdapter.setEmptyView(R.layout.layout_empty) | |||
| preTxtBtn.setOnClickListener { pre() } | |||
| nextTxtBtn.setOnClickListener { next() } | |||
| allBtn.setOnClickListener { changeStatus(0) } | |||
| @@ -94,6 +108,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| clearBtn.setOnClickListener { | |||
| keyword = "" | |||
| keywordInput.setText("") | |||
| KeyboardUtils.hideSoftInput(keywordInput) | |||
| initData() | |||
| } | |||
| @@ -120,6 +135,27 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| switchBtnTxt.setOnClickListener { | |||
| switchBtn.isChecked = !switchBtn.isChecked | |||
| } | |||
| keywordInput.addTextChangedListener(object : TextWatcher { | |||
| override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) { | |||
| } | |||
| override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | |||
| if (s != null && s.isNotEmpty()) { | |||
| clearBtn.visibility = View.VISIBLE | |||
| } else { | |||
| clearBtn.visibility = View.INVISIBLE | |||
| } | |||
| } | |||
| override fun afterTextChanged(s: Editable?) { | |||
| } | |||
| }) | |||
| filterLayout.setOnClickListener { | |||
| KeyboardUtils.hideSoftInput( keywordInput) | |||
| } | |||
| } | |||
| private fun changeSwitchBtnTxt(isChecked: Boolean) { | |||
| @@ -178,6 +214,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| } | |||
| } | |||
| dialog.show() | |||
| dialog.hideNavigationBar() | |||
| dialog.setLeaveId(detail.id) | |||
| mShowDialogList.add(dialog) | |||
| } | |||
| @@ -197,6 +234,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| } | |||
| private fun changeStatus(status: Int) { | |||
| KeyboardUtils.hideSoftInput( keywordInput) | |||
| if (isLoading) { | |||
| return | |||
| } | |||
| @@ -212,8 +250,41 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| override fun initData() { | |||
| mPager.page_no = 1 | |||
| isLoading = true | |||
| mPresenter?.getLeaveList(mPager.page_no, keyword, status) | |||
| if (NetworkUtils.isConnected()) { | |||
| showEmpty(1) | |||
| isLoading = true | |||
| mPresenter?.getLeaveList(mPager.page_no, keyword, status) | |||
| } else { | |||
| showEmpty(2) | |||
| } | |||
| } | |||
| /** | |||
| * type 1 loading 2 neterror 3 empty | |||
| */ | |||
| private fun showEmpty(type: Int) { | |||
| when (type) { | |||
| 1 -> { | |||
| mAdapter.setEmptyView(R.layout.layout_loading) | |||
| mAdapter.emptyLayout?.apply { | |||
| this.QMUIEmptyView.setLoadingShowing(true) | |||
| this.QMUIEmptyView.setTitleText("数据加载中") | |||
| } | |||
| } | |||
| 2 -> { | |||
| mAdapter.setEmptyView(R.layout.layout_loading) | |||
| mAdapter.emptyLayout?.apply { | |||
| this.QMUIEmptyView.show(false, null, "网络连接异常,请检查", "去设置") { | |||
| NetworkUtils.openWirelessSettings() | |||
| } | |||
| } | |||
| } | |||
| 3 -> { | |||
| mAdapter.setEmptyView(R.layout.layout_empty) | |||
| } | |||
| } | |||
| } | |||
| private fun refreshData() { | |||
| @@ -225,6 +296,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| } | |||
| private fun pre() { | |||
| KeyboardUtils.hideSoftInput( keywordInput) | |||
| if (isLoading) { | |||
| return | |||
| } | |||
| @@ -236,6 +308,7 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| } | |||
| private fun next() { | |||
| KeyboardUtils.hideSoftInput( keywordInput) | |||
| if (isLoading) { | |||
| return | |||
| } | |||
| @@ -250,29 +323,37 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| @SuppressLint("SetTextI18n") | |||
| override fun onLeaveListSuccess(list: MutableList<StuLeave>, pager: Pager) { | |||
| mAdapter.setList(list) | |||
| mPager = pager | |||
| pageTv.text = "${pager.page_no} / ${pager.total_pages}" | |||
| totalTv.text = "共${pager.total_count}条" | |||
| val disabledColor = Color.parseColor("#666666") | |||
| val color = Color.parseColor("#3ca0e9") | |||
| if (pager.page_no <= 1) { | |||
| preTxtBtn.textColor = disabledColor | |||
| } else { | |||
| preTxtBtn.textColor = color | |||
| } | |||
| pageTv?.apply { | |||
| mAdapter.setList(list) | |||
| mPager = pager | |||
| pageTv.text = "${pager.page_no} / ${pager.total_pages}" | |||
| totalTv.text = "共${pager.total_count}条" | |||
| val disabledColor = Color.parseColor("#666666") | |||
| val color = Color.parseColor("#3ca0e9") | |||
| if (pager.page_no <= 1) { | |||
| preTxtBtn.textColor = disabledColor | |||
| } else { | |||
| preTxtBtn.textColor = color | |||
| } | |||
| if (pager.page_no >= pager.total_pages) { | |||
| nextTxtBtn.textColor = disabledColor | |||
| } else { | |||
| nextTxtBtn.textColor = color | |||
| if (pager.page_no >= pager.total_pages) { | |||
| nextTxtBtn.textColor = disabledColor | |||
| } else { | |||
| nextTxtBtn.textColor = color | |||
| } | |||
| isLoading = false | |||
| showEmpty(3) | |||
| pageTv.postDelayed({ | |||
| refreshData() | |||
| }, 30 * 1000) | |||
| } | |||
| isLoading = false | |||
| } | |||
| pageTv.postDelayed({ | |||
| refreshData() | |||
| }, 30 * 1000) | |||
| override fun onStop() { | |||
| super.onStop() | |||
| pageTv.removeCallbacks(refreshRun) | |||
| mHandler.removeCallbacks(runnable) | |||
| } | |||
| override fun onLeaveListError(error: String) { | |||
| @@ -280,23 +361,25 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| } | |||
| override fun onLeaveDetailSuccess(detail: StuLeave) { | |||
| val item = mShowList.find { it.id == detail.id } | |||
| if (item != null) { | |||
| //替换新的数据 | |||
| val index = mShowList.indexOf(item) | |||
| mShowList[index] = detail | |||
| //移除原本的dialog | |||
| val dialogIndex = mShowDialogList.indexOfFirst { it.getLeaveId() == item.id } | |||
| if (dialogIndex > -1) { | |||
| mShowDialogList[dialogIndex].hide() | |||
| mShowDialogList.removeAt(dialogIndex) | |||
| } | |||
| pageTv?.apply { | |||
| val item = mShowList.find { it.id == detail.id } | |||
| if (item != null) { | |||
| //替换新的数据 | |||
| val index = mShowList.indexOf(item) | |||
| mShowList[index] = detail | |||
| //移除原本的dialog | |||
| val dialogIndex = mShowDialogList.indexOfFirst { it.getLeaveId() == item.id } | |||
| if (dialogIndex > -1) { | |||
| mShowDialogList[dialogIndex].hide() | |||
| mShowDialogList.removeAt(dialogIndex) | |||
| } | |||
| } else { | |||
| mShowList.add(detail) | |||
| } else { | |||
| mShowList.add(detail) | |||
| } | |||
| showLeaveDialog(detail) | |||
| } | |||
| showLeaveDialog(detail) | |||
| } | |||
| override fun onLeaveDetailError(error: String) { | |||
| @@ -308,4 +391,12 @@ class HomeFragment : BaseFragment<HomePresenter>(), HomeView { | |||
| mPresenter?.getDetail(leaveID.id) | |||
| } | |||
| } | |||
| override fun onDisconnected() { | |||
| } | |||
| override fun onConnected(networkType: NetworkUtils.NetworkType?) { | |||
| refreshData() | |||
| } | |||
| } | |||
| @@ -1,6 +1,7 @@ | |||
| package com.yzx.escreen.fragment | |||
| import android.text.InputType | |||
| import com.blankj.utilcode.util.KeyboardUtils | |||
| import com.blankj.utilcode.util.LogUtils | |||
| import com.blankj.utilcode.util.ScreenUtils | |||
| import com.blankj.utilcode.util.ToastUtils | |||
| @@ -15,6 +16,7 @@ import com.yzx.escreen.model.TeacherInfo | |||
| import com.yzx.escreen.model.User | |||
| import com.yzx.escreen.presenter.MyPresenter | |||
| import com.yzx.escreen.presenter.MyView | |||
| import com.yzx.escreen.utils.hideNavigationBar | |||
| import kotlinx.android.synthetic.main.activity_home.* | |||
| import kotlinx.android.synthetic.main.fragment_my.* | |||
| import org.jetbrains.anko.startActivity | |||
| @@ -53,24 +55,30 @@ class MyFragment : BaseFragment<MyPresenter>(), MyView { | |||
| builder.setPlaceholder("输入密码") | |||
| .setTitle("请输入密码") | |||
| .setInputType(InputType.TYPE_CLASS_PHONE) | |||
| .addAction("取消" | |||
| ) { dialog, index -> dialog?.dismiss() } | |||
| .addAction("确定" | |||
| .setInputType(InputType.TYPE_NUMBER_VARIATION_PASSWORD or InputType.TYPE_CLASS_NUMBER) | |||
| .addAction( | |||
| "取消" | |||
| ) { dialog, index -> | |||
| KeyboardUtils.hideSoftInput(builder.editText) | |||
| dialog?.dismiss() | |||
| } | |||
| .addAction( | |||
| "确定" | |||
| ) { dialog, index -> | |||
| val text = builder.editText.text | |||
| LogUtils.d(text) | |||
| LogUtils.d("112233".equals(text)) | |||
| if("112233" == text.toString()){ | |||
| if ("112233" == text.toString()) { | |||
| activity?.finish() | |||
| exitProcess(0) | |||
| }else{ | |||
| } else { | |||
| ToastUtils.showShort("密码不正确") | |||
| } | |||
| } | |||
| .setCancelable(false) | |||
| .setCanceledOnTouchOutside(false) | |||
| .show() | |||
| val dialog = builder.show() | |||
| dialog.hideNavigationBar() | |||
| } | |||
| override fun initData() { | |||
| @@ -104,7 +112,11 @@ class MyFragment : BaseFragment<MyPresenter>(), MyView { | |||
| val group = unit.teacherUnitGroups[0] | |||
| unitName.text = unit.unit_name | |||
| groupName.text = group.group_name | |||
| jobType.text = group.job_type_name | |||
| jobType.text = if (group.job_type_name.isNotEmpty()) { | |||
| group.job_type_name | |||
| } else { | |||
| "-" | |||
| } | |||
| isLeader.text = if (group.is_leader == 0) { | |||
| "是" | |||
| } else { | |||
| @@ -1,9 +1,17 @@ | |||
| package com.yzx.escreen.presenter.base; | |||
| import android.content.Intent; | |||
| import com.blankj.utilcode.util.ActivityUtils; | |||
| import com.blankj.utilcode.util.AppUtils; | |||
| import com.google.gson.stream.JsonReader; | |||
| import com.lzy.okgo.callback.AbsCallback; | |||
| import com.lzy.okgo.model.HttpHeaders; | |||
| import com.lzy.okgo.request.base.Request; | |||
| import com.yzx.escreen.App; | |||
| import com.yzx.escreen.MainActivity; | |||
| import com.yzx.escreen.activity.WebActivity; | |||
| import com.yzx.escreen.config.Config; | |||
| import com.yzx.escreen.model.User; | |||
| import com.yzx.escreen.utils.Monitor; | |||
| @@ -137,6 +145,12 @@ public abstract class JsonCallBack<T> extends AbsCallback<T> { | |||
| //noinspection unchecked | |||
| return (T) yzxResponse; | |||
| } else if (code == 406) { | |||
| User.Companion.clearUserInfo(); | |||
| Intent intent = new Intent(App.Companion.getContext(),WebActivity.class); | |||
| intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
| intent.putExtra("link", Config.INSTANCE.getOA_URL()+"/login?logout=1"); | |||
| ActivityUtils.startActivity(intent); | |||
| ActivityUtils.finishActivity(MainActivity.class); | |||
| throw new IllegalStateException("错误代码:" + code + ",错误信息:" + yzxResponse.msg); | |||
| } else { | |||
| // 直接将服务端的错误信息抛出,onError中可以获取 | |||
| @@ -1,10 +1,10 @@ | |||
| package com.yzx.escreen.utils | |||
| import android.app.Dialog | |||
| import android.view.View | |||
| import android.widget.ImageView | |||
| import com.blankj.utilcode.util.TimeUtils | |||
| import com.bumptech.glide.Glide | |||
| import java.lang.Float.parseFloat | |||
| import java.lang.Integer.parseInt | |||
| import java.util.* | |||
| fun ImageView.setSrc(identity: String, key: String) { | |||
| @@ -56,4 +56,45 @@ fun Int.durationStr(): String { | |||
| } | |||
| return "${day}天${hour.toInt()}小时" | |||
| } | |||
| } | |||
| } | |||
| fun Dialog.hideNavigationBar(){ | |||
| val window = this.window | |||
| window?.apply { | |||
| window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |||
| window.decorView.setOnSystemUiVisibilityChangeListener { | |||
| val uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or | |||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or | |||
| View.SYSTEM_UI_FLAG_FULLSCREEN or | |||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or | |||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or | |||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | |||
| window.decorView.systemUiVisibility = uiOptions | |||
| } | |||
| } | |||
| } | |||
| @@ -61,7 +61,7 @@ object Monitor { | |||
| "errorMessage:${errorMessage}\n" + | |||
| "errorStack:\n${errorStack}" | |||
| val stringBuffer = StringBuffer() | |||
| stringBuffer.append("墨水屏异常上报:").append("\n") | |||
| stringBuffer.append("电子屏异常上报:").append("\n") | |||
| stringBuffer.append("系统信息:").append(AppUtils.getAppInfo().versionName).append("\n") | |||
| val user = User.getUser() | |||
| if (user.user_id > 0) { | |||
| @@ -1,5 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <corners android:radius="5dp"></corners> | |||
| <solid android:color="#000"></solid> | |||
| <solid android:color="@color/colorPrimary"></solid> | |||
| </shape> | |||
| @@ -2,5 +2,5 @@ | |||
| <shape xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <corners android:radius="5dp"></corners> | |||
| <solid android:color="#fff"></solid> | |||
| <stroke android:color="#000" android:width="1px"></stroke> | |||
| <stroke android:color="@color/gray_1" android:width="1px"></stroke> | |||
| </shape> | |||
| @@ -0,0 +1,41 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| android:orientation="vertical" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent"> | |||
| <LinearLayout | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:orientation="horizontal"> | |||
| <FrameLayout | |||
| android:id="@+id/cancel_btn" | |||
| android:layout_width="0dp" | |||
| android:layout_weight="1" | |||
| android:layout_marginEnd="15dp" | |||
| android:layout_height="wrap_content"> | |||
| <Button | |||
| android:id="@id/versionchecklib_version_dialog_cancel" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="50dp" | |||
| android:layout_marginTop="10dp" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/shape_corner_plain" | |||
| android:text="取消" | |||
| android:textSize="20sp" | |||
| android:textColor="@color/gray" /> | |||
| </FrameLayout> | |||
| <Button | |||
| android:id="@id/versionchecklib_version_dialog_commit" | |||
| android:layout_width="0dp" | |||
| android:layout_height="50dp" | |||
| android:layout_marginTop="10dp" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/shape_corner" | |||
| android:text="立即升级" | |||
| android:textSize="20sp" | |||
| android:textColor="@android:color/white" /> | |||
| </LinearLayout> | |||
| </LinearLayout> | |||
| @@ -38,17 +38,19 @@ | |||
| android:thumb="@drawable/switch_ios_thumb" | |||
| android:track="@drawable/switch_ios_track_selector" | |||
| tools:ignore="UseSwitchCompatOrMaterialXml" /> | |||
| <TextView | |||
| android:id="@+id/switchBtnTxt" | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:text="自动弹出请假单" | |||
| android:layout_marginStart="@dimen/d_10" | |||
| android:textColor="#53a051"/> | |||
| android:text="自动弹出请假单" | |||
| android:textColor="#53a051" /> | |||
| </androidx.appcompat.widget.LinearLayoutCompat> | |||
| <androidx.appcompat.widget.LinearLayoutCompat | |||
| android:id="@+id/filterLayout" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:paddingHorizontal="@dimen/dp_40" | |||
| @@ -90,16 +92,17 @@ | |||
| android:id="@+id/clearBtn" | |||
| android:layout_width="@dimen/d_25" | |||
| android:layout_height="@dimen/d_25" | |||
| android:src="@mipmap/ic_clear" /> | |||
| android:src="@mipmap/ic_clear" | |||
| android:visibility="invisible" /> | |||
| </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundLinearLayout> | |||
| <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton | |||
| android:id="@+id/allBtn" | |||
| style="@style/home_status_btn" | |||
| android:layout_marginStart="50dp" | |||
| android:text="全部" | |||
| android:textColor="@color/white" | |||
| app:qmui_backgroundColor="#3ca0e9" | |||
| android:layout_marginStart="50dp" | |||
| app:qmui_borderColor="@color/colorPrimary" /> | |||
| <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton | |||
| @@ -210,7 +210,7 @@ | |||
| <TextView | |||
| style="@style/my_info_title" | |||
| android:text="部门" /> | |||
| android:text="岗位类别" /> | |||
| <TextView | |||
| android:id="@+id/jobType" | |||
| @@ -1,14 +1,22 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| xmlns:app="http://schemas.android.com/apk/res-auto" | |||
| android:orientation="vertical" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent"> | |||
| android:layout_height="match_parent" | |||
| android:gravity="center" | |||
| android:orientation="vertical"> | |||
| <com.qmuiteam.qmui.widget.QMUIEmptyView | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| app:qmui_show_loading="true" | |||
| app:qmui_title_text="数据加载中"/> | |||
| <ImageView | |||
| android:layout_width="wrap_content" | |||
| android:layout_height="wrap_content" | |||
| android:src="@mipmap/empty" /> | |||
| <TextView | |||
| android:id="@+id/emptyTipsView" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="wrap_content" | |||
| android:gravity="center" | |||
| android:text="暂无数据" | |||
| android:textColor="@color/gray_1" | |||
| android:textSize="@dimen/d_24" /> | |||
| </LinearLayout> | |||
| @@ -0,0 +1,15 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
| xmlns:app="http://schemas.android.com/apk/res-auto" | |||
| android:orientation="vertical" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent"> | |||
| <com.qmuiteam.qmui.widget.QMUIEmptyView | |||
| android:id="@+id/QMUIEmptyView" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="match_parent" | |||
| app:qmui_show_loading="true" | |||
| app:qmui_title_text="数据加载中"/> | |||
| </LinearLayout> | |||
| @@ -11,8 +11,8 @@ | |||
| android:orientation="vertical"> | |||
| <ImageView | |||
| android:layout_width="300dp" | |||
| android:layout_height="150dp" | |||
| android:layout_width="450dp" | |||
| android:layout_height="204dp" | |||
| android:background="@drawable/custom_bg" | |||
| android:scaleType="centerCrop" /> | |||
| @@ -31,7 +31,7 @@ | |||
| android:layout_marginTop="10dp" | |||
| android:text="@string/update_title" | |||
| android:textColor="@android:color/black" | |||
| android:textSize="18sp" /> | |||
| android:textSize="20sp" /> | |||
| <TextView | |||
| android:id="@+id/tv_msg" | |||
| @@ -40,7 +40,7 @@ | |||
| android:layout_marginTop="10dp" | |||
| android:text="@string/updatecontent" | |||
| android:textColor="#666" | |||
| android:textSize="16sp" /> | |||
| android:textSize="18sp" /> | |||
| <LinearLayout | |||
| android:layout_width="match_parent" | |||
| @@ -56,24 +56,24 @@ | |||
| <Button | |||
| android:id="@id/versionchecklib_version_dialog_cancel" | |||
| android:layout_width="match_parent" | |||
| android:layout_height="35dp" | |||
| android:layout_height="50dp" | |||
| android:layout_marginTop="10dp" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/shape_corner_plain" | |||
| android:text="取消" | |||
| android:textSize="16sp" | |||
| android:textColor="@android:color/black" /> | |||
| android:textSize="20sp" | |||
| android:textColor="@color/gray" /> | |||
| </FrameLayout> | |||
| <Button | |||
| android:id="@id/versionchecklib_version_dialog_commit" | |||
| android:layout_width="0dp" | |||
| android:layout_height="35dp" | |||
| android:layout_height="50dp" | |||
| android:layout_marginTop="10dp" | |||
| android:layout_weight="1" | |||
| android:background="@drawable/shape_corner" | |||
| android:text="立即升级" | |||
| android:textSize="16sp" | |||
| android:textSize="20sp" | |||
| android:textColor="@android:color/white" /> | |||
| </LinearLayout> | |||
| @@ -1,5 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <background android:drawable="@drawable/ic_launcher_background"/> | |||
| <foreground android:drawable="@drawable/ic_launcher_foreground"/> | |||
| </adaptive-icon> | |||
| @@ -1,5 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | |||
| <background android:drawable="@drawable/ic_launcher_background"/> | |||
| <foreground android:drawable="@drawable/ic_launcher_foreground"/> | |||
| </adaptive-icon> | |||
| @@ -1,5 +1,5 @@ | |||
| <resources> | |||
| <string name="app_name">云智学</string> | |||
| <string name="app_name">一体化平台</string> | |||
| <string name="update_title">检测到新版本</string> | |||
| <string name="updatecontent">解决了若干bug</string> | |||
| </resources> | |||
| @@ -18,6 +18,9 @@ | |||
| <item name="android:background">@android:color/transparent</item> | |||
| <item name="android:windowIsFloating">true</item> | |||
| <item name="android:windowContentOverlay">@null</item> | |||
| <item name="android:backgroundDimEnabled">true</item> | |||
| <item name="android:windowIsTranslucent">true</item> | |||
| <item name="android:colorBackgroundCacheHint">@null</item> | |||
| </style> | |||
| <!--Splash--> | |||
| @@ -1,2 +1,2 @@ | |||
| include ':app' | |||
| rootProject.name='WebEBook' | |||
| rootProject.name='WebScreen' | |||