Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sub);

    areaContainer = (RelativeLayout) findViewById(R.id.area_container);
    subFragment = new SubFragment();

    getSupportFragmentManager().beginTransaction().add(areaContainer.getId(), subFragment).commit();
  }
  @Before
  public void setUp() throws Exception {
    Activity context = Robolectric.buildActivity(Activity.class).create().get();
    relativeLayout = new RelativeLayout(context);
    relativeLayout.setId((int) Utils.generateUniqueId());
    viewGroup = new LinearLayout(context);

    BaseForwardingNativeAd baseForwardingNativeAd = new BaseForwardingNativeAd() {};
    baseForwardingNativeAd.setTitle("test title");
    baseForwardingNativeAd.setText("test text");
    baseForwardingNativeAd.setCallToAction("test call to action");
    baseForwardingNativeAd.setClickDestinationUrl("destinationUrl");

    nativeResponse =
        new NativeResponse(
            context,
            "impressionTrackerUrl",
            "clickTrackerUrl",
            "test ID",
            baseForwardingNativeAd,
            mock(MoPubNative.MoPubNativeListener.class));

    titleView = new TextView(context);
    titleView.setId((int) Utils.generateUniqueId());
    textView = new TextView(context);
    textView.setId((int) Utils.generateUniqueId());
    callToActionView = new Button(context);
    callToActionView.setId((int) Utils.generateUniqueId());
    mainImageView = new ImageView(context);
    mainImageView.setId((int) Utils.generateUniqueId());
    iconImageView = new ImageView(context);
    iconImageView.setId((int) Utils.generateUniqueId());
    badView = new ImageView(context);
    badView.setId((int) Utils.generateUniqueId());

    relativeLayout.addView(titleView);
    relativeLayout.addView(textView);
    relativeLayout.addView(callToActionView);
    relativeLayout.addView(mainImageView);
    relativeLayout.addView(iconImageView);
    relativeLayout.addView(badView);

    viewBinder =
        new ViewBinder.Builder(relativeLayout.getId())
            .titleId(titleView.getId())
            .textId(textView.getId())
            .callToActionId(callToActionView.getId())
            .mainImageId(mainImageView.getId())
            .iconImageId(iconImageView.getId())
            .build();

    subject = new MoPubNativeAdRenderer(viewBinder);
  }
  /** Metodo que contem o loop de espera do carregamento do video */
  @Override
  public void run() {
    if (video.isPlaying()) {
      if (rLayout.getId() != iDPrincipal) {
        video.stopPlayback();
        im.setImageResource(R.drawable.play);
      } else {
        im.setImageResource(R.drawable.pause);
      }
      lLayout.setVisibility(View.GONE);
      video.setBackgroundColor(Color.TRANSPARENT);

    } else {
      handler.postDelayed((Runnable) this, 200);
    }
  }
  public void renderAdView_withFailedViewBinder_shouldReturnEmptyViews() {
    viewBinder =
        new ViewBinder.Builder(relativeLayout.getId())
            .titleId(titleView.getId())
            .textId(badView.getId())
            .callToActionId(callToActionView.getId())
            .mainImageId(mainImageView.getId())
            .iconImageId(iconImageView.getId())
            .build();

    subject = new MoPubNativeAdRenderer(viewBinder);
    subject.renderAdView(relativeLayout, nativeResponse);

    assertThat(((TextView) relativeLayout.findViewById(titleView.getId())).getText()).isEqualTo("");
    assertThat(((TextView) relativeLayout.findViewById(textView.getId())).getText()).isEqualTo("");
    assertThat(((TextView) relativeLayout.findViewById(callToActionView.getId())).getText())
        .isEqualTo("");
  }
  @Override
  public void onClick(View v) {

    int id = v.getId();

    if (id == mBackLayout.getId() || id == mTitleTextView.getId()) {

      mMediaPlayerController.onBackPress(MediaPlayMode.PLAYMODE_WINDOW);

    } else if (id == mPlaybackImageView.getId()) {

      if (mMediaPlayerController.isPlaying()) {
        mMediaPlayerController.pause();
        show(0);
      } else if (!mMediaPlayerController.isPlaying()) {
        mMediaPlayerController.start();
        show();
      }
    }
  }
  public DownloadConfirmLayout(
      final Context context,
      String adm,
      String message,
      String appName,
      String okText,
      OnClickListener okListener,
      String cancelText,
      OnClickListener cancelListener)
      throws Exception {
    super(context);

    this.setBackgroundColor(Color.WHITE);

    JSONObject nativeAdAdm = new JSONObject(adm);
    String logoUrl = nativeAdAdm.getString("logo");
    String title = appName;
    String desc = nativeAdAdm.getString("desc");
    double density = context.getResources().getDisplayMetrics().density;
    RelativeLayout titleLayout = new RelativeLayout(context);
    titleLayout.setId(titleLayout.hashCode());

    iconContainer = new RelativeLayout(context);
    iconContainer.setId(iconContainer.hashCode());
    iconContainer.setVisibility(GONE);
    //        iconContainer.setBackgroundColor(Color.parseColor("#CCCCCC"));
    iconImageView = new ImageView(context);
    iconImageView.setScaleType(ImageView.ScaleType.FIT_XY);
    RelativeLayout.LayoutParams rllp = new LayoutParams(getPx(178, density), getPx(178, density));
    rllp.addRule(CENTER_IN_PARENT);
    rllp.topMargin = getPx(1, density);
    rllp.leftMargin = getPx(1, density);
    iconContainer.addView(iconImageView, rllp);

    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.addRule(ALIGN_PARENT_TOP);
    titleLayout.addView(iconContainer, rllp);

    RelativeLayout titleDescLayout = new RelativeLayout(context);
    titleDescLayout.setId(titleDescLayout.hashCode());

    TextView titleTextView = new TextView(context);
    titleTextView.setId(titleTextView.hashCode());
    titleTextView.setEllipsize(TextUtils.TruncateAt.END);
    titleTextView.setSingleLine();
    titleTextView.setText(title);
    titleTextView.setTextSize(20);
    titleTextView.setTypeface(Typeface.DEFAULT_BOLD);
    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    titleDescLayout.addView(titleTextView, rllp);

    TextView descTextView = new TextView(context);
    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.addRule(BELOW, titleTextView.getId());
    rllp.topMargin = getPx(24, density);
    descTextView.setText(desc);
    descTextView.setTextSize(13);
    descTextView.setEllipsize(TextUtils.TruncateAt.END);
    descTextView.setSingleLine();
    titleDescLayout.addView(descTextView, rllp);

    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.leftMargin = getPx(44, density);
    rllp.addRule(RIGHT_OF, iconContainer.getId());
    titleLayout.addView(titleDescLayout, rllp);

    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.leftMargin = getPx(56, density);
    rllp.topMargin = getPx(56, density);
    rllp.addRule(ALIGN_PARENT_TOP);
    addView(titleLayout, rllp);

    View ToplineView = new View(context);
    ToplineView.setId(ToplineView.hashCode());
    ToplineView.setBackgroundColor(Color.parseColor("#1C1C1C"));
    rllp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getPx(3, density));
    rllp.addRule(BELOW, titleLayout.getId());
    rllp.topMargin = getPx(21, density);
    addView(ToplineView, rllp);

    TextView messageTextView = new TextView(context);
    messageTextView.setText(message);
    messageTextView.setTextSize((float) 49.0 / 3);
    messageTextView.setId(messageTextView.hashCode());
    rllp =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.addRule(CENTER_HORIZONTAL);
    rllp.addRule(BELOW, ToplineView.getId());
    rllp.topMargin = getPx(39, density);
    rllp.bottomMargin = rllp.topMargin;
    rllp.leftMargin = getPx(56, density);
    addView(messageTextView, rllp);

    View ButtomlineView = new View(context);
    ButtomlineView.setId(ButtomlineView.hashCode());
    ButtomlineView.setBackgroundColor(Color.parseColor("#929292"));
    rllp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getPx(2, density));
    rllp.addRule(BELOW, messageTextView.getId());
    addView(ButtomlineView, rllp);

    LinearLayout buttonLayout = new LinearLayout(context);
    buttonLayout.setOrientation(LinearLayout.HORIZONTAL);
    Button okBtn = new Button(context);
    okBtn.setId(okBtn.hashCode());
    okBtn.setText(okText);
    okBtn.setOnClickListener(okListener);
    LinearLayout.LayoutParams lllp =
        new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lllp.weight = 0.5f;
    buttonLayout.addView(okBtn, lllp);

    View MiddlelineView = new View(context);
    MiddlelineView.setId(ButtomlineView.hashCode());
    MiddlelineView.setBackgroundColor(Color.parseColor("#929292"));
    rllp = new LayoutParams(getPx(2, density), ViewGroup.LayoutParams.MATCH_PARENT);
    rllp.addRule(RIGHT_OF, okBtn.getId());
    buttonLayout.addView(MiddlelineView, rllp);

    Button cancelBtn = new Button(context);
    cancelBtn.setOnClickListener(cancelListener);
    cancelBtn.setText(cancelText);
    buttonLayout.addView(cancelBtn, lllp);
    rllp =
        new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    rllp.addRule(BELOW, messageTextView.getId());
    addView(buttonLayout, rllp);

    okBtn.setBackgroundColor(Color.argb(0, 0, 0, 0));
    cancelBtn.setBackgroundColor(Color.argb(0, 0, 0, 0));

    okBtn.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            Button btn = (Button) v;
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
              btn.setBackgroundColor(Color.argb(130, 0, 0, 0));
            }
            if (event.getAction() == MotionEvent.ACTION_UP) {
              btn.setBackgroundColor(Color.argb(0, 0, 0, 0));
            }
            if (event.getAction() == MotionEvent.ACTION_CANCEL) {
              btn.setBackgroundColor(Color.argb(0, 0, 0, 0));
            }

            return false;
          }
        });

    cancelBtn.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            Button btn = (Button) v;
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
              btn.setBackgroundColor(Color.argb(130, 0, 0, 0));
            }
            if (event.getAction() == MotionEvent.ACTION_UP) {
              btn.setBackgroundColor(Color.argb(0, 0, 0, 0));
            }
            if (event.getAction() == MotionEvent.ACTION_CANCEL) {
              btn.setBackgroundColor(Color.argb(0, 0, 0, 0));
            }

            return false;
          }
        });

    HttpRequester.getAsynData(
        context,
        logoUrl,
        true,
        new HttpRequester.Listener() {
          @Override
          public void onGetDataSucceed(byte[] data) {
            Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
            iconImageView.setImageBitmap(bitmap);
            iconContainer.setVisibility(VISIBLE);
          }

          @Override
          public void onGetDataFailed(String error) {
            MVLog.e(MvErrorCode.COMMON_ERROR, error);
          }
        });
  }
 private synchronized boolean initUI() {
   boolean z;
   try {
     if (getIntent() != null) {
       this.mbHideHeader = getIntent().getBooleanExtra("HIDE_HEADER", false);
       this.mbSendAllChecksumResponseParametersToPGServer =
           getIntent()
               .getBooleanExtra("SEND_ALL_CHECKSUM_RESPONSE_PARAMETERS_TO_PG_SERVER", false);
     }
     PaytmUtility.debugLog("Hide Header " + this.mbHideHeader);
     PaytmUtility.debugLog("Initializing the UI of Transaction Page...");
     RelativeLayout RootView = new RelativeLayout(this);
     RelativeLayout TopBar = new RelativeLayout(this);
     TopBar.setLayoutParams(new LayoutParams(-1, -2));
     TopBar.setId(1);
     TopBar.setBackgroundColor(-3355444);
     Button Cancel = new Button(this, null, 16842825);
     LayoutParams CancelParams = new LayoutParams(-2, -2);
     CancelParams.addRule(15);
     CancelParams.leftMargin = (int) (getResources().getDisplayMetrics().density * 5.0f);
     Cancel.setOnClickListener(
         new OnClickListener() {
           public void onClick(View v) {
             PaytmUtility.debugLog("User pressed back button which is present in Header Bar.");
             PaytmPGActivity.this.cancelTransaction();
           }
         });
     Cancel.setLayoutParams(CancelParams);
     Cancel.setText("Cancel");
     TextView AppName = new TextView(this);
     LayoutParams AppNameParams = new LayoutParams(-2, -2);
     AppNameParams.addRule(13);
     AppName.setLayoutParams(AppNameParams);
     AppName.setTextColor(-16777216);
     AppName.setText("Paytm Payments");
     TopBar.addView(Cancel);
     TopBar.addView(AppName);
     RelativeLayout WebLayout = new RelativeLayout(this);
     LayoutParams WebLayoutParams = new LayoutParams(-1, -1);
     WebLayoutParams.addRule(3, TopBar.getId());
     WebLayout.setLayoutParams(WebLayoutParams);
     this.mWV = new PaytmWebView(this, this.mParams);
     this.mWV.setVisibility(8);
     this.mWV.setLayoutParams(new LayoutParams(-1, -1));
     mProgress = new ProgressBar(this, null, 16842873);
     LayoutParams ProgressParams = new LayoutParams(-2, -2);
     ProgressParams.addRule(13);
     mProgress.setLayoutParams(ProgressParams);
     WebLayout.addView(this.mWV);
     WebLayout.addView(mProgress);
     RootView.addView(TopBar);
     RootView.addView(WebLayout);
     if (this.mbHideHeader) {
       TopBar.setVisibility(8);
     }
     requestWindowFeature(1);
     setContentView(RootView);
     PaytmUtility.debugLog("Initialized UI of Transaction Page.");
     z = true;
   } catch (Exception inEx) {
     PaytmUtility.debugLog("Some exception occurred while initializing UI.");
     PaytmUtility.printStackTrace(inEx);
     z = false;
   }
   return z;
 }
Example #8
0
      @Override
      public void run() {

        RelativeLayout.LayoutParams rlparams =
            new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        RelativeLayout rl = new RelativeLayout(mContext);

        rl.setPadding(0, 15, 0, 15);

        RelativeLayout.LayoutParams rlpVia =
            new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        RelativeLayout.LayoutParams rlpCrimes =
            new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        RelativeLayout.LayoutParams rlpMins =
            new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

        TextView tvVia = new TextView(mContext);
        tvVia.setId(1000);
        tvVia.setText(route.getVia());
        tvVia.setTextColor(Color.parseColor("#15449B"));

        // add rules for rlpVia
        TextView tvRouteTitle = (TextView) findViewById(R.id.tv_route_title);
        rlpVia.addRule(RelativeLayout.ALIGN_LEFT, tvRouteTitle.getId());
        rlpVia.addRule(RelativeLayout.BELOW, tvRouteTitle.getId());

        tvVia.setLayoutParams(rlpVia);
        rl.addView(tvVia);

        TextView tvCrimes = new TextView(mContext);
        tvCrimes.setId(2000);
        tvCrimes.setText(route.getCrimeTotal());
        tvCrimes.setTextColor(Color.parseColor("#15449B"));

        // add rules for rlpCrimes
        rlpCrimes.addRule(RelativeLayout.ALIGN_BOTTOM, tvVia.getId());
        rlpCrimes.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        //				rlpCrimes.addRule(RelativeLayout.BELOW, vEmpty.getId());
        //				rlpCrimes.addRule(RelativeLayout.ALIGN_LEFT, vEmpty.getId());

        tvCrimes.setLayoutParams(rlpCrimes);
        rl.addView(tvCrimes);

        TextView tvMins = new TextView(mContext);
        tvMins.setId(3000);
        tvMins.setText(route.getMins());
        tvMins.setTextColor(Color.parseColor("#15449B"));

        // add rules for rlpMins
        rlpMins.addRule(RelativeLayout.BELOW, tvCrimes.getId());
        //				rlpMins.addRule(RelativeLayout.ALIGN_LEFT, tvCrimes.getId());
        rlpMins.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        //				rlpMins.addRule(RelativeLayout.BELOW, vEmpty.getId());

        tvMins.setLayoutParams(rlpMins);
        rl.addView(tvMins);

        rl.setId(route.getRouteNum()); // normalize id to start at 0

        if (routes.size() == 1) {
          RelativeLayout rlTitle = (RelativeLayout) findViewById(R.id.rl_routes_title);
          rlparams.addRule(RelativeLayout.BELOW, rlTitle.getId());
        }
        if (routes.size() != 1) {
          rlparams.addRule(RelativeLayout.BELOW, routes.size() - 1);
        }
        rlparams.setMargins(0, 5, 30, 0);

        // set onclick listeners
        rl.setOnClickListener(new MyClickListener(rl.getId()));

        llRoutes.addView(rl, rlparams);
      }
  private void init() {
    calendarGesture = new GestureDetector(context, new GestureListener());
    cal = Calendar.getInstance();
    base = new RelativeLayout(context);
    base.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    base.setMinimumHeight(40);

    base.setId(baseId);

    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.leftMargin = 16;
    params.topMargin = 40;
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    prev = new ImageView(context);
    prev.setId(preId);
    prev.setLayoutParams(params);
    prev.setImageResource(R.drawable.navigation_previous_item);
    prev.setOnClickListener(this);
    base.addView(prev);

    params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL);
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    month = new TextView(context);
    month.setId(monthId);
    month.setLayoutParams(params);
    //        month.setTextAppearance(context, android.R.attr.textAppearanceLarge);
    month.setText(
        cal.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault())
            + " "
            + cal.get(Calendar.YEAR));
    month.setTextSize(25);

    base.addView(month);

    params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.rightMargin = 16;
    params.topMargin = 40;
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    params.addRule(RelativeLayout.CENTER_VERTICAL);
    next = new ImageView(context);
    next.setImageResource(R.drawable.navigation_next_item);
    next.setLayoutParams(params);
    next.setId(nextId);
    next.setOnClickListener(this);

    base.addView(next);

    addView(base);

    params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.bottomMargin = 20;
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    params.addRule(RelativeLayout.BELOW, base.getId());

    calendar = new GridView(context);
    calendar.setLayoutParams(params);
    calendar.setVerticalSpacing(4);
    calendar.setHorizontalSpacing(4);
    calendar.setNumColumns(7);
    calendar.setChoiceMode(GridView.CHOICE_MODE_SINGLE);
    calendar.setDrawSelectorOnTop(true);

    mAdapter = new CalendarAdapter(context, cal);
    calendar.setAdapter(mAdapter);
    calendar.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return calendarGesture.onTouchEvent(event);
          }
        });

    addView(calendar);
  }
  @SuppressLint("SetJavaScriptEnabled")
  private void init(Context context) {
    this.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    int nBtnSize = Global.ScaleSize(27);

    /** create option bar */
    RelativeLayout rlLayout = new RelativeLayout(context);
    rlLayout.setId(ID_OPTION_BAR);
    RelativeLayout.LayoutParams layoutParams =
        new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, Global.ScaleSize(44));
    layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    rlLayout.setLayoutParams(layoutParams);
    rlLayout.setBackgroundColor(Color.parseColor("#f4f4f4f2"));
    rlLayout.setPadding(
        Global.ScaleSize(30), Global.ScaleSize(7), Global.ScaleSize(30), Global.ScaleSize(10));
    this.addView(rlLayout);

    webView = new WebView(context);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setWebViewClient(new WebViewClient());
    webView.setInitialScale(1);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setUseWideViewPort(true);

    RelativeLayout.LayoutParams webLayoutParams =
        new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    webLayoutParams.addRule(RelativeLayout.BELOW, rlLayout.getId());
    webView.setLayoutParams(webLayoutParams);
    webView.setWebViewClient(new myWebViewClient());
    this.addView(webView);

    ImageView imageReflash = new ImageView(context);
    ImageView imageBack = new ImageView(context);
    ImageView imagePrePage = new ImageView(context);
    ImageView imageNextPage = new ImageView(context);

    RelativeLayout.LayoutParams reflashLayoutParams =
        new RelativeLayout.LayoutParams(nBtnSize, nBtnSize);
    reflashLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    imageReflash.setId(ID_FLASH);
    imageReflash.setLayoutParams(reflashLayoutParams);
    imageReflash.setImageResource(Global.getResourceId(context, "reflash_normal", "drawable"));
    imageReflash.setScaleType(ScaleType.CENTER_INSIDE);
    rlLayout.addView(imageReflash);

    RelativeLayout.LayoutParams backLayoutParams =
        new RelativeLayout.LayoutParams(nBtnSize, nBtnSize);
    backLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    imageBack.setId(ID_BACK);
    imageBack.setLayoutParams(backLayoutParams);
    imageBack.setImageResource(Global.getResourceId(context, "exit_normal", "drawable"));
    imageBack.setScaleType(ScaleType.CENTER_INSIDE);
    rlLayout.addView(imageBack);

    RelativeLayout.LayoutParams nextPageLayoutParams =
        new RelativeLayout.LayoutParams(nBtnSize, nBtnSize);
    nextPageLayoutParams.addRule(RelativeLayout.LEFT_OF, imageReflash.getId());
    nextPageLayoutParams.setMargins(0, 0, Global.ScaleSize(65), 0);
    imageNextPage.setId(ID_NEXT_PAGE);
    imageNextPage.setLayoutParams(nextPageLayoutParams);
    imageNextPage.setImageResource(Global.getResourceId(context, "back_normal", "drawable"));
    imageNextPage.setScaleType(ScaleType.CENTER_INSIDE);
    rlLayout.addView(imageNextPage);

    RelativeLayout.LayoutParams prePageLayoutParams =
        new RelativeLayout.LayoutParams(nBtnSize, nBtnSize);
    prePageLayoutParams.addRule(RelativeLayout.LEFT_OF, imageNextPage.getId());
    prePageLayoutParams.setMargins(0, 0, Global.ScaleSize(50), 0);
    imagePrePage.setId(ID_PRE_PAGE);
    imagePrePage.setLayoutParams(prePageLayoutParams);
    imagePrePage.setImageResource(Global.getResourceId(context, "forward_normal", "drawable"));
    imagePrePage.setScaleType(ScaleType.CENTER_INSIDE);
    rlLayout.addView(imagePrePage);

    imageReflash.setOnTouchListener(onTouchListener);
    imageBack.setOnTouchListener(onTouchListener);
    imagePrePage.setOnTouchListener(onTouchListener);
    imageNextPage.setOnTouchListener(onTouchListener);

    progressBar = new ProgressBar(getContext());
    RelativeLayout.LayoutParams progressParams = new RelativeLayout.LayoutParams(80, 80);
    progressParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    progressBar.setLayoutParams(progressParams);
    progressBar
        .getIndeterminateDrawable()
        .setColorFilter(0xFF309FD6, android.graphics.PorterDuff.Mode.MULTIPLY);
  }