Giter VIP home page Giter VIP logo

laevatein's Introduction

Laevatein

Build Status

Photo image selection activity set library.

Screen Shot

Selection Activity Album List on DrawerMenu Selected List

Usage

Call photo image selection activity by the following code snipet.

public class SomeActivity extends Activity {
  public static final int REQUEST_CODE_CHOOSE = 1;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_some);
  }

  @Override
  protected void onActivityResult(int requestCode, int resultcode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    switch (requestCode) {
    case REQUEST_CODE_CHOOSE:
      if (resultCode == RESULT_OK) {
        // Get result and proceed your work from here...
        List<Uri> selected = Laevatein.obtainResult(data);
      }
      break;
    default:
      break;
    }
  }

  public void onClickButton(View view) {
    // call chooser on click button like this
    Laevatein.from(this).choose(MimeType.of(MimeType.JPEG)).forResult(REQUEST_CODE_CHOOSE);
  }
}

And you'll get the selection result on Activity#onActivityResult(int, int, Intent).

Features

Laevatein provides some APIs to customize selector behaviour for your spec.

Selectable count limitation

Set selectable count with count(int, int). Default is 0 <= count <= 1.

Laevatein.from(this)
        .choose(MimeType.of(MimeType.JPEG))
        .count(0, 10)  // minimum = 0, max = 10, so 0 <= count <= 10;
        .forResult(REQUEST_CODE_CHOOSE);

Selectable photo quality limitation

Set selectable photo quality by pixel count with quality(int, int). Default is 0 <= pixels <= Integer.MAX_VALUE.

Laevatein.from(this)
        .choose(MimeType.of(MimeType.JPEG))
        .quality(30000, Integer.MAX_VALUE)  // minimum = 30000px, max = Integer.MAX_VALUEpx, so 30000px <= count <= Integer.MAX_VALUEpx;
        .forResult(REQUEST_CODE_CHOOSE);

Use custom cell layout

Set your layout and ids for the image cell with bindEachImageWith(int, int, int).

Laevatein.from(this)
        .choose(MimeType.of(MimeType.JPEG))
        .bindEachImageWith(R.layout.my_cell, R.id.my_cell_image_view, R.id.my_cell_check_box)
        .forResult(REQUEST_CODE_CHOOSE);

Resume selection with previously selected photos

Set defaultly selected URIs with resume(List<Uri>).

List<Uri> mSelectedList;

Laevatein.from(this)
        .choose(MimeType.of(MimeType.JPEG))
        .resume(mSelectedList)
        .forResult(REQUEST_CODE_CHOOSE);

Call camera from the selection activity

Set flag to enable camera capture from the selection activity with capture(boolean).

Laevatein.from(this)
        .choose(MimeType.of(MimeType.JPEG))
        .capture(true)
        .forResult(REQUEST_CODE_CHOOSE);

Sample App

Sample application is available here. Try it on your device via DeployGate

Download

Via Gradle

repositories {
    mavenCentral()
}
android {
    dependencies {
        compile 'jp.co.nohana:Laevatein:1.0.1'
    }
}

Acknowledgement

This library depends on the following libraries.

  1. Picasso by Square Inc.
  2. ImageViewZoom by Alessandro Crugnola
  3. Amalgam by nohana, Inc.
  4. CompoundContainers by KeithYokoma
  5. AndroidDeviceCompatibility by mixi, Inc.

License

This library is licensed under Apache License v2.

Copyright (C) 2014 nohana, Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

Bitdeli Badge

laevatein's People

Contributors

bitdeli-chef avatar hidey avatar keithyokoma avatar takaya1219 avatar yuki-takeichi avatar

Watchers

 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.