sorted images correctly, made the theme light, and added an alert saying when no more pictures can be added

This commit is contained in:
Andrew Stephan
2014-03-03 13:31:06 -05:00
parent e00327dae7
commit 41c6bfd4d6
33 changed files with 27 additions and 9 deletions
+2 -2
View File
@@ -63,12 +63,12 @@
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:label="@string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity">
<activity android:label="@string/multi_app_name" android:name="com.synconset.MultiImageChooserActivity" android:theme="@android:style/Theme.Holo.Light">
<intent-filter />
</activity>
</config-file>
<source-file src="src/Android/com/synconset/ImagePicker/ImagePicker.java" target-dir="src/com/synconset" />
<source-file src="src/android/com/synconset/ImagePicker/ImagePicker.java" target-dir="src/com/synconset" />
<source-file src="src/android/Library/src/ImageFetcher.java" target-dir="src/com/synconset"/>
<source-file src="src/android/Library/src/MultiImageChooserActivity.java" target-dir="src/com/synconset"/>

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 415 B

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 454 B

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 400 B

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before

Width:  |  Height:  |  Size: 724 B

After

Width:  |  Height:  |  Size: 724 B

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 684 B

Before

Width:  |  Height:  |  Size: 825 B

After

Width:  |  Height:  |  Size: 825 B

Before

Width:  |  Height:  |  Size: 759 B

After

Width:  |  Height:  |  Size: 759 B

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

@@ -20,7 +20,7 @@
android:layout_width="0dp"
style="?android:actionButtonStyle" >
<TextView
android:drawableLeft="@drawable/ic_action_discard_dark"
android:drawableLeft="@drawable/ic_action_discard_light"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:id="@+id/actionbar_discard_textview"
@@ -27,7 +27,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingRight="20dp"
android:drawableLeft="@drawable/ic_action_done_dark"
android:drawableLeft="@drawable/ic_action_done_light"
android:drawablePadding="8dp"
android:gravity="center_vertical"
android:text="@string/done" />
@@ -37,9 +37,11 @@ import java.util.Set;
import com.wymsee.apps.synconset.R;
import android.app.Activity;
import android.app.ActionBar;
import android.app.AlertDialog;
import android.app.LoaderManager;
import android.content.Context;
import android.content.CursorLoader;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
@@ -90,6 +92,7 @@ public class MultiImageChooserActivity extends Activity implements OnItemClickLi
private SparseBooleanArray checkStatus = new SparseBooleanArray();
private int maxImages;
private int maxImageCount;
private GridView gridView;
@@ -105,6 +108,7 @@ public class MultiImageChooserActivity extends Activity implements OnItemClickLi
fileNames.clear();
maxImages = getIntent().getIntExtra(MAX_IMAGES_KEY, NOLIMIT);
maxImageCount = maxImages;
colWidth = getIntent().getIntExtra(COL_WIDTH_KEY, DEFAULT_COLUMN_WIDTH);
@@ -340,14 +344,28 @@ public class MultiImageChooserActivity extends Activity implements OnItemClickLi
boolean isChecked = !isChecked(position);
if (maxImages == 0 && isChecked) {
isChecked = false;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Maximum " + maxImageCount + " Photos");
builder.setMessage("You can only select " + maxImageCount + " photos at a time.");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
}
if (isChecked) {
if (fileNames.add(name)) {
maxImages--;
ImageView imageView = (ImageView)view;
imageView.setImageAlpha(128);
view.setBackgroundColor(selectedColor);
if (maxImageCount == 1) {
this.selectClicked(null);
} else {
maxImages--;
ImageView imageView = (ImageView)view;
imageView.setImageAlpha(128);
view.setBackgroundColor(selectedColor);
}
}
} else {
if (fileNames.remove(name)) {
@@ -389,7 +407,7 @@ public class MultiImageChooserActivity extends Activity implements OnItemClickLi
}
cl = new CursorLoader(MultiImageChooserActivity.this, MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
img.toArray(new String[img.size()]), null, null, null);
img.toArray(new String[img.size()]), null, null, "DATE_MODIFIED DESC");
return cl;
}