* commit '686fa2db5b8feeb9e378aeb8e5dbac2f79ef2153': Show spinner while waiting for mutations.
This commit is contained in:
@@ -51,15 +51,31 @@
|
|||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:selectAllOnFocus="true" />
|
android:selectAllOnFocus="true" />
|
||||||
|
|
||||||
<Button
|
<FrameLayout
|
||||||
android:id="@android:id/button1"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:text="@string/menu_save"
|
<Button
|
||||||
android:textAllCaps="true"
|
android:id="@android:id/button1"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:layout_width="wrap_content"
|
||||||
android:padding="8dp" />
|
android:layout_height="match_parent"
|
||||||
|
android:background="?android:attr/selectableItemBackground"
|
||||||
|
android:text="@string/menu_save"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:padding="8dp" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@android:id/progress"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:indeterminate="true"
|
||||||
|
android:padding="8dp"
|
||||||
|
style="?android:attr/progressBarStyle" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,11 @@ public class CreateDirectoryFragment extends DialogFragment {
|
|||||||
mDisplayName = displayName;
|
mDisplayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
mActivity.setPending(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected DocumentInfo doInBackground(Void... params) {
|
protected DocumentInfo doInBackground(Void... params) {
|
||||||
final ContentResolver resolver = mActivity.getContentResolver();
|
final ContentResolver resolver = mActivity.getContentResolver();
|
||||||
@@ -120,6 +125,8 @@ public class CreateDirectoryFragment extends DialogFragment {
|
|||||||
} else {
|
} else {
|
||||||
Toast.makeText(mActivity, R.string.create_error, Toast.LENGTH_SHORT).show();
|
Toast.makeText(mActivity, R.string.create_error, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mActivity.setPending(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -661,6 +661,13 @@ public class DocumentsActivity extends Activity {
|
|||||||
DirectoryFragment.get(getFragmentManager()).onUserModeChanged();
|
DirectoryFragment.get(getFragmentManager()).onUserModeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPending(boolean pending) {
|
||||||
|
final SaveFragment save = SaveFragment.get(getFragmentManager());
|
||||||
|
if (save != null) {
|
||||||
|
save.setPending(pending);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
if (!mState.stackTouched) {
|
if (!mState.stackTouched) {
|
||||||
@@ -1050,6 +1057,11 @@ public class DocumentsActivity extends Activity {
|
|||||||
mDisplayName = displayName;
|
mDisplayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPreExecute() {
|
||||||
|
setPending(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Uri doInBackground(Void... params) {
|
protected Uri doInBackground(Void... params) {
|
||||||
final ContentResolver resolver = getContentResolver();
|
final ContentResolver resolver = getContentResolver();
|
||||||
@@ -1083,6 +1095,8 @@ public class DocumentsActivity extends Activity {
|
|||||||
Toast.makeText(DocumentsActivity.this, R.string.save_error, Toast.LENGTH_SHORT)
|
Toast.makeText(DocumentsActivity.this, R.string.save_error, Toast.LENGTH_SHORT)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setPending(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
import android.widget.ProgressBar;
|
||||||
|
|
||||||
import com.android.documentsui.model.DocumentInfo;
|
import com.android.documentsui.model.DocumentInfo;
|
||||||
|
|
||||||
@@ -42,6 +43,7 @@ public class SaveFragment extends Fragment {
|
|||||||
private DocumentInfo mReplaceTarget;
|
private DocumentInfo mReplaceTarget;
|
||||||
private EditText mDisplayName;
|
private EditText mDisplayName;
|
||||||
private Button mSave;
|
private Button mSave;
|
||||||
|
private ProgressBar mProgress;
|
||||||
private boolean mIgnoreNextEdit;
|
private boolean mIgnoreNextEdit;
|
||||||
|
|
||||||
private static final String EXTRA_MIME_TYPE = "mime_type";
|
private static final String EXTRA_MIME_TYPE = "mime_type";
|
||||||
@@ -83,6 +85,8 @@ public class SaveFragment extends Fragment {
|
|||||||
mSave.setOnClickListener(mSaveListener);
|
mSave.setOnClickListener(mSaveListener);
|
||||||
mSave.setEnabled(false);
|
mSave.setEnabled(false);
|
||||||
|
|
||||||
|
mProgress = (ProgressBar) view.findViewById(android.R.id.progress);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +96,6 @@ public class SaveFragment extends Fragment {
|
|||||||
if (mIgnoreNextEdit) {
|
if (mIgnoreNextEdit) {
|
||||||
mIgnoreNextEdit = false;
|
mIgnoreNextEdit = false;
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "onTextChanged!");
|
|
||||||
mReplaceTarget = null;
|
mReplaceTarget = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,4 +143,9 @@ public class SaveFragment extends Fragment {
|
|||||||
public void setSaveEnabled(boolean enabled) {
|
public void setSaveEnabled(boolean enabled) {
|
||||||
mSave.setEnabled(enabled);
|
mSave.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPending(boolean pending) {
|
||||||
|
mSave.setVisibility(pending ? View.INVISIBLE : View.VISIBLE);
|
||||||
|
mProgress.setVisibility(pending ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class TestDocumentsProvider extends DocumentsProvider {
|
|||||||
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
|
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
|
||||||
final RowBuilder row = result.newRow();
|
final RowBuilder row = result.newRow();
|
||||||
row.add(Root.COLUMN_ROOT_ID, MY_ROOT_ID);
|
row.add(Root.COLUMN_ROOT_ID, MY_ROOT_ID);
|
||||||
row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_RECENTS);
|
row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_RECENTS | Root.FLAG_SUPPORTS_CREATE);
|
||||||
row.add(Root.COLUMN_TITLE, "_Test title which is really long");
|
row.add(Root.COLUMN_TITLE, "_Test title which is really long");
|
||||||
row.add(Root.COLUMN_SUMMARY,
|
row.add(Root.COLUMN_SUMMARY,
|
||||||
SystemClock.elapsedRealtime() + " summary which is also super long text");
|
SystemClock.elapsedRealtime() + " summary which is also super long text");
|
||||||
@@ -147,6 +147,14 @@ public class TestDocumentsProvider extends DocumentsProvider {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createDocument(String parentDocumentId, String mimeType, String displayName)
|
||||||
|
throws FileNotFoundException {
|
||||||
|
if (LAG) lagUntilCanceled(null);
|
||||||
|
|
||||||
|
return super.createDocument(parentDocumentId, mimeType, displayName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds any outstanding or finished "network" fetching.
|
* Holds any outstanding or finished "network" fetching.
|
||||||
*/
|
*/
|
||||||
@@ -386,6 +394,7 @@ public class TestDocumentsProvider extends DocumentsProvider {
|
|||||||
|
|
||||||
if (MY_DOC_ID.equals(docId)) {
|
if (MY_DOC_ID.equals(docId)) {
|
||||||
row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
|
row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
|
||||||
|
row.add(Document.COLUMN_FLAGS, Document.FLAG_DIR_SUPPORTS_CREATE);
|
||||||
} else if (MY_DOC_NULL.equals(docId)) {
|
} else if (MY_DOC_NULL.equals(docId)) {
|
||||||
// No MIME type
|
// No MIME type
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user