--Subproject commit dbc8c325d74f3f7e8da8236c5abe77a141ae4019
++Subproject commit c8f6e5ad57ee27fdac39c7b14eb6ab1942a92d49
android:title="@string/actionbar_mkdir"
android:contentDescription="@string/actionbar_mkdir"/>
<item
- android:icon="@android:drawable/ic_menu_view"
+ android:id="@+id/action_switch_view"
++ android:icon="@drawable/ic_view_module"
+ android:orderInCategory="2"
++ app:showAsAction="always"
+ android:title="@string/action_switch_grid_view" />
+ <item
android:id="@+id/action_sync_account"
android:icon="@drawable/ic_action_refresh"
android:orderInCategory="2"
<string name="drawer_item_settings">Settings</string>
<string name="drawer_item_logs">Logs</string>
<string name="drawer_close">Close</string>
+ <string name="drawer_open">Open</string>
<string name="prefs_category_general">General</string>
<string name="prefs_category_more">More</string>
<string name="prefs_accounts">Accounts</string>
<string name="confirmation_remove_alert">"Do you really want to remove %1$s?"</string>
<string name="confirmation_remove_folder_alert">"Do you really want to remove %1$s and its contents?"</string>
<string name="confirmation_remove_local">Local only</string>
- <string name="confirmation_remove_folder_local">Local contents only</string>
- <string name="confirmation_remove_remote">Remove from server</string>
- <string name="confirmation_remove_remote_and_local">Remote and local</string>
+ <string name="confirmation_remove_folder_local">Local only</string>
+ <string name="confirmation_remove_remote">From server</string>
+ <string name="confirmation_remove_remote_and_local">Remote & local</string>
<string name="remove_success_msg">"Removal succeeded"</string>
<string name="remove_fail_msg">"Removal failed"</string>
<string name="rename_dialog_title">Enter a new name</string>
<string name="conflict_title">File conflict</string>
<string name="conflict_message">Which files do you want to keep? If you select both versions, the local file will have a number added to its name.</string>
<string name="conflict_keep_both">Keep both</string>
- <string name="conflict_use_local_version">Use local version</string>
- <string name="conflict_use_server_version">Use server version</string>
+ <string name="conflict_use_local_version">local version</string>
+ <string name="conflict_use_server_version">server version</string>
<string name="preview_image_description">Image preview</string>
<string name="preview_image_error_unknown_format">This image cannot be shown</string>
<string name="file_list__footer__files">%1$d files</string>
<string name="file_list__footer__files_and_folder">%1$d files, 1 folder</string>
<string name="file_list__footer__files_and_folders">%1$d files, %2$d folders</string>
-
+ <string name="action_switch_grid_view">Switch to grid view</string>
+ <string name="action_switch_list_view">Switch to list view</string>
</resources>
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
import android.annotation.TargetApi;
- import android.app.AlertDialog;
+ import android.support.v7.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
+ import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
- import android.view.Window;
+ import android.widget.ProgressBar;
+ import android.widget.RelativeLayout;
+ import android.widget.TextView;
import android.widget.Toast;
import com.owncloud.android.MainApp;
private boolean mDualPane;
private View mLeftFragmentContainer;
private View mRightFragmentContainer;
+ private ProgressBar mProgressBar;
private static final String KEY_WAITING_TO_PREVIEW = "WAITING_TO_PREVIEW";
private static final String KEY_SYNC_IN_PROGRESS = "SYNC_IN_PROGRESS";
private static String DIALOG_CERT_NOT_SAVED = "DIALOG_CERT_NOT_SAVED";
private OCFile mWaitingToSend;
+ private Menu mOptionsMenu;
+
-
@Override
protected void onCreate(Bundle savedInstanceState) {
Log_OC.v(TAG, "onCreate() start");
- requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
super.onCreate(savedInstanceState); // this calls onAccountChanged() when ownCloud Account
// is valid
// Navigation Drawer
initDrawer();
+ mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
+ mProgressBar.setIndeterminateDrawable(
+ ContextCompat.getDrawable(this,
+ R.drawable.actionbar_progress_indeterminate_horizontal));
+
mDualPane = getResources().getBoolean(R.bool.large_land_layout);
mLeftFragmentContainer = findViewById(R.id.left_fragment_container);
mRightFragmentContainer = findViewById(R.id.right_fragment_container);
// according to the official
// documentation
- setSupportProgressBarIndeterminateVisibility(mSyncInProgress
- /*|| mRefreshSharesInProgress*/);
+ // enable ActionBar app icon to behave as action to toggle nav drawer
+ //getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setHomeButtonEnabled(true);
+
+ mProgressBar.setIndeterminate(mSyncInProgress);
// always AFTER setContentView(...) ; to work around bug in its implementation
setBackgroundText();
protected void onStart() {
Log_OC.v(TAG, "onStart() start");
super.onStart();
- getSupportActionBar().setIcon(DisplayUtils.getSeasonalIconId());
Log_OC.v(TAG, "onStart() end");
}
file = getStorageManager().getFileByPath(OCFile.ROOT_PATH); // never returns null
}
setFile(file);
-
+
+ if (mAccountWasSet) {
+ RelativeLayout navigationDrawerLayout = (RelativeLayout) findViewById(R.id.left_drawer);
+ if (navigationDrawerLayout != null && getAccount() != null) {
+ TextView username = (TextView) navigationDrawerLayout.findViewById(R.id.drawer_username);
+ int lastAtPos = getAccount().name.lastIndexOf("@");
+ username.setText(getAccount().name.substring(0, lastAtPos));
+ }
+ }
+
if (!stateWasRecovered) {
Log_OC.d(TAG, "Initializing Fragments in onAccountChanged..");
initFragmentsWithFile();
cleanSecondFragment();
}
+ if (DisplayUtils.isGridView(getFile(), getStorageManager())){
+ switchToGridView();
+ } else {
+ switchToListView();
+ }
+
} else {
Log_OC.wtf(TAG, "initFragments() called with invalid NULLs!");
if (getAccount() == null) {
menu.findItem(R.id.action_create_dir).setVisible(!drawerOpen);
menu.findItem(R.id.action_sort).setVisible(!drawerOpen);
menu.findItem(R.id.action_sync_account).setVisible(!drawerOpen);
++ menu.findItem(R.id.action_switch_view).setVisible(!drawerOpen);
return super.onPrepareOptionsMenu(menu);
}
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
- if (DisplayUtils.isGridView(getFile(), getStorageManager())){
- menuItem.setTitle(getApplicationContext().getString(R.string.action_switch_list_view));
- } else {
- menuItem.setTitle(getApplicationContext().getString(R.string.action_switch_grid_view));
- }
+ mOptionsMenu = menu;
+
+ MenuItem menuItem = mOptionsMenu.findItem(R.id.action_switch_view);
+
++ changeGridIcon();
+
return true;
}
builder.create().show();
break;
}
- item.setTitle(getApplicationContext().getString(R.string.action_switch_list_view));
+ case R.id.action_switch_view:{
+ if (isGridView()){
- item.setTitle(getApplicationContext().getString(R.string.action_switch_grid_view));
++ item.setTitle(getApplicationContext().getString(R.string.action_switch_grid_view));
++ item.setIcon(ContextCompat.getDrawable(getApplicationContext(),
++ R.drawable.ic_view_module));
+ DisplayUtils.setViewMode(getFile(), false);
+ switchToListView();
+ } else {
++ item.setTitle(getApplicationContext().getString(R.string.action_switch_list_view));
++ item.setIcon(ContextCompat.getDrawable(getApplicationContext(),
++ R.drawable.ic_view_list));
+ DisplayUtils.setViewMode(getFile(), true);
+ switchToGridView();
+ }
++
+ return true;
+ }
default:
retval = super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
- OCFileListFragment listOfFiles = getListOfFilesFragment();
- if (mDualPane || getSecondFragment() == null) {
- OCFile currentDir = getCurrentDir();
- if (currentDir == null || currentDir.getParentId() == FileDataStorageManager.ROOT_PARENT_ID) {
- finish();
- return;
+ if (!isDrawerOpen()){
+ OCFileListFragment listOfFiles = getListOfFilesFragment();
+ if (mDualPane || getSecondFragment() == null) {
+ OCFile currentDir = getCurrentDir();
+ if (currentDir == null || currentDir.getParentId() == FileDataStorageManager.ROOT_PARENT_ID) {
+ finish();
+ return;
+ }
+ if (listOfFiles != null) { // should never be null, indeed
+ listOfFiles.onBrowseUp();
+ }
}
if (listOfFiles != null) { // should never be null, indeed
- listOfFiles.onBrowseUp();
+ setFile(listOfFiles.getCurrentFile());
}
+ cleanSecondFragment();
++
++ changeGridIcon();
+ } else {
+ super.onBackPressed();
}
- if (listOfFiles != null) { // should never be null, indeed
- setFile(listOfFiles.getCurrentFile());
- }
- cleanSecondFragment();
+ }
++ private void changeGridIcon(){
+ MenuItem menuItem = mOptionsMenu.findItem(R.id.action_switch_view);
+ if (DisplayUtils.isGridView(getFile(), getStorageManager())){
+ menuItem.setTitle(getApplicationContext().getString(R.string.action_switch_list_view));
++ menuItem.setIcon(ContextCompat.getDrawable(getApplicationContext(),
++ R.drawable.ic_view_list));
+ } else {
+ menuItem.setTitle(getApplicationContext().getString(R.string.action_switch_grid_view));
++ menuItem.setIcon(ContextCompat.getDrawable(getApplicationContext(),
++ R.drawable.ic_view_module));
+ }
+ }
+
@Override
protected void onSaveInstanceState(Bundle outState) {
// responsibility of restore is preferred in onCreate() before than in
}
removeStickyBroadcast(intent);
Log_OC.d(TAG, "Setting progress visibility to " + mSyncInProgress);
- setSupportProgressBarIndeterminateVisibility(mSyncInProgress
- /*|| mRefreshSharesInProgress*/);
+ mProgressBar.setIndeterminate(mSyncInProgress);
+ //mProgressBar.setVisibility((mSyncInProgress) ? View.VISIBLE : View.INVISIBLE);
+ //setSupportProgressBarIndeterminateVisibility(mSyncInProgress
+ /*|| mRefreshSharesInProgress*/ //);
setBackgroundText();
startImagePreview(getFile());
} // TODO what about other kind of previews?
}
-
+
+ mProgressBar.setIndeterminate(false);
} finally {
if (intent != null) {
removeStickyBroadcast(intent);
cleanSecondFragment();
// Sync Folder
startSyncFolderOperation(directory, false);
- menuItem.setTitle(getApplicationContext().getString(R.string.action_switch_list_view));
+
+ MenuItem menuItem = mOptionsMenu.findItem(R.id.action_switch_view);
+
++ changeGridIcon();
+ if (DisplayUtils.isGridView(directory, getStorageManager())){
- menuItem.setTitle(getApplicationContext().getString(R.string.action_switch_grid_view));
+ switchToGridView();
+ } else {
+ switchToListView();
+ }
}
/**
}
-
@Override
protected ServiceConnection newTransferenceServiceConnection() {
return new ListServiceConnection();
getApplicationContext()
);
synchFolderOp.execute(getAccount(), MainApp.getAppContext(), this, null, null);
-
- setSupportProgressBarIndeterminateVisibility(true);
+ mProgressBar.setIndeterminate(true);
setBackgroundText();
}
private void sortByName(boolean ascending){
getListOfFilesFragment().sortByName(ascending);
}
+ private boolean isGridView(){ return getListOfFilesFragment().isGridView(); }
+ private void switchToGridView() {
+ getListOfFilesFragment().switchToGridView();
+ }
+ private void switchToListView() {
+ getListOfFilesFragment().switchToListView();
+ }
public void allFilesOption() {
browseToRoot();
}
- protected void switchToGridView() {
+ public void switchToGridView() {
if ((mCurrentListView == mListView)) {
mListView.setAdapter(null);
mCurrentListView = mGridView;
}
}
-
- protected void switchToListView() {
+
+ public void switchToListView() {
if (mCurrentListView == mGridView) {
mGridView.setAdapter(null);
mRefreshGridLayout.setVisibility(View.GONE);
mCurrentListView = mListView;
}
}
+
+ public boolean isGridView(){
+ if (mAdapter instanceof FileListListAdapter) {
+ return ((FileListListAdapter) mAdapter).isGridMode();
+ }
+ return false;
+ }
@Override
}
private void onCreateSwipeToRefresh(SwipeRefreshLayout refreshLayout) {
- // Colors in animations: background
- refreshLayout.setColorScheme(R.color.background_color, R.color.background_color,
- R.color.background_color, R.color.background_color);
+ // Colors in animations
+ refreshLayout.setColorSchemeResources(R.color.color_accent, R.color.primary,
+ R.color.primary_dark);
refreshLayout.setOnRefreshListener(this);
}
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.ContextMenu;
+ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
+ import android.widget.PopupMenu;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
import com.owncloud.android.ui.adapter.FileListListAdapter;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
+ import com.owncloud.android.ui.dialog.FileActionsDialogFragment;
import com.owncloud.android.ui.dialog.RemoveFileDialogFragment;
import com.owncloud.android.ui.dialog.RenameFileDialogFragment;
import com.owncloud.android.ui.preview.PreviewImageFragment;
import com.owncloud.android.ui.preview.PreviewMediaFragment;
-import com.owncloud.android.utils.DialogMenuItem;
+import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.FileStorageUtils;
/**
*
* TODO refactor to get rid of direct dependency on FileDisplayActivity
*/
- public class OCFileListFragment extends ExtendedListFragment {
+ public class OCFileListFragment extends ExtendedListFragment implements FileActionsDialogFragment.FileActionsDialogFragmentListener {
private static final String TAG = OCFileListFragment.class.getSimpleName();
);
setListAdapter(mAdapter);
- registerForContextMenu();
+ registerLongClickListener();
}
+ private void registerLongClickListener() {
+ getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
+ public boolean onItemLongClick(AdapterView<?> arg0, View v,
+ int index, long arg3) {
+ showFileAction(index);
+ return true;
+ }
+ });
+ }
+
+
+ private void showFileAction(int fileIndex) {
+ Bundle args = getArguments();
+ PopupMenu pm = new PopupMenu(getActivity(),null);
+ Menu menu = pm.getMenu();
+
+ boolean allowContextualActions =
+ (args == null) ? true : args.getBoolean(ARG_ALLOW_CONTEXTUAL_ACTIONS, true);
+
+ if (allowContextualActions) {
+ MenuInflater inflater = getActivity().getMenuInflater();
+
+ inflater.inflate(R.menu.file_actions_menu, menu);
+ OCFile targetFile = (OCFile) mAdapter.getItem(fileIndex);
+
+ if (mContainerActivity.getStorageManager() != null) {
+ FileMenuFilter mf = new FileMenuFilter(
+ targetFile,
+ mContainerActivity.getStorageManager().getAccount(),
+ mContainerActivity,
+ getActivity()
+ );
+ mf.filter(menu);
+ }
+
+ /// TODO break this direct dependency on FileDisplayActivity... if possible
+ MenuItem item = menu.findItem(R.id.action_open_file_with);
+ FileFragment frag = ((FileDisplayActivity)getActivity()).getSecondFragment();
+ if (frag != null && frag instanceof FileDetailFragment &&
+ frag.getFile().getFileId() == targetFile.getFileId()) {
+ item = menu.findItem(R.id.action_see_details);
+ if (item != null) {
+ item.setVisible(false);
+ item.setEnabled(false);
+ }
+ }
+
+ FileActionsDialogFragment dialog = FileActionsDialogFragment.newInstance(menu, fileIndex);
+ dialog.setTargetFragment(this, 0);
+ dialog.show(getFragmentManager(), FileActionsDialogFragment.FTAG_FILE_ACTIONS);
+ }
+ }
+
/**
* Saves the current listed folder.
*/
/**
* Call this, when the user presses the up button.
*
- * Tries to move up the current folder one level. If the parent folder was removed from the
+ * Tries to move up the current folder one level. If the parent folder was removed from the
* database, it continues browsing up until finding an existing folders.
*
* return Count of folder levels browsed up.
@Override
public void onCreateContextMenu (
ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
- super.onCreateContextMenu(menu, v, menuInfo);
Bundle args = getArguments();
boolean allowContextualActions =
(args == null) ? true : args.getBoolean(ARG_ALLOW_CONTEXTUAL_ACTIONS, true);
item.setEnabled(false);
}
}
+
+// String.format(mContext.getString(R.string.subject_token),
+// getClient().getCredentials().getUsername(), file.getFileName()));
}
}
-
-
+
/**
- * {@inhericDoc}
+ * {@inheritDoc}
*/
@Override
- public boolean onContextItemSelected (MenuItem item) {
- AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
- mTargetFile = (OCFile) mAdapter.getItem(info.position);
- switch (item.getItemId()) {
+ public boolean onFileActionChosen(int menuId, int filePosition) {
+ mTargetFile = (OCFile) mAdapter.getItem(filePosition);
+ switch (menuId) {
case R.id.action_share_file: {
mContainerActivity.getFileOperationsHelper().shareFileWithLink(mTargetFile);
return true;
dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION);
return true;
}
- case R.id.action_download_file:
+ case R.id.action_download_file:
case R.id.action_sync_file: {
mContainerActivity.getFileOperationsHelper().syncFile(mTargetFile);
return true;
}
case R.id.action_cancel_download:
case R.id.action_cancel_upload: {
- ((FileDisplayActivity)mContainerActivity).cancelTransference(mTargetFile);
+ ((FileDisplayActivity) mContainerActivity).cancelTransference(mTargetFile);
return true;
}
case R.id.action_see_details: {
// Obtain the file
if (!mTargetFile.isDown()) { // Download the file
Log_OC.d(TAG, mTargetFile.getRemotePath() + " : File must be downloaded");
- ((FileDisplayActivity)mContainerActivity).startDownloadForSending(mTargetFile);
-
+ ((FileDisplayActivity) mContainerActivity).startDownloadForSending(mTargetFile);
+
} else {
mContainerActivity.getFileOperationsHelper().sendDownloadedFile(mTargetFile);
}
getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES);
return true;
}
- case R.id.action_favorite_file:{
+ case R.id.action_favorite_file: {
mContainerActivity.getFileOperationsHelper().toggleFavorite(mTargetFile, true);
return true;
}
- case R.id.action_unfavorite_file:{
+ case R.id.action_unfavorite_file: {
mContainerActivity.getFileOperationsHelper().toggleFavorite(mTargetFile, false);
return true;
}
default:
- return super.onContextItemSelected(item);
+ return false;
+ }
+ }
+
+ /**
+ * {@inhericDoc}
+ */
+ @Override
+ public boolean onContextItemSelected (MenuItem item) {
+ AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
+ boolean matched = onFileActionChosen(item.getItemId(), ((AdapterContextMenuInfo) item.getMenuInfo()).position);
+ if(!matched) {
+ return super.onContextItemSelected(item);
+ } else {
+ return matched;
}
}
if (directory == null) return; // no files, wait for sync
}
}
-
+
// If that's not a directory -> List its parent
if(!directory.isFolder()){
OwnCloudVersion version = AccountUtils.getServerVersion(
((FileActivity)mContainerActivity).getAccount());
if (version != null && version.supportsRemoteThumbnails() &&
- imagesCount > 0 && imagesCount == filesCount) {
+ DisplayUtils.isGridView(mFile, mContainerActivity.getStorageManager())) {
switchToGridView();
+ registerLongClickListener();
} else {
switchToListView();
}
return output;
}
-
public void sortByName(boolean descending) {
mAdapter.setSortOrder(FileStorageUtils.SORT_NAME, descending);
}
public void sortBySize(boolean descending) {
mAdapter.setSortOrder(FileStorageUtils.SORT_SIZE, descending);
}
-
-
}
\r
package com.owncloud.android.utils;\r
\r
+import java.io.File;\r
import java.net.IDN;\r
import java.text.DateFormat;\r
import java.util.Arrays;\r
import android.annotation.TargetApi;\r
import android.app.Activity;\r
import android.content.Context;\r
-import android.graphics.Color;\r
+import android.content.SharedPreferences;\r
import android.graphics.Point;\r
+ import android.graphics.PorterDuff;\r
import android.os.Build;\r
import android.text.format.DateUtils;\r
import android.view.Display;\r
import android.webkit.MimeTypeMap;\r
+ import android.widget.ProgressBar;\r
+ import android.widget.SeekBar;\r
\r
import com.owncloud.android.MainApp;\r
import com.owncloud.android.R;\r
+import com.owncloud.android.datamodel.FileDataStorageManager;\r
import com.owncloud.android.datamodel.OCFile;\r
\r
/**\r
}\r
\r
/**\r
+ * Determines if user set folder to grid or list view. If folder is not set itself,\r
+ * it finds a parent that is set (at least root is set).\r
+ * @param file\r
+ * @param storageManager\r
+ * @return\r
+ */\r
+ public static boolean isGridView(OCFile file, FileDataStorageManager storageManager){\r
+ if (file != null) {\r
+ OCFile fileToTest = file;\r
+ OCFile parentDir = null;\r
+ String parentPath = null;\r
+\r
+ SharedPreferences setting = MainApp.getAppContext().getSharedPreferences(\r
+ "viewMode", Context.MODE_PRIVATE);\r
+\r
+ if (setting.contains(fileToTest.getRemoteId())) {\r
+ return setting.getBoolean(fileToTest.getRemoteId(), false);\r
+ } else {\r
+ do {\r
+ if (fileToTest.getParentId() != FileDataStorageManager.ROOT_PARENT_ID) {\r
+ parentPath = new File(fileToTest.getRemotePath()).getParent();\r
+ parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath :\r
+ parentPath + OCFile.PATH_SEPARATOR;\r
+ parentDir = storageManager.getFileByPath(parentPath);\r
+ } else {\r
+ parentDir = storageManager.getFileByPath(OCFile.ROOT_PATH);\r
+ }\r
+\r
+ while (parentDir == null) {\r
+ parentPath = new File(parentPath).getParent();\r
+ parentPath = parentPath.endsWith(OCFile.PATH_SEPARATOR) ? parentPath :\r
+ parentPath + OCFile.PATH_SEPARATOR;\r
+ parentDir = storageManager.getFileByPath(parentPath);\r
+ }\r
+ fileToTest = parentDir;\r
+ } while (endWhile(parentDir, setting));\r
+ return setting.getBoolean(fileToTest.getRemoteId(), false);\r
+ }\r
+ } else {\r
+ return false;\r
+ }\r
+ }\r
+\r
+ private static boolean endWhile(OCFile parentDir, SharedPreferences setting) {\r
+ if (parentDir.getRemotePath().compareToIgnoreCase(OCFile.ROOT_PATH) == 0) {\r
+ return false;\r
+ } else {\r
+ return !setting.contains(parentDir.getRemoteId());\r
+ }\r
+ }\r
+\r
+ public static void setViewMode(OCFile file, boolean setGrid){\r
+ SharedPreferences setting = MainApp.getAppContext().getSharedPreferences(\r
+ "viewMode", Context.MODE_PRIVATE);\r
+\r
+ SharedPreferences.Editor editor = setting.edit();\r
+ editor.putBoolean(file.getRemoteId(), setGrid);\r
+ editor.commit();\r
+ }\r
+\r
++ /**\r
+ * sets the coloring of the given progress bar to color_accent.\r
+ *\r
+ * @param progressBar the progress bar to be colored\r
+ */\r
+ public static void colorPreLollipopHorizontalProgressBar(ProgressBar progressBar) {\r
+ if (progressBar != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {\r
+ int color = progressBar.getResources().getColor(R.color.color_accent);\r
+ progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);\r
+ progressBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * sets the coloring of the given seek bar to color_accent.\r
+ *\r
+ * @param seekBar the seek bar to be colored\r
+ */\r
+ public static void colorPreLollipopHorizontalSeekBar(SeekBar seekBar) {\r
+ if (seekBar != null && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {\r
+ colorPreLollipopHorizontalProgressBar(seekBar);\r
+ \r
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {\r
+ int color = seekBar.getResources().getColor(R.color.color_accent);\r
+ seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);\r
+ seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);\r
+ }\r
+ }\r
+ }\r
}\r