Skip to content

Commit 066992b

Browse files
committed
upd README of included modules
1 parent 2c130f8 commit 066992b

File tree

3 files changed

+500
-0
lines changed

3 files changed

+500
-0
lines changed

doubletapplayerview/README.md

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# DoubleTapPlayerView
2+
3+
A simple library to include double tap behavior to ExoPlayer's PlayerView.
4+
Created to handle fast forward/rewind behavior like YouTube.
5+
6+
![teamwork-flip](github/preview_gif.gif)
7+
8+
# Sample app
9+
10+
If you would like to test the YouTube overlay, then you can either download the demo app,
11+
which can be found under Assets of the release or build it yourself from code.
12+
It provides all main modifications available.
13+
14+
The sample videos own by *Blender Foundation* and a full list can be found [here][videolist].
15+
16+
# Download
17+
18+
The Gradle dependency is available via [jitpack.io][jitpack].
19+
To be able to load this library, you have to add the repository to your project's gradle file:
20+
21+
```gradle
22+
allprojects {
23+
repositories {
24+
...
25+
maven { url 'https://jitpack.io' }
26+
}
27+
}
28+
```
29+
30+
Then, in your app's directory, you can include it the same way like other libraries:
31+
32+
```gradle
33+
android {
34+
...
35+
// If you face problems during building you should try including the below lines if you
36+
// haven't already
37+
38+
// compileOptions {
39+
// sourceCompatibility JavaVersion.VERSION_1_8
40+
// targetCompatibility JavaVersion.VERSION_1_8
41+
// }
42+
}
43+
44+
dependencies {
45+
implementation 'com.github.vkay94:DoubleTapPlayerView:1.0.4'
46+
}
47+
```
48+
49+
The minimum API level supported by this library is API 16 as ExoPlayer does, but I can't
50+
verify versions below API level 21 (Lollipop) myself. So feedback is welcomed.
51+
52+
# Getting started
53+
54+
In order to start using the YouTube overlay, the easiest way is to include it directly
55+
into your XML layout, e.g. on top of `DoubleTapPlayerView` or inside ExoPlayer's controller:
56+
57+
```xml
58+
<FrameLayout
59+
android:layout_width="match_parent"
60+
android:layout_height="match_parent" >
61+
62+
<com.github.vkay94.dtpv.DoubleTapPlayerView
63+
android:id="@+id/playerView"
64+
android:layout_width="match_parent"
65+
android:layout_height="match_parent"
66+
67+
app:dtpv_controller="@+id/youtube_overlay" />
68+
69+
<com.github.vkay94.dtpv.youtube.YouTubeOverlay
70+
android:id="@+id/youtube_overlay"
71+
android:layout_width="match_parent"
72+
android:layout_height="match_parent"
73+
android:visibility="invisible"
74+
75+
app:yt_playerView="@+id/playerView" />
76+
</FrameLayout>
77+
```
78+
79+
Then, inside your `Activity` or `Fragment`, you can specify which preparations should be done
80+
before and after the animation, but at least, you have got to toggle the visibility of the
81+
overlay and reference the (Simple)ExoPlayer to it:
82+
83+
```kotlin
84+
youtube_overlay
85+
.performListener(object : YouTubeOverlay.PerformListener {
86+
override fun onAnimationStart() {
87+
// Do UI changes when circle scaling animation starts (e.g. hide controller views)
88+
youtube_overlay.visibility = View.VISIBLE
89+
}
90+
91+
override fun onAnimationEnd() {
92+
// Do UI changes when circle scaling animation starts (e.g. show controller views)
93+
youtube_overlay.visibility = View.GONE
94+
}
95+
})
96+
// Uncomment this line if you haven't set yt_playerView in XML
97+
// .playerView(playerView)
98+
99+
// Uncomment this line if you haven't set dtpv_controller in XML
100+
// playerView.controller(youtube_overlay)
101+
102+
// Call this method whenever the player is released and recreated
103+
youtube_overlay.player(simpleExoPlayer)
104+
```
105+
106+
This way, you have more control about the appearance, for example you could apply a fading
107+
animation to it. For a full initialization you can refer to the demo application's MainActivity
108+
and layout files.
109+
110+
---
111+
112+
# API documentation
113+
114+
The following sections provide detailed documentation for the components of the library.
115+
116+
## DoubleTapPlayerView
117+
118+
`DoubleTapPlayerView` is the core of this library. It recognizes specific gestures
119+
which provides more control for the double tapping gesture.
120+
An overview about the added methods can be found in the [PlayerDoubleTapListener][PlayerDoubleTapListener]
121+
interface.
122+
123+
You can adjust how long the double tap mode remains after the last action,
124+
the default value is 650 milliseconds.
125+
126+
## YouTubeOverlay
127+
128+
`YouTubeOverlay` is the reason for this library. It provides nearly the
129+
same experience like the fast forward/rewind feature which is used by YouTube's
130+
Android app. It is highly modifiable.
131+
132+
### XML attributes
133+
134+
If you add the view to your XML layout you can set some custom attributes
135+
to customize the view's look and behavior.
136+
Every attributes value can also be get and set programmatically.
137+
138+
| Attribute name | Description | Type |
139+
| ------------- | ------------| ------|
140+
| `yt_seekSeconds` | Fast forward/rewind seconds skip per tap. The text *xx seconds* will be changed where xx is `value`. | `int` |
141+
| `yt_animationDuration` | Speed of the circle scaling / time in millis to expand completely. When this time has passed, YouTubeOverlay's `PerformListener.onAnimationEnd()` will be called. | `int` |
142+
| `yt_arcSize` | Arc of the background circle. The higher the value the more roundish the shape becomes. This attribute should be set dynamically depending on screen size and orientation. | `dimen` |
143+
| `yt_tapCircleColor` | Color of the scaling circle after tap. | `color` |
144+
| `yt_backgroundCircleColor` | Color of the background shape. | `color` |
145+
| `yt_iconAnimationDuration` | Time in millis to run through an full fade cycle. | `int` |
146+
| `yt_icon` | One of the three forward icons. Will be multiplied by three and mirrored for rewind. | `drawable` |
147+
| `yt_textAppearance` | Text appearance for the *xx seconds* text. | `style` |
148+
149+
I'd recommend the sample app to try out the different values for them.
150+
151+
### YouTubeOverlay.PerformListener
152+
153+
This interface listens to the *lifecycle* of the overlay.
154+
155+
```kotlin
156+
// Obligatory: Called when the overlay is not visible and the first valid double tap event occurred.
157+
// Visibility of the overlay should be set to VISIBLE within this interface method.
158+
fun onAnimationStart()
159+
160+
// Obligatory: Called when the circle animation is finished.
161+
// Visibility of the overlay should be set to GONE or INVISIBLE within this interface method.
162+
fun onAnimationEnd()
163+
164+
// Optional: Determines whether the player should forward (true), rewind (false) or ignore (null) taps.
165+
fun shouldForward(player: Player, playerView: DoubleTapPlayerView, posX: Float): Boolean?
166+
```
167+
168+
### SeekListener
169+
170+
This interface reacts to the events during rewinding/forwarding.
171+
172+
```kotlin
173+
// Called when the start of the video is reached
174+
fun onVideoStartReached()
175+
176+
// Called when the end of the video is reached
177+
fun onVideoEndReached()
178+
```
179+
180+
[videolist]: https://gist.github.com/jsturgis/3b19447b304616f18657
181+
[jitpack]: https://jitpack.io/#vkay94/DoubleTapPlayerView
182+
[PlayerDoubleTapListener]: https://github.com/vkay94/DoubleTapPlayerView/blob/master/doubletapplayerview/src/main/java/com/github/vkay94/dtpv/PlayerDoubleTapListener.java

filepicker-lib/README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Material File Picker by Arte al Programar
2+
3+
Material file picker library for Android by Arte al Programar
4+
5+
![](ss/main.png)
6+
7+
## What's new
8+
9+
- Require Android Jelly Bean 4.1.x (API 16+)
10+
- Material You (Dynamics Color) Support
11+
- Night Mode Support
12+
- New Icon Designs
13+
14+
## Add your project
15+
16+
Using Jcenter
17+
18+
```
19+
build.gradle (Project)
20+
21+
allprojects {
22+
repositories {
23+
maven { url 'https://jitpack.io' }
24+
}
25+
}
26+
27+
28+
build.gradle (Module: app)
29+
30+
dependencies {
31+
...
32+
// Java
33+
implementation 'androidx.activity:activity:1.4.0'
34+
implementation 'androidx.fragment:fragment:1.4.1'
35+
36+
// Kotlin
37+
implementation 'androidx.activity:activity-ktx:1.4.0'
38+
implementation 'androidx.fragment:fragment-ktx:1.4.1'
39+
implementation 'com.github.arteaprogramar:Android-MaterialFilePicker:3.0.1'
40+
}
41+
42+
43+
```
44+
45+
## Using (IMPORTANT)
46+
47+
- For Android 11 and above, you must request "MANAGE_EXTERNAL_STORAGE" permission in your
48+
application, "Material File Picker" requires that permission to read and show user files.
49+
50+
- Open your class and add the following code
51+
52+
```
53+
...
54+
kotlin
55+
56+
/**
57+
* This library require "Activity Result" API
58+
**/
59+
60+
private val startForResultFiles = registerForActivityResult(
61+
ActivityResultContracts.StartActivityForResult()
62+
) { result: ActivityResult ->
63+
onActivityResult(result.resultCode, result.data)
64+
}
65+
66+
...
67+
68+
// External Storage Path
69+
val externalStorage = FileUtils.getFile(applicationContext, null)
70+
71+
MaterialFilePicker()
72+
// Pass a source of context. Can be:
73+
// .withActivity(Activity activity)
74+
// .withFragment(Fragment fragment)
75+
// .withSupportFragment(androidx.fragment.app.Fragment fragment)
76+
.withActivity(this)
77+
// With cross icon on the right side of toolbar for closing picker straight away
78+
.withCloseMenu(true)
79+
// Entry point path (user will start from it)
80+
//.withPath(alarmsFolder.absolutePath)
81+
// Root path (user won't be able to come higher than it)
82+
.withRootPath(externalStorage.absolutePath)
83+
// Showing hidden files
84+
.withHiddenFiles(true)
85+
// Want to choose only jpg images
86+
.withFilter(Pattern.compile(".*\\.(jpg|jpeg)$"))
87+
// Don't apply filter to directories names
88+
.withFilterDirectories(false)
89+
.withTitle("Sample title")
90+
// Require "Activity Result" API
91+
.withActivityResultApi(startForResultFiles)
92+
.start()
93+
...
94+
95+
96+
/**
97+
* For Android API 29+, You need
98+
* <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
99+
* And some extra settings.
100+
* You can check the demo of the application
101+
**/
102+
103+
104+
```
105+
106+
Override on activity result:
107+
108+
```
109+
kotlin
110+
111+
private fun onActivityResult(resultCode: Int, data: Intent?) {
112+
if (resultCode == Activity.RESULT_OK) {
113+
val path: String? = data?.getStringExtra(FilePickerActivity.RESULT_FILE_PATH)
114+
115+
if (path != null) {
116+
Log.d("Path: ", path)
117+
Toast.makeText(this, "Picked file: $path", Toast.LENGTH_LONG).show()
118+
}
119+
}
120+
}
121+
122+
```

0 commit comments

Comments
 (0)