Skip to content

Commit

Permalink
Fixes issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
darsh2 committed Jul 22, 2015
1 parent 8fbc17b commit 20161bc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {int i = item.getItemId();
if (i == R.id.menu_item_add_image) {
if (countSelected > Constants.limit) {
Toast.makeText(getApplicationContext(), Constants.toastDisplayLimitExceed, Toast.LENGTH_LONG).show();
Toast.makeText(getApplicationContext(), String.format(getString(R.string.limit_exceeded), Constants.limit), Toast.LENGTH_LONG).show();
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,4 @@ public class Constants {

//Maximum number of images that can be selected at a time
public static int limit;

//String to display when number of selected images limit is exceeded
public static String toastDisplayLimitExceed = String.format("Can select maximum of %d images", limit);
}
2 changes: 2 additions & 0 deletions multipleimageselect/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@

<string name="selected">selected</string>

<string name="limit_exceeded">Can select a maximum of %d images</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected void onCreate(Bundle savedInstanceState) {
textView = (TextView) findViewById(R.id.text_view);

Intent intent = new Intent(MainActivity.this, AlbumSelectActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_LIMIT, 20);
intent.putExtra(Constants.INTENT_EXTRA_LIMIT, 3);
startActivityForResult(intent, Constants.REQUEST_CODE);
}

Expand Down

0 comments on commit 20161bc

Please sign in to comment.