app/src/main/java/safeluck/drive/evaluation/customview/MyDialog.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/customview/MyDialogFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/customview/QRCodeDialog.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/HomeFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/NetWorkTrainFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
app/src/main/res/layout/layout_dlg.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/safeluck/drive/evaluation/customview/MyDialog.kt
New file @@ -0,0 +1,98 @@ package safeluck.drive.evaluation.customview import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.os.Build import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.WindowManager import android.widget.Button import android.widget.TextView import androidx.fragment.app.DialogFragment import safeluck.drive.evaluation.R /** * * @ProjectName: DriveJudge * @Package: safeluck.drive.evaluation.customview * @ClassName: MyDialog * @Description: java类作用描述 * @Author: 李占伟 * @CreateDate: 2020-04-29 16:46 * @UpdateUser: 更新者 * @UpdateDate: 2020-04-29 16:46 * @UpdateRemark: 更新说明 * @Version: 1.0 */ class MyDialog : DialogFragment() { lateinit var button: Button lateinit var button_cancle: Button lateinit var textview: TextView var mess: String? = null lateinit var onClick:MyOnClickListener override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { if(dialog!=null){ var windown = dialog.window; windown.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) windown.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) dialog.setOnShowListener { windown.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) hideBottomUIMenu()} } var view = inflater.inflate(R.layout.layout_dlg,container,false) initView(view) return view } private fun initView(view: View?) { mess = arguments?.getString("message") button = view!!.findViewById(R.id.btn_sure_) textview = view!!.findViewById(R.id.tv_message) textview.text =mess button_cancle = view!!.findViewById(R.id.btn_cancle_) button.setOnClickListener { onClick.onSure() dismiss() } button_cancle.setOnClickListener { onClick.onCancle() dismiss() } } /** * 隐藏虚拟按键,并且全屏 */ protected fun hideBottomUIMenu() { //隐藏虚拟按键,并且全屏 if (Build.VERSION.SDK_INT > 11 && Build.VERSION.SDK_INT < 19) { // lower api val v = this.dialog.window.decorView v.systemUiVisibility = View.GONE } else if (Build.VERSION.SDK_INT >= 19) { //for new api versions. val decorView = dialog.window.decorView val uiOptions = (View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or View.SYSTEM_UI_FLAG_FULLSCREEN) decorView.systemUiVisibility = uiOptions } } companion object{ fun newInstance(message:String):MyDialog{ var myDialog= MyDialog() var bundle = Bundle() bundle.putString("message",message) myDialog.arguments = bundle return myDialog } } interface MyOnClickListener{ fun onSure() fun onCancle() } } app/src/main/java/safeluck/drive/evaluation/customview/MyDialogFragment.java
File was deleted app/src/main/java/safeluck/drive/evaluation/customview/QRCodeDialog.java
@@ -4,6 +4,7 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -13,6 +14,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; @@ -43,7 +46,7 @@ public class QRCodeDialog extends DialogFragment { private static final String TAG = "QRCodeDialog"; private String message="正在加载..."; private boolean canCancel= true; private boolean canCancel= false; private ImageView iv_qrCode; private Button btn; private Bitmap qrBitmap; @@ -61,14 +64,26 @@ @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { hideBottomUIMenu(); if (getDialog() != null) { Window window = getDialog().getWindow(); if (window != null) { window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); getDialog().setOnShowListener(dialog -> { window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE); hideBottomUIMenu(); }); } } View view = inflater.inflate(R.layout.layout_dialog_qrcode,container,false); initView(view); setCancelable(canCancel); Message message = Message.obtain(); message.what = 1; handler.sendMessageDelayed(message,15*1000); handler.sendMessageDelayed(message,25*1000); return view; } app/src/main/java/safeluck/drive/evaluation/fragment/HomeFragment.java
@@ -1,11 +1,9 @@ package safeluck.drive.evaluation.fragment; import android.content.DialogInterface; import android.os.Bundle; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -15,11 +13,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.fragment.app.DialogFragment; import com.anyun.exam.lib.AYSdk; import me.yokeyword.fragmentation.ISupportFragment; import me.yokeyword.fragmentation.SupportFragment; @@ -27,7 +22,7 @@ import safeluck.drive.evaluation.MainActivity; import safeluck.drive.evaluation.R; import safeluck.drive.evaluation.bean.ExamPlatformData; import safeluck.drive.evaluation.customview.LoadProgressDialog; import safeluck.drive.evaluation.customview.MyDialog; /** @@ -113,16 +108,23 @@ break; case R.id.exit_sys: //退出系统 AlertDialog.Builder builder = new AlertDialog.Builder(_mActivity); builder.setMessage("您将退出系统,请确认数据已保存").setPositiveButton("确定", new DialogInterface.OnClickListener() { MyDialog myDialog = MyDialog.Companion.newInstance("您将退出系统,请确认数据已保存"); myDialog.setOnClick(new MyDialog.MyOnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { public void onSure() { _mActivity.finish(); } }).setNegativeButton("取消", (DialogInterface dialog, int which)-> { dialog.dismiss(); }).show(); @Override public void onCancle() { } }); myDialog.show(getFragmentManager(),"mydialog"); break; case R.id.system_setting: app/src/main/java/safeluck/drive/evaluation/fragment/NetWorkTrainFragment.java
@@ -66,7 +66,6 @@ import safeluck.drive.evaluation.customview.ArrowView; import safeluck.drive.evaluation.customview.HouseView; import safeluck.drive.evaluation.customview.LoadProgressDialog; import safeluck.drive.evaluation.customview.MyDialogFragment; import safeluck.drive.evaluation.customview.QRCodeDialog; import safeluck.drive.evaluation.customview.SelectDialog; import safeluck.drive.evaluation.httpmodule.RetrofitCreator; @@ -582,7 +581,6 @@ } private LoadProgressDialog loadProgressDialog; MyDialogFragment myDialogFragment; @Override public void onClick(View v) { switch (v.getId()) { app/src/main/java/safeluck/drive/evaluation/fragment/TrainFragment.java
@@ -68,7 +68,6 @@ import safeluck.drive.evaluation.customview.ArrowView; import safeluck.drive.evaluation.customview.HouseView; import safeluck.drive.evaluation.customview.LoadProgressDialog; import safeluck.drive.evaluation.customview.MyDialogFragment; import safeluck.drive.evaluation.customview.SelectDialog; import safeluck.drive.evaluation.im.MessageProcessor; import safeluck.drive.evaluation.platformMessage.JKMessage0201; @@ -566,7 +565,6 @@ } MyDialogFragment myDialogFragment; @Override public void onClick(View v) { switch (v.getId()) { app/src/main/res/layout/layout_dlg.xml
New file @@ -0,0 +1,59 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="210dp" android:layout_height="180dp" android:gravity="center" android:background="@drawable/bg_select_dlg" android:orientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:textSize="@dimen/network_train_textsize20px" android:textColor="@android:color/white" android:layout_margin="@dimen/ui_margin_10dp" android:text="提示:"/> <TextView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="2" android:id="@+id/tv_message" android:textColor="@android:color/white" android:padding="@dimen/ui_margin_5dp" android:textSize="@dimen/network_train_textsize24px" android:textAlignment="textStart" android:text="倾听放假啦附近大力开发放假我减肥I"/> <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="2" android:orientation="horizontal" > <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:layout_marginTop="@dimen/ui_margin_10dp" android:text="确定" android:padding="@dimen/ui_margin_5dp" android:textSize="@dimen/network_train_textsize22px" android:background="@drawable/bg_rgb_dlg" android:textColor="@android:color/white" android:id="@+id/btn_sure_"/> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:padding="@dimen/ui_margin_5dp" android:layout_marginTop="@dimen/ui_margin_10dp" android:text="取消" android:textSize="@dimen/network_train_textsize22px" android:background="@drawable/bg_rgb_dlg" android:textColor="@android:color/white" android:id="@+id/btn_cancle_"/> </LinearLayout> </LinearLayout>