| | |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.DialogInterface; |
| | | import android.content.Intent; |
| | | import android.graphics.Color; |
| | | import android.text.method.LinkMovementMethod; |
| | | import android.view.LayoutInflater; |
| | |
| | | import android.widget.FrameLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.tejia.lijin.app.ui.SimpleBrowserActivity; |
| | | import com.wpc.library.util.SystemCommon; |
| | | import com.wpc.library.util.common.StringUtils; |
| | | import com.tejia.lijin.app.R; |
| | |
| | | LayoutInflater inflater = (LayoutInflater) context |
| | | .getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
| | | final UserProtocolDialog dialog = new UserProtocolDialog(context, R.style.Dialog); |
| | | dialog.setCanceledOnTouchOutside(true); |
| | | dialog.setCanceledOnTouchOutside(false); |
| | | final View layout = inflater.inflate(R.layout.dialog_user_protocol, null); |
| | | dialog.addContentView(layout, new FrameLayout.LayoutParams( |
| | | FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT)); |
| | | TextView tv_title = layout.findViewById(R.id.tv_title); |
| | | TextView tv_content = layout.findViewById(R.id.tv_content); |
| | | tv_content.setText(TextViewUtil.getClickableHtml(webviewData, context, Color.rgb(23, 106, 230))); |
| | | tv_content.setText(TextViewUtil.getClickableHtml(webviewData, context, Color.rgb(23, 106, 230), new TextViewUtil.URLClickListener() { |
| | | |
| | | @Override |
| | | public void onClick(String url) { |
| | | context.startActivity(new Intent(context, SimpleBrowserActivity.class).putExtra("url", url)); |
| | | } |
| | | })); |
| | | tv_content.setMovementMethod(LinkMovementMethod.getInstance()); |
| | | tv_content.setClickable(false); |
| | | tv_content.setHighlightColor(context.getResources().getColor(android.R.color.transparent)); |
| | |
| | | tv_positive.setText(positiveButtonText); |
| | | tv_positive.setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | try { |
| | | ShoppingApi.userProtocolListener(context, UserUtil.getUid(context) , 1, null); |
| | | } catch (Exception e) { |
| | | } |
| | | positiveButtonClickListener.onClick(dialog, |
| | | DialogInterface.BUTTON_POSITIVE); |
| | | } |
| | |
| | | tv_negative.setText(negativeButtonText); |
| | | tv_negative.setOnClickListener(new View.OnClickListener() { |
| | | public void onClick(View v) { |
| | | try { |
| | | ShoppingApi.userProtocolListener(context, UserUtil.getUid(context), 0, null); |
| | | } catch (Exception e) { |
| | | } |
| | | negativeButtonClickListener.onClick(dialog, |
| | | DialogInterface.BUTTON_NEGATIVE); |
| | | |