Skip to content

Commit 7de1fe8

Browse files
authored
Merge pull request #91 from brarcher/scroll-bar
Add a scroll bar when searching for a media file
2 parents c6be4fd + e080a8d commit 7de1fe8

File tree

8 files changed

+175
-3
lines changed

8 files changed

+175
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ script:
2626
- python2 app/src/test/shell/test.py
2727

2828
after_failure:
29+
- adb logcat -d -b main,system,events,crash
2930
- cat app/build/reports/findbugs/findbugs.html
3031
- cat app/build/reports/tests/debug/index.html

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ dependencies {
5454
compile 'commons-io:commons-io:2.5'
5555
compile group: 'com.google.guava', name: 'guava', version: '20.0'
5656
compile 'com.nononsenseapps:filepicker:4.2.1'
57+
implementation 'com.simplecityapps:recyclerview-fastscroll:1.0.9'
5758
implementation group: 'org.javatuples', name: 'javatuples', version: '1.2'
5859
implementation 'com.fasterxml.jackson.core:jackson-databind:2.8.11.1'
5960

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</intent-filter>
2828
</activity>
2929
<activity
30-
android:name="com.nononsenseapps.filepicker.FilePickerActivity"
30+
android:name=".picker.FastScrollerFilePickerActivity"
3131
android:label="@string/app_name"
3232
android:theme="@style/FilePickerTheme">
3333
<intent-filter>

app/src/main/java/protect/videotranscoder/activity/MainActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import protect.videotranscoder.media.MediaContainer;
7272
import protect.videotranscoder.media.MediaInfo;
7373
import protect.videotranscoder.media.VideoCodec;
74+
import protect.videotranscoder.picker.FastScrollerFilePickerActivity;
7475
import protect.videotranscoder.service.FFmpegProcessService;
7576
import protect.videotranscoder.service.MessageId;
7677

@@ -497,7 +498,7 @@ public void onClick(DialogInterface dialog, int which)
497498
*/
498499
private void selectVideo()
499500
{
500-
Intent i = new Intent(this, FilePickerActivity.class);
501+
Intent i = new Intent(this, FastScrollerFilePickerActivity.class);
501502

502503
i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
503504
i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
@@ -1433,6 +1434,7 @@ private void displayAboutDialog()
14331434
.put("javatuples", "https://www.javatuples.org/")
14341435
.put("jackson-databind", "https://github.com/FasterXML/jackson-databind")
14351436
.put("ACRA", "https://github.com/ACRA/acra")
1437+
.put("RecyclerView-FastScroll", "https://github.com/timusus/RecyclerView-FastScroll")
14361438
.build();
14371439

14381440
final Map<String, String> USED_ASSETS = ImmutableMap.of
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* This Source Code Form is subject to the terms of the Mozilla Public
3+
* License, v. 2.0. If a copy of the MPL was not distributed with this
4+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
5+
*/
6+
7+
package protect.videotranscoder.picker;
8+
9+
import android.os.Environment;
10+
import android.support.annotation.Nullable;
11+
12+
import com.nononsenseapps.filepicker.AbstractFilePickerActivity;
13+
import com.nononsenseapps.filepicker.AbstractFilePickerFragment;
14+
15+
import java.io.File;
16+
17+
/**
18+
* All this class does is return a suitable fragment.
19+
*/
20+
public class FastScrollerFilePickerActivity extends AbstractFilePickerActivity {
21+
22+
public FastScrollerFilePickerActivity() {
23+
super();
24+
}
25+
26+
@Override
27+
protected AbstractFilePickerFragment getFragment(@Nullable String startPath, int mode, boolean allowMultiple, boolean allowCreateDir, boolean allowExistingFile, boolean singleClick)
28+
{
29+
return getFragment(startPath, mode, allowMultiple, allowCreateDir);
30+
}
31+
32+
protected AbstractFilePickerFragment<File> getFragment(
33+
@Nullable final String startPath, final int mode, final boolean allowMultiple,
34+
final boolean allowCreateDir) {
35+
AbstractFilePickerFragment<File> fragment = new FastScrollerFilePickerFragment();
36+
// startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
37+
fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
38+
mode, allowMultiple, allowCreateDir, true, false);
39+
return fragment;
40+
}
41+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package protect.videotranscoder.picker;
2+
3+
import android.view.LayoutInflater;
4+
import android.view.View;
5+
import android.view.ViewGroup;
6+
7+
import com.nononsenseapps.filepicker.FilePickerFragment;
8+
9+
import protect.videotranscoder.R;
10+
11+
public class FastScrollerFilePickerFragment extends FilePickerFragment {
12+
@Override
13+
protected View inflateRootView(LayoutInflater inflater, ViewGroup container) {
14+
return inflater.inflate(R.layout.fragment_fastscrollerfilepicker, container, false);
15+
}
16+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<!--
4+
~ This Source Code Form is subject to the terms of the Mozilla Public
5+
~ License, v. 2.0. If a copy of the MPL was not distributed with this
6+
~ file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
-->
8+
9+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
10+
xmlns:tools="http://schemas.android.com/tools"
11+
android:layout_width="match_parent"
12+
android:layout_height="match_parent"
13+
xmlns:app="http://schemas.android.com/apk/res-auto">
14+
15+
<android.support.v7.widget.Toolbar
16+
android:id="@+id/nnf_picker_toolbar"
17+
android:layout_width="match_parent"
18+
android:layout_height="wrap_content"
19+
android:layout_alignParentTop="true"
20+
android:background="?attr/colorPrimary"
21+
android:minHeight="?attr/actionBarSize"
22+
android:theme="?nnf_toolbarTheme">
23+
24+
<TextView
25+
android:id="@+id/nnf_current_dir"
26+
android:layout_width="match_parent"
27+
android:layout_height="wrap_content"
28+
android:ellipsize="start"
29+
android:singleLine="true"
30+
android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"/>
31+
</android.support.v7.widget.Toolbar>
32+
33+
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
34+
android:id="@android:id/list"
35+
android:layout_width="match_parent"
36+
android:layout_height="wrap_content"
37+
android:layout_above="@+id/nnf_buttons_container"
38+
android:layout_below="@+id/nnf_picker_toolbar"
39+
android:descendantFocusability="afterDescendants"
40+
android:focusable="true"
41+
app:fastScrollAutoHide="true"
42+
app:fastScrollAutoHideDelay="1500"
43+
app:fastScrollPopupBgColor="?colorAccent"
44+
app:fastScrollPopupTextColor="@android:color/primary_text_dark"
45+
app:fastScrollThumbColor="?colorAccent" />
46+
47+
<FrameLayout
48+
android:id="@+id/nnf_buttons_container"
49+
android:layout_width="match_parent"
50+
android:layout_height="wrap_content"
51+
android:layout_alignParentBottom="true">
52+
53+
<LinearLayout
54+
android:id="@+id/nnf_button_container"
55+
android:layout_width="match_parent"
56+
android:layout_height="wrap_content"
57+
android:orientation="horizontal">
58+
59+
<Button
60+
android:id="@+id/nnf_button_cancel"
61+
style="?attr/borderlessButtonStyle"
62+
android:layout_width="0dp"
63+
android:layout_height="48dp"
64+
android:layout_weight="1"
65+
android:text="@string/nnf_list_cancel"/>
66+
67+
<Button
68+
android:id="@+id/nnf_button_ok"
69+
style="?attr/borderlessButtonStyle"
70+
android:layout_width="0dp"
71+
android:layout_height="48dp"
72+
android:layout_weight="1"
73+
android:text="@string/nnf_list_ok"/>
74+
75+
</LinearLayout>
76+
77+
<LinearLayout
78+
android:id="@+id/nnf_newfile_button_container"
79+
android:layout_width="match_parent"
80+
android:layout_height="wrap_content"
81+
android:orientation="horizontal">
82+
83+
<EditText
84+
android:id="@+id/nnf_text_filename"
85+
android:layout_width="0dp"
86+
android:layout_height="48dp"
87+
android:layout_weight="1"
88+
android:hint="@string/nnf_filename"
89+
android:maxLines="1"
90+
android:paddingLeft="8dp"
91+
android:paddingRight="8dp"/>
92+
93+
<ImageButton
94+
android:id="@+id/nnf_button_ok_newfile"
95+
style="?attr/borderlessButtonStyle"
96+
android:layout_width="48dp"
97+
android:layout_height="48dp"
98+
android:hint="@string/nnf_list_ok"
99+
app:srcCompat="@drawable/nnf_ic_save_black_24dp"
100+
android:tint="?attr/nnf_save_icon_color"/>
101+
102+
</LinearLayout>
103+
</FrameLayout>
104+
105+
<FrameLayout
106+
android:id="@+id/divider"
107+
android:layout_width="match_parent"
108+
android:layout_height="1dp"
109+
android:layout_above="@id/nnf_buttons_container"
110+
android:background="?nnf_separator_color"/>
111+
</RelativeLayout>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
<string name="about">About</string>
5252
<string name="app_copyright_fmt">Copyright 2018-<xliff:g>%d</xliff:g> Branden Archer</string>
53-
<string name="app_license">Licensed under the GPLv2.</string>
53+
<string name="app_license">Licensed under the GPLv3.</string>
5454
<string name="about_title_fmt">About <xliff:g id="app_name">%s</xliff:g></string>
5555
<string name="debug_version_fmt">Version: <xliff:g id="version">%s</xliff:g></string>
5656
<string name="app_revision_fmt">Revision Information: <xliff:g id="app_revision_url">%s</xliff:g></string>

0 commit comments

Comments
 (0)