Search in sources :

Example 16 with Toolbar

use of android.support.v7.widget.Toolbar in project PhotoPicker by donglua.

the class PhotoPickerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    boolean showCamera = getIntent().getBooleanExtra(EXTRA_SHOW_CAMERA, true);
    boolean showGif = getIntent().getBooleanExtra(EXTRA_SHOW_GIF, false);
    boolean previewEnabled = getIntent().getBooleanExtra(EXTRA_PREVIEW_ENABLED, true);
    setShowGif(showGif);
    setContentView(R.layout.__picker_activity_photo_picker);
    Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    setTitle(R.string.__picker_title);
    ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    actionBar.setDisplayHomeAsUpEnabled(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        actionBar.setElevation(25);
    }
    maxCount = getIntent().getIntExtra(EXTRA_MAX_COUNT, DEFAULT_MAX_COUNT);
    columnNumber = getIntent().getIntExtra(EXTRA_GRID_COLUMN, DEFAULT_COLUMN_NUMBER);
    originalPhotos = getIntent().getStringArrayListExtra(EXTRA_ORIGINAL_PHOTOS);
    pickerFragment = (PhotoPickerFragment) getSupportFragmentManager().findFragmentByTag("tag");
    if (pickerFragment == null) {
        pickerFragment = PhotoPickerFragment.newInstance(showCamera, showGif, previewEnabled, columnNumber, maxCount, originalPhotos);
        getSupportFragmentManager().beginTransaction().replace(R.id.container, pickerFragment, "tag").commit();
        getSupportFragmentManager().executePendingTransactions();
    }
    pickerFragment.getPhotoGridAdapter().setOnItemCheckListener(new OnItemCheckListener() {

        @Override
        public boolean onItemCheck(int position, Photo photo, final int selectedItemCount) {
            menuDoneItem.setEnabled(selectedItemCount > 0);
            if (maxCount <= 1) {
                List<String> photos = pickerFragment.getPhotoGridAdapter().getSelectedPhotos();
                if (!photos.contains(photo.getPath())) {
                    photos.clear();
                    pickerFragment.getPhotoGridAdapter().notifyDataSetChanged();
                }
                return true;
            }
            if (selectedItemCount > maxCount) {
                Toast.makeText(getActivity(), getString(R.string.__picker_over_max_count_tips, maxCount), LENGTH_LONG).show();
                return false;
            }
            menuDoneItem.setTitle(getString(R.string.__picker_done_with_count, selectedItemCount, maxCount));
            return true;
        }
    });
}
Also used : Photo(me.iwf.photopicker.entity.Photo) ArrayList(java.util.ArrayList) List(java.util.List) ActionBar(android.support.v7.app.ActionBar) OnItemCheckListener(me.iwf.photopicker.event.OnItemCheckListener) Toolbar(android.support.v7.widget.Toolbar)

Example 17 with Toolbar

use of android.support.v7.widget.Toolbar in project barcodescanner by dm77.

the class MainActivity method setupToolbar.

public void setupToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
}
Also used : Toolbar(android.support.v7.widget.Toolbar)

Example 18 with Toolbar

use of android.support.v7.widget.Toolbar in project barcodescanner by dm77.

the class BaseScannerActivity method setupToolbar.

public void setupToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setDisplayHomeAsUpEnabled(true);
    }
}
Also used : ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 19 with Toolbar

use of android.support.v7.widget.Toolbar in project barcodescanner by dm77.

the class MainActivity method setupToolbar.

public void setupToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
}
Also used : Toolbar(android.support.v7.widget.Toolbar)

Example 20 with Toolbar

use of android.support.v7.widget.Toolbar in project UltimateRecyclerView by cymcsg.

the class GridLayoutRVTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(getMainLayout());
    mToolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    listuv = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
    mGridAdapter = new GridJRAdapter(getJRList());
    mGridAdapter.setSpanColumns(columns);
    mGridLayoutManager = new BasicGridLayoutManager(this, columns, mGridAdapter);
    listuv.setLayoutManager(mGridLayoutManager);
    listuv.setHasFixedSize(true);
    listuv.setSaveEnabled(true);
    listuv.setClipToPadding(false);
    // mGridAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));
    listuv.setNormalHeader(setupHeaderView());
    final Handler f = new Handler();
    listuv.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() {

        @Override
        public void loadMore(int itemsCount, int maxLastVisiblePosition) {
            //   Log.d(TAG, itemsCount + " :: " + itemsCount);
            f.postDelayed(new Runnable() {

                @Override
                public void run() {
                    mGridAdapter.insert(SampleDataboxset.genJRList(5));
                    afterAdd();
                }
            }, 2000);
        }
    });
    // listuv.enableLoadmore();
    //    listuv.disableLoadmore();
    listuv.setLoadMoreView(R.layout.custom_bottom_progressbar);
    listuv.setAdapter(mGridAdapter);
    listuv.setItemAnimator(new DefaultItemAnimator());
    harness_control();
}
Also used : BasicGridLayoutManager(com.marshalchen.ultimaterecyclerview.grid.BasicGridLayoutManager) UltimateRecyclerView(com.marshalchen.ultimaterecyclerview.UltimateRecyclerView) Handler(android.os.Handler) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

Toolbar (android.support.v7.widget.Toolbar)442 View (android.view.View)316 ActionBar (android.support.v7.app.ActionBar)155 TextView (android.widget.TextView)149 RecyclerView (android.support.v7.widget.RecyclerView)120 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)112 ImageView (android.widget.ImageView)77 Intent (android.content.Intent)65 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)49 ArrayList (java.util.ArrayList)46 AdapterView (android.widget.AdapterView)38 AppCompatActivity (android.support.v7.app.AppCompatActivity)35 NavigationView (android.support.design.widget.NavigationView)34 FloatingActionButton (android.support.design.widget.FloatingActionButton)29 ViewPager (android.support.v4.view.ViewPager)29 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)28 BindView (butterknife.BindView)28 MenuItem (android.view.MenuItem)24 ViewGroup (android.view.ViewGroup)24 Handler (android.os.Handler)23