Example usage for android.widget ProgressBar setVisibility

List of usage examples for android.widget ProgressBar setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:heartware.com.FB_picker.GraphObjectAdapter.java

private View getActivityCircleView(View convertView, ViewGroup parent) {
    View result = convertView;/*  w  w w .  j a va2 s  .c  o m*/

    if (result == null) {
        result = inflater.inflate(R.layout.fb_picker_activity_circle_row, null);
    }
    ProgressBar activityCircle = (ProgressBar) result
            .findViewById(R.id.com_facebook_picker_row_activity_circle);
    activityCircle.setVisibility(View.VISIBLE);

    return result;
}

From source file:com.wanikani.androidnotifier.DashboardFragment.java

/**
 * Show or hide the spinner./*from   www .ja v a2 s.c o m*/
 * @param enable true if should be shown
 */
public void spin(boolean enable) {
    ProgressBar pb;

    spinning = enable;
    if (parent != null) {
        pb = (ProgressBar) parent.findViewById(R.id.pb_status);
        pb.setVisibility(enable ? ProgressBar.VISIBLE : ProgressBar.GONE);
    }
}

From source file:com.parse.favourama.ACTLoginSelf.java

public void checkAvail(View view) {
    String uname = username.getText().toString().trim();
    if (uname.isEmpty())
        return;//from  ww w . j  a v a 2  s .c  om

    final Context c = this;
    final ImageView imgView = (ImageView) findViewById(R.id.ava_state_img);
    final TextView textView = (TextView) findViewById(R.id.ava_state_text);
    final ProgressBar progressBar = (ProgressBar) findViewById(R.id.ava_state_prog);

    /*final Handler mHandler = new Handler();
            
    new Thread(new Runnable() {
    public void run() {
        mHandler.post(new Runnable() {
            public void run() {
                progressBar.setProgress(100);
            }
        });
    }
    }).start();*/

    ParseQuery<ParseUser> userQuery = ParseUser.getQuery();
    userQuery.whereEqualTo("username", uname);

    progressBar.setVisibility(View.VISIBLE);
    userQuery.getFirstInBackground(new GetCallback<ParseUser>() {
        @Override
        public void done(ParseUser parseUser, ParseException e) {
            progressBar.setVisibility(View.GONE);
            if (e != null && e.getCode() != 101) {
                Toast.makeText(c, "An error has occured: " + e.getMessage() + " Sorry, please try again!",
                        Toast.LENGTH_SHORT).show();
                return;
            }
            if (parseUser == null) {
                /*The name is available*/
                imgView.setImageResource(R.drawable.ic_check_black_24dp);
                textView.setText("It's available!");
            } else {
                imgView.setImageResource(R.drawable.ic_close_black_24dp);
                textView.setText("Sorry, It's taken.");
            }
        }
    });
}

From source file:com.cloverstudio.spika.utils.BitmapManager.java

public void queueJob(final String url, final ImageView imageView, final ProgressBar pbLoading) {
    /* Create handler in UI thread. */
    final Handler handler = new Handler() {
        @Override//from  w  w w.  j  a  va2 s.  c o  m
        public void handleMessage(Message msg) {
            String tag = imageViews.get(imageView);
            if (tag != null && tag.equals(url)) {
                if (msg.obj != null) {
                    if (smallImg) {
                        imageView.setScaleType(ImageView.ScaleType.CENTER);
                    } else {
                        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
                    }
                    imageView.setImageBitmap((Bitmap) msg.obj);
                    if (pbLoading != null)
                        pbLoading.setVisibility(View.GONE);
                } else {
                    //                  imageView.setImageBitmap(placeholder);
                    imageView.setImageResource(R.drawable.image_stub);
                    if (pbLoading != null)
                        pbLoading.setVisibility(View.GONE);
                }
            }
        }
    };

    pool.submit(new Runnable() {
        @Override
        public void run() {
            final Bitmap bmp = downloadBitmap(url);
            Message message = Message.obtain();
            message.obj = bmp;

            handler.sendMessage(message);
        }
    });
}

From source file:com.example.javier.MaterialDesignApp.PlayerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    String data = prefs.getString("AFilmModel", null);
    Gson gson = new Gson();

    AFilmModel aFilm = gson.fromJson(data, AFilmModel.class);
    String link = "http://nhatphim.com/index/api-detail?id=" + aFilm.getId();
    getListVideo(link);/*from   www .jav a2s .  c  o m*/
    //  contentUri = Uri.parse("http://www.phim3s.net/phim-bo/thien-kim-tro-ve_8328/xem-phim/221808/video.mp4");
    /*   contentUri = Uri.parse("http://www.phim3s.net/phim-bo/thien-kim-tro-ve_8328/xem-phim/221808/video.mp4");*/
    contentType = 2;
    contentId = "dizzy";

    setContentView(R.layout.player_activity);
    root = findViewById(R.id.root);
    root.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
                toggleControlsVisibility();
            } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
                view.performClick();
            }
            return true;
        }
    });

    shutterView = findViewById(R.id.shutter);
    debugRootView = findViewById(R.id.controls_root);

    surfaceView = (VideoSurfaceView) findViewById(R.id.surface_view);
    surfaceView.getHolder().addCallback(this);
    debugTextView = (TextView) findViewById(R.id.debug_text_view);

    playerStateTextView = (TextView) findViewById(R.id.player_state_view);
    subtitleView = (SubtitleView) findViewById(R.id.subtitles);

    mediaController = new VideoControllerView(this);
    mediaController.setAnchorView((FrameLayout) root);
    mediaController.setPrevNextListeners(new OnClickListener() {
        @Override
        public void onClick(View v) {
            //next button clicked
            Toast t = Toast.makeText(PlayerActivity.this, "click", Toast.LENGTH_SHORT);
            t.show();
        }
    }, new OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast t = Toast.makeText(PlayerActivity.this, "pt bt", Toast.LENGTH_SHORT);
            t.show();
        }
    });
    retryButton = (Button) findViewById(R.id.retry_button);
    retryButton.setOnClickListener(this);
    videoButton = (Button) findViewById(R.id.video_controls);
    audioButton = (Button) findViewById(R.id.audio_controls);
    textButton = (Button) findViewById(R.id.text_controls);

    DemoUtil.setDefaultCookieManager();
    configureSubtitleView();
    delegate = new Listener() {
        @Override
        public void GetFinish() {
            //  adapter = new NavDrawerListAdapter(PlayerActivity.this,Film.getServer());
            //  lv.setAdapter(adapter);
            contentUri = Uri.parse(Film.getServer().get(0).getLink());
            if (player == null && contentUri != null) {

                preparePlayer();
                ProgressBar progressBar = (ProgressBar) root.findViewById(R.id.progressBar);
                progressBar.setVisibility(View.GONE);
                /////////////////////////////////////////////
                FragmentManager fragmentManager;
                FragmentTransaction fragmentTransaction;
                fragmentManager = getSupportFragmentManager();
                fragmentTransaction = fragmentManager.beginTransaction();
                VerticalGridFragment verticalFragment = new VerticalGridFragment(PlayerActivity.this,
                        Film.getServer());
                fragmentTransaction.replace(R.id.view_fm, verticalFragment);
                fragmentTransaction.commit();

            }
        }
    };
    recyclerViewDesign();

}

From source file:com.uzmap.pkg.uzmodules.photoBrowser.PhotoBrowser.java

public void jsmethod_setImage(UZModuleContext uzContext) {
    int index = uzContext.optInt("index");
    String imagePath = uzContext.optString("image");

    if (!imagePath.startsWith("http")) {
        imagePath = UZUtility.makeRealPath(imagePath, getWidgetInfo());
    }/*from w  w  w  .  ja  v  a2 s .  c  o m*/

    if (index >= 0 && index < mAdapter.getCount() && !TextUtils.isEmpty(imagePath)) {
        View view = getExistChild(index);
        if (view != null) {

            int photo_view_id = UZResourcesIDFinder.getResIdID("photoView");
            final PhotoView imageView = (PhotoView) view.findViewById(photo_view_id);

            int load_progress_id = UZResourcesIDFinder.getResIdID("loadProgress");
            final ProgressBar progress = (ProgressBar) view.findViewById(load_progress_id);

            mLoader.load(imageView, progress, imagePath);

            if (mUZContext == null) {
                return;
            }

            mLoader.setOnLoadCompleteListener(new OnLoadCompleteListener() {
                @Override
                public void onLoadComplete(ProgressBar bar) {
                    PhotoBrowser.callback(mUZContext, PhotoBrowser.EVENT_TYPE_LOADSUCCESSED,
                            (Integer) bar.getTag());
                }

                @Override
                public void onLoadFailed(final ProgressBar bar) {
                    PhotoBrowser.callback(mUZContext, PhotoBrowser.EVENT_TYPE_LOADFAILED,
                            (Integer) bar.getTag());
                    new Handler(Looper.getMainLooper()).post(new Runnable() {
                        @Override
                        public void run() {
                            bar.setVisibility(View.GONE);
                        }
                    });
                }
            });

        } else {
            mConfig.imagePaths.set(index, imagePath);
        }
    }
}

From source file:in.rab.bildkort.ImageFragment.java

@SuppressLint("SetJavaScriptEnabled")
@Override//from   w ww  .j av a 2  s  . co m
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mWebView = (WebView) getView().findViewById(R.id.webView);
    final ProgressBar progress = (ProgressBar) getView().findViewById(R.id.image_progress);
    mWebView.setWebChromeClient(new WebChromeClient());
    final WebSettings settings = mWebView.getSettings();

    settings.setBuiltInZoomControls(true);
    settings.setDisplayZoomControls(false);
    settings.setJavaScriptEnabled(true);

    // We replace the src urls in imagepicker.js::init(), so don't load
    // images twice.
    settings.setBlockNetworkImage(true);

    mWebView.setInitialScale(100);

    mWebView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageFinished(WebView view, String url) {
            if (Objects.equals(url, GSTATIC_SERVER)) {
                settings.setBlockNetworkImage(false);

                progress.setVisibility(View.GONE);
                mWebView.setVisibility(View.VISIBLE);
            } else {
                view.loadUrl("javascript:" + getImagePickerJs() + "getPickerHtml();");
            }
        }
    });

    mWebView.addJavascriptInterface(new WcmJsObject(), "wcm");
    mWebView.loadUrl("https://www.google.se/search?tbm=isch&q=" + getWord());
}

From source file:mp.paschalis.LoginFragment.java

/**
 * Enables Login/Register form//from  www . ja va 2 s  . c  om
 */
private void enableLoginForm() {
    textViewLibrary = (TextView) getSherlockActivity().findViewById(R.id.TextViewLoginLibraryName);
    textViewTitle = (TextView) getSherlockActivity().findViewById(R.id.TextViewLoginTitle);

    // textViewLibraryLocation = (TextView) getSherlockActivity().findViewById(
    // R.id.textViewLibraryLocation);

    buttonLogin = (Button) getSherlockActivity().findViewById(R.id.buttonLogin);

    editTextUsername = (EditText) getSherlockActivity().findViewById(R.id.editTextLoginUsername);

    editTextPassword = (EditText) getSherlockActivity().findViewById(R.id.editTextLoginPassword);

    textViewUsernameDirection = (TextView) getSherlockActivity()
            .findViewById(R.id.textViewDirectionLoginUsername);

    textViewPasswordDirection = (TextView) getSherlockActivity()
            .findViewById(R.id.textViewDirectionLoginPassword);

    final Button buttonLogin = (Button) getSherlockActivity().findViewById(R.id.buttonLogin);

    textViewLibrary.setEnabled(true);
    textViewTitle.setEnabled(true);
    textViewLibraryLocation.setEnabled(true);
    editTextUsername.setEnabled(true);
    textViewUsernameDirection.setEnabled(true);

    editTextUsername.setText("");
    editTextPassword.setText("");

    editTextUsername.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // Clear Login Staff
            clearLoginStaff();

        }

        @Override
        public void afterTextChanged(Editable s) {
            // Enable login button
            if (editTextUsername.getText().length() >= 4) {
                editTextPassword.setEnabled(true);
                textViewPasswordDirection.setEnabled(true);
            } else {
                editTextPassword.setEnabled(false);
                textViewPasswordDirection.setEnabled(false);
                editTextPassword.setText("");

            }
        }

    });

    editTextPassword.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // Clear Login Staff
            clearLoginStaff();
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (editTextPassword.getText().length() > 0) {
                buttonLogin.setEnabled(true);
            } else
                buttonLogin.setEnabled(false);
        }
    });

    // Login Button
    buttonLogin.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            // Create new User
            app.user = new User();

            app.user.username = editTextUsername.getText().toString();
            app.user.password = editTextPassword.getText().toString();

            // Hide Progress Bar, and reEnable button
            ProgressBar progressBarLoginButton = (ProgressBar) getSherlockActivity()
                    .findViewById(R.id.progressBarLoginButton);
            Button buttonLogin = (Button) getSherlockActivity().findViewById(R.id.buttonLogin);
            buttonLogin.setClickable(false);
            buttonLogin.setEnabled(false);
            progressBarLoginButton.setVisibility(View.VISIBLE);

            // Login User
            new LoginAsyncTask().execute(app.library);
        }
    });

    enableLoginFields();

}

From source file:cm.aptoide.ptdev.adapters.ViewPagerAdapterScreenshots.java

@Override
public Object instantiateItem(ViewGroup container, final int position) {

    final View v = LayoutInflater.from(context).inflate(R.layout.row_item_screenshots_big, null);
    final ProgressBar pb = (ProgressBar) v.findViewById(R.id.screenshots_loading_big);

    String icon;//w ww  .  j a va2 s.  c  om
    if (hd) {
        Log.d("Aptoide-Screenshots", "Icon is hd: " + url.get(position));

        if (url.get(position).contains("_screen")) {
            icon = url.get(position).split("\\|")[1];
            Log.d("Aptoide-Screenshots", "Icon is : " + icon);
        } else {
            icon = url.get(position);
        }

    } else {
        icon = screenshotToThumb(url.get(position));
    }

    imageLoader.displayImage(icon, (ImageView) v.findViewById(R.id.screenshot_image_big), options,
            new ImageLoadingListener() {

                @Override
                public void onLoadingStarted(String uri, View view) {
                    pb.setVisibility(View.VISIBLE);
                }

                @Override
                public void onLoadingFailed(String uri, View v, FailReason failReason) {
                    ((ImageView) v.findViewById(R.id.screenshot_image_big))
                            .setImageResource(android.R.drawable.ic_delete);
                    pb.setVisibility(View.GONE);
                }

                @Override
                public void onLoadingComplete(String uri, View v, Bitmap loadedImage) {
                    pb.setVisibility(View.GONE);
                }

                @Override
                public void onLoadingCancelled(String uri, View v) {
                }
            });
    container.addView(v);
    if (!hd) {
        v.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                Intent i = new Intent(context, ScreenshotsViewer.class);
                i.putStringArrayListExtra("url", url);
                i.putExtra("position", position);
                i.putExtra("hashCode", hashCode + ".hd");
                context.startActivity(i);
            }
        });
    }
    return v;

}

From source file:com.glanznig.beepme.view.ExportActivity.java

public void startExport(View v) {
    Button start = (Button) findViewById(R.id.export_start_button);
    ProgressBar progress = (ProgressBar) findViewById(R.id.export_progress_bar);
    TextView runningText = (TextView) findViewById(R.id.export_running_text);

    BeeperApp app = (BeeperApp) getApplication();

    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
        enableDisableView(findViewById(R.id.export_settings), false);

        start.setVisibility(View.GONE);
        progress.setVisibility(View.VISIBLE);
        runningText.setVisibility(View.VISIBLE);

        if (app.getPreferences().exportRunningSince() == 0L || (Calendar.getInstance().getTimeInMillis()
                - app.getPreferences().exportRunningSince()) >= 120000) { //2 min
            app.getPreferences().setExportRunningSince(Calendar.getInstance().getTimeInMillis());
            createExportRunningNotification();
            exportHandler = new ExportHandler(ExportActivity.this);

            Bundle opts = new Bundle();
            opts.putBoolean("photoExport", photoExport);
            opts.putBoolean("rawExport", rawExport);
            new Thread(new ExportRunnable(ExportActivity.this, opts)).start();
        }/*from  w  ww  .  j a  va  2  s.c om*/
    } else {
        Toast.makeText(ExportActivity.this, R.string.export_storage_error, Toast.LENGTH_SHORT).show();
    }
}