update to rev 465
@ -1,6 +1,6 @@
|
|||||||
# android-filechooser
|
# android-filechooser
|
||||||
|
|
||||||
* Version: 5.4
|
* Version: 5.4.4 beta
|
||||||
|
|
||||||
|
|
||||||
Feel free to contact us at:
|
Feel free to contact us at:
|
||||||
@ -18,11 +18,31 @@ project. We hope this project will be always useful for everyone.
|
|||||||
* C
|
* C
|
||||||
* Simon McCorkindale
|
* Simon McCorkindale
|
||||||
+ [Website](http://www.aroha.mobi/)
|
+ [Website](http://www.aroha.mobi/)
|
||||||
|
* Philipp Crocoll
|
||||||
|
+ Author of open source project [Keepass2Android](https://keepass2android.codeplex.com/)
|
||||||
* And others.
|
* And others.
|
||||||
|
|
||||||
|
|
||||||
# HISTORY
|
# HISTORY
|
||||||
|
|
||||||
|
* Version 5.4.4 beta:
|
||||||
|
+ *Initialize:* October 23, 2013
|
||||||
|
|
||||||
|
* Version 5.4.3:
|
||||||
|
+ *Release:* October 23, 2013
|
||||||
|
|
||||||
|
* Version 5.4.3 beta:
|
||||||
|
+ *Initialize:* September 30, 2013
|
||||||
|
|
||||||
|
* Version 5.4.2
|
||||||
|
+ *Release:* September 27, 2013
|
||||||
|
+ Fix light themes with dark action bar.
|
||||||
|
|
||||||
|
* Version 5.4.1
|
||||||
|
+ *Release:* September 26, 2013
|
||||||
|
+ Fix light themes: now they use light action bar.
|
||||||
|
+ Add light themes with dark action bar.
|
||||||
|
|
||||||
* Version 5.4
|
* Version 5.4
|
||||||
+ *Release:* August 02, 2013
|
+ *Release:* August 02, 2013
|
||||||
+ Integrate library `android-support-v7-appcompat` for action bar in APIs
|
+ Integrate library `android-support-v7-appcompat` for action bar in APIs
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="src" path="gen"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="src" path="gen"/>
|
|
||||||
<classpathentry kind="output" path="bin/classes"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -7,12 +7,10 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="group.pals.android.lib.ui.filechooser"
|
package="group.pals.android.lib.ui.filechooser" >
|
||||||
android:versionCode="@integer/afc_lib_version_code"
|
|
||||||
android:versionName="@string/afc_lib_version_name" >
|
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="4"
|
android:minSdkVersion="4"
|
||||||
android:targetSdkVersion="17" />
|
android:targetSdkVersion="18" />
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
@ -8,6 +8,6 @@
|
|||||||
# project structure.
|
# project structure.
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-17
|
target=android-18
|
||||||
android.library=true
|
android.library=true
|
||||||
android.library.reference.1=../../../../../AppData/Local/Android/android-sdk/extras/android/support/v7/appcompat
|
android.library.reference.1=../../android-support-v7-appcompat
|
||||||
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 975 B After Width: | Height: | Size: 920 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 884 B After Width: | Height: | Size: 885 B |
Before Width: | Height: | Size: 764 B After Width: | Height: | Size: 780 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 755 B |
Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 638 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 643 B |
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 522 B |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 926 B After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.0 KiB |
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<style name="Afc.BaseThemeHelper.Light" parent="@style/Afc.BaseTheme.Light">
|
<style name="Afc.BaseThemeHelper.Light.DarkActionBar" parent="@style/Afc.BaseTheme.Light.DarkActionBar">
|
||||||
<item name="afc_ic_menu_bookmarks">@drawable/afc_ic_menu_bookmarks_light</item>
|
<item name="afc_ic_menu_bookmarks">@drawable/afc_ic_menu_bookmarks_light</item>
|
||||||
<item name="afc_ic_menu_home">@drawable/afc_ic_menu_home_light</item>
|
<item name="afc_ic_menu_home">@drawable/afc_ic_menu_home_light</item>
|
||||||
<item name="afc_ic_menu_gridview">@drawable/afc_ic_menu_gridview_light</item>
|
<item name="afc_ic_menu_gridview">@drawable/afc_ic_menu_gridview_light</item>
|
||||||
@ -29,19 +29,40 @@
|
|||||||
<item name="afc_button_bar_button_style">?android:attr/buttonBarButtonStyle</item>
|
<item name="afc_button_bar_button_style">?android:attr/buttonBarButtonStyle</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Afc.BaseThemeHelper.Light" parent="@style/Afc.BaseTheme.Light">
|
||||||
|
<item name="afc_ic_menu_bookmarks">@drawable/afc_ic_menu_bookmarks_dark</item>
|
||||||
|
<item name="afc_ic_menu_home">@drawable/afc_ic_menu_home_dark</item>
|
||||||
|
<item name="afc_ic_menu_gridview">@drawable/afc_ic_menu_gridview_dark</item>
|
||||||
|
<item name="afc_ic_menu_listview">@drawable/afc_ic_menu_listview_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_date_asc">@drawable/afc_ic_menu_sort_by_date_asc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_date_desc">@drawable/afc_ic_menu_sort_by_date_desc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_name_asc">@drawable/afc_ic_menu_sort_by_name_asc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_name_desc">@drawable/afc_ic_menu_sort_by_name_desc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_size_asc">@drawable/afc_ic_menu_sort_by_size_asc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_size_desc">@drawable/afc_ic_menu_sort_by_size_desc_dark</item>
|
||||||
|
<item name="afc_ic_button_sort_by_date_asc">@drawable/afc_ic_menu_sort_by_date_asc_dark</item>
|
||||||
|
<item name="afc_ic_button_sort_by_date_desc">@drawable/afc_ic_menu_sort_by_date_desc_dark</item>
|
||||||
|
<item name="afc_ic_button_sort_by_name_asc">@drawable/afc_ic_menu_sort_by_name_asc_dark</item>
|
||||||
|
<item name="afc_ic_button_sort_by_name_desc">@drawable/afc_ic_menu_sort_by_name_desc_dark</item>
|
||||||
|
<item name="afc_ic_button_sort_by_size_asc">@drawable/afc_ic_menu_sort_by_size_asc_dark</item>
|
||||||
|
<item name="afc_ic_button_sort_by_size_desc">@drawable/afc_ic_menu_sort_by_size_desc_dark</item>
|
||||||
|
<item name="afc_button_bar_style">?android:attr/buttonBarStyle</item>
|
||||||
|
<item name="afc_button_bar_button_style">?android:attr/buttonBarButtonStyle</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Afc.BaseTheme.Dialog.Light" parent="@android:style/Theme.Holo.Light.Dialog"></style>
|
<style name="Afc.BaseTheme.Dialog.Light" parent="@android:style/Theme.Holo.Light.Dialog"></style>
|
||||||
|
|
||||||
<style name="Afc.BaseThemeHelper.Dialog.Light" parent="@style/Afc.BaseTheme.Dialog.Light">
|
<style name="Afc.BaseThemeHelper.Dialog.Light" parent="@style/Afc.BaseTheme.Dialog.Light">
|
||||||
<item name="afc_ic_menu_bookmarks">@drawable/afc_ic_menu_bookmarks_light</item>
|
<item name="afc_ic_menu_bookmarks">@drawable/afc_ic_menu_bookmarks_dark</item>
|
||||||
<item name="afc_ic_menu_home">@drawable/afc_ic_menu_home_light</item>
|
<item name="afc_ic_menu_home">@drawable/afc_ic_menu_home_dark</item>
|
||||||
<item name="afc_ic_menu_gridview">@drawable/afc_ic_menu_gridview_light</item>
|
<item name="afc_ic_menu_gridview">@drawable/afc_ic_menu_gridview_dark</item>
|
||||||
<item name="afc_ic_menu_listview">@drawable/afc_ic_menu_listview_light</item>
|
<item name="afc_ic_menu_listview">@drawable/afc_ic_menu_listview_dark</item>
|
||||||
<item name="afc_ic_menu_sort_by_date_asc">@drawable/afc_ic_menu_sort_by_date_asc_light</item>
|
<item name="afc_ic_menu_sort_by_date_asc">@drawable/afc_ic_menu_sort_by_date_asc_dark</item>
|
||||||
<item name="afc_ic_menu_sort_by_date_desc">@drawable/afc_ic_menu_sort_by_date_desc_light</item>
|
<item name="afc_ic_menu_sort_by_date_desc">@drawable/afc_ic_menu_sort_by_date_desc_dark</item>
|
||||||
<item name="afc_ic_menu_sort_by_name_asc">@drawable/afc_ic_menu_sort_by_name_asc_light</item>
|
<item name="afc_ic_menu_sort_by_name_asc">@drawable/afc_ic_menu_sort_by_name_asc_dark</item>
|
||||||
<item name="afc_ic_menu_sort_by_name_desc">@drawable/afc_ic_menu_sort_by_name_desc_light</item>
|
<item name="afc_ic_menu_sort_by_name_desc">@drawable/afc_ic_menu_sort_by_name_desc_dark</item>
|
||||||
<item name="afc_ic_menu_sort_by_size_asc">@drawable/afc_ic_menu_sort_by_size_asc_light</item>
|
<item name="afc_ic_menu_sort_by_size_asc">@drawable/afc_ic_menu_sort_by_size_asc_dark</item>
|
||||||
<item name="afc_ic_menu_sort_by_size_desc">@drawable/afc_ic_menu_sort_by_size_desc_light</item>
|
<item name="afc_ic_menu_sort_by_size_desc">@drawable/afc_ic_menu_sort_by_size_desc_dark</item>
|
||||||
<item name="afc_ic_button_sort_by_date_asc">@drawable/afc_ic_menu_sort_by_date_asc_dark</item>
|
<item name="afc_ic_button_sort_by_date_asc">@drawable/afc_ic_menu_sort_by_date_asc_dark</item>
|
||||||
<item name="afc_ic_button_sort_by_date_desc">@drawable/afc_ic_menu_sort_by_date_desc_dark</item>
|
<item name="afc_ic_button_sort_by_date_desc">@drawable/afc_ic_menu_sort_by_date_desc_dark</item>
|
||||||
<item name="afc_ic_button_sort_by_name_asc">@drawable/afc_ic_menu_sort_by_name_asc_dark</item>
|
<item name="afc_ic_button_sort_by_name_asc">@drawable/afc_ic_menu_sort_by_name_asc_dark</item>
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<style name="Afc.BaseTheme.Light" parent="@style/Theme.AppCompat.Light.DarkActionBar"></style>
|
<style name="Afc.BaseTheme.Light.DarkActionBar" parent="@style/Theme.AppCompat.Light.DarkActionBar"></style>
|
||||||
|
|
||||||
<style name="Afc.BaseThemeHelper.Light" parent="@style/Afc.BaseTheme.Light">
|
<style name="Afc.BaseThemeHelper.Light.DarkActionBar" parent="@style/Afc.BaseTheme.Light.DarkActionBar">
|
||||||
<item name="afc_ic_menu_bookmarks">@drawable/afc_ic_menu_bookmarks_light</item>
|
<item name="afc_ic_menu_bookmarks">@drawable/afc_ic_menu_bookmarks_light</item>
|
||||||
<item name="afc_ic_menu_home">@drawable/afc_ic_menu_home_light</item>
|
<item name="afc_ic_menu_home">@drawable/afc_ic_menu_home_light</item>
|
||||||
<item name="afc_ic_menu_gridview">@drawable/afc_ic_menu_gridview_light</item>
|
<item name="afc_ic_menu_gridview">@drawable/afc_ic_menu_gridview_light</item>
|
||||||
@ -31,4 +31,51 @@
|
|||||||
<item name="afc_button_bar_button_style">?android:attr/buttonBarButtonStyle</item>
|
<item name="afc_button_bar_button_style">?android:attr/buttonBarButtonStyle</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Afc.Theme.Light.DarkActionBar" parent="@style/Afc.BaseThemeHelper.Light.DarkActionBar">
|
||||||
|
|
||||||
|
<!-- AOSP -->
|
||||||
|
|
||||||
|
<item name="android:windowBackground">@drawable/aosp_background_holo_light</item>
|
||||||
|
|
||||||
|
<!-- android-filechooser -->
|
||||||
|
|
||||||
|
<item name="afc_theme_dialog">@style/Afc.Theme.Dialog.Light</item>
|
||||||
|
<item name="afc_button_home">@drawable/afc_button_home_dark</item>
|
||||||
|
<item name="afc_ic_widget_search_view_action_search">@drawable/afc_ic_action_search_dark</item>
|
||||||
|
<item name="afc_ic_widget_search_view_action_clear">@drawable/afc_ic_action_clear_dark</item>
|
||||||
|
<item name="afc_badge_file_provider_localfile">@drawable/afc_badge_file_provider_localfile_dark</item>
|
||||||
|
<item name="afc_selector_image_button">@drawable/afc_selector_image_button_light</item>
|
||||||
|
<item name="afc_selector_button_location">@drawable/afc_selector_button_location_light</item>
|
||||||
|
<item name="afc_selector_main_button_navi_left">@drawable/afc_selector_main_button_navi_left_light</item>
|
||||||
|
<item name="afc_selector_main_button_navi_right">@drawable/afc_selector_main_button_navi_right_light</item>
|
||||||
|
<item name="afc_selector_button_ok_saveas">@drawable/afc_selector_button_ok_saveas_light</item>
|
||||||
|
<item name="afc_selector_action_navi_left_foreground">@drawable/afc_selector_action_navi_left_light_foreground</item>
|
||||||
|
<item name="afc_selector_action_navi_right_foreground">@drawable/afc_selector_action_navi_right_light_foreground</item>
|
||||||
|
<item name="afc_color_listview_cache_hint">@color/afc_listview_cache_hint_light</item>
|
||||||
|
<item name="afc_color_list_group_view_background">@color/afc_list_group_view_background_light</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="Afc.BaseTheme.Light" parent="@style/Theme.AppCompat.Light"></style>
|
||||||
|
|
||||||
|
<style name="Afc.BaseThemeHelper.Light" parent="@style/Afc.BaseTheme.Light">
|
||||||
|
<item name="afc_ic_menu_bookmarks">@drawable/afc_ic_menu_bookmarks_dark</item>
|
||||||
|
<item name="afc_ic_menu_home">@drawable/afc_ic_menu_home_dark</item>
|
||||||
|
<item name="afc_ic_menu_gridview">@drawable/afc_ic_menu_gridview_dark</item>
|
||||||
|
<item name="afc_ic_menu_listview">@drawable/afc_ic_menu_listview_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_date_asc">@drawable/afc_ic_menu_sort_by_date_asc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_date_desc">@drawable/afc_ic_menu_sort_by_date_desc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_name_asc">@drawable/afc_ic_menu_sort_by_name_asc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_name_desc">@drawable/afc_ic_menu_sort_by_name_desc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_size_asc">@drawable/afc_ic_menu_sort_by_size_asc_dark</item>
|
||||||
|
<item name="afc_ic_menu_sort_by_size_desc">@drawable/afc_ic_menu_sort_by_size_desc_dark</item>
|
||||||
|
<item name="afc_ic_button_sort_by_date_asc">@drawable/afc_ic_menu_sort_by_date_asc</item>
|
||||||
|
<item name="afc_ic_button_sort_by_date_desc">@drawable/afc_ic_menu_sort_by_date_desc</item>
|
||||||
|
<item name="afc_ic_button_sort_by_name_asc">@drawable/afc_ic_menu_sort_by_name_asc</item>
|
||||||
|
<item name="afc_ic_button_sort_by_name_desc">@drawable/afc_ic_menu_sort_by_name_desc</item>
|
||||||
|
<item name="afc_ic_button_sort_by_size_asc">@drawable/afc_ic_menu_sort_by_size_asc</item>
|
||||||
|
<item name="afc_ic_button_sort_by_size_desc">@drawable/afc_ic_menu_sort_by_size_desc</item>
|
||||||
|
<item name="afc_button_bar_style">?android:attr/buttonBarStyle</item>
|
||||||
|
<item name="afc_button_bar_button_style">?android:attr/buttonBarButtonStyle</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -8,12 +8,6 @@
|
|||||||
|
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="afc_lib_name">android-filechooser</string>
|
|
||||||
|
|
||||||
<integer name="afc_lib_version_code">51</integer>
|
|
||||||
|
|
||||||
<string name="afc_lib_version_name">5.4</string>
|
|
||||||
|
|
||||||
<bool name="afc_is_large_screen">false</bool>
|
<bool name="afc_is_large_screen">false</bool>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -103,6 +103,17 @@
|
|||||||
<item name="afc_color_list_group_view_background">@color/afc_list_group_view_background_light</item>
|
<item name="afc_color_list_group_view_background">@color/afc_list_group_view_background_light</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
These themes only display the action bar in API 7+.
|
||||||
|
We declare theme here as placeholders.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<style name="Afc.BaseTheme.Light.DarkActionBar" parent="@style/Afc.BaseTheme.Light" />
|
||||||
|
|
||||||
|
<style name="Afc.BaseThemeHelper.Light.DarkActionBar" parent="@style/Afc.BaseThemeHelper.Light" />
|
||||||
|
|
||||||
|
<style name="Afc.Theme.Light.DarkActionBar" parent="@style/Afc.Theme.Light" />
|
||||||
|
|
||||||
<style name="Afc.Theme.Dialog.Light" parent="@style/Afc.BaseThemeHelper.Dialog.Light">
|
<style name="Afc.Theme.Dialog.Light" parent="@style/Afc.BaseThemeHelper.Dialog.Light">
|
||||||
<item name="afc_theme_dialog">@style/Afc.Theme.Dialog.Light</item>
|
<item name="afc_theme_dialog">@style/Afc.Theme.Dialog.Light</item>
|
||||||
<item name="afc_button_home">@drawable/afc_button_home_dark</item>
|
<item name="afc_button_home">@drawable/afc_button_home_dark</item>
|
||||||
|
@ -509,11 +509,11 @@ public class BaseFileAdapter extends ResourceCursorAdapter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final int resId) {
|
public void onClick(final int resId) {
|
||||||
new LoadingDialog(v.getContext(),
|
new LoadingDialog<Void, Void, Void>(v.getContext(),
|
||||||
R.string.afc_msg_loading, false) {
|
R.string.afc_msg_loading, false) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
if (resId == R.string.afc_cmd_advanced_selection_all)
|
if (resId == R.string.afc_cmd_advanced_selection_all)
|
||||||
asyncSelectAll(-1, true);
|
asyncSelectAll(-1, true);
|
||||||
else if (resId == R.string.afc_cmd_advanced_selection_none)
|
else if (resId == R.string.afc_cmd_advanced_selection_none)
|
||||||
@ -532,7 +532,7 @@ public class BaseFileAdapter extends ResourceCursorAdapter {
|
|||||||
}// doInBackground()
|
}// doInBackground()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Object result) {
|
protected void onPostExecute(Void result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}// onPostExecute()
|
}// onPostExecute()
|
||||||
@ -543,4 +543,5 @@ public class BaseFileAdapter extends ResourceCursorAdapter {
|
|||||||
return true;
|
return true;
|
||||||
}// onLongClick()
|
}// onLongClick()
|
||||||
};// mCheckboxSelectionOnLongClickListener
|
};// mCheckboxSelectionOnLongClickListener
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -264,4 +264,5 @@ public class FileChooserActivity extends FragmentActivity {
|
|||||||
|
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}// onKeyDown()
|
}// onKeyDown()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.prefs;
|
package group.pals.android.lib.ui.filechooser.prefs;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import group.pals.android.lib.ui.filechooser.FileChooserActivity.ViewType;
|
import group.pals.android.lib.ui.filechooser.FileChooserActivity.ViewType;
|
||||||
import group.pals.android.lib.ui.filechooser.R;
|
import group.pals.android.lib.ui.filechooser.R;
|
||||||
import group.pals.android.lib.ui.filechooser.providers.basefile.BaseFileContract.BaseFile;
|
import group.pals.android.lib.ui.filechooser.providers.basefile.BaseFileContract.BaseFile;
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display preferences.
|
* Display preferences.
|
||||||
@ -44,7 +44,8 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Gets view type.
|
* Gets view type.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}
|
* @param c
|
||||||
|
* {@link Context}
|
||||||
* @return {@link ViewType}
|
* @return {@link ViewType}
|
||||||
*/
|
*/
|
||||||
public static ViewType getViewType(Context c) {
|
public static ViewType getViewType(Context c) {
|
||||||
@ -58,8 +59,10 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Sets view type.
|
* Sets view type.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}
|
* @param c
|
||||||
* @param v {@link ViewType}, if {@code null}, default value will be used.
|
* {@link Context}
|
||||||
|
* @param v
|
||||||
|
* {@link ViewType}, if {@code null}, default value will be used.
|
||||||
*/
|
*/
|
||||||
public static void setViewType(Context c, ViewType v) {
|
public static void setViewType(Context c, ViewType v) {
|
||||||
String key = c.getString(R.string.afc_pkey_display_view_type);
|
String key = c.getString(R.string.afc_pkey_display_view_type);
|
||||||
@ -76,7 +79,8 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Gets sort type.
|
* Gets sort type.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}
|
* @param c
|
||||||
|
* {@link Context}
|
||||||
* @return one of {@link BaseFile#SORT_BY_MODIFICATION_TIME},
|
* @return one of {@link BaseFile#SORT_BY_MODIFICATION_TIME},
|
||||||
* {@link BaseFile#SORT_BY_NAME}, {@link BaseFile#SORT_BY_SIZE}.
|
* {@link BaseFile#SORT_BY_NAME}, {@link BaseFile#SORT_BY_SIZE}.
|
||||||
*/
|
*/
|
||||||
@ -90,8 +94,10 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Sets {@link SortType}
|
* Sets {@link SortType}
|
||||||
*
|
*
|
||||||
* @param c {@link Context}
|
* @param c
|
||||||
* @param v one of {@link BaseFile#SORT_BY_MODIFICATION_TIME},
|
* {@link Context}
|
||||||
|
* @param v
|
||||||
|
* one of {@link BaseFile#SORT_BY_MODIFICATION_TIME},
|
||||||
* {@link BaseFile#SORT_BY_NAME}, {@link BaseFile#SORT_BY_SIZE}.,
|
* {@link BaseFile#SORT_BY_NAME}, {@link BaseFile#SORT_BY_SIZE}.,
|
||||||
* if {@code null}, default value will be used.
|
* if {@code null}, default value will be used.
|
||||||
*/
|
*/
|
||||||
@ -110,7 +116,8 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Gets sort ascending.
|
* Gets sort ascending.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}
|
* @param c
|
||||||
|
* {@link Context}
|
||||||
* @return {@code true} if sort is ascending, {@code false} otherwise.
|
* @return {@code true} if sort is ascending, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public static boolean isSortAscending(Context c) {
|
public static boolean isSortAscending(Context c) {
|
||||||
@ -123,8 +130,10 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Sets sort ascending.
|
* Sets sort ascending.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}
|
* @param c
|
||||||
* @param v {@link Boolean}, if {@code null}, default value will be used.
|
* {@link Context}
|
||||||
|
* @param v
|
||||||
|
* {@link Boolean}, if {@code null}, default value will be used.
|
||||||
*/
|
*/
|
||||||
public static void setSortAscending(Context c, Boolean v) {
|
public static void setSortAscending(Context c, Boolean v) {
|
||||||
if (v == null)
|
if (v == null)
|
||||||
@ -140,7 +149,8 @@ public class DisplayPrefs extends Prefs {
|
|||||||
* Checks setting of showing time for old days in this year. Default is
|
* Checks setting of showing time for old days in this year. Default is
|
||||||
* {@code false}.
|
* {@code false}.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}.
|
* @param c
|
||||||
|
* {@link Context}.
|
||||||
* @return {@code true} or {@code false}.
|
* @return {@code true} or {@code false}.
|
||||||
* @since v4.7 beta
|
* @since v4.7 beta
|
||||||
*/
|
*/
|
||||||
@ -156,8 +166,10 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Enables or disables showing time of old days in this year.
|
* Enables or disables showing time of old days in this year.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}.
|
* @param c
|
||||||
* @param v your preferred flag. If {@code null}, default will be used (
|
* {@link Context}.
|
||||||
|
* @param v
|
||||||
|
* your preferred flag. If {@code null}, default will be used (
|
||||||
* {@code false}).
|
* {@code false}).
|
||||||
* @since v4.7 beta
|
* @since v4.7 beta
|
||||||
*/
|
*/
|
||||||
@ -176,7 +188,8 @@ public class DisplayPrefs extends Prefs {
|
|||||||
* Checks setting of showing time for old days in last year and older.
|
* Checks setting of showing time for old days in last year and older.
|
||||||
* Default is {@code false}.
|
* Default is {@code false}.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}.
|
* @param c
|
||||||
|
* {@link Context}.
|
||||||
* @return {@code true} or {@code false}.
|
* @return {@code true} or {@code false}.
|
||||||
* @since v4.7 beta
|
* @since v4.7 beta
|
||||||
*/
|
*/
|
||||||
@ -190,8 +203,10 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Enables or disables showing time of old days in last year and older.
|
* Enables or disables showing time of old days in last year and older.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}.
|
* @param c
|
||||||
* @param v your preferred flag. If {@code null}, default will be used (
|
* {@link Context}.
|
||||||
|
* @param v
|
||||||
|
* your preferred flag. If {@code null}, default will be used (
|
||||||
* {@code false}).
|
* {@code false}).
|
||||||
* @since v4.7 beta
|
* @since v4.7 beta
|
||||||
*/
|
*/
|
||||||
@ -208,7 +223,8 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Checks if remembering last location is enabled or not.
|
* Checks if remembering last location is enabled or not.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}.
|
* @param c
|
||||||
|
* {@link Context}.
|
||||||
* @return {@code true} if remembering last location is enabled.
|
* @return {@code true} if remembering last location is enabled.
|
||||||
* @since v4.7 beta
|
* @since v4.7 beta
|
||||||
*/
|
*/
|
||||||
@ -222,8 +238,10 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Enables or disables remembering last location.
|
* Enables or disables remembering last location.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}.
|
* @param c
|
||||||
* @param v your preferred flag. If {@code null}, default will be used (
|
* {@link Context}.
|
||||||
|
* @param v
|
||||||
|
* your preferred flag. If {@code null}, default will be used (
|
||||||
* {@code true}).
|
* {@code true}).
|
||||||
* @since v4.7 beta
|
* @since v4.7 beta
|
||||||
*/
|
*/
|
||||||
@ -240,7 +258,8 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Gets last location.
|
* Gets last location.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}.
|
* @param c
|
||||||
|
* {@link Context}.
|
||||||
* @return the last location, or {@code null} if not available.
|
* @return the last location, or {@code null} if not available.
|
||||||
* @since v4.7 beta
|
* @since v4.7 beta
|
||||||
*/
|
*/
|
||||||
@ -252,8 +271,10 @@ public class DisplayPrefs extends Prefs {
|
|||||||
/**
|
/**
|
||||||
* Sets last location.
|
* Sets last location.
|
||||||
*
|
*
|
||||||
* @param c {@link Context}.
|
* @param c
|
||||||
* @param v the last location.
|
* {@link Context}.
|
||||||
|
* @param v
|
||||||
|
* the last location.
|
||||||
*/
|
*/
|
||||||
public static void setLastLocation(Context c, String v) {
|
public static void setLastLocation(Context c, String v) {
|
||||||
p(c).edit()
|
p(c).edit()
|
||||||
@ -276,8 +297,8 @@ public class DisplayPrefs extends Prefs {
|
|||||||
*/
|
*/
|
||||||
public static class FileTimeDisplay {
|
public static class FileTimeDisplay {
|
||||||
|
|
||||||
private boolean mShowTimeForOldDaysThisYear;
|
public boolean showTimeForOldDaysThisYear;
|
||||||
private boolean mShowTimeForOldDays;
|
public boolean showTimeForOldDays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new instance.
|
* Creates new instance.
|
||||||
@ -287,26 +308,9 @@ public class DisplayPrefs extends Prefs {
|
|||||||
*/
|
*/
|
||||||
public FileTimeDisplay(boolean showTimeForOldDaysThisYear,
|
public FileTimeDisplay(boolean showTimeForOldDaysThisYear,
|
||||||
boolean showTimeForOldDays) {
|
boolean showTimeForOldDays) {
|
||||||
mShowTimeForOldDaysThisYear = showTimeForOldDaysThisYear;
|
this.showTimeForOldDaysThisYear = showTimeForOldDaysThisYear;
|
||||||
mShowTimeForOldDays = showTimeForOldDays;
|
this.showTimeForOldDays = showTimeForOldDays;
|
||||||
}// FileTimeDisplay()
|
}// FileTimeDisplay()
|
||||||
|
|
||||||
public boolean isShowTimeForOldDaysThisYear() {
|
|
||||||
return mShowTimeForOldDaysThisYear;
|
|
||||||
}// isShowTimeForOldDaysThisYear()
|
|
||||||
|
|
||||||
public FileTimeDisplay setShowTimeForOldDaysThisYear(boolean v) {
|
|
||||||
mShowTimeForOldDaysThisYear = v;
|
|
||||||
return this;
|
|
||||||
}// setShowTimeForOldDaysThisYear()
|
|
||||||
|
|
||||||
public boolean isShowTimeForOldDays() {
|
|
||||||
return mShowTimeForOldDays;
|
|
||||||
}// isShowTimeForOldDays()
|
|
||||||
|
|
||||||
public FileTimeDisplay setShowTimeForOldDays(boolean v) {
|
|
||||||
mShowTimeForOldDays = v;
|
|
||||||
return this;
|
|
||||||
}// setShowTimeForOldDays()
|
|
||||||
}// FileTimeDisplay
|
}// FileTimeDisplay
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.prefs;
|
package group.pals.android.lib.ui.filechooser.prefs;
|
||||||
|
|
||||||
|
import group.pals.android.lib.ui.filechooser.utils.Sys;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -14,7 +15,6 @@ import android.os.Build;
|
|||||||
import android.preference.PreferenceActivity;
|
import android.preference.PreferenceActivity;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import group.pals.android.lib.ui.filechooser.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenient class for working with preferences.
|
* Convenient class for working with preferences.
|
||||||
@ -34,37 +34,35 @@ public class Prefs {
|
|||||||
/**
|
/**
|
||||||
* Generates global preference filename of this library.
|
* Generates global preference filename of this library.
|
||||||
*
|
*
|
||||||
* @param context the context.
|
|
||||||
* @return the global preference filename.
|
* @return the global preference filename.
|
||||||
*/
|
*/
|
||||||
public static final String genPreferenceFilename(Context context) {
|
public static final String genPreferenceFilename() {
|
||||||
return String.format("%s_%s", context.getString(R.string.afc_lib_name),
|
return String.format("%s_%s", Sys.LIB_NAME, UID);
|
||||||
UID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates global database filename.
|
* Generates global database filename.
|
||||||
*
|
*
|
||||||
* @param context the context.
|
* @param name
|
||||||
* @param name the database filename.
|
* the database filename.
|
||||||
* @return the global database filename.
|
* @return the global database filename.
|
||||||
*/
|
*/
|
||||||
public static final String genDatabaseFilename(Context context, String name) {
|
public static final String genDatabaseFilename(String name) {
|
||||||
return String.format("%s_%s_%s",
|
return String.format("%s_%s_%s", Sys.LIB_NAME, UID, name);
|
||||||
context.getString(R.string.afc_lib_name), UID, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets new {@link SharedPreferences}
|
* Gets new {@link SharedPreferences}
|
||||||
*
|
*
|
||||||
* @param context the context.
|
* @param context
|
||||||
|
* the context.
|
||||||
* @return {@link SharedPreferences}
|
* @return {@link SharedPreferences}
|
||||||
*/
|
*/
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
public static SharedPreferences p(Context context) {
|
public static SharedPreferences p(Context context) {
|
||||||
// always use application context
|
// always use application context
|
||||||
return context.getApplicationContext().getSharedPreferences(
|
return context.getApplicationContext().getSharedPreferences(
|
||||||
genPreferenceFilename(context), Context.MODE_MULTI_PROCESS);
|
genPreferenceFilename(), Context.MODE_MULTI_PROCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,14 +70,14 @@ public class Prefs {
|
|||||||
* You must use this method if you let the user change preferences via UI
|
* You must use this method if you let the user change preferences via UI
|
||||||
* (such as {@link PreferenceActivity}, {@link PreferenceFragment}...).
|
* (such as {@link PreferenceActivity}, {@link PreferenceFragment}...).
|
||||||
*
|
*
|
||||||
* @param context the context.
|
* @param pm
|
||||||
* @param pm {@link PreferenceManager}.
|
* {@link PreferenceManager}.
|
||||||
* @since v4.9 beta
|
* @since v4.9 beta
|
||||||
*/
|
*/
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
public static void setupPreferenceManager(Context context,
|
public static void setupPreferenceManager(PreferenceManager pm) {
|
||||||
PreferenceManager pm) {
|
|
||||||
pm.setSharedPreferencesMode(Context.MODE_MULTI_PROCESS);
|
pm.setSharedPreferencesMode(Context.MODE_MULTI_PROCESS);
|
||||||
pm.setSharedPreferencesName(genPreferenceFilename(context));
|
pm.setSharedPreferencesName(genPreferenceFilename());
|
||||||
}// setupPreferenceManager()
|
}// setupPreferenceManager()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,4 +32,5 @@ public interface BaseColumns extends android.provider.BaseColumns {
|
|||||||
* </P>
|
* </P>
|
||||||
*/
|
*/
|
||||||
public static final String COLUMN_MODIFICATION_TIME = "modification_time";
|
public static final String COLUMN_MODIFICATION_TIME = "modification_time";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -637,4 +637,5 @@ public class BaseFileProviderUtils {
|
|||||||
Integer.toString(taskId)).build(), null, null,
|
Integer.toString(taskId)).build(), null, null,
|
||||||
null, null);
|
null, null);
|
||||||
}// cancelTask()
|
}// cancelTask()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ public class DbUtils {
|
|||||||
/**
|
/**
|
||||||
* Joins all columns into one statement.
|
* Joins all columns into one statement.
|
||||||
*
|
*
|
||||||
* @param cols array of columns.
|
* @param cols
|
||||||
|
* array of columns.
|
||||||
* @return E.g: "col1,col2,col3"
|
* @return E.g: "col1,col2,col3"
|
||||||
*/
|
*/
|
||||||
public static String joinColumns(String[] cols) {
|
public static String joinColumns(String[] cols) {
|
||||||
@ -60,7 +61,8 @@ public class DbUtils {
|
|||||||
* same length (for a {@link Long}). So it will work when comparing
|
* same length (for a {@link Long}). So it will work when comparing
|
||||||
* different values as text.
|
* different values as text.
|
||||||
*
|
*
|
||||||
* @param n a long value.
|
* @param n
|
||||||
|
* a long value.
|
||||||
* @return the formatted string.
|
* @return the formatted string.
|
||||||
*/
|
*/
|
||||||
public static String formatNumber(long n) {
|
public static String formatNumber(long n) {
|
||||||
@ -71,7 +73,8 @@ public class DbUtils {
|
|||||||
* Calls {@link DatabaseUtils#sqlEscapeString(String)}, then removes single
|
* Calls {@link DatabaseUtils#sqlEscapeString(String)}, then removes single
|
||||||
* quotes at the begin and the end of the returned string.
|
* quotes at the begin and the end of the returned string.
|
||||||
*
|
*
|
||||||
* @param value the string to escape. If {@code null}, empty string will
|
* @param value
|
||||||
|
* the string to escape. If {@code null}, empty string will
|
||||||
* return;
|
* return;
|
||||||
* @return the "raw" escaped-string.
|
* @return the "raw" escaped-string.
|
||||||
*/
|
*/
|
||||||
@ -79,4 +82,5 @@ public class DbUtils {
|
|||||||
return value == null ? "" : DatabaseUtils.sqlEscapeString(value)
|
return value == null ? "" : DatabaseUtils.sqlEscapeString(value)
|
||||||
.replaceFirst("(?msi)^'", "").replaceFirst("(?msi)'$", "");
|
.replaceFirst("(?msi)^'", "").replaceFirst("(?msi)'$", "");
|
||||||
}// rawSqlEscapeString()
|
}// rawSqlEscapeString()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,12 @@ public class ProviderUtils {
|
|||||||
/**
|
/**
|
||||||
* Gets integer parameter.
|
* Gets integer parameter.
|
||||||
*
|
*
|
||||||
* @param uri the original URI.
|
* @param uri
|
||||||
* @param key the key of query parameter.
|
* the original URI.
|
||||||
* @param defaultValue will be returned if nothing found or parsing value failed.
|
* @param key
|
||||||
|
* the key of query parameter.
|
||||||
|
* @param defaultValue
|
||||||
|
* will be returned if nothing found or parsing value failed.
|
||||||
* @return the integer value.
|
* @return the integer value.
|
||||||
*/
|
*/
|
||||||
public static int getIntQueryParam(Uri uri, String key, int defaultValue) {
|
public static int getIntQueryParam(Uri uri, String key, int defaultValue) {
|
||||||
@ -42,9 +45,12 @@ public class ProviderUtils {
|
|||||||
/**
|
/**
|
||||||
* Gets long parameter.
|
* Gets long parameter.
|
||||||
*
|
*
|
||||||
* @param uri the original URI.
|
* @param uri
|
||||||
* @param key the key of query parameter.
|
* the original URI.
|
||||||
* @param defaultValue will be returned if nothing found or parsing value failed.
|
* @param key
|
||||||
|
* the key of query parameter.
|
||||||
|
* @param defaultValue
|
||||||
|
* will be returned if nothing found or parsing value failed.
|
||||||
* @return the long value.
|
* @return the long value.
|
||||||
*/
|
*/
|
||||||
public static long getLongQueryParam(Uri uri, String key, long defaultValue) {
|
public static long getLongQueryParam(Uri uri, String key, long defaultValue) {
|
||||||
@ -58,8 +64,10 @@ public class ProviderUtils {
|
|||||||
/**
|
/**
|
||||||
* Gets boolean parameter.
|
* Gets boolean parameter.
|
||||||
*
|
*
|
||||||
* @param uri the original URI.
|
* @param uri
|
||||||
* @param key the key of query parameter.
|
* the original URI.
|
||||||
|
* @param key
|
||||||
|
* the key of query parameter.
|
||||||
* @return {@code false} if the parameter does not exist, or it is either
|
* @return {@code false} if the parameter does not exist, or it is either
|
||||||
* {@code "false"} or {@code "0"}. {@code true} otherwise.
|
* {@code "false"} or {@code "0"}. {@code true} otherwise.
|
||||||
*/
|
*/
|
||||||
@ -74,9 +82,12 @@ public class ProviderUtils {
|
|||||||
/**
|
/**
|
||||||
* Gets boolean parameter.
|
* Gets boolean parameter.
|
||||||
*
|
*
|
||||||
* @param uri the original URI.
|
* @param uri
|
||||||
* @param key the key of query parameter.
|
* the original URI.
|
||||||
* @param defaultValue the default value if the parameter does not exist.
|
* @param key
|
||||||
|
* the key of query parameter.
|
||||||
|
* @param defaultValue
|
||||||
|
* the default value if the parameter does not exist.
|
||||||
* @return {@code defaultValue} if the parameter does not exist, or it is
|
* @return {@code defaultValue} if the parameter does not exist, or it is
|
||||||
* either {@code "false"} or {@code "0"}. {@code true} otherwise.
|
* either {@code "false"} or {@code "0"}. {@code true} otherwise.
|
||||||
*/
|
*/
|
||||||
@ -89,4 +100,5 @@ public class ProviderUtils {
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}// getBooleanQueryParam()
|
}// getBooleanQueryParam()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -533,4 +533,5 @@ public class BaseFileContract {
|
|||||||
*/
|
*/
|
||||||
public static final String COLUMN_PROVIDER_ICON_ATTR = "provider_icon_attr";
|
public static final String COLUMN_PROVIDER_ICON_ATTR = "provider_icon_attr";
|
||||||
}// BaseFile
|
}// BaseFile
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.providers.bookmark;
|
package group.pals.android.lib.ui.filechooser.providers.bookmark;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
import group.pals.android.lib.ui.filechooser.providers.BaseColumns;
|
import group.pals.android.lib.ui.filechooser.providers.BaseColumns;
|
||||||
import group.pals.android.lib.ui.filechooser.providers.ProviderUtils;
|
import group.pals.android.lib.ui.filechooser.providers.ProviderUtils;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bookmark contract.
|
* Bookmark contract.
|
||||||
@ -121,4 +121,5 @@ public final class BookmarkContract implements BaseColumns {
|
|||||||
* Type: {@code String}
|
* Type: {@code String}
|
||||||
*/
|
*/
|
||||||
public static final String COLUMN_PROVIDER_ID = "provider_id";
|
public static final String COLUMN_PROVIDER_ID = "provider_id";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ public class BookmarkHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
public BookmarkHelper(Context context) {
|
public BookmarkHelper(Context context) {
|
||||||
// always use application context
|
// always use application context
|
||||||
super(context.getApplicationContext(), Prefs.genDatabaseFilename(
|
super(context.getApplicationContext(), Prefs
|
||||||
context, DB_FILENAME), null, DB_VERSION);
|
.genDatabaseFilename(DB_FILENAME), null, DB_VERSION);
|
||||||
}// BookmarkHelper()
|
}// BookmarkHelper()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -59,4 +59,5 @@ public class BookmarkHelper extends SQLiteOpenHelper {
|
|||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
// TODO
|
// TODO
|
||||||
}// onUpgrade()
|
}// onUpgrade()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -359,4 +359,5 @@ public class BookmarkProvider extends ContentProvider {
|
|||||||
// Returns the number of rows updated.
|
// Returns the number of rows updated.
|
||||||
return count;
|
return count;
|
||||||
}// update()
|
}// update()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.providers.history;
|
package group.pals.android.lib.ui.filechooser.providers.history;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.Uri;
|
|
||||||
import group.pals.android.lib.ui.filechooser.providers.BaseColumns;
|
import group.pals.android.lib.ui.filechooser.providers.BaseColumns;
|
||||||
import group.pals.android.lib.ui.filechooser.providers.ProviderUtils;
|
import group.pals.android.lib.ui.filechooser.providers.ProviderUtils;
|
||||||
import group.pals.android.lib.ui.filechooser.providers.basefile.BaseFileContract.BaseFile;
|
import group.pals.android.lib.ui.filechooser.providers.basefile.BaseFileContract.BaseFile;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* History contract.
|
* History contract.
|
||||||
@ -123,4 +123,5 @@ public final class HistoryContract implements BaseColumns {
|
|||||||
* Type: {@code URI}
|
* Type: {@code URI}
|
||||||
*/
|
*/
|
||||||
public static final String COLUMN_URI = "uri";
|
public static final String COLUMN_URI = "uri";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.providers.history;
|
package group.pals.android.lib.ui.filechooser.providers.history;
|
||||||
|
|
||||||
|
import group.pals.android.lib.ui.filechooser.prefs.Prefs;
|
||||||
|
import group.pals.android.lib.ui.filechooser.providers.DbUtils;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import group.pals.android.lib.ui.filechooser.prefs.Prefs;
|
|
||||||
import group.pals.android.lib.ui.filechooser.providers.DbUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SQLite helper for history database.
|
* SQLite helper for history database.
|
||||||
@ -38,8 +38,8 @@ public class HistoryHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
public HistoryHelper(Context context) {
|
public HistoryHelper(Context context) {
|
||||||
// always use application context
|
// always use application context
|
||||||
super(context.getApplicationContext(), Prefs.genDatabaseFilename(
|
super(context.getApplicationContext(), Prefs
|
||||||
context, DB_FILENAME), null, DB_VERSION);
|
.genDatabaseFilename(DB_FILENAME), null, DB_VERSION);
|
||||||
}// HistoryHelper()
|
}// HistoryHelper()
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,4 +54,5 @@ public class HistoryHelper extends SQLiteOpenHelper {
|
|||||||
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
// TODO
|
// TODO
|
||||||
}// onUpgrade()
|
}// onUpgrade()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -422,4 +422,5 @@ public class HistoryProvider extends ContentProvider {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}// appendNameAndRealUri()
|
}// appendNameAndRealUri()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,4 +62,5 @@ public class HistoryProviderUtils {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}// doCleanupOutdatedHistoryItems()
|
}// doCleanupOutdatedHistoryItems()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -130,4 +130,5 @@ public class FileObserverEx extends FileObserver {
|
|||||||
HandlerThreadCompat_v5.quit(mHandlerThread);
|
HandlerThreadCompat_v5.quit(mHandlerThread);
|
||||||
mHandlerThread.interrupt();
|
mHandlerThread.interrupt();
|
||||||
}// stopWatching()
|
}// stopWatching()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,11 @@ public class HandlerThreadCompat_v5 {
|
|||||||
/**
|
/**
|
||||||
* Wrapper for {@link HandlerThread#quit()}.
|
* Wrapper for {@link HandlerThread#quit()}.
|
||||||
*
|
*
|
||||||
* @param thread the handler thread.
|
* @param thread
|
||||||
|
* the handler thread.
|
||||||
*/
|
*/
|
||||||
public static void quit(HandlerThread thread) {
|
public static void quit(HandlerThread thread) {
|
||||||
thread.quit();
|
thread.quit();
|
||||||
}// quit()
|
}// quit()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,8 @@ public class LocalFileContract {
|
|||||||
/**
|
/**
|
||||||
* Gets the authority of this provider.
|
* Gets the authority of this provider.
|
||||||
*
|
*
|
||||||
* @param context the context.
|
* @param context
|
||||||
|
* the context.
|
||||||
* @return the authority.
|
* @return the authority.
|
||||||
*/
|
*/
|
||||||
public static final String getAuthority(Context context) {
|
public static final String getAuthority(Context context) {
|
||||||
@ -36,4 +37,5 @@ public class LocalFileContract {
|
|||||||
* The unique ID of this provider.
|
* The unique ID of this provider.
|
||||||
*/
|
*/
|
||||||
public static final String _ID = "7dab9818-0a8b-47ef-88cc-10fe538bfaf7";
|
public static final String _ID = "7dab9818-0a8b-47ef-88cc-10fe538bfaf7";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -268,15 +268,11 @@ public class LocalFileProvider extends BaseFileProvider {
|
|||||||
else if (BaseFile.CMD_IS_ANCESTOR_OF.equals(uri.getLastPathSegment())) {
|
else if (BaseFile.CMD_IS_ANCESTOR_OF.equals(uri.getLastPathSegment())) {
|
||||||
return doCheckAncestor(uri);
|
return doCheckAncestor(uri);
|
||||||
} else if (BaseFile.CMD_GET_PARENT.equals(uri.getLastPathSegment())) {
|
} else if (BaseFile.CMD_GET_PARENT.equals(uri.getLastPathSegment())) {
|
||||||
String sourcePath = Uri.parse(
|
File file = new File(Uri.parse(
|
||||||
uri.getQueryParameter(BaseFile.PARAM_SOURCE)).getPath();
|
uri.getQueryParameter(BaseFile.PARAM_SOURCE)).getPath());
|
||||||
File file = new File(sourcePath);
|
|
||||||
file = file.getParentFile();
|
file = file.getParentFile();
|
||||||
if (file == null)
|
if (file == null)
|
||||||
{
|
|
||||||
Log.d(CLASSNAME,"returning null as parent for "+sourcePath);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
|
|
||||||
matrixCursor = BaseFileProviderUtils.newBaseFileCursor();
|
matrixCursor = BaseFileProviderUtils.newBaseFileCursor();
|
||||||
|
|
||||||
@ -285,8 +281,6 @@ public class LocalFileProvider extends BaseFileProvider {
|
|||||||
.exists() ? BaseFile.FILE_TYPE_UNKNOWN
|
.exists() ? BaseFile.FILE_TYPE_UNKNOWN
|
||||||
: BaseFile.FILE_TYPE_NOT_EXISTED));
|
: BaseFile.FILE_TYPE_NOT_EXISTED));
|
||||||
|
|
||||||
Log.d(CLASSNAME, "Returning " + Uri.fromFile(file).toString()+" as parent for "+sourcePath);
|
|
||||||
|
|
||||||
RowBuilder newRow = matrixCursor.newRow();
|
RowBuilder newRow = matrixCursor.newRow();
|
||||||
newRow.add(0);// _ID
|
newRow.add(0);// _ID
|
||||||
newRow.add(BaseFile
|
newRow.add(BaseFile
|
||||||
@ -302,7 +296,6 @@ public class LocalFileProvider extends BaseFileProvider {
|
|||||||
newRow.add(type);
|
newRow.add(type);
|
||||||
newRow.add(file.lastModified());
|
newRow.add(file.lastModified());
|
||||||
newRow.add(FileUtils.getResIcon(type, file.getName()));
|
newRow.add(FileUtils.getResIcon(type, file.getName()));
|
||||||
|
|
||||||
} else if (BaseFile.CMD_SHUTDOWN.equals(uri.getLastPathSegment())) {
|
} else if (BaseFile.CMD_SHUTDOWN.equals(uri.getLastPathSegment())) {
|
||||||
/*
|
/*
|
||||||
* TODO Stop all tasks. If the activity call this command in
|
* TODO Stop all tasks. If the activity call this command in
|
||||||
@ -747,4 +740,5 @@ public class LocalFileProvider extends BaseFileProvider {
|
|||||||
|
|
||||||
return new File(fileName);
|
return new File(fileName);
|
||||||
}// extractFile()
|
}// extractFile()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -470,4 +470,5 @@ public class AfcSearchView extends LinearLayout {
|
|||||||
mTextSearch.setText(null);
|
mTextSearch.setText(null);
|
||||||
}// onClick()
|
}// onClick()
|
||||||
};// mButtonClearOnClickListener
|
};// mButtonClearOnClickListener
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -47,4 +47,5 @@ public class Converter {
|
|||||||
String.format("%s %%sB", digitGroups == 0 ? "%,.0f" : "%,.2f"),
|
String.format("%s %%sB", digitGroups == 0 ? "%,.0f" : "%,.2f"),
|
||||||
size, units[digitGroups]);
|
size, units[digitGroups]);
|
||||||
}// sizeToStr()
|
}// sizeToStr()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,13 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.utils;
|
package group.pals.android.lib.ui.filechooser.utils;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import group.pals.android.lib.ui.filechooser.R;
|
import group.pals.android.lib.ui.filechooser.R;
|
||||||
import group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay;
|
import group.pals.android.lib.ui.filechooser.prefs.DisplayPrefs.FileTimeDisplay;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date utilities.
|
* Date utilities.
|
||||||
*
|
*
|
||||||
@ -46,9 +47,12 @@ public class DateUtils {
|
|||||||
/**
|
/**
|
||||||
* Formats date.
|
* Formats date.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}.
|
* @param context
|
||||||
* @param millis time in milliseconds.
|
* {@link Context}.
|
||||||
* @param fileTimeDisplay {@link FileTimeDisplay}.
|
* @param millis
|
||||||
|
* time in milliseconds.
|
||||||
|
* @param fileTimeDisplay
|
||||||
|
* {@link FileTimeDisplay}.
|
||||||
* @return the formatted string
|
* @return the formatted string
|
||||||
*/
|
*/
|
||||||
public static String formatDate(Context context, long millis,
|
public static String formatDate(Context context, long millis,
|
||||||
@ -61,9 +65,12 @@ public class DateUtils {
|
|||||||
/**
|
/**
|
||||||
* Formats date.
|
* Formats date.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}.
|
* @param context
|
||||||
* @param date {@link Calendar}.
|
* {@link Context}.
|
||||||
* @param fileTimeDisplay {@link FileTimeDisplay}.
|
* @param date
|
||||||
|
* {@link Calendar}.
|
||||||
|
* @param fileTimeDisplay
|
||||||
|
* {@link FileTimeDisplay}.
|
||||||
* @return the formatted string, for local human reading.
|
* @return the formatted string, for local human reading.
|
||||||
*/
|
*/
|
||||||
public static String formatDate(Context context, Calendar date,
|
public static String formatDate(Context context, Calendar date,
|
||||||
@ -87,7 +94,7 @@ public class DateUtils {
|
|||||||
date.getTimeInMillis(), FORMAT_SHORT_TIME));
|
date.getTimeInMillis(), FORMAT_SHORT_TIME));
|
||||||
}// yesterday
|
}// yesterday
|
||||||
else if (date.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)) {
|
else if (date.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)) {
|
||||||
if (fileTimeDisplay.isShowTimeForOldDaysThisYear())
|
if (fileTimeDisplay.showTimeForOldDaysThisYear)
|
||||||
res = android.text.format.DateUtils.formatDateTime(context,
|
res = android.text.format.DateUtils.formatDateTime(context,
|
||||||
date.getTimeInMillis(), FORMAT_SHORT_TIME
|
date.getTimeInMillis(), FORMAT_SHORT_TIME
|
||||||
| FORMAT_MONTH_AND_DAY);
|
| FORMAT_MONTH_AND_DAY);
|
||||||
@ -96,7 +103,7 @@ public class DateUtils {
|
|||||||
date.getTimeInMillis(), FORMAT_MONTH_AND_DAY);
|
date.getTimeInMillis(), FORMAT_MONTH_AND_DAY);
|
||||||
}// this year
|
}// this year
|
||||||
else {
|
else {
|
||||||
if (fileTimeDisplay.isShowTimeForOldDays())
|
if (fileTimeDisplay.showTimeForOldDays)
|
||||||
res = android.text.format.DateUtils.formatDateTime(context,
|
res = android.text.format.DateUtils.formatDateTime(context,
|
||||||
date.getTimeInMillis(), FORMAT_SHORT_TIME
|
date.getTimeInMillis(), FORMAT_SHORT_TIME
|
||||||
| FORMAT_MONTH_AND_DAY | FORMAT_YEAR);
|
| FORMAT_MONTH_AND_DAY | FORMAT_YEAR);
|
||||||
@ -108,4 +115,5 @@ public class DateUtils {
|
|||||||
|
|
||||||
return res;
|
return res;
|
||||||
}// formatDate()
|
}// formatDate()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.utils;
|
package group.pals.android.lib.ui.filechooser.utils;
|
||||||
|
|
||||||
|
import group.pals.android.lib.ui.filechooser.R;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -15,7 +16,6 @@ import android.view.ContextThemeWrapper;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import group.pals.android.lib.ui.filechooser.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Something funny :-)
|
* Something funny :-)
|
||||||
@ -27,16 +27,16 @@ public class E {
|
|||||||
/**
|
/**
|
||||||
* Shows it!
|
* Shows it!
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
|
* {@link Context}
|
||||||
*/
|
*/
|
||||||
public static void show(Context context) {
|
public static void show(Context context) {
|
||||||
String msg = null;
|
String msg = null;
|
||||||
try {
|
try {
|
||||||
msg = String.format("Hi :-)\n\n" + "%s %s\n"
|
msg = String.format("Hi :-)\n\n" + "%s v%s\n"
|
||||||
+ "…by Hai Bison Apps\n\n" + "http://www.haibison.com\n\n"
|
+ "…by Hai Bison Apps\n\n" + "http://www.haibison.com\n\n"
|
||||||
+ "Hope you enjoy this library.",
|
+ "Hope you enjoy this library.", Sys.LIB_NAME,
|
||||||
context.getString(R.string.afc_lib_name),
|
Sys.LIB_VERSION_NAME);
|
||||||
context.getString(R.string.afc_lib_version_name));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
msg = "Oops… You've found a broken Easter egg, try again later :-(";
|
msg = "Oops… You've found a broken Easter egg, try again later :-(";
|
||||||
}
|
}
|
||||||
@ -70,4 +70,5 @@ public class E {
|
|||||||
dialog.setContentView(textView);
|
dialog.setContentView(textView);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}// show()
|
}// show()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,4 +28,5 @@ public class EnvUtils {
|
|||||||
public static final int genId() {
|
public static final int genId() {
|
||||||
return mId++;
|
return mId++;
|
||||||
}// genId()
|
}// genId()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -92,4 +92,5 @@ public class FileUtils {
|
|||||||
public static boolean isFilenameValid(String name) {
|
public static boolean isFilenameValid(String name) {
|
||||||
return name != null && name.trim().matches("[^\\\\/?%*:|\"<>]+");
|
return name != null && name.trim().matches("[^\\\\/?%*:|\"<>]+");
|
||||||
}// isFilenameValid()
|
}// isFilenameValid()
|
||||||
|
|
||||||
}
|
}
|
@ -71,4 +71,5 @@ public class MimeTypes {
|
|||||||
public static final String REGEX_FILE_TYPE_COMPRESSED = "(?si)^.+\\.(zip|"
|
public static final String REGEX_FILE_TYPE_COMPRESSED = "(?si)^.+\\.(zip|"
|
||||||
+ "7z|lz?|[jrt]ar|gz|gzip|bzip|xz|cab|sfx|z|iso|bz?|rz|s7z|apk|"
|
+ "7z|lz?|[jrt]ar|gz|gzip|bzip|xz|cab|sfx|z|iso|bz?|rz|s7z|apk|"
|
||||||
+ "dmg)$";
|
+ "dmg)$";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012 Hai Bison
|
||||||
|
*
|
||||||
|
* See the file LICENSE at the root directory of this project for copying
|
||||||
|
* permission.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package group.pals.android.lib.ui.filechooser.utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* System variables.
|
||||||
|
*
|
||||||
|
* @author Hai Bison
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Sys {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The library name.
|
||||||
|
*/
|
||||||
|
public static final String LIB_NAME = "android-filechooser";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The library version name.
|
||||||
|
*/
|
||||||
|
public static final String LIB_VERSION_NAME = "5.4.4 beta";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The library version code.
|
||||||
|
*/
|
||||||
|
public static final int LIB_VERSION_CODE = 56;
|
||||||
|
|
||||||
|
}
|
@ -20,7 +20,8 @@ public class TextUtils {
|
|||||||
/**
|
/**
|
||||||
* Quotes a text in double quotation mark.
|
* Quotes a text in double quotation mark.
|
||||||
*
|
*
|
||||||
* @param s the text, if {@code null}, empty string will be used
|
* @param s
|
||||||
|
* the text, if {@code null}, empty string will be used
|
||||||
* @return the quoted text
|
* @return the quoted text
|
||||||
*/
|
*/
|
||||||
public static String quote(String s) {
|
public static String quote(String s) {
|
||||||
@ -30,7 +31,8 @@ public class TextUtils {
|
|||||||
/**
|
/**
|
||||||
* Compiles {@code regex}.
|
* Compiles {@code regex}.
|
||||||
*
|
*
|
||||||
* @param regex the regex.
|
* @param regex
|
||||||
|
* the regex.
|
||||||
* @return a compiled {@link Pattern}, or {@code null} if there is an error
|
* @return a compiled {@link Pattern}, or {@code null} if there is an error
|
||||||
* while compiling.
|
* while compiling.
|
||||||
*/
|
*/
|
||||||
@ -43,4 +45,5 @@ public class TextUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}// compileRegex()
|
}// compileRegex()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,4 +30,5 @@ public class Utils {
|
|||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}// hasPermissions()
|
}// hasPermissions()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,15 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.utils.history;
|
package group.pals.android.lib.ui.filechooser.utils.history;
|
||||||
|
|
||||||
import android.os.Parcelable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A history store of any object.
|
* A history store of any object.
|
||||||
*
|
*
|
||||||
* @param <A> any type
|
* @param <A>
|
||||||
|
* any type
|
||||||
* @author Hai Bison
|
* @author Hai Bison
|
||||||
* @since v2.0 alpha
|
* @since v2.0 alpha
|
||||||
*/
|
*/
|
||||||
@ -24,14 +25,16 @@ public interface History<A> extends Parcelable {
|
|||||||
* Pushes {@code newItem} to the history. If the top item is same as this
|
* Pushes {@code newItem} to the history. If the top item is same as this
|
||||||
* one, then does nothing.
|
* one, then does nothing.
|
||||||
*
|
*
|
||||||
* @param newItem the new item
|
* @param newItem
|
||||||
|
* the new item
|
||||||
*/
|
*/
|
||||||
void push(A newItem);
|
void push(A newItem);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds {@code item} and if it exists, removes all items after it.
|
* Finds {@code item} and if it exists, removes all items after it.
|
||||||
*
|
*
|
||||||
* @param item {@link A}
|
* @param item
|
||||||
|
* {@link A}
|
||||||
* @return the total items truncated.
|
* @return the total items truncated.
|
||||||
* @since v4.3 beta
|
* @since v4.3 beta
|
||||||
*/
|
*/
|
||||||
@ -40,7 +43,8 @@ public interface History<A> extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Removes an item.
|
* Removes an item.
|
||||||
*
|
*
|
||||||
* @param item {@link A}
|
* @param item
|
||||||
|
* {@link A}
|
||||||
* @since v4.0 beta
|
* @since v4.0 beta
|
||||||
*/
|
*/
|
||||||
void remove(A item);
|
void remove(A item);
|
||||||
@ -48,7 +52,8 @@ public interface History<A> extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Removes all items by a filter.
|
* Removes all items by a filter.
|
||||||
*
|
*
|
||||||
* @param filter {@link HistoryFilter}
|
* @param filter
|
||||||
|
* {@link HistoryFilter}
|
||||||
* @since v4.0 beta
|
* @since v4.0 beta
|
||||||
*/
|
*/
|
||||||
void removeAll(HistoryFilter<A> filter);
|
void removeAll(HistoryFilter<A> filter);
|
||||||
@ -63,7 +68,8 @@ public interface History<A> extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Gets index of item {@code a}
|
* Gets index of item {@code a}
|
||||||
*
|
*
|
||||||
* @param a an item
|
* @param a
|
||||||
|
* an item
|
||||||
* @return index of the {@code a}, or -1 if there is no one
|
* @return index of the {@code a}, or -1 if there is no one
|
||||||
*/
|
*/
|
||||||
int indexOf(A a);
|
int indexOf(A a);
|
||||||
@ -71,7 +77,8 @@ public interface History<A> extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Gets previous item of {@code a}
|
* Gets previous item of {@code a}
|
||||||
*
|
*
|
||||||
* @param a current item
|
* @param a
|
||||||
|
* current item
|
||||||
* @return the previous item, can be {@code null}
|
* @return the previous item, can be {@code null}
|
||||||
*/
|
*/
|
||||||
A prevOf(A a);
|
A prevOf(A a);
|
||||||
@ -79,7 +86,8 @@ public interface History<A> extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Gets next item of {@code a}
|
* Gets next item of {@code a}
|
||||||
*
|
*
|
||||||
* @param a current item
|
* @param a
|
||||||
|
* current item
|
||||||
* @return the next item, can be {@code null}
|
* @return the next item, can be {@code null}
|
||||||
*/
|
*/
|
||||||
A nextOf(A a);
|
A nextOf(A a);
|
||||||
@ -110,7 +118,8 @@ public interface History<A> extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Adds a {@link HistoryListener}
|
* Adds a {@link HistoryListener}
|
||||||
*
|
*
|
||||||
* @param listener {@link HistoryListener}
|
* @param listener
|
||||||
|
* {@link HistoryListener}
|
||||||
* @since v4.0 beta
|
* @since v4.0 beta
|
||||||
*/
|
*/
|
||||||
void addListener(HistoryListener<A> listener);
|
void addListener(HistoryListener<A> listener);
|
||||||
@ -118,7 +127,8 @@ public interface History<A> extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Removes a {@link HistoryListener}
|
* Removes a {@link HistoryListener}
|
||||||
*
|
*
|
||||||
* @param listener {@link HistoryListener}
|
* @param listener
|
||||||
|
* {@link HistoryListener}
|
||||||
* @return the removed listener
|
* @return the removed listener
|
||||||
* @since v4.0 beta
|
* @since v4.0 beta
|
||||||
*/
|
*/
|
||||||
@ -132,12 +142,15 @@ public interface History<A> extends Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Finds items with a filter.
|
* Finds items with a filter.
|
||||||
*
|
*
|
||||||
* @param filter {@link HistoryFilter}
|
* @param filter
|
||||||
* @param ascending {@code true} if you want to process the history list ascending
|
* {@link HistoryFilter}
|
||||||
|
* @param ascending
|
||||||
|
* {@code true} if you want to process the history list ascending
|
||||||
* (oldest to newest), {@code false} for descending.
|
* (oldest to newest), {@code false} for descending.
|
||||||
* @return {@code true} if the desired items have been found, {@code false}
|
* @return {@code true} if the desired items have been found, {@code false}
|
||||||
* otherwise.
|
* otherwise.
|
||||||
* @since v5.1 beta
|
* @since v5.1 beta
|
||||||
*/
|
*/
|
||||||
boolean find(HistoryFilter<A> filter, boolean ascending);
|
boolean find(HistoryFilter<A> filter, boolean ascending);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,10 @@ public interface HistoryFilter<A> {
|
|||||||
/**
|
/**
|
||||||
* Filters item.
|
* Filters item.
|
||||||
*
|
*
|
||||||
* @param item {@link A}
|
* @param item
|
||||||
|
* {@link A}
|
||||||
* @return {@code true} if the {@code item} is accepted
|
* @return {@code true} if the {@code item} is accepted
|
||||||
*/
|
*/
|
||||||
boolean accept(A item);
|
boolean accept(A item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@ public interface HistoryListener<A> {
|
|||||||
/**
|
/**
|
||||||
* Will be called after the history changed.
|
* Will be called after the history changed.
|
||||||
*
|
*
|
||||||
* @param history {@link History}
|
* @param history
|
||||||
|
* {@link History}
|
||||||
*/
|
*/
|
||||||
void onChanged(History<A> history);
|
void onChanged(History<A> history);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -259,4 +259,5 @@ public class HistoryStore<A extends Parcelable> implements History<A> {
|
|||||||
private HistoryStore(Parcel in) {
|
private HistoryStore(Parcel in) {
|
||||||
readFromParcel(in);
|
readFromParcel(in);
|
||||||
}// HistoryStore()
|
}// HistoryStore()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -129,4 +129,5 @@ public class ContextMenuUtils {
|
|||||||
*/
|
*/
|
||||||
void onClick(int resId);
|
void onClick(int resId);
|
||||||
}// OnMenuItemClickListener
|
}// OnMenuItemClickListener
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.utils.ui;
|
package group.pals.android.lib.ui.filechooser.utils.ui;
|
||||||
|
|
||||||
|
import group.pals.android.lib.ui.filechooser.R;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import group.pals.android.lib.ui.filechooser.R;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for message boxes.
|
* Utilities for message boxes.
|
||||||
@ -37,9 +37,12 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows a toast message.
|
* Shows a toast message.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msg the message.
|
* {@link Context}
|
||||||
* @param duration can be {@link #LENGTH_LONG} or {@link #LENGTH_SHORT}.
|
* @param msg
|
||||||
|
* the message.
|
||||||
|
* @param duration
|
||||||
|
* can be {@link #LENGTH_LONG} or {@link #LENGTH_SHORT}.
|
||||||
*/
|
*/
|
||||||
public static void toast(Context context, CharSequence msg, int duration) {
|
public static void toast(Context context, CharSequence msg, int duration) {
|
||||||
if (mToast != null)
|
if (mToast != null)
|
||||||
@ -51,9 +54,12 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows a toast message.
|
* Shows a toast message.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msgId the resource ID of the message.
|
* {@link Context}
|
||||||
* @param duration can be {@link #LENGTH_LONG} or {@link #LENGTH_SHORT}.
|
* @param msgId
|
||||||
|
* the resource ID of the message.
|
||||||
|
* @param duration
|
||||||
|
* can be {@link #LENGTH_LONG} or {@link #LENGTH_SHORT}.
|
||||||
*/
|
*/
|
||||||
public static void toast(Context context, int msgId, int duration) {
|
public static void toast(Context context, int msgId, int duration) {
|
||||||
toast(context, context.getString(msgId), duration);
|
toast(context, context.getString(msgId), duration);
|
||||||
@ -62,9 +68,12 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows an info dialog.
|
* Shows an info dialog.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msg the message.
|
* {@link Context}
|
||||||
* @param listener the {@link DialogInterface.OnDismissListener}.
|
* @param msg
|
||||||
|
* the message.
|
||||||
|
* @param listener
|
||||||
|
* the {@link DialogInterface.OnDismissListener}.
|
||||||
*/
|
*/
|
||||||
public static void showInfo(Context context, CharSequence msg,
|
public static void showInfo(Context context, CharSequence msg,
|
||||||
DialogInterface.OnDismissListener listener) {
|
DialogInterface.OnDismissListener listener) {
|
||||||
@ -79,9 +88,12 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows an info dialog.
|
* Shows an info dialog.
|
||||||
*
|
*
|
||||||
* @param context the context.
|
* @param context
|
||||||
* @param msgId the resource ID of the message.
|
* the context.
|
||||||
* @param listener the {@link DialogInterface.OnDismissListener}.
|
* @param msgId
|
||||||
|
* the resource ID of the message.
|
||||||
|
* @param listener
|
||||||
|
* the {@link DialogInterface.OnDismissListener}.
|
||||||
*/
|
*/
|
||||||
public static void showInfo(Context context, int msgId,
|
public static void showInfo(Context context, int msgId,
|
||||||
DialogInterface.OnDismissListener listener) {
|
DialogInterface.OnDismissListener listener) {
|
||||||
@ -91,8 +103,10 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows an info dialog.
|
* Shows an info dialog.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msg the message.
|
* {@link Context}
|
||||||
|
* @param msg
|
||||||
|
* the message.
|
||||||
*/
|
*/
|
||||||
public static void showInfo(Context context, CharSequence msg) {
|
public static void showInfo(Context context, CharSequence msg) {
|
||||||
showInfo(context, msg, null);
|
showInfo(context, msg, null);
|
||||||
@ -101,8 +115,10 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows an info dialog.
|
* Shows an info dialog.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msgId the resource ID of the message.
|
* {@link Context}
|
||||||
|
* @param msgId
|
||||||
|
* the resource ID of the message.
|
||||||
*/
|
*/
|
||||||
public static void showInfo(Context context, int msgId) {
|
public static void showInfo(Context context, int msgId) {
|
||||||
showInfo(context, context.getString(msgId));
|
showInfo(context, context.getString(msgId));
|
||||||
@ -111,9 +127,12 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows an error message.
|
* Shows an error message.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msg the message.
|
* {@link Context}
|
||||||
* @param listener will be called after the user cancelled the dialog.
|
* @param msg
|
||||||
|
* the message.
|
||||||
|
* @param listener
|
||||||
|
* will be called after the user cancelled the dialog.
|
||||||
*/
|
*/
|
||||||
public static void showError(Context context, CharSequence msg,
|
public static void showError(Context context, CharSequence msg,
|
||||||
DialogInterface.OnCancelListener listener) {
|
DialogInterface.OnCancelListener listener) {
|
||||||
@ -128,9 +147,12 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows an error message.
|
* Shows an error message.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msgId the resource ID of the message.
|
* {@link Context}
|
||||||
* @param listener will be called after the user cancelled the dialog.
|
* @param msgId
|
||||||
|
* the resource ID of the message.
|
||||||
|
* @param listener
|
||||||
|
* will be called after the user cancelled the dialog.
|
||||||
*/
|
*/
|
||||||
public static void showError(Context context, int msgId,
|
public static void showError(Context context, int msgId,
|
||||||
DialogInterface.OnCancelListener listener) {
|
DialogInterface.OnCancelListener listener) {
|
||||||
@ -140,9 +162,12 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows an unknown error.
|
* Shows an unknown error.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param t the {@link Throwable}
|
* {@link Context}
|
||||||
* @param listener will be called after the user cancelled the dialog.
|
* @param t
|
||||||
|
* the {@link Throwable}
|
||||||
|
* @param listener
|
||||||
|
* will be called after the user cancelled the dialog.
|
||||||
*/
|
*/
|
||||||
public static void showUnknownError(Context context, Throwable t,
|
public static void showUnknownError(Context context, Throwable t,
|
||||||
DialogInterface.OnCancelListener listener) {
|
DialogInterface.OnCancelListener listener) {
|
||||||
@ -156,11 +181,15 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows a confirmation dialog.
|
* Shows a confirmation dialog.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msg the message.
|
* {@link Context}
|
||||||
* @param onYes will be called if the user selects positive answer (a
|
* @param msg
|
||||||
|
* the message.
|
||||||
|
* @param onYes
|
||||||
|
* will be called if the user selects positive answer (a
|
||||||
* <i>Yes</i> or <i>OK</i>).
|
* <i>Yes</i> or <i>OK</i>).
|
||||||
* @param onNo will be called after the user cancelled the dialog.
|
* @param onNo
|
||||||
|
* will be called after the user cancelled the dialog.
|
||||||
*/
|
*/
|
||||||
public static void confirmYesno(Context context, CharSequence msg,
|
public static void confirmYesno(Context context, CharSequence msg,
|
||||||
DialogInterface.OnClickListener onYes,
|
DialogInterface.OnClickListener onYes,
|
||||||
@ -178,9 +207,12 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Shows a confirmation dialog.
|
* Shows a confirmation dialog.
|
||||||
*
|
*
|
||||||
* @param context {@link Context}
|
* @param context
|
||||||
* @param msg the message.
|
* {@link Context}
|
||||||
* @param onYes will be called if the user selects positive answer (a
|
* @param msg
|
||||||
|
* the message.
|
||||||
|
* @param onYes
|
||||||
|
* will be called if the user selects positive answer (a
|
||||||
* <i>Yes</i> or <i>OK</i>).
|
* <i>Yes</i> or <i>OK</i>).
|
||||||
*/
|
*/
|
||||||
public static void confirmYesno(Context context, CharSequence msg,
|
public static void confirmYesno(Context context, CharSequence msg,
|
||||||
@ -192,7 +224,8 @@ public class Dlg {
|
|||||||
* Creates new {@link Dialog}. Set canceled on touch outside to {@code true}
|
* Creates new {@link Dialog}. Set canceled on touch outside to {@code true}
|
||||||
* .
|
* .
|
||||||
*
|
*
|
||||||
* @param context the context which uses this library's theme.
|
* @param context
|
||||||
|
* the context which uses this library's theme.
|
||||||
* @return the {@link Dialog}.
|
* @return the {@link Dialog}.
|
||||||
* @since v4.3 beta
|
* @since v4.3 beta
|
||||||
*/
|
*/
|
||||||
@ -207,7 +240,8 @@ public class Dlg {
|
|||||||
* Creates new {@link AlertDialog}. Set canceled on touch outside to
|
* Creates new {@link AlertDialog}. Set canceled on touch outside to
|
||||||
* {@code true}.
|
* {@code true}.
|
||||||
*
|
*
|
||||||
* @param context the context which uses this library's theme.
|
* @param context
|
||||||
|
* the context which uses this library's theme.
|
||||||
* @return {@link AlertDialog}
|
* @return {@link AlertDialog}
|
||||||
* @since v4.3 beta
|
* @since v4.3 beta
|
||||||
*/
|
*/
|
||||||
@ -220,7 +254,8 @@ public class Dlg {
|
|||||||
/**
|
/**
|
||||||
* Creates new {@link AlertDialog.Builder}.
|
* Creates new {@link AlertDialog.Builder}.
|
||||||
*
|
*
|
||||||
* @param context the context which uses this library's theme.
|
* @param context
|
||||||
|
* the context which uses this library's theme.
|
||||||
* @return {@link AlertDialog}
|
* @return {@link AlertDialog}
|
||||||
* @since v4.3 beta
|
* @since v4.3 beta
|
||||||
*/
|
*/
|
||||||
@ -228,4 +263,5 @@ public class Dlg {
|
|||||||
return new AlertDialog.Builder(new ContextThemeWrapper(context,
|
return new AlertDialog.Builder(new ContextThemeWrapper(context,
|
||||||
Ui.resolveAttribute(context, R.attr.afc_theme_dialog)));
|
Ui.resolveAttribute(context, R.attr.afc_theme_dialog)));
|
||||||
}// newAlertDlgBuilder()
|
}// newAlertDlgBuilder()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import android.widget.AbsListView;
|
|||||||
*/
|
*/
|
||||||
public class GestureUtils {
|
public class GestureUtils {
|
||||||
|
|
||||||
public static final String CLASSNAME = GestureUtils.class.getName();
|
private static final String CLASSNAME = GestureUtils.class.getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The fling direction.
|
* The fling direction.
|
||||||
@ -218,4 +218,5 @@ public class GestureUtils {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}// setupGestureDetector()
|
}// setupGestureDetector()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
package group.pals.android.lib.ui.filechooser.utils.ui;
|
package group.pals.android.lib.ui.filechooser.utils.ui;
|
||||||
|
|
||||||
|
import group.pals.android.lib.ui.filechooser.R;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -21,9 +22,10 @@ import android.util.Log;
|
|||||||
* @author Hai Bison
|
* @author Hai Bison
|
||||||
* @since v2.1 alpha
|
* @since v2.1 alpha
|
||||||
*/
|
*/
|
||||||
public abstract class LoadingDialog extends AsyncTask<Void, Void, Object> {
|
public abstract class LoadingDialog<Params, Progress, Result> extends
|
||||||
|
AsyncTask<Params, Progress, Result> {
|
||||||
|
|
||||||
public static final String CLASSNAME = LoadingDialog.class.getName();
|
private static final String CLASSNAME = LoadingDialog.class.getName();
|
||||||
|
|
||||||
private final ProgressDialog mDialog;
|
private final ProgressDialog mDialog;
|
||||||
/**
|
/**
|
||||||
@ -62,7 +64,7 @@ public abstract class LoadingDialog extends AsyncTask<Void, Void, Object> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}// LoadingDialog
|
}// LoadingDialog()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new {@link LoadingDialog}
|
* Creates new {@link LoadingDialog}
|
||||||
@ -76,12 +78,26 @@ public abstract class LoadingDialog extends AsyncTask<Void, Void, Object> {
|
|||||||
*/
|
*/
|
||||||
public LoadingDialog(Context context, int msgId, boolean cancelable) {
|
public LoadingDialog(Context context, int msgId, boolean cancelable) {
|
||||||
this(context, context.getString(msgId), cancelable);
|
this(context, context.getString(msgId), cancelable);
|
||||||
}
|
}// LoadingDialog()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates new {@link LoadingDialog} showing "Loading..." (
|
||||||
|
* {@link R.string#afc_msg_loading}).
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* {@link Context}
|
||||||
|
* @param cancelable
|
||||||
|
* as the name means.
|
||||||
|
*/
|
||||||
|
public LoadingDialog(Context context, boolean cancelable) {
|
||||||
|
this(context, context.getString(R.string.afc_msg_loading), cancelable);
|
||||||
|
}// LoadingDialog()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you override this method, you must call {@code super.onPreExecute()}
|
* If you override this method, you must call {@code super.onPreExecute()}
|
||||||
* at very first of the method.
|
* at very first of the method.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
|
||||||
@ -107,7 +123,8 @@ public abstract class LoadingDialog extends AsyncTask<Void, Void, Object> {
|
|||||||
* If you override this method, you must call
|
* If you override this method, you must call
|
||||||
* {@code super.onPostExecute(result)} at the entry point of the method.
|
* {@code super.onPostExecute(result)} at the entry point of the method.
|
||||||
*/
|
*/
|
||||||
protected void onPostExecute(Object result) {
|
@Override
|
||||||
|
protected void onPostExecute(Result result) {
|
||||||
doFinish();
|
doFinish();
|
||||||
}// onPostExecute()
|
}// onPostExecute()
|
||||||
|
|
||||||
@ -115,6 +132,7 @@ public abstract class LoadingDialog extends AsyncTask<Void, Void, Object> {
|
|||||||
* If you override this method, you must call {@code super.onCancelled()} at
|
* If you override this method, you must call {@code super.onCancelled()} at
|
||||||
* the entry point of the method.
|
* the entry point of the method.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void onCancelled() {
|
protected void onCancelled() {
|
||||||
doFinish();
|
doFinish();
|
||||||
super.onCancelled();
|
super.onCancelled();
|
||||||
@ -148,9 +166,10 @@ public abstract class LoadingDialog extends AsyncTask<Void, Void, Object> {
|
|||||||
*
|
*
|
||||||
* @param delayTime
|
* @param delayTime
|
||||||
* the delay time to set
|
* the delay time to set
|
||||||
* @return {@link LoadingDialog}
|
* @return the instance of this dialog, for chaining multiple calls into a
|
||||||
|
* single statement.
|
||||||
*/
|
*/
|
||||||
public LoadingDialog setDelayTime(int delayTime) {
|
public LoadingDialog<Params, Progress, Result> setDelayTime(int delayTime) {
|
||||||
mDelayTime = delayTime >= 0 ? delayTime : 0;
|
mDelayTime = delayTime >= 0 ? delayTime : 0;
|
||||||
return this;
|
return this;
|
||||||
}// setDelayTime()
|
}// setDelayTime()
|
||||||
@ -174,4 +193,5 @@ public abstract class LoadingDialog extends AsyncTask<Void, Void, Object> {
|
|||||||
protected Throwable getLastException() {
|
protected Throwable getLastException() {
|
||||||
return mLastException;
|
return mLastException;
|
||||||
}// getLastException()
|
}// getLastException()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -65,4 +65,5 @@ public class MenuItemAdapter extends BaseAdapter {
|
|||||||
|
|
||||||
return convertView;
|
return convertView;
|
||||||
}// getView()
|
}// getView()
|
||||||
|
|
||||||
}
|
}
|
@ -24,4 +24,5 @@ public interface TaskListener {
|
|||||||
* the user data, can be {@code null}.
|
* the user data, can be {@code null}.
|
||||||
*/
|
*/
|
||||||
public void onFinish(boolean ok, Object any);
|
public void onFinish(boolean ok, Object any);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -145,4 +145,5 @@ public class Ui {
|
|||||||
dialogWindow.setLayout(width, height);
|
dialogWindow.setLayout(width, height);
|
||||||
}
|
}
|
||||||
}// adjustDialogSizeForLargeScreen()
|
}// adjustDialogSizeForLargeScreen()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -566,4 +566,5 @@ public class BookmarkCursorAdapter extends ResourceCursorTreeAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}// markItemAsDeleted()
|
}// markItemAsDeleted()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import java.util.List;
|
|||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
|
import android.content.ContentUris;
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
@ -660,9 +661,8 @@ public class BookmarkFragment extends DialogFragment implements
|
|||||||
BookmarkContract.COLUMN_MODIFICATION_TIME,
|
BookmarkContract.COLUMN_MODIFICATION_TIME,
|
||||||
DbUtils.formatNumber(new Date().getTime()));
|
DbUtils.formatNumber(new Date().getTime()));
|
||||||
context.getContentResolver().update(
|
context.getContentResolver().update(
|
||||||
Uri.withAppendedPath(BookmarkContract
|
ContentUris.withAppendedId(BookmarkContract
|
||||||
.genContentIdUriBase(context), Uri
|
.genContentIdUriBase(context), id),
|
||||||
.encode(Integer.toString(id))),
|
|
||||||
values, null, null);
|
values, null, null);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
@ -801,4 +801,5 @@ public class BookmarkFragment extends DialogFragment implements
|
|||||||
setEditor(false);
|
setEditor(false);
|
||||||
}// onClick()
|
}// onClick()
|
||||||
};// mBtnOkOnClickListener
|
};// mBtnOkOnClickListener
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -610,4 +610,5 @@ public class HistoryCursorAdapter extends ResourceCursorTreeAdapter {
|
|||||||
return android.text.format.DateUtils.formatDateTime(c, millis,
|
return android.text.format.DateUtils.formatDateTime(c, millis,
|
||||||
DateUtils.FORMAT_SHORT_TIME);
|
DateUtils.FORMAT_SHORT_TIME);
|
||||||
}// formatTime()
|
}// formatTime()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,7 @@ public class HistoryFragment extends DialogFragment implements
|
|||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface arg0, int arg1) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
getActivity().getContentResolver().delete(
|
getActivity().getContentResolver().delete(
|
||||||
HistoryContract.genContentUri(getActivity()),
|
HistoryContract.genContentUri(getActivity()),
|
||||||
null, null);
|
null, null);
|
||||||
@ -771,4 +771,5 @@ public class HistoryFragment extends DialogFragment implements
|
|||||||
return false;
|
return false;
|
||||||
}// onItemLongClick()
|
}// onItemLongClick()
|
||||||
};// mListViewOnItemLongClickListener
|
};// mListViewOnItemLongClickListener
|
||||||
|
|
||||||
}
|
}
|
||||||
|