Search in sources :

Example 1 with DriveImageModel

use of ch.haclyon.driveimageview.DriveImageModel 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)

Example 2 with DriveImageModel

use of ch.haclyon.driveimageview.DriveImageModel in project UltimateAndroid by cymcsg.

the class DetailFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.drive_image_view_fragment_detail, container, false);
    final DriveImageView imageView = (DriveImageView) view.findViewById(R.id.detail_driveImageView);
    imageView.setDriveImageModel(new DriveImageModel(MainFragment.sampleTexts[arrayPosition], "test", MainFragment.samplePictures[arrayPosition]));
    imageView.setBackgroundColor(MainFragment.sampleColours[arrayPosition]);
    imageView.setCustomHeight(MainFragment.sampleHeights[arrayPosition]);
    imageView.setAlphaValue(OPACITY_SEEKBAR_PROGRESS / 100.0f);
    Button animateButton = (Button) view.findViewById(R.id.detail_animatebutton);
    animateButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            imageView.animateText();
        }
    });
    createOpacitySeekbar(view, imageView);
    createFolderEditText(view, imageView);
    createMainEditText(view, imageView);
    createHeightSeekBar(view, imageView);
    createWidthSeekBar(view, imageView);
    createFolderSeekBar(view, imageView);
    return view;
}
Also used : DriveImageModel(ch.haclyon.driveimageview.DriveImageModel) Button(android.widget.Button) DriveImageView(ch.haclyon.driveimageview.DriveImageView) View(android.view.View) DriveImageView(ch.haclyon.driveimageview.DriveImageView)

Example 3 with DriveImageModel

use of ch.haclyon.driveimageview.DriveImageModel in project UltimateAndroid by cymcsg.

the class DetailFragment method createFolderEditText.

private void createFolderEditText(View view, final DriveImageView imageView) {
    EditText folderEditText = (EditText) view.findViewById(R.id.detail_folder);
    folderEditText.setText(imageView.getDriveImageModel().getFolderTitle());
    folderEditText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            DriveImageModel model = imageView.getDriveImageModel();
            model.setFolderTitle(editable.toString());
            imageView.setDriveImageModel(model);
        }
    });
}
Also used : EditText(android.widget.EditText) DriveImageModel(ch.haclyon.driveimageview.DriveImageModel) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Example 4 with DriveImageModel

use of ch.haclyon.driveimageview.DriveImageModel in project UltimateAndroid by cymcsg.

the class DetailFragment method createMainEditText.

private void createMainEditText(View view, final DriveImageView imageView) {
    EditText mainEditText = (EditText) view.findViewById(R.id.detail_main);
    mainEditText.setText(imageView.getDriveImageModel().getMainTitle());
    mainEditText.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }

        @Override
        public void afterTextChanged(Editable editable) {
            DriveImageModel model = imageView.getDriveImageModel();
            model.setMainTitle(editable.toString());
            imageView.setDriveImageModel(model);
        }
    });
}
Also used : EditText(android.widget.EditText) DriveImageModel(ch.haclyon.driveimageview.DriveImageModel) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Aggregations

DriveImageModel (ch.haclyon.driveimageview.DriveImageModel)4 Editable (android.text.Editable)2 TextWatcher (android.text.TextWatcher)2 View (android.view.View)2 EditText (android.widget.EditText)2 DriveImageView (ch.haclyon.driveimageview.DriveImageView)2 FragmentTransaction (android.app.FragmentTransaction)1 Button (android.widget.Button)1 DetailFragment (com.marshalchen.common.demoofui.driveimageview.fragments.DetailFragment)1