android:orientation="vertical">
<!-- Breadcrumb -->
- <com.cyanogenmod.filemanager.ui.widgets.BreadcrumbView
+ <com.cyanogenmod.filemanager.ui.widgets.DialogBreadcrumbView
android:id="@+id/breadcrumb_view"
android:layout_width="match_parent"
android:layout_height="@dimen/default_row_height"
<drawable name="filesystem_unlocked_drawable">@drawable/ic_material_light_fs_unlocked</drawable>
<!-- FileSystem warning drawable -->
<drawable name="filesystem_warning_drawable">@drawable/ic_material_light_fs_warning</drawable>
+ <!-- FileSystem locked drawable -->
+ <drawable name="filesystem_dialog_locked_drawable">@drawable/ic_material_dialog_fs_locked</drawable>
+ <!-- FileSystem unlocked drawable -->
+ <drawable name="filesystem_dialog_unlocked_drawable">@drawable/ic_material_dialog_fs_unlocked</drawable>
+ <!-- FileSystem warning drawable -->
+ <drawable name="filesystem_dialog_warning_drawable">@drawable/ic_material_dialog_fs_warning</drawable>
<!-- Secure FileSystem icon -->
<drawable name="secure_filesystem_drawable">@drawable/ic_material_light_secure</drawable>
/**
* @hide
*/
+ final boolean mIsDialog;
+
+ /**
+ * @hide
+ */
static int sColorFilterNormal;
/**
public FilesystemAsyncTask(
Context context, ImageView mountPointInfo,
ProgressBar diskUsageInfo, int freeDiskSpaceWarningLevel) {
+ this(context, mountPointInfo, diskUsageInfo, freeDiskSpaceWarningLevel,
+ false);
+ }
+
+ /**
+ * Constructor of <code>FilesystemAsyncTask</code>.
+ *
+ * @param context The current context
+ * @param mountPointInfo The mount point info view
+ * @param diskUsageInfo The mount point info view
+ * @param freeDiskSpaceWarningLevel The free disk space warning level
+ * @param isDialog Whether or not to use dialog theme resources
+ */
+ public FilesystemAsyncTask(
+ Context context, ImageView mountPointInfo,
+ ProgressBar diskUsageInfo, int freeDiskSpaceWarningLevel, boolean isDialog) {
super();
this.mContext = context;
this.mMountPointInfo = mountPointInfo;
this.mDiskUsageInfo = diskUsageInfo;
this.mFreeDiskSpaceWarningLevel = freeDiskSpaceWarningLevel;
this.mRunning = false;
+ this.mIsDialog = isDialog;
}
/**
theme.setImageDrawable(
FilesystemAsyncTask.this.mContext,
FilesystemAsyncTask.this.mMountPointInfo,
- "filesystem_warning_drawable"); //$NON-NLS-1$
+ FilesystemAsyncTask.this.mIsDialog ?
+ "filesystem_dialog_warning_drawable" //$NON-NLS-1$
+ : "filesystem_warning_drawable"); //$NON-NLS-1$
FilesystemAsyncTask.this.mMountPointInfo.setTag(null);
}
});
public void run() {
String resource =
MountPointHelper.isReadOnly(mp)
- ? "filesystem_locked_drawable" //$NON-NLS-1$
- : "filesystem_unlocked_drawable"; //$NON-NLS-1$
+ ? FilesystemAsyncTask.this.mIsDialog ?
+ "filesystem_dialog_locked_drawable" //$NON-NLS-1$
+ : "filesystem_locked_drawable" //$NON-NLS-1$
+ : FilesystemAsyncTask.this.mIsDialog ?
+ "filesystem_dialog_unlocked_drawable" //$NON-NLS-1$
+ : "filesystem_unlocked_drawable"; //$NON-NLS-1$
Theme theme = ThemeManager.getCurrentTheme(FilesystemAsyncTask.this.mContext);
theme.setImageDrawable(
FilesystemAsyncTask.this.mContext,
* @hide
*/
HorizontalScrollView mScrollView;
- private ViewGroup mBreadcrumbBar;
+ protected ViewGroup mBreadcrumbBar;
/**
* @hide
*/
* @hide
*/
View mLoading;
- private FilesystemAsyncTask mFilesystemAsyncTask;
+ protected FilesystemAsyncTask mFilesystemAsyncTask;
- private int mFreeDiskSpaceWarningLevel = 95;
+ protected int mFreeDiskSpaceWarningLevel = 95;
private List<BreadcrumbListener> mBreadcrumbListeners;
- private String mCurrentPath;
+ protected String mCurrentPath;
/**
* Constructor of <code>BreadcrumbView</code>.
--- /dev/null
+package com.cyanogenmod.filemanager.ui.widgets;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import com.cyanogenmod.filemanager.R;
+import com.cyanogenmod.filemanager.model.MountPoint;
+import com.cyanogenmod.filemanager.tasks.FilesystemAsyncTask;
+import com.cyanogenmod.filemanager.ui.ThemeManager;
+import com.cyanogenmod.filemanager.util.MountPointHelper;
+
+public class DialogBreadcrumbView extends BreadcrumbView {
+ public DialogBreadcrumbView(Context context) {
+ super(context);
+ }
+
+ public DialogBreadcrumbView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public DialogBreadcrumbView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ public void applyTheme() {
+ ThemeManager.Theme theme = ThemeManager.getCurrentTheme(getContext());
+
+ //- Breadcrumb
+ if (this.mBreadcrumbBar != null) {
+ int cc = this.mBreadcrumbBar.getChildCount();
+ for (int i = 0; i < cc; i++) {
+ // There are 2 types: Breadcrumb items and separators
+ View v = this.mBreadcrumbBar.getChildAt(i);
+ if (v instanceof BreadcrumbItem) {
+ // Breadcrumb item
+ theme.setTextColor(
+ getContext(), (BreadcrumbItem)v, "text_color"); //$NON-NLS-1$
+ } else if (v instanceof ImageView) {
+ // Divider drawable
+ theme.setImageDrawable(
+ getContext(),
+ (ImageView)v, "breadcrumb_divider_drawable"); //$NON-NLS-1$
+ }
+ }
+ }
+ if (this.mDiskUsageInfo != null) {
+ Drawable dw = theme.getDrawable(getContext(), "horizontal_progress_bar"); //$NON-NLS-1$
+ this.mDiskUsageInfo.setProgressDrawable(dw);
+ }
+ final ImageView fsInfo = (ImageView)findViewById(R.id.ab_filesystem_info);
+ if (fsInfo != null) {
+ MountPoint mp = (MountPoint) fsInfo.getTag();
+ if (mp == null) {
+ theme.setImageDrawable(getContext(), fsInfo, "filesystem_dialog_warning_drawable");
+ } else {
+ String resource =
+ MountPointHelper.isReadOnly(mp)
+ ? "filesystem_dialog_locked_drawable"
+ : "filesystem_dialog_unlocked_drawable";
+ theme.setImageDrawable(getContext(), fsInfo, resource);
+ }
+ }
+ }
+
+ @Override
+ public synchronized void updateMountPointInfo() {
+ //Cancel the current execution (if any) and launch again
+ if (this.mFilesystemAsyncTask != null && this.mFilesystemAsyncTask.isRunning()) {
+ this.mFilesystemAsyncTask.cancel(true);
+ }
+ final ImageView filesystemInfo = (ImageView)findViewById(R.id.ab_filesystem_info);
+ final ProgressBar diskUsageInfo = (ProgressBar)findViewById(R.id.breadcrumb_diskusage);
+ this.mFilesystemAsyncTask =
+ new FilesystemAsyncTask(
+ getContext(), filesystemInfo,
+ diskUsageInfo, this.mFreeDiskSpaceWarningLevel, true);
+ this.mFilesystemAsyncTask.execute(this.mCurrentPath);
+ }
+}