Git Product home page Git Product logo

album's Introduction

Album

android album

Chinese : wiki

Screenshot

multiple, radio, preview, crop, sample ui,customize camera

sample

Manifests.xml

    <activity
        android:name="com.yalantis.ucrop.UCropActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
    <activity
        android:name="com.album.ui.activity.AlbumActivity"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
    <activity
        android:name="com.album.ui.activity.PreviewActivity"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar" />

gradle

 compile 'com.ydevelop:album:0.0.2'
 compile "com.android.support:recyclerview-v7:$supportLibraryVersion"
 compile "com.github.bumptech.glide:glide:$glideVersion"

If you use the built-in frame, please rely on glide

compile 'com.github.bumptech.glide:glide:3.7.0'

or

SimpleGlide4xAlbumImageLoader

sampleDemo

    Album
            .getInstance()
            .setAlbumModels(new ArrayList<AlbumModel>())
            .setOptions(new UCrop.Options())
            .setAlbumImageLoader(new SimpleAlbumImageLoader())
            .setConfig(new AlbumConfig())
            .setAlbumListener(new SimpleAlbumListener())
            .start(this);

customize camera

picture folder can not exist .nomedia, otherwise the picture is not scanned

CustomizeCamera

     Album
            .getInstance()
            .setAlbumCameraListener(new AlbumCameraListener() {
                  @Override
                  public void startCamera(@NonNull Fragment fragment) {
                  
                       FragmentActivity activity = fragment.getActivity();
                       Intent intent = new Intent(activity, SimpleCameraActivity.class);
                       // AlbumConstant.CUSTOMIZE_CAMERA_RESULT_CODE
                       fragment.startActivityForResult(intent, AlbumConstant.CUSTOMIZE_CAMERA_RESULT_CODE);
                  }
            })


FileUtils.finishCamera(SimpleCameraActivity.this, cameraFile.getPath());


public static void finishCamera(Activity activity, String path) {
    Bundle bundle = new Bundle();
    
    //AlbumConstant.CUSTOMIZE_CAMERA_RESULT_PATH_KEY, path
    bundle.putString(AlbumConstant.CUSTOMIZE_CAMERA_RESULT_PATH_KEY, path);
    Intent intent = new Intent();
    intent.putExtras(bundle);
    activity.setResult(RESULT_OK, intent);
    activity.finish();
}

ImageLoader

Fresco

Album
     .getInstance()
     .setConfig(new AlbumConfig().setFrescoImageLoader(true)  // notification Album is using Fresco
     .start(this);

SimpleFrescoAlbumImageLoader

SimpleGlide4xAlbumImageLoader

SimpleImageLoaderAlbumImageLoader

SimplePicassoAlbumImageLoader

public class SimpleImageLoader implements AlbumImageLoader {

    @Override
    public void displayAlbum(@NonNull ImageView view, int width, int height, @NonNull AlbumModel albumModel) {
        
    }

    @Override
    public void displayAlbumThumbnails(@NonNull ImageView view, @NonNull FinderModel finderModel) {

    }

    @Override
    public void displayPreview(@NonNull ImageView view, @NonNull AlbumModel albumModel) {

    }


    // fresco DraweeView
    // other  null
    @Nullable
    @Override
    public ImageView frescoView(@NonNull Context context, @FrescoType int type) {
        return null;
    }

}

UI

see: SimpleAlbumUI

Listener

see: SimpleAlbumListener

 public class AlbumListener implements AlbumListener {

        private Context context;
        private List<AlbumModel> list = null;

        void toast(String s) {
            Toast.makeText(context, s, Toast.LENGTH_SHORT).show();
        }

        MainAlbumListener(Context context, ArrayList<AlbumModel> list) {
            this.context = context.getApplicationContext();
            this.list = list;
        }

        @Override
        public void onAlbumActivityFinish() {
            toast("album activity finish");
        }

        @Override
        public void onAlbumPermissionsDenied(@PermissionsType int type) {
            toast("permissions error");
        }

        @Override
        public void onAlbumFragmentNull() {
            toast("album fragment null");
        }

        @Override
        public void onAlbumPreviewFileNull() {
            toast("preview image has been deleted");
        }

        @Override
        public void onAlbumFinderNull() {
            toast("folder directory is empty");
        }

        @Override
        public void onAlbumBottomPreviewNull() {
            toast("preview no image");
        }

        @Override
        public void onAlbumBottomSelectNull() {
            toast("select no image");
        }

        @Override
        public void onAlbumFragmentFileNull() {
            toast("album image has been deleted");
        }

        @Override
        public void onAlbumPreviewSelectNull() {
            toast("PreviewActivity,  preview no image");
        }

        @Override
        public void onAlbumCheckBoxFileNull() {
            toast("check box  image has been deleted");
        }

        @Override
        public void onAlbumFragmentCropCanceled() {
            toast("cancel crop");
        }

        @Override
        public void onAlbumFragmentCameraCanceled() {
            toast("cancel camera");
        }

        @Override
        public void onAlbumFragmentUCropError(@Nullable Throwable data) {
            toast("crop error:" + data.toString());
        }

        @Override
        public void onAlbumResources(@NonNull List<AlbumModel> list) {
            
        }

        @Override
        public void onAlbumUCropResources(@Nullable File scannerFile) {
            toast("crop file:" + scannerFile);
        }

        @Override
        public void onAlbumMaxCount() {
            toast("select max count");
        }

        @Override
        public void onAlbumActivityBackPressed() {
            toast("AlbumActivity Back");
        }

        @Override
        public void onAlbumOpenCameraError() {
            toast("camera error");
        }
        
        @Override
        public void onAlbumEmpty() {
             toast("no image");
        }
        
        @Override
        public void onAlbumNoMore() {
             toast("image no more");
        }
        
        @Override
        public void onAlbumResultCameraError() {
             toast("result camera error");
        }
    }

TestPhone

  • onePlus3T 7.1.1
  • huawei ale-cl00 4.4.4
  • meizu mx5 5.1
  • galaxy S8+ 7.0
  • hanzhong 5.1
  • xiaomi note 6.0.1
  • redmi note4 6.0
  • oppo R7c 4.4.4
  • Lenovo K30-T 4.4.4

ProGuard

-dontwarn com.album.**
-keep class  com.album.** { *;}
-keep interface  com.album.** { *;}

ucrop

-dontwarn com.yalantis.ucrop**
-keep class com.yalantis.ucrop** { *; }
-keep interface com.yalantis.ucrop** { *; }

Thanks

TouchImageView

cameraview

MediaScannerConnection Memory leak

LICENSE

Mozilla Public License 2.0

album's People

Contributors

7449 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.