adding support for horizontal scrolling

This commit is contained in:
tibbi 2017-06-24 21:42:53 +02:00
parent 1afb293977
commit 5604d1f8b5
6 changed files with 90 additions and 11 deletions

View file

@ -32,7 +32,7 @@ android {
}
dependencies {
compile 'com.simplemobiletools:commons:2.21.13'
compile 'com.simplemobiletools:commons:2.21.14'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.4.0'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'

View file

@ -213,7 +213,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private fun checkIfColorChanged() {
if (directories_grid.adapter != null && getRecyclerAdapter().foregroundColor != config.primaryColor) {
getRecyclerAdapter().updatePrimaryColor(config.primaryColor)
directories_fastscroller.updateHandleColor()
directories_vertical_fastscroller.updateHandleColor()
directories_horizontal_fastscroller.updateHandleColor()
}
}
@ -395,7 +396,18 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
itemClicked(it.path)
}
}
directories_fastscroller.setViews(directories_grid, directories_refresh_layout)
directories_vertical_fastscroller.isHorizontal = false
directories_vertical_fastscroller.beGoneIf(config.scrollHorizontally)
directories_horizontal_fastscroller.isHorizontal = true
directories_horizontal_fastscroller.beVisibleIf(config.scrollHorizontally)
if (config.scrollHorizontally) {
directories_horizontal_fastscroller.setViews(directories_grid, directories_refresh_layout)
} else {
directories_vertical_fastscroller.setViews(directories_grid, directories_refresh_layout)
}
}
private fun checkLastMediaChanged() {

View file

@ -128,7 +128,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun checkIfColorChanged() {
if (media_grid.adapter != null && getRecyclerAdapter().foregroundColor != config.primaryColor) {
getRecyclerAdapter().updatePrimaryColor(config.primaryColor)
media_fastscroller.updateHandleColor()
media_horizontal_fastscroller.updateHandleColor()
media_vertical_fastscroller.updateHandleColor()
}
}
@ -144,7 +145,18 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
itemClicked(it.path)
}
}
media_fastscroller.setViews(media_grid, media_refresh_layout)
media_vertical_fastscroller.isHorizontal = false
media_vertical_fastscroller.beGoneIf(config.scrollHorizontally)
media_horizontal_fastscroller.isHorizontal = true
media_horizontal_fastscroller.beVisibleIf(config.scrollHorizontally)
if (config.scrollHorizontally) {
media_horizontal_fastscroller.setViews(media_grid, media_refresh_layout)
} else {
media_vertical_fastscroller.setViews(media_grid, media_refresh_layout)
}
}
private fun checkLastMediaChanged() {

View file

@ -20,13 +20,41 @@
app:spanCount="@integer/directory_columns_vertical_scroll"/>
<com.simplemobiletools.commons.views.FastScroller
android:id="@+id/directories_fastscroller"
android:id="@+id/directories_vertical_fastscroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:paddingLeft="@dimen/normal_margin"
android:paddingStart="@dimen/normal_margin"/>
android:paddingStart="@dimen/normal_margin">
<ImageView
android:id="@+id/fastscroller_handle_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:alpha="0"
android:background="@drawable/fastscroller_handle_vertical"/>
</com.simplemobiletools.commons.views.FastScroller>
<com.simplemobiletools.commons.views.FastScroller
android:id="@+id/directories_horizontal_fastscroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:paddingTop="@dimen/normal_margin">
<ImageView
android:id="@+id/fastscroller_handle_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:alpha="0"
android:background="@drawable/fastscroller_handle_horizontal"/>
</com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>

View file

@ -20,13 +20,41 @@
app:spanCount="@integer/media_columns_vertical_scroll"/>
<com.simplemobiletools.commons.views.FastScroller
android:id="@+id/media_fastscroller"
android:id="@+id/media_vertical_fastscroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:paddingLeft="@dimen/normal_margin"
android:paddingStart="@dimen/normal_margin"/>
android:paddingStart="@dimen/normal_margin">
<ImageView
android:id="@+id/fastscroller_handle_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:alpha="0"
android:background="@drawable/fastscroller_handle_vertical"/>
</com.simplemobiletools.commons.views.FastScroller>
<com.simplemobiletools.commons.views.FastScroller
android:id="@+id/media_horizontal_fastscroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:paddingTop="@dimen/normal_margin">
<ImageView
android:id="@+id/fastscroller_handle_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:alpha="0"
android:background="@drawable/fastscroller_handle_horizontal"/>
</com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>

View file

@ -214,8 +214,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"
android:visibility="gone">
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_scroll_horizontally"