Search in sources :

Example 1 with DocumentsActivity

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();
}
Also used : Context(android.content.Context) AlertDialog(android.support.v7.app.AlertDialog) EditText(android.widget.EditText) DocumentsActivity(dev.dworks.apps.anexplorer.DocumentsActivity) DialogInterface(android.content.DialogInterface) View(android.view.View) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 2 with DocumentsActivity

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);
}
Also used : DocumentsActivity(dev.dworks.apps.anexplorer.DocumentsActivity)

Example 3 with DocumentsActivity

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());
}
Also used : DocumentsActivity(dev.dworks.apps.anexplorer.DocumentsActivity) Bundle(android.os.Bundle)

Example 4 with DocumentsActivity

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);
    }
}
Also used : DocumentsActivity(dev.dworks.apps.anexplorer.DocumentsActivity) RootInfo(dev.dworks.apps.anexplorer.model.RootInfo) Timer(java.util.Timer) Bundle(android.os.Bundle) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 5 with DocumentsActivity

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;
    }
}
Also used : DocumentsActivity(dev.dworks.apps.anexplorer.DocumentsActivity)

Aggregations

DocumentsActivity (dev.dworks.apps.anexplorer.DocumentsActivity)6 View (android.view.View)3 Context (android.content.Context)2 DialogInterface (android.content.DialogInterface)2 OnClickListener (android.content.DialogInterface.OnClickListener)2 Bundle (android.os.Bundle)2 AlertDialog (android.support.v7.app.AlertDialog)2 LayoutInflater (android.view.LayoutInflater)2 EditText (android.widget.EditText)2 RecyclerView (android.support.v7.widget.RecyclerView)1 TextView (android.widget.TextView)1 DocumentInfo (dev.dworks.apps.anexplorer.model.DocumentInfo)1 RootInfo (dev.dworks.apps.anexplorer.model.RootInfo)1 Timer (java.util.Timer)1