/**
  * Sets the alpha value of the ImageView. API Level < 16:
  * http://developer.android.com/reference/android/widget/ImageView.html#setAlpha(int) API Level >=
  * 16: http://developer.android.com/reference/android/widget/ImageView.html#setImageAlpha(int)
  *
  * @param imageView the ImageView
  * @param alpha the alpha value being applied to the ImageView
  */
 public static void setImageViewAlpha(@NonNull ImageView imageView, int alpha) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     imageView.setImageAlpha(alpha);
   } else {
     imageView.setAlpha(alpha);
   }
 }
 @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
 private void setAlpha(View view, int alpha) {
   if (view instanceof ImageView && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     ((ImageView) view).setImageAlpha(alpha);
   } else {
     ViewCompat.setAlpha(view, alpha);
   }
 }
 /** @see android.widget.ImageView#setImageAlpha(int) */
 @SuppressWarnings("deprecation")
 public static void setImageAlpha(ImageView iv, int alpha) {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
     iv.setImageAlpha(alpha);
   } else {
     iv.setAlpha(alpha);
   }
 }
  public void updatePageNumView() {
    Log.i("StoreMainActivity - updatePageNumView", "Start");
    TextView tvPage = (TextView) findViewById(R.id.tvStoreDetailPage);
    if (this.listProduct.size() > 0) {
      String pageDisplay = mPager.getCurrentItem() + 1 + "/" + mPagerAdapter.getCount();
      tvPage.setText(pageDisplay);
    }

    ImageView btnPagePrevious = (ImageView) findViewById(R.id.btnStoreDetailPagePrevious);
    ImageView btnPageNext = (ImageView) findViewById(R.id.btnStoreDetailPageNext);

    if (mPagerAdapter.getCount() > 1) {
      if (mPager.getCurrentItem() == 0) {
        btnPagePrevious.setImageAlpha(70);
        btnPageNext.setImageAlpha(255);
      } else if (mPager.getCurrentItem() == (mPagerAdapter.getCount() - 1)) {
        btnPageNext.setImageAlpha(70);
        btnPagePrevious.setImageAlpha(255);
      } else {
        btnPagePrevious.setImageAlpha(255);
      }
    } else {
      btnPageNext.setImageAlpha(70);
      btnPagePrevious.setImageAlpha(70);
    }

    StoreMainActivity.productTransactionDetailInfo = new TransactionDetailInfo();
  }
Exemple #5
0
 @TargetApi(16)
 @SuppressWarnings("deprecation")
 public static void setPosterBackground(ImageView background, String posterPath, Context context) {
   if (AndroidUtils.isJellyBeanOrHigher()) {
     background.setImageAlpha(30);
   } else {
     background.setAlpha(30);
   }
   ImageProvider.getInstance(context).loadImage(background, posterPath, false);
 }
  private void initialize() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(false);

    mToolbarView = findViewById(R.id.toolbar_actionbar);

    // Setup RecyclerView inside drawer
    final TypedValue typedValue = new TypedValue();
    getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true);
    color = typedValue.data;

    mToolbarView.setBackgroundColor(ScrollUtils.getColorWithAlpha(0, color));
    mScrollView = (ObservableScrollView) findViewById(R.id.scroll);
    mScrollView.addScrollViewCallbacks(this);

    mParallaxImageHeight = getResources().getDimensionPixelSize(R.dimen.parallax_image_height);

    banner = (ImageView) findViewById(R.id.banner);
    displayMainString = (TextView) findViewById(R.id.tv_albumname);
    displayFirstSubString = (TextView) findViewById(R.id.tv_title_frst);
    displaySecondSubString = (TextView) findViewById(R.id.tv_title_sec);
    songsList = (ExpandableHeightListView) findViewById(R.id.listView_songs);
    mSongsListAdapter = new AllSongsListAdapter(context);

    songsList.setAdapter(mSongsListAdapter);

    options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.bg_default_album_art)
            .showImageForEmptyUri(R.drawable.bg_default_album_art)
            .showImageOnFail(R.drawable.bg_default_album_art)
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    try {
      fab_button = (ImageView) findViewById(R.id.fab_button);
      fab_button.setColorFilter(color);
      fab_button.setImageAlpha(255);
    } catch (Exception e) {
      e.printStackTrace();
    }

    setupVkMusicHelper();
  }
  /** 界面预设 */
  private void prepare() {
    if (listNews.getHeaderViewsCount() > 0) {
      return;
    }
    animRight =
        new RotateAnimation(
            -30, 30f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animRight.setDuration(1000);
    animRight.setAnimationListener(listener);
    animLeft =
        new RotateAnimation(
            30f, -30f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animLeft.setDuration(1000);
    animLeft.setAnimationListener(listener);
    View viewHead = LayoutInflater.from(this.getActivity()).inflate(R.layout.div_home_head, null);
    listNews.addHeaderView(viewHead);
    scrollEntry = (HorizontalScrollViewEx) viewHead.findViewById(R.id.home_scroll_entry);
    scrollEntry.setHorizontalScrollViewListenner(
        new HorizontalScrollViewEx.HorizontalScrollViewListenner() {
          @Override
          public void onScrollChanged(int x, int y, int oldx, int oldy) {
            if (x > oldx && x > 50) {
              imgDot1.setImageResource(R.drawable.icon_dot_unselected);
              imgDot2.setImageResource(R.drawable.icon_dot_selected);
            } else if (x < oldx && x < 50) {
              imgDot1.setImageResource(R.drawable.icon_dot_selected);
              imgDot2.setImageResource(R.drawable.icon_dot_unselected);
            }
          }
        });
    viewEntry1 = (View) viewHead.findViewById(R.id.home_layout_entry1);
    viewEntry2 = (View) viewHead.findViewById(R.id.home_layout_entry2);
    viewEntry3 = (View) viewHead.findViewById(R.id.home_layout_entry3);
    viewEntry4 = (View) viewHead.findViewById(R.id.home_layout_entry4);
    viewEntry5 = (View) viewHead.findViewById(R.id.home_layout_entry5);
    viewEntry6 = (View) viewHead.findViewById(R.id.home_layout_entry6);
    btnRegion.getBackground().setAlpha(200);
    btnSearch.getBackground().setAlpha(200);
    btnBell.setImageAlpha(200);
    imgDot1 = (ImageView) viewHead.findViewById(R.id.home_image_dot1);
    imgDot2 = (ImageView) viewHead.findViewById(R.id.home_image_dot2);
    browser = (ScrollWebView) viewHead.findViewById(R.id.home_browser);

    DisplayMetrics metrics = new DisplayMetrics();
    this.getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    LayoutParams lp = (LayoutParams) browser.getLayoutParams();
    lp.height = metrics.widthPixels * 7 / 10;
    browser.setLayoutParams(lp);

    browser.getSettings().setJavaScriptEnabled(true);
    browser.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    browser.setWebViewClient(
        new WebViewClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Intent intent = new Intent(HomeActivity.this.getActivity(), BrowserActivity.class);
            intent.putExtra("url", url);
            startActivity(intent);
            browser.pauseTimers();
            browser.resumeTimers();
            return true;
          }

          @Override
          public void onReceivedError(
              WebView view, int errorCode, String description, String failingUrl) {
            super.onReceivedError(view, errorCode, description, failingUrl);
            browser.loadUrl("about:blank");
          }
        });

    View viewActivity1 = (View) viewHead.findViewById(R.id.home_layout_left);
    viewActivity1.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String token = "";
            if (null != Me.instance) {
              token = Me.instance.token;
            }
            String regionId = "";
            if (null != Profile.instance().region) {
              regionId = String.valueOf(Profile.instance().region.id);
            }
            Helper.openBrowser(
                HomeActivity.this.getActivity(), Networking.fetchURL("activity1", token, regionId));
          }
        });
    View viewActivity2 = (View) viewHead.findViewById(R.id.home_layout_right);
    viewActivity2.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            String token = "";
            if (null != Me.instance) {
              token = Me.instance.token;
            }
            String regionId = "";
            if (null != Profile.instance().region) {
              regionId = String.valueOf(Profile.instance().region.id);
            }
            Helper.openBrowser(
                HomeActivity.this.getActivity(), Networking.fetchURL("activity2", token, regionId));
          }
        });
    this.getActivity().findViewById(R.id.home_layout_header).bringToFront();
  }
 private void animateShowing() {
   floatingImage.setImageAlpha(255);
 }
 private void animateHidden() {
   if (AppHelper.isAutoTransparent(context))
     floatingImage.setImageAlpha(AppHelper.getIconTransparency(context));
 }
Exemple #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
    setContentView(R.layout.activity_shop_screen);

    // Hide status bar
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // Hide the action bar
    ActionBar actionBar = getSupportActionBar();
    actionBar.hide();

    MainLayout = (LinearLayout) findViewById(R.id.main_layout);
    MainLayout.setBackgroundResource(R.drawable.background);

    // Set opacity on background_coin
    ImageView img = (ImageView) findViewById(R.id.background_coin);
    img.setImageAlpha(85);

    final Button usables = (Button) findViewById(R.id.usablebtn);
    final Button cosmetic = (Button) findViewById(R.id.Cosmeticbtn);
    usables.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (!FragUsable.isVisible()) {

              cosmetic.setBackgroundResource(R.drawable.buttonmenu);
              cosmetic.setTextColor(Color.WHITE);

              usables.setBackgroundResource(R.drawable.buttonpressed);
              usables.setTextColor(Color.parseColor("#ce492b"));

              FragmentManager fm = getFragmentManager();
              FragmentTransaction ft = fm.beginTransaction();

              ft.setCustomAnimations(R.animator.slide_in_left, R.animator.slide_out_right);
              ft.replace(R.id.fragment_place, FragUsable);

              ft.commit();
            }
          }
        });

    cosmetic.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (!FragCosmetic.isVisible()) {
              usables.setBackgroundResource(R.drawable.buttonmenu);
              usables.setTextColor(Color.WHITE);
              cosmetic.setBackgroundResource(R.drawable.buttonpressed);
              cosmetic.setTextColor(Color.parseColor("#ce492b"));

              FragmentManager fm = getFragmentManager();
              FragmentTransaction ft = fm.beginTransaction();

              ft.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_left);
              ft.replace(R.id.fragment_place, FragCosmetic);

              ft.commit();
            }
          }
        });

    TextView goldText = (TextView) findViewById(R.id.editText);
    Button Cosmeticbtn = (Button) findViewById(R.id.Cosmeticbtn);
    Button usablebtn = (Button) findViewById(R.id.usablebtn);

    FontsOverride.setTextViewFont(this, goldText);
    FontsOverride.setButtonFont(this, Cosmeticbtn);
    FontsOverride.setButtonFont(this, usablebtn);
  }
 @Override
 public void setValue(ImageView imageView, int value) {
   imageView.setImageAlpha(value);
 }