Skip to content

Commit

Permalink
2012-9-4 v1.7.0 update code
Browse files Browse the repository at this point in the history
  • Loading branch information
jxsmallmouse committed Sep 4, 2012
1 parent 52bdef3 commit 5677102
Show file tree
Hide file tree
Showing 5 changed files with 472 additions and 477 deletions.
17 changes: 6 additions & 11 deletions .gitignore
@@ -1,14 +1,9 @@
# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/
# Package Files #
*.jar
*.war
*.ear
/lint.xml
/bin
/gen
6 changes: 3 additions & 3 deletions README.md
@@ -1,5 +1,5 @@
android-app
===========
===========

# **开源中国社区 Android 客户端项目简析** #

Expand Down Expand Up @@ -97,8 +97,8 @@ AndroidManifest.xml注册的启动界面为"AppStart",具体文件为net.oschi

#### 2、APP访问API流程 ####

以首页资讯列表显示访问API数据为例:

以首页资讯列表显示访问API数据为例:

**1) 初始化控件**<br>
首页Activity(Main.java)在onCreate()方法里面加载布局文件(Main.xml),对下拉刷新列表控件(PullToRefreshListView)进行了初始化,并设置了数据适配器(ListViewNewsAdapter)。<br>
*注:Main.xml布局文件在res\layout目录下;PullToRefreshListView控件在net.oschina.app.widget包;ListViewNewsAdapter适配器在net.oschina.app.adapter包。*
Expand Down
172 changes: 86 additions & 86 deletions res/layout/search.xml
@@ -1,86 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/white">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:orientation="horizontal"
android:background="@drawable/widget_head_bg">
<EditText
android:id="@+id/search_editer"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:layout_gravity="left|center"
android:layout_marginRight="36dip"
android:singleLine="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:imeOptions="actionSearch"
android:background="@drawable/edit_search_bg"
android:hint="输入搜索内容"/>
<Button
android:id="@+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="30dip"
android:layout_gravity="right|center"
android:background="@drawable/btn_search_bg"/>
<ProgressBar
android:id="@+id/search_progress"
style="@style/loading_small"
android:layout_gravity="right|center"
android:layout_marginRight="8dip"
android:background="@color/white"
android:visibility="gone"/>
</FrameLayout>

<LinearLayout
android:id="@+id/search_ll"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="35.0dip"
android:orientation="horizontal"
android:gravity="center_vertical">
<Button
android:id="@+id/search_catalog_software"
style="@style/frame_button"
android:text="软件"/>
<ImageView android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/frame_button_cutline"/>
<Button
android:id="@+id/search_catalog_post"
style="@style/frame_button"
android:text="问答"/>
<ImageView android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/frame_button_cutline"/>
<Button
android:id="@+id/search_catalog_blog"
style="@style/frame_button"
android:text="博客"/>
<ImageView android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/frame_button_cutline"/>
<Button
android:id="@+id/search_catalog_news"
style="@style/frame_button"
android:text="新闻"/>
<ImageView android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/frame_button_cutline"
android:visibility="gone" />
<Button
android:id="@+id/search_catalog_code"
style="@style/frame_button"
android:text="代码"
android:visibility="gone"/>
</LinearLayout>

<ListView
android:id="@+id/search_listview"
style="@style/widget_listview"/>

</LinearLayout>

</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/white">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:orientation="horizontal"
android:background="@drawable/widget_head_bg">
<EditText
android:id="@+id/search_editer"
android:layout_width="fill_parent"
android:layout_height="30dip"
android:layout_gravity="left|center"
android:layout_marginRight="36dip"
android:singleLine="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:imeOptions="actionSearch"
android:background="@drawable/edit_search_bg"
android:hint="输入搜索内容"/>
<Button
android:id="@+id/search_btn"
android:layout_width="wrap_content"
android:layout_height="30dip"
android:layout_gravity="right|center"
android:background="@drawable/btn_search_bg"/>
<ProgressBar
android:id="@+id/search_progress"
style="@style/loading_small"
android:layout_gravity="right|center"
android:layout_marginRight="8dip"
android:background="@color/white"
android:visibility="gone"/>
</FrameLayout>

<LinearLayout
android:id="@+id/search_ll"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="35.0dip"
android:orientation="horizontal"
android:gravity="center_vertical">
<Button
android:id="@+id/search_catalog_software"
style="@style/frame_button"
android:text="软件"/>
<ImageView android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/frame_button_cutline"/>
<Button
android:id="@+id/search_catalog_post"
style="@style/frame_button"
android:text="问答"/>
<ImageView android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/frame_button_cutline"/>
<Button
android:id="@+id/search_catalog_blog"
style="@style/frame_button"
android:text="博客"/>
<ImageView android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/frame_button_cutline"/>
<Button
android:id="@+id/search_catalog_news"
style="@style/frame_button"
android:text="新闻"/>
<ImageView android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@drawable/frame_button_cutline"
android:visibility="gone" />
<Button
android:id="@+id/search_catalog_code"
style="@style/frame_button"
android:text="代码"
android:visibility="gone"/>
</LinearLayout>

<ListView
android:id="@+id/search_listview"
style="@style/widget_listview"/>

</LinearLayout>

</LinearLayout>
158 changes: 79 additions & 79 deletions res/layout/tweet_detail_footer.xml
@@ -1,79 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<ViewSwitcher
android:id="@+id/tweet_detail_foot_viewswitcher"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/widget_bar_bg_n">
<ImageView
android:id="@+id/tweet_detail_footbar_editebox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:layout_marginRight="100dip"
android:layout_gravity="center_vertical"
android:background="@drawable/reply_editbox_bg1"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:background="@drawable/widget_bar_bg_n">
<ImageView
android:id="@+id/tweet_detail_foot_face"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@drawable/widget_bar_face"/>
<EditText
android:id="@+id/tweet_detail_foot_editer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="5dip"
android:layout_marginBottom="5dip"
android:focusable="true"
android:focusableInTouchMode="true"
android:autoLink="web|email"
android:gravity="top"
android:background="@drawable/reply_edittext_bg"
android:visibility="gone"/>
<Button
android:id="@+id/tweet_detail_foot_pubcomment"
android:layout_width="45dip"
android:layout_height="34dip"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:background="@drawable/widget_button_bg"
android:textColor="@color/black"
android:textSize="14dip"
android:text="评论"/>
</LinearLayout>
<GridView
android:id="@+id/tweet_detail_foot_faces"
android:layout_width="fill_parent"
android:layout_height="220dip"
android:numColumns="auto_fit"
android:columnWidth="50dip"
android:stretchMode="columnWidth"
android:gravity="center"
android:fadingEdge="none"
android:scrollingCache="false"
android:background="@color/face_bg"
android:visibility="gone"/>
</LinearLayout>
</ViewSwitcher>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<ViewSwitcher
android:id="@+id/tweet_detail_foot_viewswitcher"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/widget_bar_bg_n">
<ImageView
android:id="@+id/tweet_detail_footbar_editebox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="4dip"
android:layout_marginRight="100dip"
android:layout_gravity="center_vertical"
android:background="@drawable/reply_editbox_bg1"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:background="@drawable/widget_bar_bg_n">
<ImageView
android:id="@+id/tweet_detail_foot_face"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@drawable/widget_bar_face"/>
<EditText
android:id="@+id/tweet_detail_foot_editer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="5dip"
android:layout_marginBottom="5dip"
android:focusable="true"
android:focusableInTouchMode="true"
android:autoLink="web|email"
android:gravity="top"
android:background="@drawable/reply_edittext_bg"
android:visibility="gone"/>
<Button
android:id="@+id/tweet_detail_foot_pubcomment"
android:layout_width="45dip"
android:layout_height="34dip"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:background="@drawable/widget_button_bg"
android:textColor="@color/black"
android:textSize="14dip"
android:text="评论"/>
</LinearLayout>
<GridView
android:id="@+id/tweet_detail_foot_faces"
android:layout_width="fill_parent"
android:layout_height="220dip"
android:numColumns="auto_fit"
android:columnWidth="50dip"
android:stretchMode="columnWidth"
android:gravity="center"
android:fadingEdge="none"
android:scrollingCache="false"
android:background="@color/face_bg"
android:visibility="gone"/>
</LinearLayout>
</ViewSwitcher>
</LinearLayout>

0 comments on commit 5677102

Please sign in to comment.