mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
more androidish way for disabled icons; use selected path
This commit is contained in:
parent
5328375941
commit
cea22e0d6d
12 changed files with 44 additions and 20 deletions
BIN
third-party/android-filechooser/code/res/drawable-hdpi/afc_folder_disabled.png
vendored
Normal file
BIN
third-party/android-filechooser/code/res/drawable-hdpi/afc_folder_disabled.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
third-party/android-filechooser/code/res/drawable-ldpi/afc_folder_disabled.png
vendored
Normal file
BIN
third-party/android-filechooser/code/res/drawable-ldpi/afc_folder_disabled.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 507 B |
BIN
third-party/android-filechooser/code/res/drawable-mdpi/afc_folder_disabled.png
vendored
Normal file
BIN
third-party/android-filechooser/code/res/drawable-mdpi/afc_folder_disabled.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 683 B |
BIN
third-party/android-filechooser/code/res/drawable-xhdpi/afc_folder_disabled.png
vendored
Normal file
BIN
third-party/android-filechooser/code/res/drawable-xhdpi/afc_folder_disabled.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
14
third-party/android-filechooser/code/res/drawable/afc_item_folder.xml
vendored
Executable file
14
third-party/android-filechooser/code/res/drawable/afc_item_folder.xml
vendored
Executable file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (c) 2012 Hai Bison
|
||||
|
||||
See the file LICENSE at the root directory of this project for copying
|
||||
permission.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/afc_folder_disabled" android:state_enabled="false"/> <!-- enabled -->
|
||||
<item android:drawable="@drawable/afc_folder"/> <!-- default -->
|
||||
|
||||
</selector>
|
|
@ -24,7 +24,7 @@ import java.util.Collection;
|
|||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.Paint;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -288,18 +288,8 @@ public class IFileAdapter extends BaseAdapter {
|
|||
*/
|
||||
bag.mTxtFileName.setSingleLine(parent instanceof GridView);
|
||||
|
||||
final boolean isAccessible = FileUtils.isAccessible(file, mFilenameRegexp);
|
||||
// file icon
|
||||
bag.mImageIcon.setImageResource(FileUtils.getResIcon(file, mFilterMode));
|
||||
final ColorMatrix matrix = new ColorMatrix();
|
||||
if (!isAccessible) {
|
||||
final ColorMatrix scaleMatrix = new ColorMatrix();
|
||||
scaleMatrix.setScale(.7f, .7f, .7f, 1f);
|
||||
final ColorMatrix saturationMatrix = new ColorMatrix();
|
||||
saturationMatrix.setSaturation(0f);
|
||||
matrix.setConcat(saturationMatrix, scaleMatrix);
|
||||
}
|
||||
bag.mImageIcon.setColorFilter(new ColorMatrixColorFilter(matrix));
|
||||
|
||||
// filename
|
||||
bag.mTxtFileName.setText(file.getSecondName());
|
||||
|
@ -316,6 +306,8 @@ public class IFileAdapter extends BaseAdapter {
|
|||
else
|
||||
bag.mTxtFileInfo.setText(String.format("%s, %s", Converter.sizeToStr(file.length()), time));
|
||||
|
||||
final boolean isAccessible = FileUtils.isAccessible(file, mFilenameRegexp);
|
||||
bag.mImageIcon.setEnabled(isAccessible);
|
||||
bag.mTxtFileName.setEnabled(isAccessible);
|
||||
bag.mTxtFileInfo.setEnabled(isAccessible);
|
||||
|
||||
|
|
|
@ -74,9 +74,9 @@ public class FileUtils {
|
|||
if (filterMode == IFileProvider.FilterMode.DirectoriesOnly) {
|
||||
if (file instanceof File && !((File)file).canWrite()) {
|
||||
if (file instanceof ParentFile) {
|
||||
return R.drawable.afc_folder;
|
||||
return R.drawable.afc_item_folder;
|
||||
} else if (accessDenied(file)) {
|
||||
return R.drawable.afc_folder;
|
||||
return R.drawable.afc_item_folder;
|
||||
} else {
|
||||
return R.drawable.afc_folder_locked;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class FileUtils {
|
|||
return R.drawable.afc_folder;
|
||||
}
|
||||
} else {
|
||||
return R.drawable.afc_folder;
|
||||
return R.drawable.afc_item_folder;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue