| | |
| | | import android.app.Dialog; |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.graphics.Color; |
| | | import android.graphics.drawable.AnimationDrawable; |
| | | import android.graphics.drawable.GradientDrawable; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | | |
| | | import com.androidquery.AQuery; |
| | |
| | | import com.tejia.lijin.app.util.ad.ExpressAdContainer; |
| | | import com.tejia.lijin.app.util.ad.ExpressAdManager; |
| | | import com.wpc.library.util.SystemCommon; |
| | | import com.wpc.library.util.common.DimenUtils; |
| | | import com.wpc.library.widget.RatioLayout; |
| | | import com.wpc.library.widget.ResizableImageView; |
| | | |
| | | import java.util.List; |
| | |
| | | String notifyDesc; |
| | | String notifyUrl; |
| | | int platform; |
| | | int time = 5; |
| | | int time = 3; |
| | | Runnable runnable = null; |
| | | IDialogClose dialogCloseListener; |
| | | |
| | |
| | | } |
| | | |
| | | public Builder setAdInfo(String type, String pid) { |
| | | this.adType=type; |
| | | this.adType = type; |
| | | this.adPid = pid; |
| | | return this; |
| | | } |
| | |
| | | |
| | | private void initView(AQuery mAuery) { |
| | | if (!hasAd) { |
| | | mAuery.id(R.id.ll_top).visibility(View.GONE); |
| | | mAuery.id(R.id.ll_notify).visibility(View.GONE); |
| | | mAuery.id(R.id.ll_top).background(R.drawable.shape_dialog_goods_detail_jump_loading_top_common); |
| | | mAuery.id(R.id.ll_loading).visibility(View.VISIBLE); |
| | | mAuery.id(R.id.fl_ad).visibility(View.GONE); |
| | | mAuery.id(R.id.tv_time).text("正在跳转至"); |
| | | mAuery.id(R.id.ll_content).background(R.drawable.shape_dialog_goods_detail_jump_loading_top_common); |
| | | ((RatioLayout) mAuery.id(R.id.rl_container).getView()).setRatio(0.6f); |
| | | } else { |
| | | mAuery.id(R.id.ll_top).visibility(View.VISIBLE); |
| | | mAuery.id(R.id.ll_notify).visibility(View.VISIBLE); |
| | | mAuery.id(R.id.ll_top).background(R.drawable.shape_dialog_goods_detail_jump_loading_top); |
| | | mAuery.id(R.id.ll_loading).visibility(View.GONE); |
| | | mAuery.id(R.id.fl_ad).visibility(View.VISIBLE); |
| | | mAuery.id(R.id.tv_time).text(""); |
| | |
| | | |
| | | //非VIP |
| | | if (hasAd) { |
| | | final FrameLayout fl_ad = (FrameLayout) mAquery.id(R.id.fl_ad_content).getView(); |
| | | final TextView tv_time = mAquery.id(R.id.tv_time).getTextView(); |
| | | //填充通知信息 |
| | | mAquery.id(R.id.tv_notify).text(notifyDesc); |
| | | mAquery.id(R.id.ll_notify).clicked(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | } |
| | | }); |
| | | |
| | | //需要展示广告,然后倒计时 |
| | | mAquery.id(R.id.tv_skip).clicked(new View.OnClickListener() { |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | if (dialog.isShowing()) |
| | | dialog.dismiss(); |
| | | if (dialogCloseListener != null) { |
| | | dialogCloseListener.onClose(false); |
| | | } |
| | | } |
| | | }); |
| | | //填充广告 |
| | | new ExpressAdManager(AdUtil.AD_TYPE.valueOf(adType), context).loadGoodsJumpLoadingAd(adPid, new ExpressAdManager.IAdLoadListener() { |
| | | @Override |
| | | public void onSuccess(List<ExpressAdContainer> adList) { |
| | | if (adList != null && adList.size() > 0) { |
| | | //广告 |
| | | ExpressAdManager.renderAndFillAd(context, adList.get(0), fl_ad, new ExpressAdManager.IAdEventListener() { |
| | | |
| | | @Override |
| | | public void closeAd(ExpressAdContainer ad) { |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | GradientDrawable drawable = new GradientDrawable(); |
| | | drawable.setColor(Color.WHITE); |
| | | drawable.setCornerRadius(DimenUtils.dip2px(context, 30)); |
| | | ((LinearLayout) mAquery.id(R.id.ll_notify).getView()).setBackground(drawable); |
| | | |
| | | |
| | | runnable = new Runnable() { |
| | |
| | | } else { |
| | | if (dialog.isShowing()) |
| | | dialog.dismiss(); |
| | | dialogCloseListener.onClose(true); |
| | | if (dialogCloseListener != null) |
| | | dialogCloseListener.onClose(true); |
| | | } |
| | | } |
| | | }; |