aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-11-02 23:23:17 -0700
committerSteve Kondik <steve@cyngn.com>2016-11-03 00:24:08 -0700
commit26fc1a5f55865a6a6d51b4f911fba83dd7f4a91d (patch)
treebd8a1d8e2ed963b1d7e60e933b47346f64d417c2
parentab9e32aad5e56a2e83a66647f2b43a026ecc238f (diff)
downloadandroid_packages_apps_CMFileManager-26fc1a5f55865a6a6d51b4f911fba83dd7f4a91d.tar.gz
android_packages_apps_CMFileManager-26fc1a5f55865a6a6d51b4f911fba83dd7f4a91d.tar.bz2
android_packages_apps_CMFileManager-26fc1a5f55865a6a6d51b4f911fba83dd7f4a91d.zip
cmfm: Fix build issues
Change-Id: I9c28bbba740f66518bb7aeefc806def9448bb8d5
-rw-r--r--Android.mk31
-rwxr-xr-xsrc/com/cyanogenmod/filemanager/activities/MainActivity.java5
-rw-r--r--src/com/cyanogenmod/filemanager/activities/PickerActivity.java7
-rw-r--r--src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java33
-rw-r--r--src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java44
5 files changed, 55 insertions, 65 deletions
diff --git a/Android.mk b/Android.mk
index f7e8c0ab..21e489f8 100644
--- a/Android.mk
+++ b/Android.mk
@@ -21,6 +21,7 @@ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
frameworks/support/design/res \
frameworks/support/v7/appcompat/res \
frameworks/support/v7/cardview/res \
+ frameworks/support/v7/recyclerview/res \
external/uicommon/res
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -28,31 +29,29 @@ LOCAL_SRC_FILES += $(call all-java-files-under, libs/android-syntax-highlight/sr
LOCAL_SRC_FILES += $(call all-java-files-under, libs/color-picker-view/src)
LOCAL_AAPT_FLAGS := \
- --auto-add-overlay \
- --extra-packages com.cyngn.uicommon
-
-LOCAL_AAPT_FLAGS += --extra-packages android.support.design:android.support.v7.appcompat:android.support.v7.cardview
-
-LOCAL_STATIC_JAVA_LIBRARIES += libtruezip
-LOCAL_STATIC_JAVA_LIBRARIES += juniversalchardet
-LOCAL_STATIC_JAVA_LIBRARIES += uicommon
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-appcompat
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-design
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-cardview
+ --auto-add-overlay \
+ --extra-packages android.support.design:android.support.v7.appcompat:android.support.v7.cardview:android.support.v7.recyclerview:com.cyngn.uicommon
+
+LOCAL_STATIC_JAVA_LIBRARIES += \
+ libtruezip \
+ juniversalchardet \
+ uicommon \
+ android-support-design \
+ android-support-v4 \
+ android-support-v7-appcompat \
+ android-support-v7-cardview \
+ android-support-v7-recyclerview
LOCAL_PACKAGE_NAME := CMFileManager
LOCAL_CERTIFICATE := platform
#LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_AAPT_FLAGS := --auto-add-overlay
-
include $(BUILD_PACKAGE)
-include $(CLEAR_VARS)
+include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
juniversalchardet:libs/juniversalchardet/juniversalchardet-1.0.3.jar
-
include $(BUILD_MULTI_PREBUILT)
+
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/src/com/cyanogenmod/filemanager/activities/MainActivity.java b/src/com/cyanogenmod/filemanager/activities/MainActivity.java
index 2ec12849..14cde81e 100755
--- a/src/com/cyanogenmod/filemanager/activities/MainActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/MainActivity.java
@@ -262,6 +262,8 @@ public class MainActivity extends ActionBarActivity
*/
@Override
protected void onCreate(Bundle state) {
+ super.onCreate(state);
+
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
// Set the theme before setContentView
@@ -271,9 +273,6 @@ public class MainActivity extends ActionBarActivity
//Set the main layout of the activity
setContentView(R.layout.navigation);
- //Save state
- super.onCreate(state);
-
if (!hasPermissions()) {
requestNecessaryPermissions();
} else {
diff --git a/src/com/cyanogenmod/filemanager/activities/PickerActivity.java b/src/com/cyanogenmod/filemanager/activities/PickerActivity.java
index c28544d1..4775f2b7 100644
--- a/src/com/cyanogenmod/filemanager/activities/PickerActivity.java
+++ b/src/com/cyanogenmod/filemanager/activities/PickerActivity.java
@@ -537,7 +537,7 @@ public class PickerActivity extends Activity implements OnCancelListener, OnDism
if (INTENT_FOLDER_SELECT.equals(getIntent().getAction())) {
Intent result = new Intent();
- result.putExtra(EXTRA_FOLDER_PATH, src.getAbsolutePath());
+ result.putExtra(EXTRA_FOLDER_PATH, mFso.getFullPath());
setResult(Activity.RESULT_OK, result);
finish();
return;
@@ -816,4 +816,9 @@ public class PickerActivity extends Activity implements OnCancelListener, OnDism
public void onCancel(){
// nop
}
+
+ @Override
+ public void onClearCache(Object o) {
+ // nop
+ }
}
diff --git a/src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java b/src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java
index f1311906..67cc0700 100644
--- a/src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java
+++ b/src/com/cyanogenmod/filemanager/adapters/FileSystemObjectAdapter.java
@@ -255,6 +255,11 @@ public class FileSystemObjectAdapter
StringBuilder sbSummary = new StringBuilder();
if (fso instanceof ParentDirectory) {
sbSummary.append(res.getString(R.string.parent_dir));
+ } else if (fso instanceof RootDirectory) {
+ // TODO: add summary for root list directories
+ // Currently RootDirectory is only used in picker activity, which uses simple view
+ // by default (no summary).
+ // Roots List needs to add a summary if the user is in privileged mode
} else {
if (!FileHelper.isDirectory(fso)) {
sbSummary.append(FileHelper.getHumanReadableSize(fso));
@@ -420,34 +425,14 @@ public class FileSystemObjectAdapter
* @param item The path or the {@link FileSystemObject}
*/
private void openPropertiesDialog(Object item) {
+ FileSystemObject fso = null;
// Resolve the full path
String path = String.valueOf(item);
if (item instanceof FileSystemObject) {
path = ((FileSystemObject)item).getFullPath();
- }
-
- // Prior to show the dialog, refresh the item reference
- FileSystemObject fso = null;
- try {
- fso = CommandHelper.getFileInfo(getContext(), path, false, null);
- if (fso == null) {
- throw new NoSuchFileOrDirectory(path);
- }
-
- } catch (Exception e) {
- // Notify the user
- ExceptionUtil.translateException(getContext(), e);
-
- // Remove the object
- if (e instanceof FileNotFoundException || e instanceof NoSuchFileOrDirectory) {
- // If have a FileSystemObject reference then there is no need to search
- // the path (less resources used)
- if (item instanceof FileSystemObject) {
- //removeItem((FileSystemObject)item);
- } else {
- //removeItem((String)item);
- }
- }
+ fso = (FileSystemObject)item;
+ } else {
+ Log.e(TAG, "Failed to open Properties Dialog. Invalid file object.");
return;
}
diff --git a/src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java b/src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java
index 647ba005..98e88a44 100644
--- a/src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java
+++ b/src/com/cyanogenmod/filemanager/ui/fragments/NavigationFragment.java
@@ -22,26 +22,17 @@ import android.app.Dialog;
import android.app.SearchManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
-import android.content.ContentUris;
-import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Color;
-import android.Manifest;
-import android.net.Uri;
-import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
-import android.os.Parcel;
import android.os.Parcelable;
import android.os.storage.StorageVolume;
-import android.provider.Settings;
import android.support.v4.app.Fragment;
-import android.support.v4.content.FileProvider;
import android.support.v4.graphics.ColorUtils;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
@@ -68,7 +59,6 @@ import com.cyanogenmod.filemanager.console.ConsoleAllocException;
import com.cyanogenmod.filemanager.console.ConsoleBuilder;
import com.cyanogenmod.filemanager.console.InsufficientPermissionsException;
import com.cyanogenmod.filemanager.console.VirtualMountPointConsole;
-import com.cyanogenmod.filemanager.console.secure.SecureConsole;
import com.cyanogenmod.filemanager.dialogs.SortViewOptions;
import com.cyanogenmod.filemanager.listeners.OnHistoryListener;
import com.cyanogenmod.filemanager.listeners.OnRequestRefreshListener;
@@ -111,7 +101,6 @@ import com.cyanogenmod.filemanager.util.ExceptionUtil;
import com.cyanogenmod.filemanager.util.FileHelper;
import com.cyanogenmod.filemanager.util.MountPointHelper;
import com.cyanogenmod.filemanager.util.StorageHelper;
-import com.cyngn.uicommon.view.Snackbar;
import java.io.File;
import java.util.ArrayList;
@@ -386,11 +375,6 @@ public class NavigationFragment extends Fragment
*/
private List<History> mHistory;
- /**
- * Used to record the items saved in database
- */
- private List<History> mHistorySaved;
-
private ViewGroup mActionBar;
private SelectionView mSelectionBar;
@@ -417,8 +401,6 @@ public class NavigationFragment extends Fragment
View mView;
LayoutInflater mLayoutInflater;
- private AsyncTask<Void, Void, Boolean> mHistoryTask;
-
public View onCreateView(
LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -429,6 +411,24 @@ public class NavigationFragment extends Fragment
Log.d(TAG, "NavigationFragment.onCreate"); //$NON-NLS-1$
}
+ // Register the broadcast receiver
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(FileManagerSettings.INTENT_SETTING_CHANGED);
+ filter.addAction(FileManagerSettings.INTENT_FILE_CHANGED);
+ filter.addAction(FileManagerSettings.INTENT_THEME_CHANGED);
+ filter.addAction(Intent.ACTION_DATE_CHANGED);
+ filter.addAction(Intent.ACTION_TIME_CHANGED);
+ filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
+ filter.addAction(FileManagerSettings.INTENT_MOUNT_STATUS_CHANGED);
+ getActivity().registerReceiver(this.mNotificationReceiver, filter);
+
+ // This filter needs the file data scheme, so it must be defined separately.
+ IntentFilter newFilter = new IntentFilter();
+ newFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
+ newFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
+ newFilter.addDataScheme(ContentResolver.SCHEME_FILE);
+ getActivity().registerReceiver(mNotificationReceiver, newFilter);
+
//Set the main layout of the activity
mView = inflater.inflate(R.layout.nav_fragment, container, false);
@@ -1111,8 +1111,7 @@ public class NavigationFragment extends Fragment
* @param isFromSavedHistory Whether this is called by saved history item
* @return boolean A problem occurs while navigate
*/
- public synchronized boolean navigateToHistory(
- History history, boolean isFromSavedHistory) {
+ public synchronized boolean navigateToHistory(History history) {
try {
//Navigate to item. Check what kind of history is
if (history.getItem() instanceof NavigationViewInfoParcelable) {
@@ -1197,7 +1196,7 @@ public class NavigationFragment extends Fragment
//Navigate to history
if (this.mHistory.size() > 0) {
- return navigateToHistory(mHistory.get(mHistory.size() - 1), false);
+ return navigateToHistory(mHistory.get(mHistory.size() - 1));
}
//Nothing to apply
@@ -1216,6 +1215,9 @@ public class NavigationFragment extends Fragment
}
// Show the dialog
+ if (mActionsDialog != null && mActionsDialog.isShowing()) {
+ return;
+ }
mActionsDialog = new ActionsDialog(getActivity(), this, fso, global, false);
mActionsDialog.setOnRequestRefreshListener(this);
mActionsDialog.setOnSelectionListener(getCurrentNavigationView());