Skip to content

Commit

Permalink
Add all files to update to current progress.
Browse files Browse the repository at this point in the history
  • Loading branch information
cwhsu1984 committed Aug 31, 2013
1 parent 905cc1b commit e7b5bee
Show file tree
Hide file tree
Showing 28 changed files with 687 additions and 0 deletions.
31 changes: 31 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.novel"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.novel.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.novel.SearchActivity"
android:label="@string/app_name" >
</activity>
</application>

</manifest>
Binary file added ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added libs/android-support-v4.jar
Binary file not shown.
Binary file added libs/jsoup-1.7.2.jar
Binary file not shown.
20 changes: 20 additions & 0 deletions proguard-project.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
15 changes: 15 additions & 0 deletions project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-18
android.library.reference.1=../gridlayout_v7
Binary file added res/drawable-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<fragment class="com.example.novel.MainActivity$HomeListFragment"
android:id="@+id/home"
android:layout_width="match_parent" android:layout_height="match_parent" />

</FrameLayout>
6 changes: 6 additions & 0 deletions res/layout/search.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/search_layout">

</FrameLayout>
42 changes: 42 additions & 0 deletions res/layout/search_fragment.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<Spinner
android:id="@+id/option"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />

<EditText
android:id="@+id/input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="text" >

<requestFocus />
</EditText>

<Button
android:id="@+id/search_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/search_button" />

</LinearLayout>

<ListView
android:id="@+id/result"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>

</LinearLayout>
9 changes: 9 additions & 0 deletions res/menu/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"/>

</menu>
8 changes: 8 additions & 0 deletions res/values-sw600dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>

<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw600dp devices (e.g. 7" tablets) here.
-->

</resources>
9 changes: 9 additions & 0 deletions res/values-sw720dp-land/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<resources>

<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>

</resources>
11 changes: 11 additions & 0 deletions res/values-v11/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<resources>

<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>

</resources>
12 changes: 12 additions & 0 deletions res/values-v14/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<resources>

<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>

</resources>
7 changes: 7 additions & 0 deletions res/values/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<resources>

<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>

</resources>
22 changes: 22 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">novel</string>
<string name="action_settings">Settings</string>

<!-- Home -->
<string name="search">小說查詢</string>
<string name="add">近期新增</string>
<string name="classes">分類索引</string>
<string name="mybook">我的書庫</string>
<string name="spwriter">特約作家</string>
<string name="writer">作家專區</string>
<string name="guestbook">貼文留言</string>
<string name="hot">排行 / 評分榜</string>

<!-- Search -->
<string name="search_book">作品查詢</string>
<string name="search_writer">作家查詢</string>
<string name ="search_button">查詢</string>
<string name ="not_found">請重新選擇或輸入搜尋條件!!</string>
</resources>
20 changes: 20 additions & 0 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<resources>

<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

</resources>
91 changes: 91 additions & 0 deletions src/com/example/novel/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package com.example.novel;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends FragmentActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set fragment statically
setContentView(R.layout.activity_main);
}

public static class HomeListFragment extends ListFragment {

static String[] menu = null;
static final int SEARCH = 0;
static final int ADD = 1;
static final int CLASSES = 2;
static final int MYBOOK = 3;
static final int SPWRITER = 4;
static final int WRITER = 5;
static final int GUESTBOOK = 6;
static final int HOT = 7;

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
initializeMenu();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),
android.R.layout.simple_list_item_1, menu);
setListAdapter(adapter);
}

private void initializeMenu() {
Resources resources = getActivity().getResources();
menu = new String[] {
resources.getString(R.string.search),
resources.getString(R.string.add),
resources.getString(R.string.classes),
resources.getString(R.string.mybook),
resources.getString(R.string.spwriter),
resources.getString(R.string.writer),
resources.getString(R.string.guestbook),
resources.getString(R.string.hot)
};
}

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
switch (position) {
case SEARCH:
Intent intent = new Intent();
intent.setClass(getActivity(), SearchActivity.class);
//intent.putExtra("index", index);
startActivity(intent);
break;
/*
case ADD:
break;
case HOT:
break;
*/
default:
Toast.makeText(getActivity(), "TODO", Toast.LENGTH_LONG).show();
}
}

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
39 changes: 39 additions & 0 deletions src/com/example/novel/SearchActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.novel;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;

public class SearchActivity extends FragmentActivity {

static final String FRAGMENT_TAG = "search";
SearchFragment mSearchFragment;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search);

FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
// Use fragment tag to check if the fragment existed to prevent fragment overlap
// by adding new fragment.
if (fragmentManager.findFragmentByTag(FRAGMENT_TAG) == null) {
mSearchFragment = new SearchFragment();
fragmentTransaction.add(R.id.search_layout, mSearchFragment, FRAGMENT_TAG).commit();
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

public SearchFragment geSearchFragment() {
return mSearchFragment;
}
}
Loading

0 comments on commit e7b5bee

Please sign in to comment.