Search in sources :

Example 1 with LoadFilesListTask

use of com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask in project AmazeFileManager by TeamAmaze.

the class MainFragment method loadlist.

/**
 * This loads a path into the MainFragment.
 * @param path the path to be loaded
 * @param back if we're coming back from any directory and want the scroll to be restored
 * @param openMode the mode in which the directory should be opened
 */
public void loadlist(final String path, final boolean back, final OpenMode openMode) {
    if (mActionMode != null)
        mActionMode.finish();
    mSwipeRefreshLayout.setRefreshing(true);
    if (loadFilesListTask != null && loadFilesListTask.getStatus() == AsyncTask.Status.RUNNING) {
        loadFilesListTask.cancel(true);
    }
    loadFilesListTask = new LoadFilesListTask(ma.getActivity(), path, ma, openMode, getBoolean(PREFERENCE_SHOW_THUMB), getBoolean(PREFERENCE_SHOW_HIDDENFILES), (data) -> {
        if (data != null && data.second != null) {
            boolean isPathLayoutGrid = dataUtils.getListOrGridForPath(path, DataUtils.LIST) == DataUtils.GRID;
            setListElements(data.second, back, path, data.first, false, isPathLayoutGrid);
            mSwipeRefreshLayout.setRefreshing(false);
        }
    });
    loadFilesListTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) Bundle(android.os.Bundle) Uri(android.net.Uri) ImageView(android.widget.ImageView) ColorDrawable(android.graphics.drawable.ColorDrawable) AppTheme(com.amaze.filemanager.utils.theme.AppTheme) CryptHandler(com.amaze.filemanager.database.CryptHandler) PREFERENCE_SHOW_HEADERS(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_SHOW_HEADERS) Log(android.util.Log) LayoutElementParcelable(com.amaze.filemanager.adapters.data.LayoutElementParcelable) DividerItemDecoration(com.amaze.filemanager.ui.views.DividerItemDecoration) GeneralDialogCreation(com.amaze.filemanager.ui.dialogs.GeneralDialogCreation) MediaScannerConnection(android.media.MediaScannerConnection) ActionMode(android.support.v7.view.ActionMode) IntentFilter(android.content.IntentFilter) R(com.amaze.filemanager.R) PREFERENCE_SHOW_DIVIDERS(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_SHOW_DIVIDERS) MainActivity(com.amaze.filemanager.activities.MainActivity) ArrayList(java.util.ArrayList) PREFERENCE_USE_CIRCULAR_IMAGES(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_USE_CIRCULAR_IMAGES) MainActivityHelper(com.amaze.filemanager.utils.MainActivityHelper) SshClientUtils(com.amaze.filemanager.filesystem.ssh.SshClientUtils) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) DataUtils(com.amaze.filemanager.utils.DataUtils) Menu(android.view.Menu) CloudUtil(com.amaze.filemanager.utils.cloud.CloudUtil) ShortcutManagerCompat(android.support.v4.content.pm.ShortcutManagerCompat) DrawerLayout(android.support.v4.widget.DrawerLayout) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) Formatter(android.text.format.Formatter) DeleteTask(com.amaze.filemanager.asynchronous.asynctasks.DeleteTask) UtilitiesProvider(com.amaze.filemanager.utils.provider.UtilitiesProvider) EncryptedEntry(com.amaze.filemanager.database.models.EncryptedEntry) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) File(java.io.File) EncryptDecryptUtils(com.amaze.filemanager.utils.files.EncryptDecryptUtils) FragmentManager(android.support.v4.app.FragmentManager) Utils(com.amaze.filemanager.utils.Utils) SharedPreferences(android.content.SharedPreferences) SmbFile(jcifs.smb.SmbFile) RingtoneManager(android.media.RingtoneManager) PreferencesConstants(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants) ColorUsage(com.amaze.filemanager.utils.color.ColorUsage) PackageManager(android.content.pm.PackageManager) SmbException(jcifs.smb.SmbException) ThemedActivity(com.amaze.filemanager.activities.superclasses.ThemedActivity) RecyclerAdapter(com.amaze.filemanager.adapters.RecyclerAdapter) PasteHelper(com.amaze.filemanager.filesystem.PasteHelper) View(android.view.View) PreferenceManager(android.preference.PreferenceManager) BottomBarButtonPath(com.amaze.filemanager.utils.BottomBarButtonPath) FileHandler(com.amaze.filemanager.asynchronous.handlers.FileHandler) PREFERENCE_SHOW_GOBACK_BUTTON(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_SHOW_GOBACK_BUTTON) AsyncTask(android.os.AsyncTask) LoadFilesListTask(com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask) OTGUtil(com.amaze.filemanager.utils.OTGUtil) IconCompat(android.support.v4.graphics.drawable.IconCompat) BroadcastReceiver(android.content.BroadcastReceiver) ViewGroup(android.view.ViewGroup) CryptUtil(com.amaze.filemanager.utils.files.CryptUtil) List(java.util.List) TextView(android.widget.TextView) ActivityNotFoundException(android.content.ActivityNotFoundException) FragmentActivity(android.support.v4.app.FragmentActivity) CustomFileObserver(com.amaze.filemanager.filesystem.CustomFileObserver) CloudHandler(com.amaze.filemanager.database.CloudHandler) ShortcutInfoCompat(android.support.v4.content.pm.ShortcutInfoCompat) MimeTypes(com.amaze.filemanager.ui.icons.MimeTypes) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) Tab(com.amaze.filemanager.database.models.Tab) FastScroller(com.amaze.filemanager.ui.views.FastScroller) Context(android.content.Context) AppBarLayout(android.support.design.widget.AppBarLayout) PREFERENCE_SHOW_LAST_MODIFIED(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_SHOW_LAST_MODIFIED) HybridFile(com.amaze.filemanager.filesystem.HybridFile) Intent(android.content.Intent) HashMap(java.util.HashMap) RoundedImageView(com.amaze.filemanager.ui.views.RoundedImageView) Streamer(com.amaze.filemanager.utils.SmbStreamer.Streamer) PreferencesActivity(com.amaze.filemanager.activities.PreferencesActivity) MenuItem(android.view.MenuItem) HybridFileParcelable(com.amaze.filemanager.filesystem.HybridFileParcelable) PREFERENCE_SHOW_FILE_SIZE(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_SHOW_FILE_SIZE) PREFERENCE_SHOW_PERMISSIONS(com.amaze.filemanager.fragments.preference_fragments.PreferencesConstants.PREFERENCE_SHOW_PERMISSIONS) Build(android.os.Build) FileListSorter(com.amaze.filemanager.utils.files.FileListSorter) MalformedURLException(java.net.MalformedURLException) LayoutInflater(android.view.LayoutInflater) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) ResolveInfo(android.content.pm.ResolveInfo) Color(android.graphics.Color) MediaStoreHack(com.amaze.filemanager.filesystem.MediaStoreHack) FileUtils(com.amaze.filemanager.utils.files.FileUtils) ViewTreeObserver(android.view.ViewTreeObserver) Activity(android.app.Activity) OpenMode(com.amaze.filemanager.utils.OpenMode) Collections(java.util.Collections) Resources(android.content.res.Resources) LoadFilesListTask(com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask)

Aggregations

Activity (android.app.Activity)1 ActivityNotFoundException (android.content.ActivityNotFoundException)1 BroadcastReceiver (android.content.BroadcastReceiver)1 Context (android.content.Context)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 SharedPreferences (android.content.SharedPreferences)1 PackageManager (android.content.pm.PackageManager)1 ResolveInfo (android.content.pm.ResolveInfo)1 Resources (android.content.res.Resources)1 Color (android.graphics.Color)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 MediaScannerConnection (android.media.MediaScannerConnection)1 RingtoneManager (android.media.RingtoneManager)1 Uri (android.net.Uri)1 AsyncTask (android.os.AsyncTask)1 Build (android.os.Build)1 Bundle (android.os.Bundle)1 PreferenceManager (android.preference.PreferenceManager)1 AppBarLayout (android.support.design.widget.AppBarLayout)1