diff options
author | Tony Wickham <twickham@google.com> | 2016-03-24 10:29:34 -0700 |
---|---|---|
committer | Tony Wickham <twickham@google.com> | 2016-03-24 10:29:34 -0700 |
commit | 87dfda9c26d355b8a3c735c2948608be65165033 (patch) | |
tree | 6014058f6ab724c4114eb2c690a06f7d50d8bd1b | |
parent | 602a01e8b5e5990ddacde661bda0bbef50fd6abc (diff) | |
download | WallpaperPicker-87dfda9c26d355b8a3c735c2948608be65165033.tar.gz |
Disable "Set wallpaper" action bar when no tile is selected.
Bug: 27484720
Change-Id: I13420db56fa32d26ba2fdcea3d3faefe9690afb6
-rw-r--r-- | res/layout/actionbar_set_wallpaper.xml | 3 | ||||
-rw-r--r-- | src/com/android/wallpaperpicker/WallpaperPickerActivity.java | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/res/layout/actionbar_set_wallpaper.xml b/res/layout/actionbar_set_wallpaper.xml index a8f1a6e..459f221 100644 --- a/res/layout/actionbar_set_wallpaper.xml +++ b/res/layout/actionbar_set_wallpaper.xml @@ -28,4 +28,5 @@ android:drawableLeft="@drawable/ic_actionbar_accept" android:drawablePadding="8dp" android:gravity="start|center_vertical" - android:text="@string/wallpaper_instructions" /> + android:text="@string/wallpaper_instructions" + android:enabled="false" /> diff --git a/src/com/android/wallpaperpicker/WallpaperPickerActivity.java b/src/com/android/wallpaperpicker/WallpaperPickerActivity.java index 094d3ce..f303f93 100644 --- a/src/com/android/wallpaperpicker/WallpaperPickerActivity.java +++ b/src/com/android/wallpaperpicker/WallpaperPickerActivity.java @@ -202,7 +202,7 @@ public class WallpaperPickerActivity extends WallpaperCropActivity new View.OnClickListener() { @Override public void onClick(View v) { - // Ensure that a tile is slelected and loaded. + // Ensure that a tile is selected and loaded. if (mSelectedTile != null && mCropView.getTileSource() != null) { // Prevent user from selecting any new tile. mWallpaperStrip.setVisibility(View.GONE); @@ -211,9 +211,9 @@ public class WallpaperPickerActivity extends WallpaperCropActivity WallpaperTileInfo info = (WallpaperTileInfo) mSelectedTile.getTag(); info.onSave(WallpaperPickerActivity.this); } else { - // no tile was selected, so we just finish the activity and go back - setResult(Activity.RESULT_OK); - finish(); + // This case shouldn't be possible, since "Set wallpaper" is disabled + // until user clicks on a title. + Log.w(TAG, "\"Set wallpaper\" was clicked when no tile was selected"); } } }); @@ -232,10 +232,10 @@ public class WallpaperPickerActivity extends WallpaperCropActivity } return; } - setWallpaperButtonEnabled(true); WallpaperTileInfo info = (WallpaperTileInfo) v.getTag(); if (info.isSelectable() && v.getVisibility() == View.VISIBLE) { selectTile(v); + setWallpaperButtonEnabled(true); } info.onClick(this); } |