Android: we can now download and display the list
authorNiki Roo <niki@nikiroo.be>
Sun, 10 Dec 2017 16:59:13 +0000 (17:59 +0100)
committerNiki Roo <niki@nikiroo.be>
Sun, 10 Dec 2017 16:59:13 +0000 (17:59 +0100)
res/layout/activity_main.xml
res/layout/activity_say_it.xml [deleted file]
res/layout/fragment_android_reader_book.xml
res/layout/fragment_android_reader_group.xml
res/mipmap-anydpi-v26/ic_launcher.xml [deleted file]
res/mipmap-anydpi-v26/ic_launcher_round.xml [deleted file]
src/AndroidManifest.xml
src/be/nikiroo/fanfix/reader/android/AndroidReaderActivity.java
src/be/nikiroo/fanfix/reader/android/AndroidReaderBook.java
src/be/nikiroo/fanfix/reader/android/AndroidReaderGroup.java
src/be/nikiroo/fanfix/reader/android/SayIt.java [deleted file]

index 6187f32de1c854ec8f9afe1b2651d3f5c7185fdc..e576892e8981cb6018d1ae5daf7d104004fc9ce5 100644 (file)
@@ -2,60 +2,37 @@
 <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/mainRoot"
+    android:id="@+id/Main"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     tools:context=".AndroidReaderActivity">
 
-    <EditText
-        android:id="@+id/editText"
-        android:layout_width="177dp"
-        android:layout_height="38dp"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="8dp"
-        android:ems="10"
-        android:inputType="textPersonName"
-        android:text="@string/enter_text"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
-    <Button
-        android:id="@+id/button"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
-        android:layout_marginStart="8dp"
-        android:onClick="onClick"
-        android:text="Download if needed"
-        app:layout_constraintBottom_toBottomOf="@+id/editText"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="1.0"
-        app:layout_constraintStart_toEndOf="@+id/editText" />
-
     <Button
-        android:id="@+id/button2"
+        android:id="@+id/Main_btnAdd"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginEnd="8dp"
         android:layout_marginStart="8dp"
-        android:layout_marginTop="28dp"
-        android:onClick="buttonClick"
-        android:text="Add all sources"
+        android:layout_marginTop="8dp"
+        android:onClick="onAdd"
+        android:text="Add story"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintHorizontal_bias="0.472"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/editText" />
+        app:layout_constraintTop_toTopOf="parent" />
 
     <LinearLayout
-        android:id="@+id/dropZone"
-        android:layout_width="363dp"
-        android:layout_height="wrap_content"
+        android:id="@+id/Main_pnlStories"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_marginBottom="8dp"
         android:layout_marginEnd="8dp"
         android:layout_marginStart="8dp"
-        android:layout_marginTop="88dp"
+        android:layout_marginTop="8dp"
         android:orientation="vertical"
+        app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/editText"></LinearLayout>
+        app:layout_constraintTop_toBottomOf="@+id/Main_btnAdd"></LinearLayout>
 
 </android.support.constraint.ConstraintLayout>
diff --git a/res/layout/activity_say_it.xml b/res/layout/activity_say_it.xml
deleted file mode 100644 (file)
index 527ae08..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context="be.nikiroo.testy.be.nikiroo.fanfix.reader.android.SayIt">
-
-    <TextView
-        android:id="@+id/textView"
-        android:layout_width="285dp"
-        android:layout_height="250dp"
-        android:text="TextView"
-        tools:layout_editor_absoluteX="38dp"
-        tools:layout_editor_absoluteY="130dp" />
-</android.support.constraint.ConstraintLayout>
index a742c86b5bc188f5b3cd90801420b068f27bbb8d..3cd5423840d19495ff3b9125f29619b77feba0e2 100644 (file)
@@ -1,7 +1,7 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
-    android:id="@+id/coverWidget"
+    android:id="@+id/Book"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:clickable="true"
         android:layout_height="wrap_content">
 
         <TextView
-            android:id="@+id/title"
+            android:id="@+id/Book_lblTitle"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_marginEnd="8dp"
             android:layout_marginStart="8dp"
             android:layout_marginTop="8dp"
-            android:text="TITLE"
-            app:layout_constraintEnd_toStartOf="@+id/cover"
+            android:textStyle="bold"
+            app:layout_constraintEnd_toStartOf="@+id/Book_imgCover"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="@+id/cover" />
+            app:layout_constraintTop_toTopOf="@+id/Book_imgCover" />
 
         <ImageView
-            android:id="@+id/cover"
+            android:id="@+id/Book_imgCover"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_marginBottom="8dp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintTop_toTopOf="parent" />
+
+        <TextView
+            android:id="@+id/Book_lblAuthor"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginEnd="8dp"
+            android:layout_marginTop="8dp"
+            android:textColor="@android:color/darker_gray"
+            app:layout_constraintEnd_toStartOf="@+id/Book_imgCover"
+            app:layout_constraintStart_toEndOf="@+id/Book_lblBy"
+            app:layout_constraintTop_toBottomOf="@+id/Book_lblTitle" />
+
+        <TextView
+            android:id="@+id/Book_lblBy"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="8dp"
+            android:text="By "
+            android:textColor="@android:color/darker_gray"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/Book_lblTitle" />
     </android.support.constraint.ConstraintLayout>
 </FrameLayout>
index 978a2f16961327a6894df4c1c18c4e36857952a2..7d3b272b64e722d6447188e9ec17b09a2163e887 100644 (file)
@@ -6,10 +6,9 @@
 
     <!-- TODO: Update blank fragment layout -->
 
-    <LinearLayout
-        android:id="@+id/AndroidReaderGroup_root"
+    <ListView
+        android:id="@+id/Group_root"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"></LinearLayout>
+        android:layout_height="match_parent" />
 
 </FrameLayout>
diff --git a/res/mipmap-anydpi-v26/ic_launcher.xml b/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644 (file)
index bbd3e02..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
-    <background android:drawable="@drawable/ic_launcher_background"/>
-    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
-</adaptive-icon>
\ No newline at end of file
diff --git a/res/mipmap-anydpi-v26/ic_launcher_round.xml b/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644 (file)
index bbd3e02..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
-    <background android:drawable="@drawable/ic_launcher_background"/>
-    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
-</adaptive-icon>
\ No newline at end of file
index 931bcb589d59d4d461b7dfa5b1c8cec02650b3a4..7e919baa53f6531f04fc8214512fe33c31ce61ea 100644 (file)
@@ -19,6 +19,5 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
-        <activity android:name="be.nikiroo.fanfix.reader.android.SayIt" />
     </application>
 </manifest>
\ No newline at end of file
index b4d33d7bdd079a7d6fae1654f69fb5b124cd252b..290b5baee76f54b2b0a7d42266714199dbca318f 100644 (file)
@@ -1,11 +1,13 @@
 package be.nikiroo.fanfix.reader.android;
 
 import android.app.Activity;
+import android.app.AlertDialog;
 import android.app.FragmentTransaction;
-import android.content.Intent;
-import android.os.AsyncTask;
+import android.content.Context;
+import android.content.DialogInterface;
 import android.os.Bundle;
 import android.os.Environment;
+import android.text.InputType;
 import android.view.View;
 import android.widget.EditText;
 
@@ -25,70 +27,88 @@ public class AndroidReaderActivity extends Activity implements
 
        @Override
        protected void onCreate(Bundle savedInstanceState) {
-               config();
+               reader = config();
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_main);
        }
 
-       int i = 1;
+       @Override
+       protected void onStart() {
+               super.onStart();
+               refresh();
+       }
 
-       public void buttonClick(View view) {
-               AndroidReaderGroup group = null;
-               if (group == null) {
-                       group = new AndroidReaderGroup();
-               }
+       private void refresh() {
+               AndroidReaderGroup group = new AndroidReaderGroup();
 
                FragmentTransaction trans = getFragmentManager().beginTransaction();
-               trans.replace(R.id.dropZone, group);
+               trans.replace(R.id.Main_pnlStories, group);
                trans.commit();
                getFragmentManager().executePendingTransactions();
 
-               group.fill(reader, null);
+               group.fill(reader.getLibrary().getList(), reader);
        }
 
-       public void onClick(View view) {
-               new AsyncTask<Void, Void, String>() {
-                       @Override
-                       protected void onPreExecute() {
-                               EditText editText = findViewById(R.id.editText);
-                               editText.setText("Downloading...");
-                       }
-
-                       @Override
-                       protected String doInBackground(Void... voids) {
-                               try {
-                                       URL[] urls = new URL[] {
-                                                       new URL("https://e621.net/pool/show/13124"),
-                                                       new URL("https://e621.net/pool/show/13121"), };
-
-                                       for (int i = 0; i < urls.length; i++) {
-                                               if (reader.getLibrary().getList().size() <= i) {
-                                                       reader.getLibrary().imprt(urls[i], null);
-                                               }
-                                       }
-
-                                       String message = "";
-                                       for (MetaData meta : reader.getLibrary().getList()) {
-                                               message += meta.getTitle() + "\n";
+       public void onAdd(View view) {
+               final View root = findViewById(R.id.Main);
+
+               ask(this,
+                               "Import new story",
+                               "Enter the story URL (the program will then download it -- the interface will not be usable until it is downloaded",
+                               "Download", new AnswerListener() {
+                                       @Override
+                                       public void onAnswer(final String answer) {
+                                               root.setEnabled(false);
+                                               new Thread(new Runnable() {
+                                                       @Override
+                                                       public void run() {
+                                                               try {
+                                                                       URL url = new URL(answer);
+                                                                       reader.getLibrary().imprt(url, null);
+                                                               } catch (Throwable e) {
+                                                                       // TODO: show error message correctly
+                                                                       String mess = "";
+                                                                       for (String tab = ""; e != null
+                                                                                       && e != e.getCause(); e = e
+                                                                                       .getCause()) {
+                                                                               mess += tab + "["
+                                                                                               + e.getClass().getSimpleName()
+                                                                                               + "] " + e.getMessage() + "\n";
+                                                                               tab += "\t";
+                                                                       }
+
+                                                                       final String messf = mess;
+                                                                       AndroidReaderActivity.this
+                                                                                       .runOnUiThread(new Runnable() {
+                                                                                               @Override
+                                                                                               public void run() {
+                                                                                                       ask(AndroidReaderActivity.this,
+                                                                                                                       "Error",
+                                                                                                                       "Cannot import URL: \n"
+                                                                                                                                       + messf,
+                                                                                                                       "OK", null);
+                                                                                               }
+                                                                                       });
+
+                                                               }
+
+                                                               AndroidReaderActivity.this
+                                                                               .runOnUiThread(new Runnable() {
+                                                                                       @Override
+                                                                                       public void run() {
+                                                                                               refresh();
+                                                                                               root.setEnabled(true);
+                                                                                       }
+                                                                               });
+                                                       }
+                                               }).start();
                                        }
+                               });
 
-                                       return message;
-                               } catch (Exception e) {
-                                       return e.getClass() + ": " + e.getMessage();
-                               }
-                       }
-
-                       @Override
-                       protected void onPostExecute(String message) {
-                               EditText editText = findViewById(R.id.editText);
-                               editText.setText("testy");
-
-                               Intent intent = new Intent(AndroidReaderActivity.this,
-                                               SayIt.class);
-                               intent.putExtra(SayIt.MESSAGE, message);
-                               startActivity(intent);
-                       }
-               }.execute();
+               /*
+                * Intent intent = new Intent(AndroidReaderActivity.this, SayIt.class);
+                * intent.putExtra(SayIt.MESSAGE, message); startActivity(intent);
+                */
        }
 
        @Override
@@ -101,9 +121,9 @@ public class AndroidReaderActivity extends Activity implements
                }
        }
 
-       private void config() {
+       private Reader config() {
                if (reader != null) {
-                       return;
+                       return reader;
                }
 
                String internal = getExternalFilesDir(null).toString();
@@ -130,6 +150,42 @@ public class AndroidReaderActivity extends Activity implements
                Instance.setTraceHandler(new TraceHandler(true, true, 2));
 
                BasicReader.setDefaultReaderType(Reader.ReaderType.ANDROID);
-               reader = BasicReader.getReader();
+               return BasicReader.getReader();
+       }
+
+       public static void ask(Context context, String title, String message,
+                       String okMessage, final AnswerListener listener) {
+               final EditText input = new EditText(context);
+               input.setFocusable(true);
+               input.setInputType(InputType.TYPE_CLASS_TEXT);
+
+               AlertDialog.Builder alert = new AlertDialog.Builder(context);
+               alert.setTitle(title);
+               alert.setMessage(message);
+               alert.setCancelable(true);
+               alert.setView(input);
+
+               if (listener != null) {
+                       alert.setPositiveButton(okMessage,
+                                       new DialogInterface.OnClickListener() {
+                                               @Override
+                                               public void onClick(DialogInterface dialog, int which) {
+                                                       listener.onAnswer(input.getText().toString());
+                                               }
+                                       });
+
+                       alert.setOnCancelListener(new DialogInterface.OnCancelListener() {
+                               @Override
+                               public void onCancel(DialogInterface dialog) {
+                                       listener.onAnswer(null);
+                               }
+                       });
+               }
+
+               alert.show();
+       }
+
+       private interface AnswerListener {
+               public void onAnswer(String answer);
        }
 }
\ No newline at end of file
index 5d3f65daf1a1859530466bad54bc04a56f06e6a8..700a566938627d06ce8d66e723a6c97c1b56d036 100644 (file)
@@ -14,16 +14,13 @@ import android.widget.TextView;
 
 import java.io.IOException;
 
-import be.nikiroo.fanfix.Instance;
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.reader.Reader;
 import be.nikiroo.utils.Image;
 import be.nikiroo.utils.android.ImageUtilsAndroid;
 
 public class AndroidReaderBook extends Fragment {
-       private Reader reader;
        private OnFragmentInteractionListener listener;
-       private MetaData meta;
 
        /**
         * This interface must be implemented by activities that contain this
@@ -63,56 +60,63 @@ public class AndroidReaderBook extends Fragment {
                listener = null;
        }
 
-       public void fill(final Reader reader, final String luid) {
-               View view = getView();
-               if (view == null) {
-                       return;
-               }
-
-               final ImageView cover = view.findViewById(R.id.cover);
-               final TextView title = view.findViewById(R.id.title);
-               final FrameLayout frame = view.findViewById(R.id.coverWidget);
+       public void fill(final MetaData meta, final Reader reader) {
+               ViewHolder viewHolder = new ViewHolder(getView());
 
-               new AsyncTask<Void, Void, MetaData>() {
+               viewHolder.title.setText(meta.getTitle());
+               viewHolder.author.setText(meta.getAuthor());
+               viewHolder.frame.setClickable(true);
+               viewHolder.frame.setFocusable(true);
+               viewHolder.frame.setOnClickListener(new View.OnClickListener() {
                        @Override
-                       protected MetaData doInBackground(Void[] objects) {
-                               return Instance.getLibrary().getInfo(luid);
+                       public void onClick(View v) {
+                               OnFragmentInteractionListener llistener = listener;
+                               if (llistener != null) {
+                                       llistener.onFragmentInteraction(meta);
+                               }
                        }
+               });
 
+               new AsyncTask<MetaData, Void, Image>() {
                        @Override
-                       protected void onPostExecute(MetaData meta) {
-                               AndroidReaderBook.this.meta = meta;
-
-                               if (meta != null) {
-                                       title.setText(meta.getTitle());
-                                       try {
-                                               Image coverImage = reader.getLibrary().getCover(
-                                                               meta.getLuid());
-                                               if (coverImage != null) {
-                                                       Bitmap coverBitmap = ImageUtilsAndroid
-                                                                       .fromImage(coverImage);
-                                                       coverBitmap = Bitmap.createScaledBitmap(
-                                                                       coverBitmap, 128, 128, true);
-                                                       cover.setImageBitmap(coverBitmap);
-                                               }
-                                       } catch (IOException e) {
-                                               e.printStackTrace();
-                                       }
+                       protected Image doInBackground(MetaData[] metas) {
+                               if (metas[0].getCover() != null) {
+                                       return metas[0].getCover();
                                }
 
-                               frame.setClickable(true);
-                               frame.setFocusable(true);
-                               frame.setOnClickListener(new View.OnClickListener() {
-                                       @Override
-                                       public void onClick(View v) {
-                                               OnFragmentInteractionListener llistener = listener;
-                                               if (llistener != null) {
-                                                       llistener
-                                                                       .onFragmentInteraction(AndroidReaderBook.this.meta);
-                                               }
+                               return reader.getLibrary().getCover(metas[0].getLuid());
+                       }
+
+                       @Override
+                       protected void onPostExecute(Image coverImage) {
+                               ViewHolder viewHolder = new ViewHolder(getView());
+
+                               try {
+                                       if (coverImage != null) {
+                                               Bitmap coverBitmap = ImageUtilsAndroid
+                                                               .fromImage(coverImage);
+                                               coverBitmap = Bitmap.createScaledBitmap(coverBitmap,
+                                                               128, 128, true);
+                                               viewHolder.cover.setImageBitmap(coverBitmap);
                                        }
-                               });
+                               } catch (IOException e) {
+                                       e.printStackTrace();
+                               }
                        }
-               }.execute();
+               }.execute(meta);
+       }
+
+       private class ViewHolder {
+               public FrameLayout frame;
+               public TextView title;
+               public TextView author;
+               public ImageView cover;
+
+               public ViewHolder(View book) {
+                       frame = book.findViewById(R.id.Book);
+                       title = book.findViewById(R.id.Book_lblTitle);
+                       author = book.findViewById(R.id.Book_lblAuthor);
+                       cover = book.findViewById(R.id.Book_imgCover);
+               }
        }
 }
index d998a8cf9c40b947226f0995d489052a957fc137..2d4819942a7d7b83c67fe645bb149b1015049004 100644 (file)
@@ -3,13 +3,17 @@ package be.nikiroo.fanfix.reader.android;
 import android.app.Fragment;
 import android.app.FragmentTransaction;
 import android.content.Context;
-import android.os.AsyncTask;
 import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.reader.Reader;
@@ -21,6 +25,7 @@ import be.nikiroo.fanfix.reader.Reader;
  */
 public class AndroidReaderGroup extends Fragment {
        private OnFragmentInteractionListener listener;
+       private Map<View, AndroidReaderBook> books = new HashMap<View, AndroidReaderBook>();
 
        public interface OnFragmentInteractionListener {
                void onFragmentInteraction(MetaData meta);
@@ -33,7 +38,6 @@ public class AndroidReaderGroup extends Fragment {
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                        Bundle savedInstanceState) {
-               // Inflate the layout for this fragment
                return inflater.inflate(R.layout.fragment_android_reader_group,
                                container, false);
        }
@@ -52,31 +56,46 @@ public class AndroidReaderGroup extends Fragment {
                listener = null;
        }
 
-       public void fill(final Reader reader, final String source) {
-               new AsyncTask<Void, Void, List<MetaData>>() {
+       public void fill(final List<MetaData> metas, final Reader reader) {
+               final List<MetaData> datas = new ArrayList<MetaData>(metas);
+
+               ListView list = getView().findViewById(R.id.Group_root);
+               list.setAdapter(new BaseAdapter() {
+                       @Override
+                       public int getCount() {
+                               return datas.size();
+                       }
+
                        @Override
-                       protected List<MetaData> doInBackground(Void... voids) {
-                               return reader.getLibrary().getListBySource(source);
+                       public long getItemId(int position) {
+                               return -1; // TODO: what is a "row id" in this context?
                        }
 
                        @Override
-                       protected void onPostExecute(List<MetaData> metas) {
-                               for (MetaData meta : metas) {
-                                       String tag = "Book_" + meta.getLuid();
-                                       tag = null; // TODO: how does it work?
-                                       AndroidReaderBook book = null;// (AndroidReaderBook)
-                                                                                                       // getFragmentManager().findFragmentByTag(tag);
-                                       if (book == null) {
-                                               book = new AndroidReaderBook();
-                                               FragmentTransaction trans = getFragmentManager()
-                                                               .beginTransaction();
-                                               trans.add(R.id.AndroidReaderGroup_root, book, tag);
-                                               trans.commit();
-                                               getFragmentManager().executePendingTransactions();
-                                       }
-                                       book.fill(reader, meta.getLuid());
+                       public Object getItem(int position) {
+                               return datas.get(position);
+                       }
+
+                       @Override
+                       public View getView(int position, View convertView, ViewGroup parent) {
+                               AndroidReaderBook book = books.get(convertView);
+                               if (book == null) {
+                                       book = new AndroidReaderBook();
+
+                                       FragmentTransaction trans = getFragmentManager()
+                                                       .beginTransaction();
+                                       trans.add(book, null);
+                                       trans.commit();
+                                       getFragmentManager().executePendingTransactions();
+
+                                       books.put(book.getView(), book);
                                }
+
+                               MetaData meta = (MetaData) getItem(position);
+                               book.fill(meta, reader);
+
+                               return book.getView();
                        }
-               }.execute();
+               });
        }
 }
diff --git a/src/be/nikiroo/fanfix/reader/android/SayIt.java b/src/be/nikiroo/fanfix/reader/android/SayIt.java
deleted file mode 100644 (file)
index 1346506..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-package be.nikiroo.fanfix.reader.android;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.widget.TextView;
-
-
-public class SayIt extends Activity {
-    public static final String MESSAGE = "be.nikiroo.testy.message";
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_say_it);
-
-        // Get the Intent that started this activity and extract the string
-        Intent intent = getIntent();
-        String message = intent.getStringExtra(SayIt.MESSAGE);
-
-        // Capture the layout's TextView and set the string as its text
-        TextView textView = findViewById(R.id.textView);
-        textView.setText(message);
-    }
-}