Commits

Yang Zhang  committed ea7300f

start to refactor

  • Participants
  • Parent commits f2d22b6

Comments (0)

Files changed (10)

File android/gen/me/yangblog/manmanpa/R.java

         public static final int tab_unselected_pressed_megamh=0x7f020054;
     }
     public static final class id {
-        public static final int Button01=0x7f0a0008;
-        public static final int Button02=0x7f0a0009;
-        public static final int Button03=0x7f0a000a;
-        public static final int Button04=0x7f0a000b;
-        public static final int Button05=0x7f0a000c;
-        public static final int Button06=0x7f0a000d;
-        public static final int Button07=0x7f0a0011;
-        public static final int Button08=0x7f0a000f;
-        public static final int Button09=0x7f0a0010;
-        public static final int Button11=0x7f0a000e;
         public static final int author=0x7f0a0003;
-        public static final int bookCover=0x7f0a0013;
-        public static final int bookName=0x7f0a0014;
-        public static final int button1=0x7f0a0007;
-        public static final int chapterName=0x7f0a0020;
-        public static final int chapters=0x7f0a0018;
+        public static final int bookCover=0x7f0a0009;
+        public static final int bookName=0x7f0a000a;
+        public static final int chapterName=0x7f0a0016;
+        public static final int chapters=0x7f0a000e;
         public static final int container=0x7f0a0000;
-        public static final int currentPage=0x7f0a0025;
-        public static final int delete=0x7f0a001a;
-        public static final int download=0x7f0a0016;
-        public static final int downloadBookList=0x7f0a001f;
-        public static final int downloadGradview=0x7f0a001e;
-        public static final int downloadNumberShower=0x7f0a0021;
-        public static final int downloadProgressBar=0x7f0a0022;
-        public static final int downloadState=0x7f0a0019;
-        public static final int downloadSureButton=0x7f0a001d;
+        public static final int currentPage=0x7f0a001b;
+        public static final int delete=0x7f0a0010;
+        public static final int download=0x7f0a000c;
+        public static final int downloadBookList=0x7f0a0015;
+        public static final int downloadGradview=0x7f0a0014;
+        public static final int downloadNumberShower=0x7f0a0017;
+        public static final int downloadProgressBar=0x7f0a0018;
+        public static final int downloadState=0x7f0a000f;
+        public static final int downloadSureButton=0x7f0a0013;
+        public static final int hot_labels=0x7f0a0007;
         public static final int hotestLabel=0x7f0a0006;
-        public static final int imageview=0x7f0a0024;
+        public static final int imageview=0x7f0a001a;
         public static final int imgIcon=0x7f0a0001;
-        public static final int intro=0x7f0a0017;
-        public static final int lastCh=0x7f0a0015;
+        public static final int intro=0x7f0a000d;
+        public static final int lastCh=0x7f0a000b;
         public static final int lastchapter=0x7f0a0004;
-        public static final int linearLayout=0x7f0a0012;
-        public static final int menu_exit=0x7f0a0026;
-        public static final int read=0x7f0a0023;
+        public static final int linearLayout=0x7f0a0008;
+        public static final int menu_exit=0x7f0a001c;
+        public static final int read=0x7f0a0019;
         public static final int search=0x7f0a0005;
-        public static final int select_all=0x7f0a001c;
-        public static final int stopOrResume=0x7f0a001b;
+        public static final int select_all=0x7f0a0012;
+        public static final int stopOrResume=0x7f0a0011;
         public static final int txtTitle=0x7f0a0002;
     }
     public static final class integer {

File android/res/layout/category_search.xml

         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:orientation="vertical" >
-
+
         <SearchView
             android:id="@+id/search"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:iconifiedByDefault="false"
             android:queryHint="漫画名 | 作者名" >
-
         </SearchView>
 
         <TextView
             android:paddingLeft="@dimen/padding_large"
             android:text="热门标签"
             android:textAppearance="?android:attr/textAppearanceLarge" />
-
+
         <GridLayout
+            android:id="@+id/hot_labels"
             android:layout_width="wrap_content"
-            android:layout_height="match_parent"
+            android:layout_height="wrap_content"
             android:layout_gravity="center_horizontal"
             android:layout_margin="@dimen/padding_large"
             android:alignmentMode="alignMargins"
-            android:columnCount="4"
+            android:columnCount="5"
             android:orientation="horizontal"
             android:useDefaultMargins="false" >
-
-            <Button
-                android:id="@+id/button1"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
 
-            <Button
-                android:id="@+id/Button01"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button02"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button03"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button04"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button05"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button06"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button11"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button08"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button09"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
-
-            <Button
-                android:id="@+id/Button07"
-                style="?android:attr/buttonStyleSmall"
-                android:layout_gravity="left"
-                android:text="Button" />
         </GridLayout>
 
     </LinearLayout>

File android/res/layout/download_book_list.xml

          android:layout_margin="@dimen/padding_small"
          android:focusable="false"
          android:text="删除" />
-
+
      <Button
          android:id="@+id/stopOrResume"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
-         android:layout_margin="@dimen/padding_medium"
-         android:focusable="false" />
+         android:layout_margin="@dimen/padding_small"
+         android:focusable="false"
+         android:text="完成" />
         
 </LinearLayout>

File android/src/me/yangblog/manmanpa/DownloadAdapter.java

 			@Override
 			public void onClick(View v) {
 //				context.getHs().saveHistoryorUpdate(book, chapterList.get(position));
+				DownloadAdapter.this.notifyDataSetChanged();
 				Intent intent = new Intent(context, ComicReaderActivity.class);
 				Book book = bookList.get(groupPosition);
 				Chapter ch = book.getChapterList().get(childPosition);

File android/src/me/yangblog/manmanpa/GlobalVariable.java

 	public static final String CHAPTER_URL = ROOT_URL + "/api/json/chapters/";
 	public static final String PAGE_URL = ROOT_URL + "/api/json/pages/";
 	public static final String COVER_URL = ROOT_URL + "/static/covers/";
+	public static final String SEARCH_URL = ROOT_URL + "/api/json/search/";
+	public static final String LABEL_URL = ROOT_URL + "/api/json/label/";
+	
+	
 
 	//
 	public static Downloader downloader = new Downloader();

File android/src/me/yangblog/manmanpa/Helper.java

 import me.yangblog.manmanpa.model.Book;
 import me.yangblog.manmanpa.model.Page;
 
+import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.GradientDrawable.Orientation;
 import android.os.Environment;
+import android.widget.ListView;
 
 public class Helper {
 	public static void createFolderIfNotExsist(String pathString) {
 		String text = writer.toString();
 		return text;
 	}
+	
+	
+	
+	
+	public static void setListViewDivid(ListView listView){
+		int[] colors = {0xFFFFEEEE, 0xFFDD4B37, 0xFFFFEEEE};
+		listView.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));
+		listView.setDividerHeight(2);
+	}
+	
+	
 
 }

File android/src/me/yangblog/manmanpa/fragment/CategoryFragment.java

 package me.yangblog.manmanpa.fragment;
 
+import java.util.LinkedList;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import me.yangblog.manmanpa.BookArrayAdapter;
+import me.yangblog.manmanpa.GlobalVariable;
+import me.yangblog.manmanpa.JSONNeedParser;
 import me.yangblog.manmanpa.MainActivity;
 import me.yangblog.manmanpa.R;
+import me.yangblog.manmanpa.model.Book;
+import me.yangblog.manmanpa.network.JSONParser;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.View.OnClickListener;
 import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.GridLayout;
+import android.widget.SearchView;
 
-public class CategoryFragment extends Fragment{
+public class CategoryFragment extends Fragment implements JSONNeedParser{
 	private MainActivity activity;
+
+	
 	public CategoryFragment(MainActivity activity) {
 		this.activity = activity;
 		
 			Bundle savedInstanceState) {
 		
 		View view = inflater.inflate(R.layout.category_search, container, false);
+		SearchView sv =(SearchView) view.findViewById(R.id.search);
+		//sv.setBackground(new ColorDrawable(Color.RED));
 		
-		
-		
-		
+		GridLayout gl = (GridLayout) view.findViewById(R.id.hot_labels);
+		gl.addView(makeLabelButton("�������"));
+		gl.addView(makeLabelButton("���"));
+		gl.addView(makeLabelButton("�ձ�����"));
+		gl.addView(makeLabelButton("������Ѫ"));
+		gl.addView(makeLabelButton("��Цϲ��"));
+		gl.addView(makeLabelButton("��̨"));
+		gl.addView(makeLabelButton("ŷ��"));
+		gl.addView(makeLabelButton("��̽����"));
+		gl.addView(makeLabelButton("�ֲ�����"));
+		gl.addView(makeLabelButton("��������"));
+		gl.addView(makeLabelButton("������"));
+		gl.addView(makeLabelButton("��½����"));
 		
 		
 		return view;
 	}
+
+	private Button makeLabelButton(String string) {
+		Button button = new Button(activity);
+		button.setMinimumWidth(100);
+		button.setText(string);
+		button.getBackground().setColorFilter(GlobalVariable.BUTTON_COLOR);
+		button.setOnClickListener(new OnClickListener() {
+			
+			@Override
+			public void onClick(View v) {
+				
+			}
+		});
+		return button;
+	}
+
+	@Override
+	public void parseJSON(JSONObject jObj) throws JSONException {
+		// TODO Auto-generated method stub
+		
+	}
+
+	@Override
+	public void notifyDataChange() {
+		// TODO Auto-generated method stub
+		
+	}
 	
 	
 	

File android/src/me/yangblog/manmanpa/fragment/DownloadFragment.java

 
 import me.yangblog.manmanpa.DownloadAdapter;
 import me.yangblog.manmanpa.GlobalVariable;
+import me.yangblog.manmanpa.Helper;
 import me.yangblog.manmanpa.MainActivity;
 import me.yangblog.manmanpa.NotifyAble;
 import me.yangblog.manmanpa.R;
 		View view = inflater.inflate(R.layout.download_fragment, container, false);
 
 		ExpandableListView expLV = (ExpandableListView) view.findViewById(R.id.downloadBookList);
+		Helper.setListViewDivid(expLV);
 		expLV.setAdapter(adaptor);
 		expLV.setOnGroupExpandListener(new OnGroupExpandListener() {
 			

File android/src/me/yangblog/manmanpa/fragment/MyComicFragment.java

 import me.yangblog.manmanpa.ChapterAdapter;
 import me.yangblog.manmanpa.ChapterListActivity;
 import me.yangblog.manmanpa.GlobalVariable;
+import me.yangblog.manmanpa.Helper;
 import me.yangblog.manmanpa.MainActivity;
 import me.yangblog.manmanpa.MyBookArrayAdapter;
 import me.yangblog.manmanpa.model.Book;
 import android.app.AlertDialog;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.graphics.drawable.GradientDrawable;
+import android.graphics.drawable.GradientDrawable.Orientation;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.view.LayoutInflater;
 			Bundle savedInstanceState) {
 
 		ListView listView = new ListView(getActivity());
+		Helper.setListViewDivid(listView);
 		adapter = new MyBookArrayAdapter(getActivity(), bookList);
 
 		// Assign adapter to ListView

File android/src/me/yangblog/manmanpa/fragment/RankFragment.java

 import me.yangblog.manmanpa.BookArrayAdapter;
 import me.yangblog.manmanpa.ChapterListActivity;
 import me.yangblog.manmanpa.GlobalVariable;
+import me.yangblog.manmanpa.Helper;
 import me.yangblog.manmanpa.JSONNeedParser;
 import me.yangblog.manmanpa.MainActivity;
 import me.yangblog.manmanpa.model.Book;
 		// Toast.LENGTH_SHORT).show();
 		// bookList.add(new Book.BookBuilder("Test3").build());
 		ListView listView = new ListView(getActivity());
+		Helper.setListViewDivid(listView);
 		adapter = new BookArrayAdapter(getActivity(), bookList);
 
 		// Assign adapter to ListView