Commit 0eeb1ff2 authored by Alan McNatty's avatar Alan McNatty

Working around the main UI redraw with a default intent on notification to...

Working around the main UI redraw with a default intent on notification to reload it and setting the activity as singleTop in Manifest.

Also found some basic boundary 'null' case bugs for image gallery - should now be resolved (i.e. no image in post ;).
parent 2f1b1394
......@@ -8,7 +8,8 @@
<activity android:name=".ui.ArtefactExpandableListAdapterActivity"
android:label="@string/app_name"
android:theme="@style/MaharaTheme">
android:theme="@style/MaharaTheme"
android:launchMode="singleTop">
<!--
<activity android:name=".ui.ArtefactExpandableListAdapterActivity"
android:label="@string/options_menu_viewsaved" /> -->
......@@ -39,7 +40,8 @@
<activity android:name=".ui.ArtifactSettingsActivity"
android:label="@string/artifactsettings"
android:theme="@style/MaharaTheme">
android:theme="@style/MaharaTheme"
>
<intent-filter>
<action android:name="nz.net.catalyst.MaharaDroid.ARTEFACTSETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
......
......@@ -26,6 +26,8 @@ import org.json.JSONException;
import org.json.JSONObject;
import nz.net.catalyst.MaharaDroid.R;
import nz.net.catalyst.MaharaDroid.ui.ArtefactExpandableListAdapterActivity;
import nz.net.catalyst.MaharaDroid.ui.about.AboutActivity;
import android.accounts.Account;
import android.app.Notification;
import android.app.NotificationManager;
......@@ -145,7 +147,7 @@ public class Utils {
PendingIntent contentIntent = null;
// The PendingIntent to launch our activity if the user selects this notification
if ( intent == null ) {
contentIntent = PendingIntent.getActivity(mContext, 0, new Intent(), 0);
contentIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, ArtefactExpandableListAdapterActivity.class), 0);
} else {
contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
}
......@@ -328,6 +330,9 @@ public class Utils {
return new String[][] { k, v };
}
public static Bitmap getFileThumbData(Context context, String filename) {
if ( filename == null )
return null;
Uri uri = Uri.parse(filename);
Bitmap bm = null;
......@@ -336,7 +341,7 @@ public class Utils {
ContentResolver cr = context.getContentResolver();
Cursor cursor = cr.query(uri, new String[]{android.provider.MediaStore.MediaColumns._ID}, null, null, null);
if (cursor != null) {
if ( DEBUG ) Log.d(TAG, "cursor query succeeded");
if ( VERBOSE ) Log.v(TAG, "getFileThumbData cursor query succeeded for '" + filename + "'");
cursor.moveToFirst();
try {
Long id = cursor.getLong(0);
......
......@@ -31,6 +31,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.preference.PreferenceManager;
......@@ -575,7 +576,7 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
}
public int getCount() {
return u.length;
return ( u == null ) ? 0 : u.length;
}
public Object getItem(int position) {
......@@ -588,17 +589,7 @@ public class ArtifactSettingsActivity extends Activity implements OnClickListene
public View getView(int position, View convertView, ViewGroup parent) {
ImageView iv = new ImageView(mContext);
iv.setImageBitmap(Utils.getFileThumbData(mContext, u[position]));
// iv.setClickable(true);
// iv.setOnClickListener(this);
// iv.setLayoutParams(new Gallery.LayoutParams(96, 96));
// iv.setPadding(4, 4, 4, 4);
// iv.setScaleType(ImageView.ScaleType.FIT_XY);
// imageView.setBackgroundResource(mGalleryItemBackground);
// parent.invalidate();
// convertView.invalidate();
iv.setImageBitmap(Utils.getFileThumbData(mContext, u[position]));
return iv;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment