Android Open Source - photo-share-android Upload Page Fragment






From Project

Back to project page photo-share-android.

License

The source code is released under:

Apache License

If you think the Android project photo-share-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.project.photoshare;
// w  w w. java  2s .  c o  m
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.laevatein.Laevatein;
import com.laevatein.MimeType;

import java.util.List;

/**
 * Tab Fragment for uploading images screen.
 *
 * @author <a href="mailto:t.kodama61@gmail.com">TakuyaKodama</a> (kodama-t)
 * @version 1.00 14/04/06 kodama-t
 */
public class UploadPageFragment extends Fragment {

    private static final String TAG = UploadPageFragment.class.getSimpleName();
    public static final String EXTRA_SIZE_LIMIT = "android.intent.extra.sizeLimit";

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.upload_fragment, container, false);

        view.findViewById(R.id.button_select_image).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Laevatein.from(getActivity())
                        .choose(MimeType.of(MimeType.JPEG))
                        .count(0, 10)
                        .capture(true)
                        .forResult(MainActivity.REQUEST_IMAGE_SELECTOR);
            }
        });

        return view;
    }

    public UploadPageFragment() {
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(resultCode != getActivity().RESULT_OK) {
            return;
        }

        if(requestCode == MainActivity.REQUEST_IMAGE_SELECTOR) {
            List<Uri> selected = Laevatein.obtainResult(data);
            for(int i = 0; i < selected.size(); i++) {
                Log.i(TAG, i + ": " + selected.get(i));
            }
        }
    }
}




Java Source Code List

com.project.photoshare.DefaultActivity.java
com.project.photoshare.DownloadPageFragment.java
com.project.photoshare.HistoryPageFragment.java
com.project.photoshare.InputPassword.java
com.project.photoshare.MainActivity.java
com.project.photoshare.MyPageFragment.java
com.project.photoshare.PasswordConfirmation.java
com.project.photoshare.SelectIsAddLater.java
com.project.photoshare.SplashActivity.java
com.project.photoshare.UploadCompleted.java
com.project.photoshare.UploadPageFragment.java
com.project.photoshare.api.ApiRequestService.java
com.project.photoshare.api.InputStreamRequest.java
com.project.photoshare.api.MultipartHurlStack.java
com.project.photoshare.api.MultipartJsonRequest.java
com.project.photoshare.listener.PostImageErrorListener.java
com.project.photoshare.listener.PostImageSuccessListener.java
com.project.photoshare.utils.BitmapDecodeLoader.java
com.project.photoshare.utils.ImageUtils.java
com.project.photoshare.utils.LogHelper.java
com.project.photoshare.utils.Utils.java
com.project.photoshare.utils.volley.LruImageCache.java
com.project.photoshare.utils.volley.VolleyHelper.java
com.project.photoshare.widget.CustomEditText.java