Merge branch 'android-filechooser-orig'

Conflicts:
	src/java/android-filechooser/code/project.properties
	src/java/android-filechooser/code/res/drawable-hdpi/afc_ic_menu_bookmarks.png
	src/java/android-filechooser/code/res/drawable-hdpi/afc_ic_menu_bookmarks_dark.png
	src/java/android-filechooser/code/res/drawable-hdpi/afc_ic_menu_bookmarks_light.png
	src/java/android-filechooser/code/res/drawable-mdpi/afc_ic_menu_bookmarks.png
	src/java/android-filechooser/code/res/drawable-mdpi/afc_ic_menu_bookmarks_dark.png
	src/java/android-filechooser/code/res/drawable-mdpi/afc_ic_menu_bookmarks_light.png
	src/java/android-filechooser/code/res/drawable-xhdpi/afc_ic_menu_bookmarks.png
	src/java/android-filechooser/code/res/drawable-xhdpi/afc_ic_menu_bookmarks_dark.png
	src/java/android-filechooser/code/res/drawable-xhdpi/afc_ic_menu_bookmarks_light.png
	src/java/android-filechooser/code/res/drawable-xxhdpi/afc_ic_menu_bookmarks_dark.png
	src/java/android-filechooser/code/res/drawable-xxhdpi/afc_ic_menu_bookmarks_light.png
	src/java/android-filechooser/code/res/values-v11/themes_light.xml
	src/java/android-filechooser/code/res/values-v7/themes_light.xml
	src/java/android-filechooser/code/res/values/env.xml
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/FragmentFiles.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/providers/BaseFileProviderUtils.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/providers/bookmark/BookmarkContract.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/providers/bookmark/BookmarkHelper.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/providers/bookmark/BookmarkProvider.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/utils/Sys.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/utils/Utils.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/utils/ui/LoadingDialog.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/utils/ui/bookmark/BookmarkCursorAdapter.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/utils/ui/bookmark/BookmarkFragment.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/utils/ui/history/HistoryCursorAdapter.java
	src/java/android-filechooser/code/src/group/pals/android/lib/ui/filechooser/utils/ui/history/HistoryFragment.java
This commit is contained in:
Philipp Crocoll 2013-10-25 04:45:52 +02:00
commit 55da547141
47 changed files with 883 additions and 758 deletions

View File

@ -1,6 +1,6 @@
# android-filechooser
* Version: 5.4
* Version: 5.4.4 beta
Feel free to contact us at:
@ -18,11 +18,31 @@ project. We hope this project will be always useful for everyone.
* C
* Simon McCorkindale
+ [Website](http://www.aroha.mobi/)
* Philipp Crocoll
+ Author of open source project [Keepass2Android](https://keepass2android.codeplex.com/)
* And others.
# 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
+ *Release:* August 02, 2013
+ Integrate library `android-support-v7-appcompat` for action bar in APIs

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<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.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

View File

@ -7,12 +7,10 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="group.pals.android.lib.ui.filechooser"
android:versionCode="@integer/afc_lib_version_code"
android:versionName="@string/afc_lib_version_name" >
package="group.pals.android.lib.ui.filechooser" >
<uses-sdk
android:minSdkVersion="4"
android:targetSdkVersion="17" />
android:targetSdkVersion="18" />
</manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 885 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 B

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 926 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -265,4 +265,5 @@ public class FileChooserActivity extends FragmentActivity {
return super.onKeyDown(keyCode, event);
}// onKeyDown()
}

View File

@ -7,14 +7,14 @@
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.R;
import group.pals.android.lib.ui.filechooser.providers.basefile.BaseFileContract.BaseFile;
import android.content.Context;
/**
* Display preferences.
*
*
* @author Hai Bison
* @since v4.3 beta
*/
@ -43,8 +43,9 @@ public class DisplayPrefs extends Prefs {
/**
* Gets view type.
*
* @param c {@link Context}
*
* @param c
* {@link Context}
* @return {@link ViewType}
*/
public static ViewType getViewType(Context c) {
@ -57,9 +58,11 @@ public class DisplayPrefs extends Prefs {
/**
* Sets view type.
*
* @param c {@link Context}
* @param v {@link ViewType}, if {@code null}, default value will be used.
*
* @param c
* {@link Context}
* @param v
* {@link ViewType}, if {@code null}, default value will be used.
*/
public static void setViewType(Context c, ViewType v) {
String key = c.getString(R.string.afc_pkey_display_view_type);
@ -75,8 +78,9 @@ public class DisplayPrefs extends Prefs {
/**
* Gets sort type.
*
* @param c {@link Context}
*
* @param c
* {@link Context}
* @return one of {@link BaseFile#SORT_BY_MODIFICATION_TIME},
* {@link BaseFile#SORT_BY_NAME}, {@link BaseFile#SORT_BY_SIZE}.
*/
@ -89,11 +93,13 @@ public class DisplayPrefs extends Prefs {
/**
* Sets {@link SortType}
*
* @param c {@link Context}
* @param v one of {@link BaseFile#SORT_BY_MODIFICATION_TIME},
* {@link BaseFile#SORT_BY_NAME}, {@link BaseFile#SORT_BY_SIZE}.,
* if {@code null}, default value will be used.
*
* @param c
* {@link Context}
* @param v
* one of {@link BaseFile#SORT_BY_MODIFICATION_TIME},
* {@link BaseFile#SORT_BY_NAME}, {@link BaseFile#SORT_BY_SIZE}.,
* if {@code null}, default value will be used.
*/
public static void setSortType(Context c, Integer v) {
String key = c.getString(R.string.afc_pkey_display_sort_type);
@ -109,8 +115,9 @@ public class DisplayPrefs extends Prefs {
/**
* Gets sort ascending.
*
* @param c {@link Context}
*
* @param c
* {@link Context}
* @return {@code true} if sort is ascending, {@code false} otherwise.
*/
public static boolean isSortAscending(Context c) {
@ -122,9 +129,11 @@ public class DisplayPrefs extends Prefs {
/**
* Sets sort ascending.
*
* @param c {@link Context}
* @param v {@link Boolean}, if {@code null}, default value will be used.
*
* @param c
* {@link Context}
* @param v
* {@link Boolean}, if {@code null}, default value will be used.
*/
public static void setSortAscending(Context c, Boolean v) {
if (v == null)
@ -139,8 +148,9 @@ public class DisplayPrefs extends Prefs {
/**
* Checks setting of showing time for old days in this year. Default is
* {@code false}.
*
* @param c {@link Context}.
*
* @param c
* {@link Context}.
* @return {@code true} or {@code false}.
* @since v4.7 beta
*/
@ -155,10 +165,12 @@ public class DisplayPrefs extends Prefs {
/**
* Enables or disables showing time of old days in this year.
*
* @param c {@link Context}.
* @param v your preferred flag. If {@code null}, default will be used (
* {@code false}).
*
* @param c
* {@link Context}.
* @param v
* your preferred flag. If {@code null}, default will be used (
* {@code false}).
* @since v4.7 beta
*/
public static void setShowTimeForOldDaysThisYear(Context c, Boolean v) {
@ -175,8 +187,9 @@ public class DisplayPrefs extends Prefs {
/**
* Checks setting of showing time for old days in last year and older.
* Default is {@code false}.
*
* @param c {@link Context}.
*
* @param c
* {@link Context}.
* @return {@code true} or {@code false}.
* @since v4.7 beta
*/
@ -189,10 +202,12 @@ public class DisplayPrefs extends Prefs {
/**
* Enables or disables showing time of old days in last year and older.
*
* @param c {@link Context}.
* @param v your preferred flag. If {@code null}, default will be used (
* {@code false}).
*
* @param c
* {@link Context}.
* @param v
* your preferred flag. If {@code null}, default will be used (
* {@code false}).
* @since v4.7 beta
*/
public static void setShowTimeForOldDays(Context c, Boolean v) {
@ -207,8 +222,9 @@ public class DisplayPrefs extends Prefs {
/**
* 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.
* @since v4.7 beta
*/
@ -218,10 +234,12 @@ public class DisplayPrefs extends Prefs {
/**
* Enables or disables remembering last location.
*
* @param c {@link Context}.
* @param v your preferred flag. If {@code null}, default will be used (
* {@code true}).
*
* @param c
* {@link Context}.
* @param v
* your preferred flag. If {@code null}, default will be used (
* {@code true}).
* @since v4.7 beta
*/
public static void setRememberLastLocation(Context c, Boolean v) {
@ -236,8 +254,9 @@ public class DisplayPrefs extends Prefs {
/**
* Gets last location.
*
* @param c {@link Context}.
*
* @param c
* {@link Context}.
* @return the last location, or {@code null} if not available.
* @since v4.7 beta
*/
@ -248,9 +267,11 @@ public class DisplayPrefs extends Prefs {
/**
* Sets last location.
*
* @param c {@link Context}.
* @param v the last location.
*
* @param c
* {@link Context}.
* @param v
* the last location.
*/
public static void setLastLocation(Context c, String v) {
p(c).edit()
@ -265,7 +286,7 @@ public class DisplayPrefs extends Prefs {
/**
* File time display options.
*
*
* @author Hai Bison
* @see DisplayPrefs#isShowTimeForOldDaysThisYear(Context)
* @see DisplayPrefs#isShowTimeForOldDays(Context)
@ -273,37 +294,20 @@ public class DisplayPrefs extends Prefs {
*/
public static class FileTimeDisplay {
private boolean mShowTimeForOldDaysThisYear;
private boolean mShowTimeForOldDays;
public boolean showTimeForOldDaysThisYear;
public boolean showTimeForOldDays;
/**
* Creates new instance.
*
*
* @param showTimeForOldDaysThisYear
* @param showTimeForOldDays
*/
public FileTimeDisplay(boolean showTimeForOldDaysThisYear,
boolean showTimeForOldDays) {
mShowTimeForOldDaysThisYear = showTimeForOldDaysThisYear;
mShowTimeForOldDays = showTimeForOldDays;
boolean showTimeForOldDays) {
this.showTimeForOldDaysThisYear = showTimeForOldDaysThisYear;
this.showTimeForOldDays = showTimeForOldDays;
}// 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
}

View File

@ -9,7 +9,7 @@ package group.pals.android.lib.ui.filechooser.providers;
/**
* The base columns.
*
*
* @author Hai Bison
* @since v5.1 beta
*/
@ -32,4 +32,5 @@ public interface BaseColumns extends android.provider.BaseColumns {
* </P>
*/
public static final String COLUMN_MODIFICATION_TIME = "modification_time";
}

View File

@ -16,14 +16,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
/**
* Utilities for base file provider.
@ -118,10 +115,11 @@ public class BaseFileProviderUtils {
String result = getProviderName(providerId);
if (result == null) {
Cursor cursor = queryInBackground(
context,
BaseFile.genContentUriApi(getProviderAuthority(providerId)),
null, null, null, null);
Cursor cursor = context
.getContentResolver()
.query(BaseFile
.genContentUriApi(getProviderAuthority(providerId)),
null, null, null, null);
if (cursor == null)
return null;
@ -167,10 +165,11 @@ public class BaseFileProviderUtils {
int attr = MAP_PROVIDER_INFO.get(providerId).getInt(
BaseFile.COLUMN_PROVIDER_ICON_ATTR);
if (attr == 0) {
Cursor cursor = queryInBackground(
context,
BaseFile.genContentUriApi(getProviderAuthority(providerId)),
null, null, null, null);
Cursor cursor = context
.getContentResolver()
.query(BaseFile
.genContentUriApi(getProviderAuthority(providerId)),
null, null, null, null);
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
@ -250,8 +249,8 @@ public class BaseFileProviderUtils {
* otherwise.
*/
public static boolean isDirectory(Context context, Uri uri) {
//Log.d("AFC", "isDir? "+uri.toString());
Cursor cursor = queryInBackground(context, uri, null, null, null, null);
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
if (cursor == null)
return false;
@ -286,8 +285,8 @@ public class BaseFileProviderUtils {
* @return {@code true} if {@code uri} is a file, {@code false} otherwise.
*/
public static boolean isFile(Context context, Uri uri) {
//Log.d("AFC", "isFile? "+uri.toString());
Cursor cursor = queryInBackground(context, uri, null, null, null, null);
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
if (cursor == null)
return false;
@ -321,8 +320,8 @@ public class BaseFileProviderUtils {
* @return the file name if {@code uri} is a file, {@code null} otherwise.
*/
public static String getFileName(Context context, Uri uri) {
//Log.d("AFC", "getFileName "+uri.toString());
Cursor cursor = queryInBackground(context, uri, null, null, null, null);
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
if (cursor == null)
return null;
@ -359,8 +358,8 @@ public class BaseFileProviderUtils {
* @return the real URI of {@code uri}.
*/
public static Uri getRealUri(Context context, Uri uri) {
//Log.d("AFC", "getRealUri "+uri.toString());
Cursor cursor = queryInBackground(context, uri, null, null, null, null);
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
if (cursor == null)
return null;
@ -400,8 +399,8 @@ public class BaseFileProviderUtils {
* {@link #FILE_TYPE_UNKNOWN}, {@link #FILE_TYPE_NOT_EXISTED}.
*/
public static int getFileType(Context context, Uri uri) {
//Log.d("AFC", "filetype? "+uri.toString());
Cursor cursor = queryInBackground(context, uri, null, null, null, null);
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
if (cursor == null)
return BaseFile.FILE_TYPE_NOT_EXISTED;
@ -449,8 +448,8 @@ public class BaseFileProviderUtils {
* @return {@code true} or {@code false}.
*/
public static boolean fileExists(Context context, Uri uri) {
//Log.d("AFC", "exists? "+uri.toString());
Cursor cursor = queryInBackground(context, uri, null, null, null, null);
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
if (cursor == null)
return false;
@ -474,8 +473,8 @@ public class BaseFileProviderUtils {
* @return {@code true} or {@code false}.
*/
public static boolean fileCanRead(Context context, Uri uri) {
//Log.d("AFC", "canread? "+uri.toString());
Cursor cursor = queryInBackground(context, uri, null, null, null, null);
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
if (cursor == null)
return false;
@ -511,8 +510,8 @@ public class BaseFileProviderUtils {
* @return {@code true} or {@code false}.
*/
public static boolean fileCanWrite(Context context, Uri uri) {
//Log.d("AFC", "canWrite? "+uri.toString());
Cursor cursor = queryInBackground(context, uri, null, null, null, null);
Cursor cursor = context.getContentResolver().query(uri, null, null,
null, null);
if (cursor == null)
return false;
@ -548,8 +547,7 @@ public class BaseFileProviderUtils {
* @return the default path, can be {@code null}.
*/
public static Uri getDefaultPath(Context context, String authority) {
Cursor cursor = queryInBackground(
context,
Cursor cursor = context.getContentResolver().query(
BaseFile.genContentUriApi(authority).buildUpon()
.appendPath(BaseFile.CMD_GET_DEFAULT_PATH).build(),
null, null, null, null);
@ -576,8 +574,7 @@ public class BaseFileProviderUtils {
* @return the parent file if it exists, {@code null} otherwise.
*/
public static Uri getParentFile(Context context, Uri uri) {
Cursor cursor = queryInBackground(
context,
Cursor cursor = context.getContentResolver().query(
BaseFile.genContentUriApi(uri.getAuthority())
.buildUpon()
.appendPath(BaseFile.CMD_GET_PARENT)
@ -610,8 +607,7 @@ public class BaseFileProviderUtils {
* {@code false} otherwise.
*/
public static boolean isAncestorOf(Context context, Uri uri1, Uri uri2) {
return queryInBackground(
context,
return context.getContentResolver().query(
BaseFile.genContentUriApi(uri1.getAuthority())
.buildUpon()
.appendPath(BaseFile.CMD_IS_ANCESTOR_OF)
@ -633,8 +629,7 @@ public class BaseFileProviderUtils {
* the task ID.
*/
public static void cancelTask(Context context, String authority, int taskId) {
queryInBackground(
context,
context.getContentResolver().query(
BaseFile.genContentUriApi(authority)
.buildUpon()
.appendPath(BaseFile.CMD_CANCEL)
@ -643,185 +638,4 @@ public class BaseFileProviderUtils {
null, null);
}// cancelTask()
/**
* Creates new background thread to delete given URI, waits for the thread
* to finish (or be interrupted) and returns the result.
*
* @param context
* the context.
* @param uri
* the URI to delete, see
* {@link ContentResolver#delete(Uri, String, String[])} for more
* details.
* @param where
* the {@code WHERE} clause, see
* {@link ContentResolver#delete(Uri, String, String[])} for more
* details.
* @param selectionArgs
* the selection arguments, see
* {@link ContentResolver#delete(Uri, String, String[])} for more
* details.
* @return the value returned from
* {@link ContentResolver#delete(Uri, String, String[])} , or
* {@code -1} if an error occurred.
*/
public static int deleteInBackground(final Context context, final Uri uri,
final String where, final String[] selectionArgs) {
final int[] result = { 0 };
Thread thread = new Thread() {
@Override
public void run() {
result[0] = context.getContentResolver().delete(uri, where,
selectionArgs);
}// run()
};
thread.start();
try {
thread.join();
return result[0];
} catch (InterruptedException e) {
return -1;
}
}// deleteInBackground()
/**
* Creates new background thread to insert values to given URI, waits for
* the thread to finish (or be interrupted) and returns the result.
*
* @param context
* the context.
* @param uri
* the URI to insert values into, see
* {@link ContentResolver#insert(Uri, ContentValues)} for more
* details.
* @param values
* the values to insert into, see
* {@link ContentResolver#insert(Uri, ContentValues)} for more
* details.
* @return the URI returned from
* {@link ContentResolver#insert(Uri, ContentValues)}, or
* {@code null} if an error occurred.
*/
public static Uri insertInBackground(final Context context, final Uri uri,
final ContentValues values) {
final Uri[] result = { null };
Thread thread = new Thread() {
@Override
public void run() {
result[0] = context.getContentResolver().insert(uri, values);
}// run()
};
thread.start();
try {
thread.join();
return result[0];
} catch (InterruptedException e) {
return null;
}
}// insertInBackground()
/**
* Creates new background thread to query given URI, waits for the thread to
* finish (or be interrupted) and returns the result.
*
* @param context
* the context.
* @param uri
* the URI to query, see
* {@link ContentResolver#query(Uri, String[], String, String[], String)}
* for more details.
* @param projection
* the projection, see
* {@link ContentResolver#query(Uri, String[], String, String[], String)}
* for more details.
* @param selection
* the selection, see
* {@link ContentResolver#query(Uri, String[], String, String[], String)}
* for more details.
* @param selectionArgs
* the selection arguments, see
* {@link ContentResolver#query(Uri, String[], String, String[], String)}
* for more details.
* @param sortOrder
* the sort order, see
* {@link ContentResolver#query(Uri, String[], String, String[], String)}
* for more details.
* @return the cursor returned from
* {@link ContentResolver#query(Uri, String[], String, String[], String)}
* , or {@code null} if an error occurred.
*/
public static Cursor queryInBackground(final Context context,
final Uri uri, final String[] projection, final String selection,
final String[] selectionArgs, final String sortOrder) {
final Cursor[] result = { null };
Thread thread = new Thread() {
@Override
public void run() {
result[0] = context.getContentResolver().query(uri, projection,
selection, selectionArgs, sortOrder);
}// run()
};
thread.start();
try {
thread.join();
return result[0];
} catch (InterruptedException e) {
return null;
}
}// queryInBackground()
/**
* Creates new background thread to update given URI, waits for the thread
* to finish (or be interrupted) and returns the result.
*
* @param context
* the context.
* @param uri
* the URI to update, see
* {@link ContentResolver#update(Uri, ContentValues, String, String[])}
* for more details.
* @param values
* the values to update, see
* {@link ContentResolver#update(Uri, ContentValues, String, String[])}
* for more details.
* @param where
* the {@code WHERE} clause, see
* {@link ContentResolver#update(Uri, ContentValues, String, String[])}
* for more details.
* @param selectionArgs
* the selection arguments, see
* {@link ContentResolver#update(Uri, ContentValues, String, String[])}
* for more details.
* @return the value returned from
* {@link ContentResolver#update(Uri, ContentValues, String, String[])}
* , or {@code -1} if an error occurred.
*/
public static int updateInBackground(final Context context, final Uri uri,
final ContentValues values, final String where,
final String[] selectionArgs) {
final int[] result = { 0 };
Thread thread = new Thread() {
@Override
public void run() {
result[0] = context.getContentResolver().update(uri, values,
where, selectionArgs);
}// run()
};
thread.start();
try {
thread.join();
return result[0];
} catch (InterruptedException e) {
return -1;
}
}// updateInBackground()
}

View File

@ -11,7 +11,7 @@ import android.database.DatabaseUtils;
/**
* Database utilities.
*
*
* @author Hai Bison
* @since v5.1 beta
*/
@ -20,13 +20,13 @@ public class DbUtils {
public static final String DATE_FORMAT = "yyyy:MM:dd'T'kk:mm:ss";
/**
* SQLite component FTS3.
*
*
* @since v4.6 beta
*/
public static final String SQLITE_FTS3 = "FTS3";
/**
* SQLite component FTS4.
*
*
* @since v4.6 beta
*/
public static final String SQLITE_FTS4 = "FTS4";
@ -38,8 +38,9 @@ public class DbUtils {
/**
* Joins all columns into one statement.
*
* @param cols array of columns.
*
* @param cols
* array of columns.
* @return E.g: "col1,col2,col3"
*/
public static String joinColumns(String[] cols) {
@ -59,8 +60,9 @@ public class DbUtils {
* output string with {@code "0"} to make sure the results will always have
* same length (for a {@link Long}). So it will work when comparing
* different values as text.
*
* @param n a long value.
*
* @param n
* a long value.
* @return the formatted string.
*/
public static String formatNumber(long n) {
@ -70,13 +72,15 @@ public class DbUtils {
/**
* Calls {@link DatabaseUtils#sqlEscapeString(String)}, then removes single
* quotes at the begin and the end of the returned string.
*
* @param value the string to escape. If {@code null}, empty string will
* return;
*
* @param value
* the string to escape. If {@code null}, empty string will
* return;
* @return the "raw" escaped-string.
*/
public static String rawSqlEscapeString(String value) {
return value == null ? "" : DatabaseUtils.sqlEscapeString(value)
.replaceFirst("(?msi)^'", "").replaceFirst("(?msi)'$", "");
}// rawSqlEscapeString()
}

View File

@ -12,7 +12,7 @@ import android.net.Uri;
/**
* Utilities for providers.
*
*
* @author Hai Bison
* @since v5.1 beta
*/
@ -25,10 +25,13 @@ public class ProviderUtils {
/**
* Gets integer parameter.
*
* @param uri the original URI.
* @param key the key of query parameter.
* @param defaultValue will be returned if nothing found or parsing value failed.
*
* @param uri
* the original URI.
* @param key
* the key of query parameter.
* @param defaultValue
* will be returned if nothing found or parsing value failed.
* @return the integer value.
*/
public static int getIntQueryParam(Uri uri, String key, int defaultValue) {
@ -41,10 +44,13 @@ public class ProviderUtils {
/**
* Gets long parameter.
*
* @param uri the original URI.
* @param key the key of query parameter.
* @param defaultValue will be returned if nothing found or parsing value failed.
*
* @param uri
* the original URI.
* @param key
* the key of query parameter.
* @param defaultValue
* will be returned if nothing found or parsing value failed.
* @return the long value.
*/
public static long getLongQueryParam(Uri uri, String key, long defaultValue) {
@ -57,9 +63,11 @@ public class ProviderUtils {
/**
* Gets boolean parameter.
*
* @param uri the original URI.
* @param key the key of query parameter.
*
* @param uri
* the original URI.
* @param key
* the key of query parameter.
* @return {@code false} if the parameter does not exist, or it is either
* {@code "false"} or {@code "0"}. {@code true} otherwise.
*/
@ -73,15 +81,18 @@ public class ProviderUtils {
/**
* Gets boolean parameter.
*
* @param uri the original URI.
* @param key the key of query parameter.
* @param defaultValue the default value if the parameter does not exist.
*
* @param uri
* the original URI.
* @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
* either {@code "false"} or {@code "0"}. {@code true} otherwise.
*/
public static boolean getBooleanQueryParam(Uri uri, String key,
boolean defaultValue) {
boolean defaultValue) {
String param = uri.getQueryParameter(key);
if (param == null)
return defaultValue;
@ -89,4 +100,5 @@ public class ProviderUtils {
return false;
return true;
}// getBooleanQueryParam()
}

View File

@ -533,4 +533,5 @@ public class BaseFileContract {
*/
public static final String COLUMN_PROVIDER_ICON_ATTR = "provider_icon_attr";
}// BaseFile
}

View File

@ -7,11 +7,11 @@
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.ProviderUtils;
import group.pals.android.lib.ui.filechooser.providers.basefile.BaseFileContract.BaseFile;
import android.content.Context;
import android.net.Uri;
/**
* History contract.
@ -123,4 +123,5 @@ public final class HistoryContract implements BaseColumns {
* Type: {@code URI}
*/
public static final String COLUMN_URI = "uri";
}

View File

@ -423,4 +423,5 @@ public class HistoryProvider extends ContentProvider {
return result;
}// appendNameAndRealUri()
}

View File

@ -131,4 +131,5 @@ public class FileObserverEx extends FileObserver {
HandlerThreadCompat_v5.quit(mHandlerThread);
mHandlerThread.interrupt();
}// stopWatching()
}

View File

@ -11,7 +11,7 @@ import android.os.HandlerThread;
/**
* Helper class for backward compatibility of {@link HandlerThread} from API 5+.
*
*
* @author Hai Bison
* @since v5.1 beta
*/
@ -19,10 +19,12 @@ public class HandlerThreadCompat_v5 {
/**
* Wrapper for {@link HandlerThread#quit()}.
*
* @param thread the handler thread.
*
* @param thread
* the handler thread.
*/
public static void quit(HandlerThread thread) {
thread.quit();
}// quit()
}

View File

@ -11,7 +11,7 @@ import android.content.Context;
/**
* Contract for local file.
*
*
* @author Hai Bison
* @since v5.1 beta
*/
@ -24,8 +24,9 @@ public class LocalFileContract {
/**
* Gets the authority of this provider.
*
* @param context the context.
*
* @param context
* the context.
* @return the authority.
*/
public static final String getAuthority(Context context) {
@ -36,4 +37,5 @@ public class LocalFileContract {
* The unique ID of this provider.
*/
public static final String _ID = "7dab9818-0a8b-47ef-88cc-10fe538bfaf7";
}

View File

@ -269,15 +269,11 @@ public class LocalFileProvider extends BaseFileProvider {
else if (BaseFile.CMD_IS_ANCESTOR_OF.equals(uri.getLastPathSegment())) {
return doCheckAncestor(uri);
} else if (BaseFile.CMD_GET_PARENT.equals(uri.getLastPathSegment())) {
String sourcePath = Uri.parse(
uri.getQueryParameter(BaseFile.PARAM_SOURCE)).getPath();
File file = new File(sourcePath);
File file = new File(Uri.parse(
uri.getQueryParameter(BaseFile.PARAM_SOURCE)).getPath());
file = file.getParentFile();
if (file == null)
{
Log.d(CLASSNAME,"returning null as parent for "+sourcePath);
return null;
}
matrixCursor = BaseFileProviderUtils.newBaseFileCursor();
@ -286,8 +282,6 @@ public class LocalFileProvider extends BaseFileProvider {
.exists() ? BaseFile.FILE_TYPE_UNKNOWN
: BaseFile.FILE_TYPE_NOT_EXISTED));
Log.d(CLASSNAME, "Returning " + Uri.fromFile(file).toString()+" as parent for "+sourcePath);
RowBuilder newRow = matrixCursor.newRow();
newRow.add(0);// _ID
newRow.add(BaseFile
@ -747,4 +741,5 @@ public class LocalFileProvider extends BaseFileProvider {
return new File(fileName);
}// extractFile()
}

View File

@ -471,4 +471,5 @@ public class AfcSearchView extends LinearLayout {
mTextSearch.setText(null);
}// onClick()
};// mButtonClearOnClickListener
}

View File

@ -47,4 +47,5 @@ public class Converter {
String.format("%s %%sB", digitGroups == 0 ? "%,.0f" : "%,.2f"),
size, units[digitGroups]);
}// sizeToStr()
}

View File

@ -7,15 +7,16 @@
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.prefs.DisplayPrefs.FileTimeDisplay;
import java.util.Calendar;
import android.content.Context;
/**
* Date utilities.
*
*
* @author Hai Bison
* @since v4.7 beta
*/
@ -45,14 +46,17 @@ public class DateUtils {
/**
* Formats date.
*
* @param context {@link Context}.
* @param millis time in milliseconds.
* @param fileTimeDisplay {@link FileTimeDisplay}.
*
* @param context
* {@link Context}.
* @param millis
* time in milliseconds.
* @param fileTimeDisplay
* {@link FileTimeDisplay}.
* @return the formatted string
*/
public static String formatDate(Context context, long millis,
FileTimeDisplay fileTimeDisplay) {
FileTimeDisplay fileTimeDisplay) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(millis);
return formatDate(context, cal, fileTimeDisplay);
@ -60,14 +64,17 @@ public class DateUtils {
/**
* Formats date.
*
* @param context {@link Context}.
* @param date {@link Calendar}.
* @param fileTimeDisplay {@link FileTimeDisplay}.
*
* @param context
* {@link Context}.
* @param date
* {@link Calendar}.
* @param fileTimeDisplay
* {@link FileTimeDisplay}.
* @return the formatted string, for local human reading.
*/
public static String formatDate(Context context, Calendar date,
FileTimeDisplay fileTimeDisplay) {
FileTimeDisplay fileTimeDisplay) {
final Calendar yesterday = Calendar.getInstance();
yesterday.add(Calendar.DAY_OF_YEAR, -1);
@ -79,7 +86,7 @@ public class DateUtils {
}// today
else if (date.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)
&& date.get(Calendar.DAY_OF_YEAR) == yesterday
.get(Calendar.DAY_OF_YEAR)) {
.get(Calendar.DAY_OF_YEAR)) {
res = String.format(
"%s, %s",
context.getString(R.string.afc_yesterday),
@ -87,25 +94,26 @@ public class DateUtils {
date.getTimeInMillis(), FORMAT_SHORT_TIME));
}// yesterday
else if (date.get(Calendar.YEAR) == yesterday.get(Calendar.YEAR)) {
if (fileTimeDisplay.isShowTimeForOldDaysThisYear())
if (fileTimeDisplay.showTimeForOldDaysThisYear)
res = android.text.format.DateUtils.formatDateTime(context,
date.getTimeInMillis(), FORMAT_SHORT_TIME
| FORMAT_MONTH_AND_DAY);
| FORMAT_MONTH_AND_DAY);
else
res = android.text.format.DateUtils.formatDateTime(context,
date.getTimeInMillis(), FORMAT_MONTH_AND_DAY);
}// this year
else {
if (fileTimeDisplay.isShowTimeForOldDays())
if (fileTimeDisplay.showTimeForOldDays)
res = android.text.format.DateUtils.formatDateTime(context,
date.getTimeInMillis(), FORMAT_SHORT_TIME
| FORMAT_MONTH_AND_DAY | FORMAT_YEAR);
| FORMAT_MONTH_AND_DAY | FORMAT_YEAR);
else
res = android.text.format.DateUtils.formatDateTime(context,
date.getTimeInMillis(), FORMAT_MONTH_AND_DAY
| FORMAT_YEAR);
| FORMAT_YEAR);
}// other years (maybe older or newer than this year)
return res;
}// formatDate()
}

View File

@ -28,4 +28,5 @@ public class EnvUtils {
public static final int genId() {
return mId++;
}// genId()
}

View File

@ -95,4 +95,5 @@ public class FileUtils {
public static boolean isFilenameValid(String name) {
return name != null && name.trim().matches("[^\\\\/?%*:|\"<>]+");
}// isFilenameValid()
}

View File

@ -77,4 +77,5 @@ public class MimeTypes {
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|"
+ "dmg)$";
}

View File

@ -23,11 +23,11 @@ public class Sys {
/**
* The library version name.
*/
public static final String LIB_VERSION_NAME = "5.4.3 beta";
public static final String LIB_VERSION_NAME = "5.4.4 beta";
/**
* The library version code.
*/
public static final int LIB_VERSION_CODE = 54;
public static final int LIB_VERSION_CODE = 56;
}

View File

@ -11,7 +11,7 @@ import java.util.regex.Pattern;
/**
* Text utilities.
*
*
* @author Hai Bison
* @since v4.3 beta
*/
@ -19,8 +19,9 @@ public class TextUtils {
/**
* 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
*/
public static String quote(String s) {
@ -29,8 +30,9 @@ public class TextUtils {
/**
* Compiles {@code regex}.
*
* @param regex the regex.
*
* @param regex
* the regex.
* @return a compiled {@link Pattern}, or {@code null} if there is an error
* while compiling.
*/
@ -43,4 +45,5 @@ public class TextUtils {
return null;
}
}// compileRegex()
}

View File

@ -7,14 +7,15 @@
package group.pals.android.lib.ui.filechooser.utils.history;
import android.os.Parcelable;
import java.util.ArrayList;
import android.os.Parcelable;
/**
* A history store of any object.
*
* @param <A> any type
*
* @param <A>
* any type
* @author Hai Bison
* @since v2.0 alpha
*/
@ -23,15 +24,17 @@ public interface History<A> extends Parcelable {
/**
* Pushes {@code newItem} to the history. If the top item is same as this
* one, then does nothing.
*
* @param newItem the new item
*
* @param newItem
* the new item
*/
void push(A newItem);
/**
* 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.
* @since v4.3 beta
*/
@ -39,54 +42,59 @@ public interface History<A> extends Parcelable {
/**
* Removes an item.
*
* @param item {@link A}
*
* @param item
* {@link A}
* @since v4.0 beta
*/
void remove(A item);
/**
* Removes all items by a filter.
*
* @param filter {@link HistoryFilter}
*
* @param filter
* {@link HistoryFilter}
* @since v4.0 beta
*/
void removeAll(HistoryFilter<A> filter);
/**
* Gets size of the history
*
*
* @return the size of the history
*/
int size();
/**
* 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
*/
int indexOf(A a);
/**
* Gets previous item of {@code a}
*
* @param a current item
*
* @param a
* current item
* @return the previous item, can be {@code null}
*/
A prevOf(A a);
/**
* Gets next item of {@code a}
*
* @param a current item
*
* @param a
* current item
* @return the next item, can be {@code null}
*/
A nextOf(A a);
/**
* Retrieves all items in this history, in an <i>independent</i> list.
*
*
* @return list of {@link A}.
* @since v4.3 beta
*/
@ -94,7 +102,7 @@ public interface History<A> extends Parcelable {
/**
* Checks if the history is empty or not.
*
*
* @return {@code true} if this history is empty, {@code false} otherwise.
* @since v4.3 beta
*/
@ -102,23 +110,25 @@ public interface History<A> extends Parcelable {
/**
* Clears this history.
*
*
* @since v4.3 beta.
*/
void clear();
/**
* Adds a {@link HistoryListener}
*
* @param listener {@link HistoryListener}
*
* @param listener
* {@link HistoryListener}
* @since v4.0 beta
*/
void addListener(HistoryListener<A> listener);
/**
* Removes a {@link HistoryListener}
*
* @param listener {@link HistoryListener}
*
* @param listener
* {@link HistoryListener}
* @return the removed listener
* @since v4.0 beta
*/
@ -131,13 +141,16 @@ public interface History<A> extends Parcelable {
/**
* Finds items with a filter.
*
* @param filter {@link HistoryFilter}
* @param ascending {@code true} if you want to process the history list ascending
* (oldest to newest), {@code false} for descending.
*
* @param filter
* {@link HistoryFilter}
* @param ascending
* {@code true} if you want to process the history list ascending
* (oldest to newest), {@code false} for descending.
* @return {@code true} if the desired items have been found, {@code false}
* otherwise.
* @since v5.1 beta
*/
boolean find(HistoryFilter<A> filter, boolean ascending);
}

View File

@ -9,7 +9,7 @@ package group.pals.android.lib.ui.filechooser.utils.history;
/**
* Filter of {@link History}
*
*
* @author Hai Bison
* @since v4.0 beta
*/
@ -17,9 +17,11 @@ public interface HistoryFilter<A> {
/**
* Filters item.
*
* @param item {@link A}
*
* @param item
* {@link A}
* @return {@code true} if the {@code item} is accepted
*/
boolean accept(A item);
}

View File

@ -9,7 +9,7 @@ package group.pals.android.lib.ui.filechooser.utils.history;
/**
* Listener of {@link History}
*
*
* @author Hai Bison
* @since v4.0 beta
*/
@ -17,8 +17,10 @@ public interface HistoryListener<A> {
/**
* Will be called after the history changed.
*
* @param history {@link History}
*
* @param history
* {@link History}
*/
void onChanged(History<A> history);
}

View File

@ -259,4 +259,5 @@ public class HistoryStore<A extends Parcelable> implements History<A> {
private HistoryStore(Parcel in) {
readFromParcel(in);
}// HistoryStore()
}

View File

@ -129,4 +129,5 @@ public class ContextMenuUtils {
*/
void onClick(int resId);
}// OnMenuItemClickListener
}

View File

@ -7,17 +7,17 @@
package group.pals.android.lib.ui.filechooser.utils.ui;
import group.pals.android.lib.ui.filechooser.R;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.ContextThemeWrapper;
import android.widget.Toast;
import group.pals.android.lib.ui.filechooser.R;
/**
* Utilities for message boxes.
*
*
* @author Hai Bison
* @since v2.1 alpha
*/
@ -36,10 +36,13 @@ public class Dlg {
/**
* Shows a toast message.
*
* @param context {@link Context}
* @param msg the message.
* @param duration can be {@link #LENGTH_LONG} or {@link #LENGTH_SHORT}.
*
* @param context
* {@link Context}
* @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) {
if (mToast != null)
@ -50,10 +53,13 @@ public class Dlg {
/**
* Shows a toast message.
*
* @param context {@link Context}
* @param msgId the resource ID of the message.
* @param duration can be {@link #LENGTH_LONG} or {@link #LENGTH_SHORT}.
*
* @param context
* {@link Context}
* @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) {
toast(context, context.getString(msgId), duration);
@ -61,13 +67,16 @@ public class Dlg {
/**
* Shows an info dialog.
*
* @param context {@link Context}
* @param msg the message.
* @param listener the {@link DialogInterface.OnDismissListener}.
*
* @param context
* {@link Context}
* @param msg
* the message.
* @param listener
* the {@link DialogInterface.OnDismissListener}.
*/
public static void showInfo(Context context, CharSequence msg,
DialogInterface.OnDismissListener listener) {
DialogInterface.OnDismissListener listener) {
AlertDialog dlg = newAlertDlg(context);
dlg.setIcon(android.R.drawable.ic_dialog_info);
dlg.setTitle(R.string.afc_title_info);
@ -78,21 +87,26 @@ public class Dlg {
/**
* Shows an info dialog.
*
* @param context the context.
* @param msgId the resource ID of the message.
* @param listener the {@link DialogInterface.OnDismissListener}.
*
* @param context
* the context.
* @param msgId
* the resource ID of the message.
* @param listener
* the {@link DialogInterface.OnDismissListener}.
*/
public static void showInfo(Context context, int msgId,
DialogInterface.OnDismissListener listener) {
DialogInterface.OnDismissListener listener) {
showInfo(context, context.getString(msgId), listener);
}// showInfo()
/**
* Shows an info dialog.
*
* @param context {@link Context}
* @param msg the message.
*
* @param context
* {@link Context}
* @param msg
* the message.
*/
public static void showInfo(Context context, CharSequence msg) {
showInfo(context, msg, null);
@ -100,9 +114,11 @@ public class Dlg {
/**
* Shows an info dialog.
*
* @param context {@link Context}
* @param msgId the resource ID of the message.
*
* @param context
* {@link Context}
* @param msgId
* the resource ID of the message.
*/
public static void showInfo(Context context, int msgId) {
showInfo(context, context.getString(msgId));
@ -110,13 +126,16 @@ public class Dlg {
/**
* Shows an error message.
*
* @param context {@link Context}
* @param msg the message.
* @param listener will be called after the user cancelled the dialog.
*
* @param context
* {@link Context}
* @param msg
* the message.
* @param listener
* will be called after the user cancelled the dialog.
*/
public static void showError(Context context, CharSequence msg,
DialogInterface.OnCancelListener listener) {
DialogInterface.OnCancelListener listener) {
AlertDialog dlg = newAlertDlg(context);
dlg.setIcon(android.R.drawable.ic_dialog_alert);
dlg.setTitle(R.string.afc_title_error);
@ -127,25 +146,31 @@ public class Dlg {
/**
* Shows an error message.
*
* @param context {@link Context}
* @param msgId the resource ID of the message.
* @param listener will be called after the user cancelled the dialog.
*
* @param context
* {@link Context}
* @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,
DialogInterface.OnCancelListener listener) {
DialogInterface.OnCancelListener listener) {
showError(context, context.getString(msgId), listener);
}// showError()
/**
* Shows an unknown error.
*
* @param context {@link Context}
* @param t the {@link Throwable}
* @param listener will be called after the user cancelled the dialog.
*
* @param context
* {@link Context}
* @param t
* the {@link Throwable}
* @param listener
* will be called after the user cancelled the dialog.
*/
public static void showUnknownError(Context context, Throwable t,
DialogInterface.OnCancelListener listener) {
DialogInterface.OnCancelListener listener) {
showError(
context,
String.format(
@ -155,16 +180,20 @@ public class Dlg {
/**
* Shows a confirmation dialog.
*
* @param context {@link Context}
* @param msg the message.
* @param onYes will be called if the user selects positive answer (a
* <i>Yes</i> or <i>OK</i>).
* @param onNo will be called after the user cancelled the dialog.
*
* @param context
* {@link Context}
* @param msg
* the message.
* @param onYes
* will be called if the user selects positive answer (a
* <i>Yes</i> or <i>OK</i>).
* @param onNo
* will be called after the user cancelled the dialog.
*/
public static void confirmYesno(Context context, CharSequence msg,
DialogInterface.OnClickListener onYes,
DialogInterface.OnCancelListener onNo) {
DialogInterface.OnClickListener onYes,
DialogInterface.OnCancelListener onNo) {
AlertDialog dlg = newAlertDlg(context);
dlg.setIcon(android.R.drawable.ic_dialog_alert);
dlg.setTitle(R.string.afc_title_confirmation);
@ -177,22 +206,26 @@ public class Dlg {
/**
* Shows a confirmation dialog.
*
* @param context {@link Context}
* @param msg the message.
* @param onYes will be called if the user selects positive answer (a
* <i>Yes</i> or <i>OK</i>).
*
* @param context
* {@link Context}
* @param msg
* the message.
* @param onYes
* will be called if the user selects positive answer (a
* <i>Yes</i> or <i>OK</i>).
*/
public static void confirmYesno(Context context, CharSequence msg,
DialogInterface.OnClickListener onYes) {
DialogInterface.OnClickListener onYes) {
confirmYesno(context, msg, onYes, null);
}// confirmYesno()
/**
* 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}.
* @since v4.3 beta
*/
@ -206,8 +239,9 @@ public class Dlg {
/**
* Creates new {@link AlertDialog}. 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 {@link AlertDialog}
* @since v4.3 beta
*/
@ -219,8 +253,9 @@ public class Dlg {
/**
* 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}
* @since v4.3 beta
*/
@ -228,4 +263,5 @@ public class Dlg {
return new AlertDialog.Builder(new ContextThemeWrapper(context,
Ui.resolveAttribute(context, R.attr.afc_theme_dialog)));
}// newAlertDlgBuilder()
}

View File

@ -23,7 +23,7 @@ import android.widget.AbsListView;
*/
public class GestureUtils {
public static final String CLASSNAME = GestureUtils.class.getName();
private static final String CLASSNAME = GestureUtils.class.getName();
/**
* The fling direction.
@ -218,4 +218,5 @@ public class GestureUtils {
}
});
}// setupGestureDetector()
}

View File

@ -7,6 +7,7 @@
package group.pals.android.lib.ui.filechooser.utils.ui;
import group.pals.android.lib.ui.filechooser.R;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
@ -24,7 +25,7 @@ import android.util.Log;
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;
/**
@ -79,6 +80,19 @@ public abstract class LoadingDialog<Params, Progress, Result> extends
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()}
* at very first of the method.

View File

@ -65,4 +65,5 @@ public class MenuItemAdapter extends BaseAdapter {
return convertView;
}// getView()
}

View File

@ -24,4 +24,5 @@ public interface TaskListener {
* the user data, can be {@code null}.
*/
public void onFinish(boolean ok, Object any);
}

View File

@ -145,4 +145,5 @@ public class Ui {
dialogWindow.setLayout(width, height);
}
}// adjustDialogSizeForLargeScreen()
}