use of dev.dworks.apps.anexplorer.model.RootInfo in project AnExplorer by 1hakr.
the class Utils method getAppsBackupFile.
public static File getAppsBackupFile(Context context) {
final RootInfo root = DocumentsApplication.getRootsCache(context).getPrimaryRoot();
File rootFile = (null != root) ? new File(root.path) : Environment.getExternalStorageDirectory();
return new File(rootFile, DIRECTORY_APPBACKUP);
}
use of dev.dworks.apps.anexplorer.model.RootInfo in project AnExplorer by 1hakr.
the class HomeFragment method showShortcuts.
private void showShortcuts() {
ArrayList<RootInfo> data = roots.getShortcutsInfo();
mShortcutsAdapter = new ShortcutsAdapter(getActivity(), data);
mShortcutsAdapter.setOnItemClickListener(new ShortcutsAdapter.OnItemClickListener() {
@Override
public void onItemClick(ShortcutsAdapter.ViewHolder item, int position) {
openRoot(mShortcutsAdapter.getItem(position));
}
});
mShortcutsRecycler.setAdapter(mShortcutsAdapter);
}
use of dev.dworks.apps.anexplorer.model.RootInfo in project AnExplorer by 1hakr.
the class HomeFragment method showMemory.
private void showMemory(long currentAvailableBytes) {
final RootInfo processRoot = roots.getProcessRoot();
if (null != processRoot) {
memoryStats.setVisibility(View.VISIBLE);
memoryStats.setInfo(processRoot);
memoryStats.setAction(R.drawable.ic_clean, new View.OnClickListener() {
@Override
public void onClick(View view) {
new OperationTask(processRoot).execute();
Bundle params = new Bundle();
AnalyticsManager.logEvent("process_clean", params);
}
});
memoryStats.setCardListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openRoot(processRoot);
}
});
if (currentAvailableBytes != 0) {
long availableBytes = processRoot.availableBytes - currentAvailableBytes;
String summaryText = availableBytes <= 0 ? "Already cleaned up!" : getActivity().getString(R.string.root_available_bytes, Formatter.formatFileSize(getActivity(), availableBytes));
((DocumentsActivity) getActivity()).showInfo(summaryText);
}
processTimer = new Timer();
animateProgress(memoryStats, processTimer, processRoot);
}
}
use of dev.dworks.apps.anexplorer.model.RootInfo in project AnExplorer by 1hakr.
the class HomeFragment method showRecents.
private void showRecents() {
final RootInfo root = roots.getRecentsRoot();
recents.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openRoot(root);
}
});
mRecentsAdapter = new RecentsAdapter(getActivity(), null);
mRecentsAdapter.setOnItemClickListener(new RecentsAdapter.OnItemClickListener() {
@Override
public void onItemClick(RecentsAdapter.ViewHolder item, int position) {
openDocument(item.mDocumentInfo);
}
});
mRecentsRecycler.setAdapter(mRecentsAdapter);
LinearSnapHelper helper = new LinearSnapHelper();
helper.attachToRecyclerView(mRecentsRecycler);
final BaseActivity.State state = getDisplayState(this);
mCallbacks = new LoaderManager.LoaderCallbacks<DirectoryResult>() {
@Override
public Loader<DirectoryResult> onCreateLoader(int id, Bundle args) {
final RootsCache roots = DocumentsApplication.getRootsCache(getActivity());
return new RecentLoader(getActivity(), roots, state);
}
@Override
public void onLoadFinished(Loader<DirectoryResult> loader, DirectoryResult result) {
if (!isAdded())
return;
if (null == result.cursor || (null != result.cursor && result.cursor.getCount() == 0)) {
recents_container.setVisibility(View.GONE);
} else {
// recents_container.setVisibility(View.VISIBLE);
mRecentsAdapter.swapCursor(new LimitCursorWrapper(result.cursor, MAX_RECENT_COUNT));
}
}
@Override
public void onLoaderReset(Loader<DirectoryResult> loader) {
mRecentsAdapter.swapCursor(null);
}
};
getLoaderManager().restartLoader(mLoaderId, null, mCallbacks);
}
use of dev.dworks.apps.anexplorer.model.RootInfo in project AnExplorer by 1hakr.
the class DocumentsActivity method again.
@Override
public void again() {
if (Utils.hasMarshmallow()) {
RootsCache.updateRoots(this, ExternalStorageProvider.AUTHORITY);
mRoots = DocumentsApplication.getRootsCache(this);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
mRoots.updateAsync();
final RootInfo root = getCurrentRoot();
if (root.isHome()) {
HomeFragment homeFragment = HomeFragment.get(getFragmentManager());
if (null != homeFragment) {
homeFragment.reloadData();
}
}
}
}, 500);
}
}
Aggregations