自定义对话框组件(二)
Intent shareIntent = new Intent(Intent.ACTION_SEND);
AppInfo app = getShareAppList().get(position);
shareIntent.setComponent(new ComponentName(app.getAppPkgName(), app.getAppLauncherClassName()));
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, downUrl);
shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(shareIntent);
dialog.dismiss();
}
});
Button btn_close = (Button) dialog.findViewById(R.id.btn_dialog_close);
btn_close.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
}
/**
*
* @param priceBytime
* 按次购买价格
* @param priceByMonth
* 包月价格
* @param timeRemain
* 按次购买提醒内容
* @param monthRemain
* 包月购买提醒内容
* @param orderRemain
* 订购提示
* @param onClickListener
* 点击事件
*/
public void showDialogOrder(String priceBytime, String priceByMonth, String timeRemain, String monthRemain, String orderRemain, final BtnClickListener onClickListener) {
dialog = new Dialog(context, R.style.dialog);
dialog.setContentView(R.layout.dialog_factory_order);
TextView tv_ordorByTime = (TextView) dialog.findViewById(R.id.tv_orderByTime);
if (priceBytime != null) {
tv_ordorByTime.setText(priceBytime);
}
tv_ordorByTime.setText("按次:" + priceBytime + "元");
// 按次订购按钮
Button btn_orderByTime = (Button) dialog.findViewById(R.id.btn_orderByTime);
btn_orderByTime.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
if (onClickListener != null) {
onClickListener.btnOrderByTime(v);
}
}
});
TextView tv_orderByMonth = (TextView) dialog.findViewById(R.id.tv_orderByMonth);
if (priceByMonth != null) {
tv_orderByMonth.setText("包月:" + priceByMonth + "元(天翼视讯全能看)");
}
// 包月订购按钮
Button btn_ordrByMonth = (Button) dialog.findViewById(R.id.btn_orderByMonth);
btn_ordrByMonth.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
if (onClickListener != null) {
onClickListener.btnOrderByMonth(v);
}
}
});
TextView tv_remain_time = (TextView) dialog.findViewById(R.id.tv_remain_time);
if (timeRemain != null || "".equals(timeRemain)) {
tv_remain_time.setText(timeRemain);
} else {
LinearLayout ll = (LinearLayout) dialog.findViewById(R.id.ll_orderByTime);
View view = dialog.findViewById(R.id.view_line_3);
ll.setVisibility(View.GONE);
view.setVisibility(View.GONE);
}
TextView tv_remain_month = (TextView) dialog.findViewById(R.id.tv_remain_month);
if (monthRemain != null || "".equals(mo