-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from brarcher/scroll-bar
Add a scroll bar when searching for a media file
- Loading branch information
Showing
8 changed files
with
175 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/src/main/java/protect/videotranscoder/picker/FastScrollerFilePickerActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package protect.videotranscoder.picker; | ||
|
||
import android.os.Environment; | ||
import android.support.annotation.Nullable; | ||
|
||
import com.nononsenseapps.filepicker.AbstractFilePickerActivity; | ||
import com.nononsenseapps.filepicker.AbstractFilePickerFragment; | ||
|
||
import java.io.File; | ||
|
||
/** | ||
* All this class does is return a suitable fragment. | ||
*/ | ||
public class FastScrollerFilePickerActivity extends AbstractFilePickerActivity { | ||
|
||
public FastScrollerFilePickerActivity() { | ||
super(); | ||
} | ||
|
||
@Override | ||
protected AbstractFilePickerFragment getFragment(@Nullable String startPath, int mode, boolean allowMultiple, boolean allowCreateDir, boolean allowExistingFile, boolean singleClick) | ||
{ | ||
return getFragment(startPath, mode, allowMultiple, allowCreateDir); | ||
} | ||
|
||
protected AbstractFilePickerFragment<File> getFragment( | ||
@Nullable final String startPath, final int mode, final boolean allowMultiple, | ||
final boolean allowCreateDir) { | ||
AbstractFilePickerFragment<File> fragment = new FastScrollerFilePickerFragment(); | ||
// startPath is allowed to be null. In that case, default folder should be SD-card and not "/" | ||
fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(), | ||
mode, allowMultiple, allowCreateDir, true, false); | ||
return fragment; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
app/src/main/java/protect/videotranscoder/picker/FastScrollerFilePickerFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package protect.videotranscoder.picker; | ||
|
||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.nononsenseapps.filepicker.FilePickerFragment; | ||
|
||
import protect.videotranscoder.R; | ||
|
||
public class FastScrollerFilePickerFragment extends FilePickerFragment { | ||
@Override | ||
protected View inflateRootView(LayoutInflater inflater, ViewGroup container) { | ||
return inflater.inflate(R.layout.fragment_fastscrollerfilepicker, container, false); | ||
} | ||
} |
111 changes: 111 additions & 0 deletions
111
app/src/main/res/layout/fragment_fastscrollerfilepicker.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<!-- | ||
~ This Source Code Form is subject to the terms of the Mozilla Public | ||
~ License, v. 2.0. If a copy of the MPL was not distributed with this | ||
~ file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
--> | ||
|
||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<android.support.v7.widget.Toolbar | ||
android:id="@+id/nnf_picker_toolbar" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentTop="true" | ||
android:background="?attr/colorPrimary" | ||
android:minHeight="?attr/actionBarSize" | ||
android:theme="?nnf_toolbarTheme"> | ||
|
||
<TextView | ||
android:id="@+id/nnf_current_dir" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:ellipsize="start" | ||
android:singleLine="true" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"/> | ||
</android.support.v7.widget.Toolbar> | ||
|
||
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView | ||
android:id="@android:id/list" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_above="@+id/nnf_buttons_container" | ||
android:layout_below="@+id/nnf_picker_toolbar" | ||
android:descendantFocusability="afterDescendants" | ||
android:focusable="true" | ||
app:fastScrollAutoHide="true" | ||
app:fastScrollAutoHideDelay="1500" | ||
app:fastScrollPopupBgColor="?colorAccent" | ||
app:fastScrollPopupTextColor="@android:color/primary_text_dark" | ||
app:fastScrollThumbColor="?colorAccent" /> | ||
|
||
<FrameLayout | ||
android:id="@+id/nnf_buttons_container" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true"> | ||
|
||
<LinearLayout | ||
android:id="@+id/nnf_button_container" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal"> | ||
|
||
<Button | ||
android:id="@+id/nnf_button_cancel" | ||
style="?attr/borderlessButtonStyle" | ||
android:layout_width="0dp" | ||
android:layout_height="48dp" | ||
android:layout_weight="1" | ||
android:text="@string/nnf_list_cancel"/> | ||
|
||
<Button | ||
android:id="@+id/nnf_button_ok" | ||
style="?attr/borderlessButtonStyle" | ||
android:layout_width="0dp" | ||
android:layout_height="48dp" | ||
android:layout_weight="1" | ||
android:text="@string/nnf_list_ok"/> | ||
|
||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:id="@+id/nnf_newfile_button_container" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="horizontal"> | ||
|
||
<EditText | ||
android:id="@+id/nnf_text_filename" | ||
android:layout_width="0dp" | ||
android:layout_height="48dp" | ||
android:layout_weight="1" | ||
android:hint="@string/nnf_filename" | ||
android:maxLines="1" | ||
android:paddingLeft="8dp" | ||
android:paddingRight="8dp"/> | ||
|
||
<ImageButton | ||
android:id="@+id/nnf_button_ok_newfile" | ||
style="?attr/borderlessButtonStyle" | ||
android:layout_width="48dp" | ||
android:layout_height="48dp" | ||
android:hint="@string/nnf_list_ok" | ||
app:srcCompat="@drawable/nnf_ic_save_black_24dp" | ||
android:tint="?attr/nnf_save_icon_color"/> | ||
|
||
</LinearLayout> | ||
</FrameLayout> | ||
|
||
<FrameLayout | ||
android:id="@+id/divider" | ||
android:layout_width="match_parent" | ||
android:layout_height="1dp" | ||
android:layout_above="@id/nnf_buttons_container" | ||
android:background="?nnf_separator_color"/> | ||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters