tyl210110 / PhotoPicker

类似微信的图片选择、预览组件

Home Page:https://play.google.com/store/apps/details?id=me.iwf.PhotoPickerDemo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PhotoPicker

Build Status Android Arsenal Download API


Example

Get it on Google Play


Usage

Gradle

dependencies {
    compile 'me.iwf.photopicker:PhotoPicker:0.2.7@aar'
    
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.android.support:recyclerview-v7:22.2.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.android.support:design:22.2.0'
    compile 'com.github.bumptech.glide:glide:3.6.0'
}

eclipse

[GO HOME

Pick Photo

PhotoPickerIntent intent = new PhotoPickerIntent(MainActivity.this);
intent.setPhotoCount(9);
intent.setShowCamera(true);
intent.setShowGif(true);
startActivityForResult(intent, REQUEST_CODE);

Preview Photo

Intent intent = new Intent(mContext, PhotoPagerActivity.class);
intent.putExtra(PhotoPagerActivity.EXTRA_CURRENT_ITEM, position);
intent.putExtra(PhotoPagerActivity.EXTRA_PHOTOS, photoPaths);
startActivityForResult(intent, REQUEST_CODE);

onActivityResult

@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);

  if (resultCode == RESULT_OK && requestCode == REQUEST_CODE) {
    if (data != null) {
      ArrayList<String> photos = 
          data.getStringArrayListExtra(PhotoPickerActivity.KEY_SELECTED_PHOTOS);
    }
  }
}

manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    >
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <uses-feature android:name="android.hardware.camera" android:required="true" />

  <application
    ...
    >
    ...
    
    <activity android:name="me.iwf.photopicker.PhotoPickerActivity"
      android:theme="@style/Theme.AppCompat.NoActionBar" 
       />

    <activity android:name="me.iwf.photopicker.PhotoPagerActivity"
      android:theme="@style/Theme.AppCompat.NoActionBar"/>
    
  </application>
</manifest>

Custom style

<style name="myTheme.actionBar" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
  <item name="android:textColorPrimary">#0000ff</item>
</style>

<style name="myTheme" parent="Theme.AppCompat.Light.NoActionBar">
  <item name="actionBarTheme">@style/myTheme.actionBar</item>
  <item name="colorPrimary">#00FF00</item>
</style>

License

Copyright 2015 Huang Donglu

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.

About

类似微信的图片选择、预览组件

https://play.google.com/store/apps/details?id=me.iwf.PhotoPickerDemo

License:Apache License 2.0


Languages

Language:Java 100.0%