Skip to content
Browse files

click now open

remove open button
make ui nicer
  • Loading branch information...
1 parent 4d8654e commit 26389268c6d5f8f2e7d82052f2f15b166d761c2b @ghk committed
View
2 AndroidManifest.xml
@@ -6,7 +6,7 @@
<supports-screens android:anyDensity="true" android:largeScreens="true" android:resizeable="true" android:normalScreens="true" android:smallScreens="true"></supports-screens>
- <application android:icon="@drawable/icon" android:label="@string/app_name">
+ <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Light">
<activity android:name=".SeriesActivity"
android:label="@string/app_name">
<intent-filter>
View
2 README
@@ -3,3 +3,5 @@ Android comic library for perfect viewer https://market.android.com/details?id=c
Using coverflow widget: http://www.inter-fuser.com/2010/02/android-coverflow-widget-v2.html
Icons by: http://www.customicondesign.com/
+
+only tested in galaxy tab
View
BIN res/drawable-hdpi/whitepaper.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
47 res/layout/main.xml
@@ -1,32 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:layout_height="fill_parent"
+ android:background="@drawable/whitepaper"
+ >
<com.kaulahcintaku.comicshelf.CoverFlow android:id="@+id/coverflow"
- android:layout_width="fill_parent" android:layout_height="wrap_content"
- android:layout_weight="1" />
+ android:layout_width="fill_parent" android:layout_height="fill_parent" />
- <LinearLayout android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <LinearLayout android:layout_width="fill_parent"
- android:layout_height="match_parent" android:padding="6dip">
- <Button android:id="@+id/open"
- android:layout_width="100dip"
- android:layout_height="100dip"
- android:layout_marginRight="6dip"
- android:text="Open"
- android:layout_gravity="center_vertical" />
- <LinearLayout android:id="@+id/content"
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="wrap_content">
- <TextView android:id="@+id/title" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:gravity="right|center_vertical"
- android:text="Title" android:textStyle="bold" android:textSize="18dip"
- android:paddingBottom="6dip" />
- <TextView android:id="@+id/detail" android:layout_width="match_parent"
- android:layout_height="wrap_content" android:gravity="right|center_vertical"
- android:paddingBottom="6dip" android:text="Detail" />
- </LinearLayout>
- </LinearLayout>
+ <LinearLayout android:id="@+id/content"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_alignParentBottom="true"
+ android:layout_height="60dip"
+ android:padding="10dip"
+ >
+ <TextView android:id="@+id/title" android:layout_width="wrap_content"
+ android:layout_height="fill_parent" android:gravity="left|center_vertical"
+ android:text="Title" android:textStyle="bold" android:textSize="30dip"
+ />
+ <TextView android:id="@+id/detail" android:layout_width="fill_parent"
+ android:layout_height="fill_parent" android:gravity="right|center_vertical"
+ android:text="Detail" />
</LinearLayout>
-</LinearLayout>
+</RelativeLayout>
View
4 src/com/kaulahcintaku/comicshelf/CoverFlow.java
@@ -44,9 +44,9 @@
/**
* The maximum zoom on the centre Child
*/
- private int mMaxZoom = -90;
+ private int mMaxZoom = -100;
- private float mZoom = -310.0f;
+ private float mZoom = -350.0f;
/**
* The Centre of the Coverflow
View
5 src/com/kaulahcintaku/comicshelf/ItemAdapter.java
@@ -5,6 +5,7 @@
import java.util.List;
import android.content.Context;
+import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -16,6 +17,7 @@
import android.graphics.PorterDuff.Mode;
import android.graphics.Shader.TileMode;
import android.graphics.drawable.BitmapDrawable;
+import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
@@ -24,7 +26,6 @@
public class ItemAdapter extends BaseAdapter {
- private int galleryItemBackground;
private Context context;
private ImageView[] imageViews;
@@ -41,6 +42,7 @@ public ItemAdapter(Context c, List<Item> items, boolean useReflection) {
if(useReflection){
bitmaps = createReflectedImages(bitmaps);
}
+
}
private List<Bitmap> createReflectedImages(List<Bitmap> originalImages) {
@@ -116,6 +118,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
i.setImageBitmap(bitmaps.get(position));
i.setLayoutParams(new CoverFlow.LayoutParams(130, 130));
i.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
+ //i.setBackgroundResource(galleryItemBackground);
// Make sure we set anti-aliasing otherwise we get jaggies
BitmapDrawable drawable = (BitmapDrawable) i.getDrawable();
View
16 src/com/kaulahcintaku/comicshelf/PerfectViewerDatabase.java
@@ -32,9 +32,23 @@ public void close(){
database = null;
}
+ private static final String SERIES_QUERY =
+ "select book_cate, book_path, book_cover "+
+ "from bookfolder "+
+ "where book_path "+
+ "in ( " +
+ " select bp "+
+ " from " +
+ " ( " +
+ " select book_index, book_cate, min(book_path) as bp " +
+ " from bookfolder " +
+ " group by book_cate) " +
+ " ) " +
+ "group by book_cate";
+
public List<Item> getSeries(){
List<Item> results = new ArrayList<Item>();
- Cursor cursor = database.query(true, TABLE_NAME, TABLE_COLUMNS, null, null, "book_cate", null, "book_path", null);
+ Cursor cursor = database.rawQuery(SERIES_QUERY, null);
while(cursor.moveToNext()){
Item series = new Item(cursor.getBlob(2), cursor.getString(0), cursor.getString(1), true);
String sql = "SELECT COUNT(*) FROM " + TABLE_NAME+" WHERE book_cate=?";
View
26 src/com/kaulahcintaku/comicshelf/SeriesActivity.java
@@ -22,21 +22,6 @@
public class SeriesActivity extends Activity {
private Item selectedItem;
- private View.OnClickListener openClickListener = new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- openSelectedItem();
- }
- };
-
- private AdapterView.OnItemLongClickListener longClickListener = new AdapterView.OnItemLongClickListener(){
- @Override
- public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
- int arg2, long arg3) {
- return openSelectedItem();
- }
- };
-
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -83,8 +68,15 @@ public void onNothingSelected(android.widget.AdapterView<?> arg0) {
coverFlow.setSpacing(0);
coverFlow.setAnimationDuration(1000);
- coverFlow.setOnItemLongClickListener(longClickListener);
- ((Button) findViewById(R.id.open)).setOnClickListener(openClickListener);
+ coverFlow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+ @Override
+ public void onItemClick(AdapterView<?> arg0, View arg1, int position,
+ long arg3) {
+ Item item = (Item)items.get(position);
+ if(item == selectedItem)
+ openSelectedItem();
+ }
+ });
}
private boolean openSelectedItem(){

0 comments on commit 2638926

Please sign in to comment.
Something went wrong with that request. Please try again.