• This repository has been archived on 23/Aug/2019
  • Stars
    star
    429
  • Rank 101,271 (Top 2 %)
  • Language
    Kotlin
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

[WIP]✨ Charles is a local multi-media selector for Android

Charles

Build Status Download

Charles is a local file selector for Android. You can

  • Use it in Activity or Fragment
  • Select multi-media file including images, videos, audio and documents
  • Apply different themes, including two built-in themes and custom themes
  • Restrict different screen orientations
  • Find more by yourself
Charles Style Charles Dark Style Empty View
Charles Style Empty View Charles Empty Layout

Download

  • Add the JitPack repository to your build file:
allprojects {
    repositories {
        jcenter()
    }
}
  • Add the dependency:
dependencies {
    implementation 'io.github.tonnyl:charles:x.y.z'
}

ProGuard

If you use Glide as your image engine, add rules as Glide's README says. And add extra rule:

-dontwarn com.squareup.picasso.**

If you use Picasso as your image engine, add rules as Picasso's README says. And add extra rule:

-dontwarn com.bumptech.glide.**

Attention: The above progurad rules are correct.

Usage

Permission

The library requires two permissions:

  • android.permission.READ_EXTERNAL_STORAGE
  • android.permission.WRITE_EXTERNAL_STORAGE

So if you are targeting Android 6.0+, you need to handle runtime permission request before next step.

Simple Usage Snippet

Start CharlesActivity from current Activity or Fragment:

Charles.from(this@MainActivity)
        .choose()
        .maxSelectable(9)
        .progressRate(true)
        .theme(R.style.Charles)
        .imageEngine(GlideEngine())
        .restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
        .forResult(REQUEST_CODE_CHOOSE)

Themes

There are two built-in themes you can use to start CharlesActivity:

  • R.style.Charles (light mode)
  • R.style.CharlesDark (dark mode)

And Also you can define your own theme as you wish.

Receive Result

In onActivityResult() callback of the starting Activity or Fragment:

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode == REQUEST_CODE_CHOOSE && resultCode == Activity.RESULT_OK) {
        val uris = Charles.obtainResult(data)
        val paths = Charles.obtainPathResult(data)

        Log.d("charles", "uris: $uris")
        Log.d("charles", "paths: $paths")
    }
}

More

Find more details about Charles in wiki.

Contribution

Discussions and pull requests are welcomed 💖.

Thanks

This library is inspired by Matisse and uses some of its source code.

License

Charles is under the MIT license. See the LICENSE for more information.

More Repositories

1

Awesome_APIs

:octocat: A collection of APIs
11,690
star
2

PaperPlane

📚 PaperPlane - An Android reading app, including articles from Zhihu Daily, Guokr Handpick and Douban Moment.
Kotlin
1,140
star
3

Espresso

🚚 Espresso is an express delivery tracking app designed with Material Design style, built on MVP(Model-View-Presenter) architecture with RxJava2, Retrofit2, Realm database and ZXing
Java
1,087
star
4

Spark

🎨 An Android library to create gradient animation like Instagram&Spotify
Kotlin
671
star
5

Mango

🏀 An Android app for dribbble.com
Kotlin
655
star
6

Light

🍭 The usual Snackbar, but elegant
Kotlin
547
star
7

WhatsNew

🎉 WhatsNew automatically displays a short description of the new features when users update your app
Kotlin
475
star
8

FanfouHandpick

📖 A Fanfou Handpick Client Developed by Kotlin
Kotlin
227
star
9

Zhihu_Zhuanlan_APIs

知乎专栏API分析
190
star
10

Windary

🎓 My solutions to LeetCode problems written in Go, Java, JavaScript, Kotlin, Python, Rust & Swift.
Swift
189
star
11

Translator

📘 Translator-A translation app based on Android platform
Java
67
star
12

Reader

📚 MVP + Volley + Gson, 内容包含了糗事百科,煎蛋,和内涵段子
Java
58
star
13

Latticify

[DEPRECATED]💬 An Android app for Slack.
Kotlin
42
star
14

awesome-courses-of-chinese-university

中国大学课程资料
30
star
15

GaussianBlur

Android Gaussian Blur using RenderScript
Java
26
star
16

wukong

A command-line tool for browsing GitHub trending written by Rust. [DEPRECATED]
Rust
24
star
17

Packman

A mobile application made for managing GitLab CI/CD jobs, demonstrating how to implement some latest technologies in mobile software development.
Kotlin
16
star
18

Dash

Design patterns in Kotlin and Swift.
Swift
12
star
19

Telecode

Country&Region&Telecode data in Chinese&English
11
star
20

CircleProgressBar

A circel progress bar library on Android
Java
6
star
21

WaterPal

🥛 WaterPal - Remind you to drink water at regular time.
Java
5
star
22

toolman

A collection of tools
Shell
5
star
23

Moka-Feedback

Moka is a mobile app for GitHub.
4
star
24

cathem

Dart
4
star
25

MyPythonLearnProject

My Project of Learning Python
Python
3
star
26

TDate

Calculate the date in a way that is similar to Windows system
C++
2
star
27

TonnyL

1
star
28

ActionsFlow

1
star