Fields Summary |
---|
public static final String | TAG |
private com.android.documentsui.model.DocumentInfo | mReplaceTarget |
private android.widget.EditText | mDisplayName |
private android.widget.Button | mSave |
private android.widget.ProgressBar | mProgress |
private boolean | mIgnoreNextEdit |
private static final String | EXTRA_MIME_TYPE |
private static final String | EXTRA_DISPLAY_NAME |
private android.text.TextWatcher | mDisplayNameWatcher |
private View.OnClickListener | mSaveListener |
Methods Summary |
---|
public static com.android.documentsui.SaveFragment | get(android.app.FragmentManager fm)
return (SaveFragment) fm.findFragmentByTag(TAG);
|
public android.view.View | onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
final Context context = inflater.getContext();
final View view = inflater.inflate(R.layout.fragment_save, container, false);
final ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
icon.setImageDrawable(
IconUtils.loadMimeIcon(context, getArguments().getString(EXTRA_MIME_TYPE)));
mDisplayName = (EditText) view.findViewById(android.R.id.title);
mDisplayName.addTextChangedListener(mDisplayNameWatcher);
mDisplayName.setText(getArguments().getString(EXTRA_DISPLAY_NAME));
mSave = (Button) view.findViewById(android.R.id.button1);
mSave.setOnClickListener(mSaveListener);
mSave.setEnabled(false);
mProgress = (ProgressBar) view.findViewById(android.R.id.progress);
return view;
|
public void | setPending(boolean pending)
mSave.setVisibility(pending ? View.INVISIBLE : View.VISIBLE);
mProgress.setVisibility(pending ? View.VISIBLE : View.GONE);
|
public void | setReplaceTarget(com.android.documentsui.model.DocumentInfo replaceTarget)Set given document as target for in-place writing if user hits save
without changing the filename. Can be set to {@code null} if user
navigates outside the target directory.
mReplaceTarget = replaceTarget;
if (mReplaceTarget != null) {
getArguments().putString(EXTRA_DISPLAY_NAME, replaceTarget.displayName);
mIgnoreNextEdit = true;
mDisplayName.setText(replaceTarget.displayName);
}
|
public void | setSaveEnabled(boolean enabled)
mSave.setEnabled(enabled);
|
public static void | show(android.app.FragmentManager fm, java.lang.String mimeType, java.lang.String displayName)
final Bundle args = new Bundle();
args.putString(EXTRA_MIME_TYPE, mimeType);
args.putString(EXTRA_DISPLAY_NAME, displayName);
final SaveFragment fragment = new SaveFragment();
fragment.setArguments(args);
final FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.container_save, fragment, TAG);
ft.commitAllowingStateLoss();
|