Author: tian
Date: Sat Jul 16 18:53:31 2016
New Revision: 2287

URL: http://svn.gna.org/viewcvs/gcstar?rev=2287&view=rev
Log:
Handle list of images

Modified:
    viewer/src/com/gcstar/viewer/GCstarCollectionLoader.java
    viewer/src/com/gcstar/viewer/GCstarItemDialog.java
    viewer/src/com/gcstar/viewer/GCstarModel.java

Modified: viewer/src/com/gcstar/viewer/GCstarCollectionLoader.java
URL: 
http://svn.gna.org/viewcvs/gcstar/viewer/src/com/gcstar/viewer/GCstarCollectionLoader.java?rev=2287&r1=2286&r2=2287&view=diff
==============================================================================
--- viewer/src/com/gcstar/viewer/GCstarCollectionLoader.java    (original)
+++ viewer/src/com/gcstar/viewer/GCstarCollectionLoader.java    Sat Jul 16 
18:53:31 2016
@@ -273,7 +273,7 @@
                             {
                                 String key = parser.getAttributeName(i);
                                 String value = parser.getAttributeValue(i);
-                                Log.i("GCS", "Got : " + key + " = " + value);
+                                //Log.i("GCS", "Got : " + key + " = " + value);
                                 if (key.equals("borrower")
                                         && value.equals("none"))
                                 {
@@ -340,7 +340,8 @@
                         {
                             if (_model.isList(currentTag))
                             {
-                                if (_model.getFieldType(currentTag) == 
GCstarModel.MultiList)
+                                if ((_model.getFieldType(currentTag) == 
GCstarModel.MultiList) ||
+                                   (_model.getFieldType(currentTag) == 
GCstarModel.Images))
                                 {
                                     currentItem.addField(currentTag,
                                             currentList);

Modified: viewer/src/com/gcstar/viewer/GCstarItemDialog.java
URL: 
http://svn.gna.org/viewcvs/gcstar/viewer/src/com/gcstar/viewer/GCstarItemDialog.java?rev=2287&r1=2286&r2=2287&view=diff
==============================================================================
--- viewer/src/com/gcstar/viewer/GCstarItemDialog.java  (original)
+++ viewer/src/com/gcstar/viewer/GCstarItemDialog.java  Sat Jul 16 18:53:31 2016
@@ -38,6 +38,7 @@
 import android.hardware.SensorManager;
 import android.net.Uri;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.Display;
 import android.view.GestureDetector;
 import android.view.Gravity;
@@ -450,6 +451,7 @@
                 break;
             }
             case GCstarModel.MultiList:
+            case GCstarModel.Images:
             {
                 TableLayout table = new TableLayout(getContext());
                 TableLayout.LayoutParams tparams = new 
TableLayout.LayoutParams(
@@ -512,18 +514,28 @@
         }
     }
 
-    public ImageButton createImage(boolean isCover)
+    public ImageButton createImage(boolean isCover, boolean needWrap)
     {
         ImageButton image = new ImageButton(getContext());
+
         image.setOnClickListener(this);
         // image.setMinimumHeight(_imageHeight);
         image.setMaxHeight(_imageHeight);
         // image.setPadding(2, 2, 2, 2);
         image.setAdjustViewBounds(true);
-        image.setLayoutParams(new Gallery.LayoutParams(
-                LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
+        if (needWrap)
+        {
+            image.setLayoutParams(new Gallery.LayoutParams(
+                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
+        }
         _images.add(image);
+        Log.i("GCS", "Created : " + image);
         return image;
+    }
+
+    public ImageButton createImage(boolean isCover)
+    {
+        return createImage(isCover, true);
     }
 
     public void addTab(String name)
@@ -604,6 +616,7 @@
                             setCurrentUrl(value);
                             break;
                         case GCstarModel.MultiList:
+                        case GCstarModel.Images:
                             TableLayout table = (TableLayout) (_widgets
                                     .get(key));
                             table.removeViews(1, table.getChildCount() - 1);
@@ -616,10 +629,29 @@
                                     TableRow tr = new TableRow(getContext());
                                     for (String col : line)
                                     {
-                                        TextView headerView = new TextView(
-                                                getContext());
-                                        headerView.setText(col);
-                                        tr.addView(headerView);
+                                        if (type == GCstarModel.Images)
+                                        {
+                                            /*
+                                            TextView content = new TextView(
+                                                    getContext());
+                                            content.setText(col);
+                                            tr.addView(content);
+                                            ImageButton addBtn = new 
ImageButton(getContext());
+                                            
addBtn.setImageResource(R.drawable.check_yes);
+                                            tr.addView(addBtn);
+                                            */
+                                            ImageButton image = 
createImage(false, false);
+                                            setImage(image, col, false);
+                                            tr.addView(image);
+                                            Log.i("GCS", "Added : " + col + " 
= " + image);
+                                        }
+                                        else
+                                        {
+                                            TextView content = new TextView(
+                                                    getContext());
+                                            content.setText(col);
+                                            tr.addView(content);
+                                        }
                                     }
                                     table.addView(tr,
                                             new TableLayout.LayoutParams(
@@ -686,6 +718,7 @@
         options.inSampleSize = 2;
         _parent.getLoader().loadImage(image, path, isCover, _imageHeight,
                 options, false /* no cache */);
+        Log.i("GCS", "Set : " + image + " = " + path);
     }
 
     public class AccelerometerListener implements SensorEventListener

Modified: viewer/src/com/gcstar/viewer/GCstarModel.java
URL: 
http://svn.gna.org/viewcvs/gcstar/viewer/src/com/gcstar/viewer/GCstarModel.java?rev=2287&r1=2286&r2=2287&view=diff
==============================================================================
--- viewer/src/com/gcstar/viewer/GCstarModel.java       (original)
+++ viewer/src/com/gcstar/viewer/GCstarModel.java       Sat Jul 16 18:53:31 2016
@@ -47,7 +47,8 @@
        public static final int Date = 6;
        public static final int Url = 7;
        public static final int YesNo = 8;
-               
+       public static final int Images = 9;
+
        public GCstarModel(String name, GCstarViewer activity)
        {
                _titleField = new String();
@@ -160,8 +161,11 @@
                             else if (typeName.equals("images"))
                             {
                                 _listFields.add(id);
-                                type = ShortText;
-                            }
+                                type = Images;
+                                                               String[] labels 
= new String[10];
+                                                               addField(group, 
id, label, labels, type);
+                                                               alreadyAdded = 
true;
+                                                       }
                             else if (typeName.equals("number"))
                                                        {
                                                                type = 
ShortText;


_______________________________________________
GCstar-commits mailing list
[email protected]
https://mail.gna.org/listinfo/gcstar-commits

Reply via email to