|
|
@@ -1,9 +1,8 @@
|
|
|
package com.uas.yuejiahong.fragment;
|
|
|
|
|
|
-import android.app.AlertDialog;
|
|
|
+import android.app.Dialog;
|
|
|
import android.content.ComponentName;
|
|
|
import android.content.Context;
|
|
|
-import android.content.DialogInterface;
|
|
|
import android.content.Intent;
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
import android.net.Uri;
|
|
|
@@ -355,19 +354,46 @@ public class IndexSettingFragment extends BaseFragment implements View.OnClickLi
|
|
|
break;
|
|
|
case R.id.setting_printer_rl:
|
|
|
if (!CommonUtil.appIsInstalled(getActivity(), Constants.CONSTANT.PRINT_SHARE_PACKAGE)) {
|
|
|
- new AlertDialog.Builder(getActivity()).setTitle("提示")
|
|
|
- .setMessage("您还未安装打印程序,点击确认开始安装")
|
|
|
- .setPositiveButton("确认", new DialogInterface.OnClickListener() {
|
|
|
+ final Dialog dia = new Dialog(getContext());
|
|
|
+ dia.setContentView(R.layout.alert_dialog);
|
|
|
+
|
|
|
+ TextView title = dia.findViewById(R.id.title);
|
|
|
+ TextView tv_cancel = dia.findViewById(R.id.tv_cancel);
|
|
|
+ TextView tv_ok = dia.findViewById(R.id.tv_ok);
|
|
|
+ title.setText("您还未安装打印程序,点击确认开始安装");
|
|
|
+ tv_ok.setText("确认");
|
|
|
+ //选择true的话点击其他地方可以使dialog消失,为false的话不会消失
|
|
|
+ dia.setCanceledOnTouchOutside(true); // Sets whether this web_dialog is
|
|
|
+ tv_ok.setOnClickListener(
|
|
|
+ new View.OnClickListener() {
|
|
|
@Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
+ public void onClick(View view) {
|
|
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
File assetsFileToCacheDir = FileUtils.getAssetsFileToCacheDir(getActivity(), "PrinterShare.apk");
|
|
|
intent.setDataAndType(Uri.fromFile(assetsFileToCacheDir), "application/vnd.android.package-archive");
|
|
|
getActivity().startActivity(intent);
|
|
|
-
|
|
|
}
|
|
|
- })
|
|
|
- .setNegativeButton("取消", null).create().show();
|
|
|
+ });
|
|
|
+ tv_cancel.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ dia.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dia.show();
|
|
|
+// new AlertDialog.Builder(getActivity()).setTitle("提示")
|
|
|
+// .setMessage("您还未安装打印程序,点击确认开始安装")
|
|
|
+// .setPositiveButton("确认", new DialogInterface.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(DialogInterface dialog, int which) {
|
|
|
+// Intent intent = new Intent(Intent.ACTION_VIEW);
|
|
|
+// File assetsFileToCacheDir = FileUtils.getAssetsFileToCacheDir(getActivity(), "PrinterShare.apk");
|
|
|
+// intent.setDataAndType(Uri.fromFile(assetsFileToCacheDir), "application/vnd.android.package-archive");
|
|
|
+// getActivity().startActivity(intent);
|
|
|
+//
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .setNegativeButton("取消", null).create().show();
|
|
|
} else {
|
|
|
Intent intent = new Intent();
|
|
|
ComponentName comp = new ComponentName("com.dynamixsoftware.printershare", "com.dynamixsoftware.printershare.ActivityMain");
|
|
|
@@ -383,15 +409,40 @@ public class IndexSettingFragment extends BaseFragment implements View.OnClickLi
|
|
|
getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.container_function_fragment, mFragment).commit();
|
|
|
break;
|
|
|
case R.id.setting_exit_current_account_ll:
|
|
|
- new AlertDialog.Builder(getActivity()).setTitle("提示").setMessage("确定要退出当前账号吗?")
|
|
|
- .setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {
|
|
|
+ final Dialog dia = new Dialog(getContext());
|
|
|
+ dia.setContentView(R.layout.alert_dialog);
|
|
|
+ TextView tv_cancel = dia.findViewById(R.id.tv_cancel);
|
|
|
+ TextView tv_ok = dia.findViewById(R.id.tv_ok);
|
|
|
+ //选择true的话点击其他地方可以使dialog消失,为false的话不会消失
|
|
|
+ dia.setCanceledOnTouchOutside(true); // Sets whether this web_dialog is
|
|
|
+ tv_ok.setOnClickListener(
|
|
|
+ new View.OnClickListener() {
|
|
|
@Override
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
+ public void onClick(View view) {
|
|
|
progressDialog.show();
|
|
|
//传递Handler对象给Volley
|
|
|
VolleyUtil.setVolleyHandler(mHandler);
|
|
|
//连接服务器
|
|
|
VolleyUtil.getVolleyUtil().requestConnectServer(getActivity(), GloableParams.ADDRESS_LOGOUT_APPLY, VolleyUtil.METHOD_GET, VolleyUtil.FRAGMENT_LOGOUT);
|
|
|
+ dia.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ tv_cancel.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ dia.dismiss();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dia.show();
|
|
|
+// new AlertDialog.Builder(getActivity()).setTitle("提示").setMessage("确定要退出当前账号吗?")
|
|
|
+// .setPositiveButton(getString(R.string.confirm), new DialogInterface.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(DialogInterface dialog, int which) {
|
|
|
+// progressDialog.show();
|
|
|
+// //传递Handler对象给Volley
|
|
|
+// VolleyUtil.setVolleyHandler(mHandler);
|
|
|
+// //连接服务器
|
|
|
+// VolleyUtil.getVolleyUtil().requestConnectServer(getActivity(), GloableParams.ADDRESS_LOGOUT_APPLY, VolleyUtil.METHOD_GET, VolleyUtil.FRAGMENT_LOGOUT);
|
|
|
|
|
|
/*PdaApplication.mRequestQueue.cancelAll(TAG + "logout");
|
|
|
|
|
|
@@ -426,8 +477,8 @@ public class IndexSettingFragment extends BaseFragment implements View.OnClickLi
|
|
|
mStringRequest.setTag(TAG + "logout");
|
|
|
PdaApplication.mRequestQueue.add(mStringRequest);*/
|
|
|
|
|
|
- }
|
|
|
- }).setNegativeButton(getString(R.string.cancel), null).create().show();
|
|
|
+// }
|
|
|
+// }).setNegativeButton(getString(R.string.cancel), null).create().show();
|
|
|
|
|
|
break;
|
|
|
case R.id.setting_style_rl:
|