Example usage for android.widget ProgressBar ProgressBar

List of usage examples for android.widget ProgressBar ProgressBar

Introduction

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

Prototype

public ProgressBar(Context context) 

Source Link

Document

Create a new progress bar with range 0...100 and initial progress of 0.

Usage

From source file:nkfust.selab.android.explorer.layout.view.PhotoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    FrameLayout fl = new FrameLayout(getActivity());
    ProgressBar pb = new ProgressBar(getActivity());
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
            FrameLayout.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;//from w ww . j  ava  2  s. co m
    pb.setLayoutParams(params);
    image = new CoustomizedImageView(getActivity());
    image.setMaxZoom(2f);
    image.setDrawingCacheEnabled(false);
    aFetcher.loadImage(path, image);

    fl.addView(pb);
    fl.addView(image);
    return fl;
}

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;//from  w  w  w  . j  a  v  a  2 s  .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:com.grarak.rom.switcher.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/*from   w  w  w  . ja v a 2  s  .  c  o m*/

    progressBar = new ProgressBar(this);
    progressBar.getIndeterminateDrawable().setColorFilter(
            new LightingColorFilter(0xFF000000, getResources().getColor(android.R.color.white)));
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM);
    actionBar.setCustomView(progressBar, new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT,
            ActionBar.LayoutParams.WRAP_CONTENT, Gravity.CENTER_VERTICAL | Gravity.END));

    new Task().execute();
}

From source file:org.projectbuendia.client.ui.ProgressFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    mFrame = new RelativeLayout(getActivity());
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
    mFrame.setLayoutParams(layoutParams);

    RelativeLayout.LayoutParams relativeLayout = new RelativeLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    relativeLayout.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mIndeterminateProgressBar = new ProgressBar(getActivity());
    mIndeterminateProgressBar.setLayoutParams(relativeLayout);

    mProgressBarLayout = inflater.inflate(R.layout.progress_fragment_measured_progress_view, null);
    mProgressBarLayout.setLayoutParams(relativeLayout);
    mProgressBar = (ProgressBar) mProgressBarLayout.findViewById(R.id.progress_fragment_progress_bar);
    mProgressBarLabel = (TextView) mProgressBarLayout.findViewById(R.id.progress_fragment_label);

    RelativeLayout.LayoutParams fullLayout = new RelativeLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    fullLayout.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
    mErrorTextView = new TextView(getActivity());
    mErrorTextView.setLayoutParams(fullLayout);
    mErrorTextView.setGravity(Gravity.CENTER);

    mContent.setVisibility(View.GONE);
    mProgressBarLayout.setVisibility(View.GONE);
    mFrame.addView(mIndeterminateProgressBar);
    mFrame.addView(mProgressBarLayout);//  w  w w.j a  va  2 s  .co m
    mFrame.addView(mContent);
    mFrame.addView(mErrorTextView);
    return mFrame;
}

From source file:de.gebatzens.ggvertretungsplan.fragment.RemoteDataFragment.java

public View createLoadingView() {
    LinearLayout l = new LinearLayout(getActivity());
    l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    l.setGravity(Gravity.CENTER);//from ww  w .  j a va  2s.  c o  m

    ProgressBar pb = new ProgressBar(getActivity());
    pb.getIndeterminateDrawable().setColorFilter(GGApp.GG_APP.provider.getColor(), PorterDuff.Mode.SRC_IN);
    pb.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    pb.setVisibility(ProgressBar.VISIBLE);

    l.addView(pb);
    return l;
}

From source file:com.ymt.demo1.plates.news.FileNoticeFragment.java

protected void initView(View view) {

    /*/*from ww w  . ja  v  a2s .c  om*/
     *listView 
     */
    listView = (PullToRefreshListView) view.findViewById(R.id.pull_to_refresh_list_view);
    ListView theListView = listView.getRefreshableView();
    testArray = new ArrayList<>();
    ProgressBar progressBar = new ProgressBar(getActivity());
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    progressBar.setLayoutParams(params);
    listView.setEmptyView(progressBar);

    /*
    ??
     */
    summaryAdapter = new NewsSummaryAdapter(getActivity());
    listView.setAdapter(summaryAdapter);
    summaryAdapter.setList(testArray);
    scrollView.setListView(listView); //???listView?

    /*
     *??
     */
    theListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, final View view, final int position, long id) {

            /*
            *???
            */
            String[] actionList = new String[] { "", "?" };
            PopActionUtil popActionUtil = PopActionUtil.getInstance(getActivity());
            actionListener = new PopActionListener() {
                @Override
                public void onAction(String action) {
                    switch (action) {
                    case "":
                        Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT).show();
                        break;
                    case "?":
                        Toast.makeText(getActivity(), "?", Toast.LENGTH_SHORT).show();
                        break;
                    default:
                        break;
                    }
                }

                @Override
                public void onDismiss() {

                }
            };

            popActionUtil.setActionListener(actionListener);
            popActionUtil.setActions(actionList);
            final PopupWindow itemPopMenu = popActionUtil.getSimpleTxtPopActionMenu();

            itemPopMenu.showAsDropDown(view, view.getWidth() - 20, -view.getHeight());
            itemPopMenu.update();

            return true;
        }
    });

    /*
    listView   ?
     */
    theListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            //
            //todo bug
            Intent intent = new Intent(getActivity(), NewsDetailActivity.class);
            NewsSummary summary = (NewsSummary) (parent.getAdapter()).getItem(position);
            intent.putExtra("summary", summary);
            intent.putExtra("type", "notice");
            startActivity(intent);
        }
    });

    /*
     * 
     */
    listView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() {
        @Override
        public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {
            mNews.clear();
            startPosition = 1;
            mQueue.add(summaryRequest(state, start, pagesize));
        }

        @Override
        public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {
            startPosition++;
            mQueue.add(summaryRequest(state, start, pagesize));
        }
    });

}

From source file:com.QuarkLabs.BTCeClient.fragments.OrdersBookFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);/*www  .  ja  v a  2  s .  c  om*/
    @SuppressLint("InflateParams")
    View v = inflater.inflate(R.layout.fragment_ordersbook, container, false);
    mAsksList = (ListView) v.findViewById(R.id.asks);
    mBidsList = (ListView) v.findViewById(R.id.bids);
    mChartArea = (FrameLayout) v.findViewById(R.id.OrdersBookChart);
    mLoadingViewAsks = new ProgressBar(getActivity());
    mLoadingViewBids = new ProgressBar(getActivity());
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    lp.gravity = Gravity.CENTER;
    mLoadingViewAsks.setLayoutParams(lp);

    mLoadingViewBids.setLayoutParams(lp);
    ((LinearLayout) mAsksList.getParent()).addView(mLoadingViewAsks);
    mAsksList.setEmptyView(mLoadingViewAsks);
    ((LinearLayout) mBidsList.getParent()).addView(mLoadingViewBids);
    mBidsList.setEmptyView(mLoadingViewBids);

    ActionBarActivity hostActivity = (ActionBarActivity) getActivity();
    hostActivity.getSupportActionBar().setCustomView(mPairsSpinner, new ActionBar.LayoutParams(Gravity.END));
    hostActivity.getSupportActionBar().setDisplayShowCustomEnabled(true);
    return v;
}

From source file:de.gebatzens.sia.fragment.RemoteDataFragment.java

public View createLoadingView() {
    ScrollView sv = new ScrollView(getActivity());
    sv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    sv.setTag("gg_scroll");
    sv.setFillViewport(true);/* w w  w .  j a va  2  s.co m*/
    LinearLayout l = new LinearLayout(getActivity());
    l.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    l.setGravity(Gravity.CENTER);

    ProgressBar pb = new ProgressBar(getActivity());
    pb.getIndeterminateDrawable().setColorFilter(SIAApp.SIA_APP.school.getAccentColor(),
            PorterDuff.Mode.SRC_IN);
    pb.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    pb.setVisibility(ProgressBar.VISIBLE);

    l.addView(pb);
    sv.addView(l);
    return sv;
}

From source file:ua.naiksoftware.chars.Sender.java

@Override
protected void onPreExecute() {
    Log.d(tag, "onPreExecute begin");

    ProgressBar progressBar = new ProgressBar(EngineActivity.CONTEXT);
    progressBar.setIndeterminate(true);/*w  w  w  . j  av  a2  s.c  o m*/

    AlertDialog.Builder builder = new AlertDialog.Builder(EngineActivity.CONTEXT);
    builder.setCustomTitle(progressBar);
    builder.setIcon(android.R.drawable.ic_menu_upload);
    builder.setMessage(R.string.send_record);
    builder.setCancelable(false);
    dialog = builder.create();
    dialog.show();
    Log.d(tag, "onPreExecute end");
}

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);//from   ww  w .  j a  v  a  2  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);

}