Laevatein


Source link: https://github.com/nohana/Laevatein

Laevatein

![Gitter](https://badges.gitter.im/Join Chat.svg)

Photo image selection activity set library.

Screen Shot

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);

Customize theme

Change Laevatein's theme with theme(int).

Laevatein.from(this)

.theme(R.style.OriginalTheme)

.choose(MimeType.of(MimeType.JPEG))

.forResult(REQUEST_CODE_CHOOSE);

Theme must implement these parameter at least.

<style name="OriginalTheme" parent="Theme.AppCompat.Light.NoActionBar">
  <item name="l_drawerStyle">@style/L_DrawerMenu</item>
  <item name="l_drawerItemStyle">@style/L_DrawerMenuItem</item>
  <item name="l_gridStyle">@style/L_Grid</item>
  <item name="l_counterStyle">@style/L_Counter</item> </style>

Sample App

Sample application is available here.

Download

Via Gradle

repositories {

  mavenCentral() 
}
 android {

  dependencies {

compile 'jp.co.nohana:Laevatein:1.0.4@aar'
  
}
 
}

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.
  6. PermissionsDispatcher by Shintaro Katafuchi, Marcel Schnelle, Yoshinori Isogai

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. 

Resources

Helper library for Android developers looking to add YouTube video playback in their applications via the iframe player in WebView.

This library allows to use better multi-threading approach with observer-pattern.

Use this library to add GCM to your project in a few minutes!

This library allows to add integration with Spotify.

It allows you to add a mask to EditText.

Uses JavaScript calls to automate interaction with web pages displayed in Android WebViews. Could be especially helpful in testing.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes