Search in sources :

Example 1 with CheckableGalleryLayout

use of com.abewy.android.apps.klyph.widget.CheckableGalleryLayout in project Klyph by jonathangerbaud.

the class GalleryFragment method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    loadingView = (ProgressBar) view.findViewById(android.R.id.progress);
    setListVisible(false);
    super.onViewCreated(view, savedInstanceState);
    imageUris = new ArrayList<String>();
    getGridView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    getGridView().setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> gridView, View view, int position, long id) {
            GraphObject o = getAdapter().getItem(position);
            if (o instanceof CameraObject) {
                Intent intent = new Intent(getActivity(), GalleryActivity.class);
                intent.putExtra(KlyphBundleExtras.CAMERA_PICTURES, true);
                intent.putStringArrayListExtra(KlyphBundleExtras.PHOTO_LIST_URI, (ArrayList<String>) initUris);
                startActivityForResult(intent, CAMERA_GALLERY_CODE);
            } else {
                if (!Android.isMinAPI(11)) {
                    CheckableGalleryLayout cgl = (CheckableGalleryLayout) view;
                    cgl.toggle();
                    Picture image = (Picture) o;
                    image.setSelected(cgl.isChecked());
                }
                if (actionMode == null)
                    actionMode = getActivity().startActionMode(mActionModeCallback);
                refreshActionModeTitle();
            }
        }
    });
    showCamera = !getActivity().getIntent().getBooleanExtra(KlyphBundleExtras.CAMERA_PICTURES, false);
    hasCamera = getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA) || getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);
    defineEmptyText(R.string.empty_list_no_photo);
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ArrayList(java.util.ArrayList) Intent(android.content.Intent) GalleryActivity(com.abewy.android.apps.klyph.app.GalleryActivity) GraphObject(com.abewy.android.apps.klyph.core.graph.GraphObject) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) CheckableGalleryLayout(com.abewy.android.apps.klyph.widget.CheckableGalleryLayout)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1 GalleryActivity (com.abewy.android.apps.klyph.app.GalleryActivity)1 GraphObject (com.abewy.android.apps.klyph.core.graph.GraphObject)1 CheckableGalleryLayout (com.abewy.android.apps.klyph.widget.CheckableGalleryLayout)1 ArrayList (java.util.ArrayList)1