Example usage for android.widget ProgressBar getIndeterminateDrawable

List of usage examples for android.widget ProgressBar getIndeterminateDrawable

Introduction

In this page you can find the example usage for android.widget ProgressBar getIndeterminateDrawable.

Prototype

public Drawable getIndeterminateDrawable() 

Source Link

Document

Get the drawable used to draw the progress bar in indeterminate mode.

Usage

From source file:org.onebusaway.android.report.ui.BaseReportActivity.java

protected void setUpProgressBar() {
    ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT,
            ActionBar.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.END;/*  w ww . j  a va2s  .c o m*/

    ProgressBar progressBar = new ProgressBar(this);
    progressBar.setIndeterminate(true);
    progressBar.setVisibility(View.GONE);
    progressBar.setIndeterminate(true);
    progressBar.setLayoutParams(params);
    progressBar.getIndeterminateDrawable().setColorFilter(Color.WHITE,
            android.graphics.PorterDuff.Mode.MULTIPLY);

    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setDisplayShowCustomEnabled(true);
        ab.setCustomView(progressBar);
    }
}

From source file:in.andres.kandroid.ui.TaskEditActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
    case android.R.id.home:
        onBackPressed();//from  w  ww  .  ja va2 s  .  c o  m
        return true;
    case R.id.action_save:
        ownerId = spinnerProjectUsers.getSelectedItemPosition();
        if (spinnerProjectUsers.getSelectedItemPosition() != 0) {
            for (Enumeration<Integer> iter = projectUsers.keys(); iter.hasMoreElements();) {
                Integer key = iter.nextElement();
                if (projectUsers.get(key).contentEquals((String) spinnerProjectUsers.getSelectedItem())) {
                    ownerId = key;
                    break;
                }
            }
        }
        if (isNewTask) {
            kanboardAPI.createTask(editTextTitle.getText().toString(), projectid,
                    colorId != null ? colorId : defaultColor, columnId, ownerId, null, dueDate,
                    editTextDescription.getText().toString(), null, null, swimlaneId, null, null, null, null,
                    null, null, null, startDate);

        } else {
            kanboardAPI.updateTask(task.getId(), editTextTitle.getText().toString(),
                    colorId != null ? colorId : defaultColor, ownerId, dueDate,
                    editTextDescription.getText().toString(), null, null, null, null, null, null, null, null,
                    null, startDate);
        }
        ProgressBar prog = new ProgressBar(TaskEditActivity.this);
        prog.getIndeterminateDrawable().setColorFilter(Color.WHITE, android.graphics.PorterDuff.Mode.MULTIPLY);
        item.setActionView(prog);
        item.expandActionView();
        return true;
    default:
        return super.onOptionsItemSelected(item);
    }
}

From source file:in.andres.kandroid.ui.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    refreshAction = menu.findItem(R.id.action_refresh);
    if (progressBarCount > 0) {
        ProgressBar prog = new ProgressBar(self);
        prog.getIndeterminateDrawable().setColorFilter(Color.WHITE, android.graphics.PorterDuff.Mode.MULTIPLY);
        refreshAction.setActionView(prog);
        refreshAction.expandActionView();
        progressVisible = true;/*w  w w  . j a  va  2s.c  o m*/
    }
    return true;
}

From source file:in.andres.kandroid.ui.MainActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
private boolean showProgress(final boolean show) {
    // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
    // for very easy animations. If available, use these APIs to fade-in
    // the progress spinner.
    if (show)/*from   w ww. j a  va2  s.  com*/
        progressBarCount++;
    else
        progressBarCount = progressBarCount > 0 ? --progressBarCount : 0;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
        mMainView.setVisibility(progressBarCount > 0 ? View.GONE : View.VISIBLE);
        mMainView.animate().setDuration(shortAnimTime).alpha(progressBarCount > 0 ? 0 : 1)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mMainView.setVisibility(progressBarCount > 0 ? View.GONE : View.VISIBLE);
                    }
                });

        mProgress.setVisibility(progressBarCount > 0 ? View.VISIBLE : View.GONE);
        mProgress.animate().setDuration(shortAnimTime).alpha(progressBarCount > 0 ? 1 : 0)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        mProgress.setVisibility(progressBarCount > 0 ? View.VISIBLE : View.GONE);
                    }
                });
    } else {
        // The ViewPropertyAnimator APIs are not available, so simply show
        // and hide the relevant UI components.
        mProgress.setVisibility(progressBarCount > 0 ? View.VISIBLE : View.GONE);
        mMainView.setVisibility(progressBarCount > 0 ? View.GONE : View.VISIBLE);
    }

    if (progressBarCount > 0 && refreshAction != null && !progressVisible) {
        ProgressBar prog = new ProgressBar(self);
        prog.getIndeterminateDrawable().setColorFilter(Color.WHITE, android.graphics.PorterDuff.Mode.MULTIPLY);
        refreshAction.setActionView(prog);
        refreshAction.expandActionView();
        progressVisible = true;
    }
    if (progressBarCount == 0 && refreshAction != null && progressVisible) {
        refreshAction.collapseActionView();
        refreshAction.setActionView(null);
        progressVisible = false;
    }

    return progressBarCount != 0;
}

From source file:app.sunstreak.yourpisd.ClassSwipeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //      requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_class_swipe);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);//  w w w.  j a  v a2  s .c  om
    }
    ProgressBar spinner = new ProgressBar(this);
    spinner.setIndeterminate(true);
    spinner.setId(R.id.action_bar_spinner);
    spinner.getIndeterminateDrawable().setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
    toolbar.addView(spinner);
    receivedClassIndex = getIntent().getExtras().getInt("classIndex");
    classCount = getIntent().getExtras().getInt("classCount");
    termIndex = getIntent().getExtras().getInt("termIndex");
    studentIndex = getIntent().getExtras().getInt("studentIndex");

    setTitle(TermFinder.Term.values()[termIndex].name);

    session = ((YPApplication) getApplication()).session;

    session.studentIndex = studentIndex;
    student = session.getCurrentStudent();
    classesForTerm = student.getClassesForTerm(termIndex);

    System.out.println(classesForTerm);

    mFragments = new ArrayList<Fragment>();
    for (int i = 0; i < classesForTerm.size(); i++) {
        Bundle args = new Bundle();
        args.putInt(DescriptionFragment.ARG_SECTION_NUMBER, i);
        Fragment fragment = new DescriptionFragment();
        fragment.setArguments(args);
        mFragments.add(fragment);
    }

    // Create the adapter that will return a fragment for each of the 
    // primary sections of the app.

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(), mFragments);

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    //      final ActionBar actionBar = getActionBar();
    //      actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    /*
    for(int i = 0; i< classCount; i++)
    {
       actionBar.addTab(actionBar.newTab()
       .setText(session.getCurrentStudent()
             .getClassName(session.getCurrentStudent().getClassMatch()[i]))
             .setTabListener(this));
    }
     */

    //      for (int classIndex : classesForTerm)
    //         actionBar.addTab(actionBar.newTab().setText(student.getClassName(student.getClassMatch()[classIndex]))
    //               .setTabListener(this));
    ArrayList<String> temp = new ArrayList<>();
    for (int classIndex : classesForTerm) {
        temp.add(student.getClassName(student.getClassMatch()[classIndex]));
    }

    setUpMaterialTabs(temp);
    //      mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
    //
    //         @Override
    //         public void onPageSelected(int position) {
    //            // on changing the page
    //            // make respected tab selected
    //            actionBar.setSelectedNavigationItem(position);
    //         }
    //
    //         @Override
    //         public void onPageScrolled(int arg0, float arg1, int arg2) {
    //         }
    //
    //         @Override
    //         public void onPageScrollStateChanged(int arg0) {
    //         }
    //      });
    //
    System.out.println("received class index = " + receivedClassIndex);
    if (receivedClassIndex > 0 && receivedClassIndex < classesForTerm.size())
        mViewPager.setCurrentItem(receivedClassIndex);
    // otherwise, current item is defaulted to 0

    //      mViewPager.setOffscreenPageLimit(5);

}

From source file:com.owncloud.android.ui.activity.Uploader.java

@Override
protected Dialog onCreateDialog(final int id) {
    final AlertDialog.Builder builder = new Builder(this);
    switch (id) {
    case DIALOG_WAITING:
        final ProgressDialog pDialog = new ProgressDialog(this, R.style.ProgressDialogTheme);
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(false);/*w  w  w .  j  av  a 2  s.  c  o  m*/
        pDialog.setMessage(getResources().getString(R.string.uploader_info_uploading));
        pDialog.setOnShowListener(new DialogInterface.OnShowListener() {
            @Override
            public void onShow(DialogInterface dialog) {
                ProgressBar v = (ProgressBar) pDialog.findViewById(android.R.id.progress);
                v.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.color_accent),
                        android.graphics.PorterDuff.Mode.MULTIPLY);

            }
        });
        return pDialog;
    case DIALOG_NO_ACCOUNT:
        builder.setIcon(android.R.drawable.ic_dialog_alert);
        builder.setTitle(R.string.uploader_wrn_no_account_title);
        builder.setMessage(
                String.format(getString(R.string.uploader_wrn_no_account_text), getString(R.string.app_name)));
        builder.setCancelable(false);
        builder.setPositiveButton(R.string.uploader_wrn_no_account_setup_btn_text, new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.ECLAIR_MR1) {
                    // using string value since in API7 this
                    // constatn is not defined
                    // in API7 < this constatant is defined in
                    // Settings.ADD_ACCOUNT_SETTINGS
                    // and Settings.EXTRA_AUTHORITIES
                    Intent intent = new Intent(android.provider.Settings.ACTION_ADD_ACCOUNT);
                    intent.putExtra("authorities", new String[] { MainApp.getAuthTokenType() });
                    startActivityForResult(intent, REQUEST_CODE_SETUP_ACCOUNT);
                } else {
                    // since in API7 there is no direct call for
                    // account setup, so we need to
                    // show our own AccountSetupAcricity, get
                    // desired results and setup
                    // everything for ourself
                    Intent intent = new Intent(getBaseContext(), AccountAuthenticator.class);
                    startActivityForResult(intent, REQUEST_CODE_SETUP_ACCOUNT);
                }
            }
        });
        builder.setNegativeButton(R.string.uploader_wrn_no_account_quit_btn_text, new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        return builder.create();
    case DIALOG_MULTIPLE_ACCOUNT:
        CharSequence ac[] = new CharSequence[mAccountManager
                .getAccountsByType(MainApp.getAccountType()).length];
        for (int i = 0; i < ac.length; ++i) {
            ac[i] = DisplayUtils.convertIdn(mAccountManager.getAccountsByType(MainApp.getAccountType())[i].name,
                    false);
        }
        builder.setTitle(R.string.common_choose_account);
        builder.setItems(ac, new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                setAccount(mAccountManager.getAccountsByType(MainApp.getAccountType())[which]);
                onAccountSet(mAccountWasRestored);
                dialog.dismiss();
                mAccountSelected = true;
                mAccountSelectionShowing = false;
            }
        });
        builder.setCancelable(true);
        builder.setOnCancelListener(new OnCancelListener() {
            @Override
            public void onCancel(DialogInterface dialog) {
                mAccountSelectionShowing = false;
                dialog.cancel();
                finish();
            }
        });
        return builder.create();
    case DIALOG_NO_STREAM:
        builder.setIcon(android.R.drawable.ic_dialog_alert);
        builder.setTitle(R.string.uploader_wrn_no_content_title);
        builder.setMessage(R.string.uploader_wrn_no_content_text);
        builder.setCancelable(false);
        builder.setNegativeButton(R.string.common_cancel, new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        return builder.create();
    default:
        throw new IllegalArgumentException("Unknown dialog id: " + id);
    }
}

From source file:com.aero2.android.DefaultActivities.SmogMapActivity.java

public void showMapHideLoadingScreen() {
    ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
    View loadingTV = (View) findViewById(R.id.loading_tv);
    progressBar.getIndeterminateDrawable().setColorFilter(Color.parseColor("#FF00BEED"),
            PorterDuff.Mode.MULTIPLY);//  w  w  w  . j a v  a2  s  .co m
    progressBar.setVisibility(View.GONE);
    loadingTV.setVisibility(View.GONE);
}

From source file:jahirfiquitiva.iconshowcase.activities.ViewerActivity.java

@SuppressWarnings("ResourceAsColor")
@Override//from   ww w.  j a v a2  s  . c om
protected void onCreate(Bundle savedInstanceState) {

    ThemeUtils.onActivityCreateSetTheme(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ThemeUtils.onActivityCreateSetNavBar(this);
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    super.onCreate(savedInstanceState);

    context = this;

    usePalette = getResources().getBoolean(R.bool.use_palette_api_in_viewer);

    mPrefs = new Preferences(context);

    mPrefs.setActivityVisible(true);

    Intent intent = getIntent();
    String transitionName = intent.getStringExtra("transitionName");

    item = intent.getParcelableExtra("item");

    setContentView(R.layout.wall_viewer_activity);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setTitle("");
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back);
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);
    }

    final int iconsColor = ThemeUtils.darkTheme ? ContextCompat.getColor(context, R.color.toolbar_text_dark)
            : ContextCompat.getColor(context, R.color.toolbar_text_light);

    ToolbarColorizer.colorizeToolbar(toolbar, iconsColor);

    toHide1 = (LinearLayout) findViewById(R.id.iconsA);
    toHide2 = (LinearLayout) findViewById(R.id.iconsB);

    int tintLightLighter = ContextCompat.getColor(context, R.color.drawable_base_tint);
    int tintDark = ContextCompat.getColor(context, R.color.drawable_tint_dark);

    Drawable save = ColorUtils.getTintedIcon(context, R.drawable.ic_save,
            ThemeUtils.darkTheme ? tintDark : tintLightLighter);

    Drawable apply = ColorUtils.getTintedIcon(context, R.drawable.ic_apply_wallpaper,
            ThemeUtils.darkTheme ? tintDark : tintLightLighter);

    Drawable info = ColorUtils.getTintedIcon(context, R.drawable.ic_info,
            ThemeUtils.darkTheme ? tintDark : tintLightLighter);

    ImageView saveIV = (ImageView) findViewById(R.id.download);
    if (item.isDownloadable()) {
        saveIV.setImageDrawable(save);
        saveIV.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!PermissionUtils.canAccessStorage(context)) {
                    PermissionUtils.setViewerActivityAction("save");
                    PermissionUtils.requestStoragePermission(context);
                } else {
                    showDialogs("save");
                }
            }
        });
    } else {
        saveIV.setVisibility(View.GONE);
    }

    ImageView applyIV = (ImageView) findViewById(R.id.apply);
    applyIV.setImageDrawable(apply);
    applyIV.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            showApplyWallpaperDialog(context, item.getWallURL());
        }
    });

    ImageView infoIV = (ImageView) findViewById(R.id.info);
    infoIV.setImageDrawable(info);
    infoIV.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ISDialogs.showWallpaperDetailsDialog(context, item.getWallName(), item.getWallAuthor(),
                    item.getWallDimensions(), item.getWallCopyright());
        }
    });

    TouchImageView mPhoto = (TouchImageView) findViewById(R.id.big_wallpaper);
    ViewCompat.setTransitionName(mPhoto, transitionName);

    layout = (RelativeLayout) findViewById(R.id.viewerLayout);

    TextView wallNameText = (TextView) findViewById(R.id.wallName);
    wallNameText.setText(item.getWallName());

    Bitmap bmp = null;
    String filename = getIntent().getStringExtra("image");
    try {
        if (filename != null) {
            FileInputStream is = context.openFileInput(filename);
            bmp = BitmapFactory.decodeStream(is);
            is.close();
        } else {
            bmp = null;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    int colorFromCachedPic = 0;

    if (bmp != null) {
        colorFromCachedPic = ColorExtractor.getFinalGeneratedIconsColorFromPalette(bmp, usePalette);
    } else {
        colorFromCachedPic = ThemeUtils.darkTheme ? tintDark : tintLightLighter;
    }

    final ProgressBar spinner = (ProgressBar) findViewById(R.id.progress);
    spinner.getIndeterminateDrawable().setColorFilter(colorFromCachedPic, PorterDuff.Mode.SRC_IN);

    ToolbarColorizer.colorizeToolbar(toolbar, colorFromCachedPic);

    Drawable d;
    if (bmp != null) {
        d = new GlideBitmapDrawable(getResources(), bmp);
    } else {
        d = new ColorDrawable(ContextCompat.getColor(context, android.R.color.transparent));
    }

    if (mPrefs.getAnimationsEnabled()) {
        Glide.with(context).load(item.getWallURL()).placeholder(d).diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .fitCenter().listener(new RequestListener<String, GlideDrawable>() {
                    @Override
                    public boolean onException(Exception e, String model, Target<GlideDrawable> target,
                            boolean isFirstResource) {
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(GlideDrawable resource, String model,
                            Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                        Bitmap picture = ((GlideBitmapDrawable) resource).getBitmap();
                        ToolbarColorizer.colorizeToolbar(toolbar,
                                ColorExtractor.getFinalGeneratedIconsColorFromPalette(picture, usePalette));
                        spinner.setVisibility(View.GONE);
                        return false;
                    }
                }).into(mPhoto);
    } else {
        Glide.with(context).load(item.getWallURL()).placeholder(d).dontAnimate()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE).fitCenter()
                .listener(new RequestListener<String, GlideDrawable>() {
                    @Override
                    public boolean onException(Exception e, String model, Target<GlideDrawable> target,
                            boolean isFirstResource) {
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(GlideDrawable resource, String model,
                            Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                        Bitmap picture = ((GlideBitmapDrawable) resource).getBitmap();
                        ToolbarColorizer.colorizeToolbar(toolbar,
                                ColorExtractor.getFinalGeneratedIconsColorFromPalette(picture, usePalette));
                        spinner.setVisibility(View.GONE);
                        return false;
                    }
                }).into(mPhoto);
    }
}

From source file:com.gigigo.vuforia.core.sdkimagerecognition.cloudrecognition.CloudRecognition.java

public void startLoadingAnimation() {
    // Inflates the Overlay Layout to be displayed above the Camera View
    LayoutInflater inflater = LayoutInflater.from(this.mActivity);
    mUILayout = (RelativeLayout) inflater.inflate(R.layout.camera_overlay_vuforia, null, false);
    mUILayout.setVisibility(View.VISIBLE);

    ProgressBar loadingProgressBar = (ProgressBar) mUILayout.findViewById(R.id.loading_indicator);

    // By default
    loadingDialogHandler.mLoadingDialogContainer = mUILayout.findViewById(R.id.loading_container);

    if (Build.VERSION.SDK_INT < 21) {
        if (loadingProgressBar.getIndeterminateDrawable() != null) {
            loadingProgressBar.getIndeterminateDrawable().setColorFilter(
                    ContextCompat.getColor(mActivity, R.color.vuforia_loading_indicator_color),
                    PorterDuff.Mode.SRC_IN);
        }/*w  w w.  j  a  va 2s.c o  m*/
    }

    loadingDialogHandler.mLoadingDialogContainer.setVisibility(View.VISIBLE);

    this.mActivity.addContentView(mUILayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
}

From source file:jahirfiquitiva.iconshowcase.activities.WallpaperViewerActivity.java

@SuppressWarnings("ResourceAsColor")
@Override/*from   w w  w. ja  va2 s .  c  om*/
protected void onCreate(Bundle savedInstanceState) {

    ThemeUtils.onActivityCreateSetTheme(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ThemeUtils.onActivityCreateSetNavBar(this);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }

    super.onCreate(savedInstanceState);

    makeStatusBarIconsWhite();

    context = this;

    mPrefs = new Preferences(context);

    Intent intent = getIntent();
    String transitionName = intent.getStringExtra("transitionName");

    item = intent.getParcelableExtra("item");

    setContentView(R.layout.wallpaper_viewer_activity);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setTitle("");
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back_with_shadow);
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);
    }

    ToolbarColorizer.colorizeToolbar(toolbar, ContextCompat.getColor(context, android.R.color.white));

    toHide1 = (LinearLayout) findViewById(R.id.iconsA);
    toHide2 = (LinearLayout) findViewById(R.id.iconsB);

    int tintColor = ThemeUtils.darkOrLight(context, R.color.drawable_tint_dark, R.color.drawable_base_tint);

    Drawable save = IconUtils.getTintedIcon(context, R.drawable.ic_save, tintColor);

    Drawable apply = IconUtils.getTintedIcon(context, R.drawable.ic_apply_wallpaper, tintColor);

    Drawable info = IconUtils.getTintedIcon(context, R.drawable.ic_info, tintColor);

    ImageView saveIV = (ImageView) findViewById(R.id.download);
    if (item.isDownloadable()) {
        saveIV.setImageDrawable(save);
        saveIV.setOnClickListener(new DebouncedClickListener() {
            @Override
            public void onDebouncedClick(View v) {
                if (!PermissionUtils.canAccessStorage(context)) {
                    PermissionUtils.setViewerActivityAction("save");
                    PermissionUtils.requestStoragePermission(context);
                } else {
                    showDialogs("save");
                }
            }
        });
    } else {
        saveIV.setVisibility(View.GONE);
    }

    ImageView applyIV = (ImageView) findViewById(R.id.apply);
    applyIV.setImageDrawable(apply);
    applyIV.setOnClickListener(new DebouncedClickListener() {
        @Override
        public void onDebouncedClick(View v) {
            showApplyWallpaperDialog(item.getWallURL());
        }
    });

    ImageView infoIV = (ImageView) findViewById(R.id.info);
    infoIV.setImageDrawable(info);
    infoIV.setOnClickListener(new DebouncedClickListener() {
        @Override
        public void onDebouncedClick(View v) {
            ISDialogs.showWallpaperDetailsDialog(context, item.getWallName(), item.getWallAuthor(),
                    item.getWallDimensions(), item.getWallCopyright(), new DialogInterface.OnDismissListener() {
                        @Override
                        public void onDismiss(DialogInterface dialogInterface) {
                            //Do nothing
                        }
                    });
        }
    });

    TouchImageView mPhoto = (TouchImageView) findViewById(R.id.big_wallpaper);
    ViewCompat.setTransitionName(mPhoto, transitionName);

    layout = (RelativeLayout) findViewById(R.id.viewerLayout);

    TextView wallNameText = (TextView) findViewById(R.id.wallName);
    wallNameText.setText(item.getWallName());

    Bitmap bmp = null;
    String filename = getIntent().getStringExtra("image");
    try {
        if (filename != null) {
            FileInputStream is = context.openFileInput(filename);
            bmp = BitmapFactory.decodeStream(is);
            is.close();
        } else {
            bmp = null;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    int colorFromCachedPic;

    if (bmp != null) {
        colorFromCachedPic = ColorUtils.getPaletteSwatch(bmp).getTitleTextColor();
    } else {
        colorFromCachedPic = tintColor;
    }

    final ProgressBar spinner = (ProgressBar) findViewById(R.id.progress);
    spinner.getIndeterminateDrawable().setColorFilter(colorFromCachedPic, PorterDuff.Mode.SRC_IN);

    Drawable d;
    if (bmp != null) {
        d = new GlideBitmapDrawable(getResources(), bmp);
    } else {
        d = new ColorDrawable(ContextCompat.getColor(context, android.R.color.transparent));
    }

    if (mPrefs.getAnimationsEnabled()) {
        Glide.with(context).load(item.getWallURL()).placeholder(d).diskCacheStrategy(DiskCacheStrategy.SOURCE)
                .fitCenter().listener(new RequestListener<String, GlideDrawable>() {
                    @Override
                    public boolean onException(Exception e, String model, Target<GlideDrawable> target,
                            boolean isFirstResource) {
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(GlideDrawable resource, String model,
                            Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                        spinner.setVisibility(View.GONE);
                        return false;
                    }
                }).into(mPhoto);
    } else {
        Glide.with(context).load(item.getWallURL()).placeholder(d).dontAnimate()
                .diskCacheStrategy(DiskCacheStrategy.SOURCE).fitCenter()
                .listener(new RequestListener<String, GlideDrawable>() {
                    @Override
                    public boolean onException(Exception e, String model, Target<GlideDrawable> target,
                            boolean isFirstResource) {
                        return false;
                    }

                    @Override
                    public boolean onResourceReady(GlideDrawable resource, String model,
                            Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
                        spinner.setVisibility(View.GONE);
                        return false;
                    }
                }).into(mPhoto);
    }
}