package com.yyrh.ui;


import android.app.Activity;
import android.app.Dialog;
import android.widget.TextView;

import com.yyrh.utils.ResourceUtil;
import com.yyrh.utils.Utils;

import static com.yyrh.constant.URLConstants.CHANNELLOGIN;
import static com.yyrh.constant.URLConstants.FASTREGISTER;
import static com.yyrh.constant.URLConstants.GETCAPTCHA;
import static com.yyrh.constant.URLConstants.INIT;
import static com.yyrh.constant.URLConstants.PAYMENTWAY;
import static com.yyrh.constant.URLConstants.RECHARGEINT;
import static com.yyrh.constant.URLConstants.REGISTERWITHPHONE;
import static com.yyrh.constant.URLConstants.RESETPWDWITHPHONE;
import static com.yyrh.constant.URLConstants.USERLOGIN;


public class NewProgressDialogUtils {


	 private String getShowMessage(String url){
	 	String message;
		switch (url){
			case INIT:
				message =  "hnyy_network_error_tip";
				break;
			case USERLOGIN:
				message =  "hnyy_logging";
			break;
			case FASTREGISTER:
				message =  "hnyy_registering";
			break;
			case CHANNELLOGIN:
				message =  "hnyy_logging";
				break;
			case PAYMENTWAY:
				message =  "hnyy_pay_init";
				break;
			case RECHARGEINT:
				message =  "hnyy_pay_init";
				break;
			case GETCAPTCHA:
				message =  "hnyy_get_code";
				break;
			case REGISTERWITHPHONE:
				message =  "hnyy_registering";
				break;
			case RESETPWDWITHPHONE:
				message =  "hnyy_resetpwd";
				break;

			default :
				 message = "";
			break;
		}
		return message;
	}

	
	public  Dialog show(Activity _activity,final String _mesage){




			Dialog progressDialog = new Dialog(_activity,ResourceUtil.getStyleId(_activity, "hnyy_progress_dialog"));
			progressDialog.setContentView(ResourceUtil.getLayoutId(_activity, "hnyy_dialog_progress"));
            progressDialog.setCancelable(false);
            progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
            TextView msg =  progressDialog.findViewById(ResourceUtil.getId(_activity, "id_tv_loadingmsg"));


			String message = getShowMessage(_mesage);

			if (!Utils.judgeStrNull(message)){

				msg.setText(_activity.getString(ResourceUtil.getStringId(_activity, message)));

			}




		progressDialog.show();

		return progressDialog;

		
	}


}
