use of dev.dworks.apps.anexplorer.DocumentsActivity in project AnExplorer by 1hakr.
the class RenameFragment method onCreateDialog.
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Context context = getActivity();
final DocumentsActivity activity = (DocumentsActivity) getActivity();
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
final LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());
final View view = dialogInflater.inflate(R.layout.dialog_create_dir, null, false);
final EditText text1 = (EditText) view.findViewById(android.R.id.text1);
Utils.tintWidget(text1);
String nameOnly = editExtension ? doc.displayName : FileUtils.removeExtension(doc.mimeType, doc.displayName);
text1.setText(nameOnly);
text1.setSelection(text1.getText().length());
builder.setTitle(R.string.menu_rename);
builder.setView(view);
builder.setPositiveButton(R.string.menu_rename, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
final String displayName = text1.getText().toString();
final String fileName = editExtension ? displayName : FileUtils.addExtension(doc.mimeType, displayName);
new RenameTask(activity, doc, fileName).executeOnExecutor(ProviderExecutor.forAuthority(doc.authority));
}
});
builder.setNegativeButton(android.R.string.cancel, null);
return builder.create();
}
use of dev.dworks.apps.anexplorer.DocumentsActivity in project AnExplorer by 1hakr.
the class ConnectionsFragment method openConnectionRoot.
public void openConnectionRoot(NetworkConnection connection) {
DocumentsActivity activity = ((DocumentsActivity) getActivity());
activity.onRootPicked(activity.getRoots().getRootInfo(connection), mConnectionsRoot);
}
use of dev.dworks.apps.anexplorer.DocumentsActivity in project AnExplorer by 1hakr.
the class HomeFragment method openRoot.
private void openRoot(RootInfo rootInfo) {
DocumentsActivity activity = ((DocumentsActivity) getActivity());
activity.onRootPicked(rootInfo, mHomeRoot);
AnalyticsManager.logEvent("open_shortcuts", rootInfo, new Bundle());
}
use of dev.dworks.apps.anexplorer.DocumentsActivity 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.DocumentsActivity in project AnExplorer by 1hakr.
the class MoveFragment method onClick.
@Override
public void onClick(View v) {
final DocumentsActivity activity = DocumentsActivity.get(MoveFragment.this);
switch(v.getId()) {
case android.R.id.button1:
if (mReplaceTarget != null) {
final boolean deleteAfter = getArguments().getBoolean(EXTRA_DELETE_AFTER);
activity.onMoveRequested(docs, mReplaceTarget, deleteAfter);
}
break;
case android.R.id.button2:
getActivity().getFragmentManager().beginTransaction().remove(this).commit();
break;
}
}
Aggregations