Search in sources :

Example 1 with DetailFragment

use of com.marshalchen.common.demoofui.driveimageview.fragments.DetailFragment in project UltimateAndroid by cymcsg.

the class DisplayItemAdapter method getView.

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    String desc = getItem(position);
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.drive_image_view_item, parent, false);
    }
    String ftext = "photo number " + (position + 1) + " of " + MainFragment.samplePictures.length;
    DriveImageModel m = new DriveImageModel(desc, ftext, MainFragment.samplePictures[position]);
    DriveImageView view = (DriveImageView) convertView.findViewById(R.id.driveImageView);
    view.setDriveImageModel(m);
    view.setBackgroundColor(MainFragment.sampleColours[position]);
    view.setCustomFolderSpacing(100f);
    view.setAlphaValue(0.7f);
    view.setCustomHeight(MainFragment.sampleHeights[position]);
    view.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
            DetailFragment detailFragment = DetailFragment.newInstance(position);
            fragmentTransaction.replace(R.id.fragment_container, detailFragment);
            fragmentTransaction.addToBackStack("detail");
            fragmentTransaction.commit();
        }
    });
    return convertView;
}
Also used : DriveImageModel(ch.haclyon.driveimageview.DriveImageModel) FragmentTransaction(android.app.FragmentTransaction) DriveImageView(ch.haclyon.driveimageview.DriveImageView) DetailFragment(com.marshalchen.common.demoofui.driveimageview.fragments.DetailFragment) View(android.view.View) DriveImageView(ch.haclyon.driveimageview.DriveImageView)

Aggregations

FragmentTransaction (android.app.FragmentTransaction)1 View (android.view.View)1 DriveImageModel (ch.haclyon.driveimageview.DriveImageModel)1 DriveImageView (ch.haclyon.driveimageview.DriveImageView)1 DetailFragment (com.marshalchen.common.demoofui.driveimageview.fragments.DetailFragment)1