Compare commits
10 Commits
8d01869e37
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b2f00849a2 | |||
| 415b6f24fa | |||
| 2ca61d8791 | |||
| bf4cb33a6d | |||
| 73a98c05a3 | |||
| 8f9abdec26 | |||
| 1a3cdf9104 | |||
| 130a5a19ec | |||
| bf1d079155 | |||
| 3856b76a3c |
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "pulltorefresh"]
|
||||
path = pulltorefresh
|
||||
url = git://github.com/chrisbanes/Android-PullToRefresh.git
|
||||
@@ -7,7 +7,7 @@
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc}/osj-forum/AndroidAutoIncrementVersionCode.exe"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,auto,"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,clean"/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/OSJ Forum}"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>auto,full,incremental,</triggers>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
|
||||
54
OSJ Forum/.settings/org.eclipse.jdt.ui.prefs
Normal file
54
OSJ Forum/.settings/org.eclipse.jdt.ui.prefs
Normal file
@@ -0,0 +1,54 @@
|
||||
cleanup.add_default_serial_version_id=false
|
||||
cleanup.add_generated_serial_version_id=true
|
||||
cleanup.add_missing_annotations=true
|
||||
cleanup.add_missing_deprecated_annotations=true
|
||||
cleanup.add_missing_methods=true
|
||||
cleanup.add_missing_nls_tags=false
|
||||
cleanup.add_missing_override_annotations=true
|
||||
cleanup.add_missing_override_annotations_interface_methods=true
|
||||
cleanup.add_serial_version_id=true
|
||||
cleanup.always_use_blocks=false
|
||||
cleanup.always_use_parentheses_in_expressions=false
|
||||
cleanup.always_use_this_for_non_static_field_access=false
|
||||
cleanup.always_use_this_for_non_static_method_access=false
|
||||
cleanup.convert_to_enhanced_for_loop=true
|
||||
cleanup.correct_indentation=true
|
||||
cleanup.format_source_code=true
|
||||
cleanup.format_source_code_changes_only=false
|
||||
cleanup.make_local_variable_final=true
|
||||
cleanup.make_parameters_final=true
|
||||
cleanup.make_private_fields_final=true
|
||||
cleanup.make_type_abstract_if_missing_method=false
|
||||
cleanup.make_variable_declarations_final=true
|
||||
cleanup.never_use_blocks=true
|
||||
cleanup.never_use_parentheses_in_expressions=true
|
||||
cleanup.organize_imports=true
|
||||
cleanup.qualify_static_field_accesses_with_declaring_class=false
|
||||
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
|
||||
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
|
||||
cleanup.qualify_static_member_accesses_with_declaring_class=true
|
||||
cleanup.qualify_static_method_accesses_with_declaring_class=false
|
||||
cleanup.remove_private_constructors=true
|
||||
cleanup.remove_trailing_whitespaces=true
|
||||
cleanup.remove_trailing_whitespaces_all=true
|
||||
cleanup.remove_trailing_whitespaces_ignore_empty=false
|
||||
cleanup.remove_unnecessary_casts=true
|
||||
cleanup.remove_unnecessary_nls_tags=true
|
||||
cleanup.remove_unused_imports=true
|
||||
cleanup.remove_unused_local_variables=true
|
||||
cleanup.remove_unused_private_fields=true
|
||||
cleanup.remove_unused_private_members=true
|
||||
cleanup.remove_unused_private_methods=true
|
||||
cleanup.remove_unused_private_types=true
|
||||
cleanup.sort_members=true
|
||||
cleanup.sort_members_all=false
|
||||
cleanup.use_blocks=true
|
||||
cleanup.use_blocks_only_for_return_and_throw=false
|
||||
cleanup.use_parentheses_in_expressions=true
|
||||
cleanup.use_this_for_non_static_field_access=true
|
||||
cleanup.use_this_for_non_static_field_access_only_if_necessary=true
|
||||
cleanup.use_this_for_non_static_method_access=true
|
||||
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
|
||||
cleanup_profile=_Ricky
|
||||
cleanup_settings_version=2
|
||||
eclipse.preferences.version=1
|
||||
@@ -1,5 +1,5 @@
|
||||
<manifest package="org.RickBarrette.osj.forum"
|
||||
android:versionCode="345"
|
||||
android:versionCode="1362"
|
||||
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||
|
||||
<uses-sdk
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<strong>OJS Forum - Ocean State Jeepsters Forum</strong>
|
||||
<br/>
|
||||
<h1>OJS Forum - Ocean State Jeepsters Forum</h1>
|
||||
<pre> Copyright © 2012 <a href="mailto:rickbarrette@gmail.com?subject=OSJ+Forum">Rick Barrette</a>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,18 +16,38 @@
|
||||
|
||||
<hr/>
|
||||
|
||||
<p>OSJ and Ocean State Jeepsters are Copyright © Ocean State Jeepsters 2007-2011<a href="http://www.oceanstatejeepsters.com/"> http://www.oceanstatejeepsters.com/</a></o><br/>
|
||||
<p>OSJ and Ocean State Jeepsters are Copyright © Ocean State Jeepsters 2007-2012<a href="http://www.oceanstatejeepsters.com/"> http://www.oceanstatejeepsters.com/</a></o><br/>
|
||||
|
||||
<hr/>
|
||||
|
||||
OSJ Forum uses the following open source libraries licensed under the <a href="#apachelicense">Apache Software License 2.0</a>.
|
||||
<strong>OJS Forum</strong> is powered by: <strong>Tapatalk API</strong> <br/>
|
||||
<br/>
|
||||
|
||||
Tapatalk API is free to use, however you agree that:
|
||||
<ul>
|
||||
<li>Mentioning of "Tapatalk" in your product communication, news, website, announcement. A short phase such as "Tapatalk compatible client" would suffice.</li>
|
||||
<li>Add "Powered by Tapatalk" within your app predominantly.</li>
|
||||
<li>Not redistributing our plugins and any other copyrighted materials.</li>
|
||||
</ul>
|
||||
<a href="#tapatalklicense">Tapatalk End-User Product License Agreement</a>
|
||||
<br/>
|
||||
|
||||
<hr/>
|
||||
|
||||
<strong>OJS Forum</strong> uses the following open source libraries licensed under the <a href="#apachelicense">Apache Software License 2.0</a>.
|
||||
|
||||
<ul>
|
||||
<li> <a href="http://code.google.com/p/android-xmlrpc/">android-xmlrpc</a> - Very thin xmlrpc client library for Android platform
|
||||
<li> <a href="http://code.google.com/p/android-xmlrpc/">android-xmlrpc</a> - Very thin xmlrpc client library for Android platform</li>
|
||||
<li> <a href="https://github.com/chrisbanes/Android-PullToRefresh"/>Android-PullToRefresh</a> - A project to provide a reusable Pull to Refresh widget for Android</li>
|
||||
<li> <a href="https://github.com/commonsguy/cwac-thumbnai"/>CWAC Thumbnail</a> - Images in Lists, Without the Wait</li>
|
||||
<li> <a href="https://github.com/commonsguy/cwac-adapter"/>CWAC AdapterWrapper</a> - Adding Bits o' Functionality</li>
|
||||
<li> <a href="https://github.com/commonsguy/cwac-bus"/>CWAC Bus</a> - Services And Activities, Communicating</li>
|
||||
<li> <a href="https://github.com/commonsguy/cwac-cache"/>CWAC Cache</a> - Dealing With Pesky Download Times</li>
|
||||
<li> <a href="https://github.com/commonsguy/cwac-task"/>CWAC Task</a> - A Bit More Background Task Goodness</li>
|
||||
</ul>
|
||||
<hr/>
|
||||
|
||||
<a name="apachelicense"/><p>Apache License<br></br>Version 2.0, January 2004<br></br>
|
||||
<a name="apachelicense"/><h2>Apache License</h2><a>Version 2.0, January 2004</br>
|
||||
<a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a> </p>
|
||||
<p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
|
||||
<p><strong><a name="definitions">1. Definitions</a></strong>.</p>
|
||||
@@ -182,3 +201,82 @@ harmless for any liability incurred by, or claims asserted against, such
|
||||
Contributor by reason of your accepting any such warranty or additional
|
||||
liability.</p>
|
||||
<p>END OF TERMS AND CONDITIONS</p>
|
||||
|
||||
<br/>
|
||||
<hr/>
|
||||
<br/>
|
||||
|
||||
<a name="tapatalklicense"/>
|
||||
<h2>Tapatalk Plugin: End-User Product License Agreement</h2>
|
||||
|
||||
|
||||
<p>IMPORTANT-READ THESE TERMS CAREFULLY BEFORE DOWNLOADING THE TAPATALK SOFTWARE (THE "PRODUCT"). BY DOWNLOADING OR USING THE PRODUCT, YOU ("YOU" OR "END-USER") ACKNOWLEDGE THAT YOU HAVE READ THIS LICENSE AGREEMENT, THAT YOU UNDERSTAND IT, AND THAT YOU AGREE TO BE BOUND BY ITS TERMS (THE "LICENSE" OR "AGREEMENT"). IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT, YOU ARE NOT PERMITTED AND NOT AUTHORIZED TO DOWNLOAD OR USE THIS PRODUCT.</p>
|
||||
<p>IMPORTANT-READ THESE TERMS CAREFULLY BEFORE DOWNLOADING THE TAPATALK SOFTWARE (THE "PRODUCT"). BY DOWNLOADING OR USING THE PRODUCT, YOU ("YOU" OR "END-USER") ACKNOWLEDGE THAT YOU HAVE READ THIS LICENSE AGREEMENT, THAT YOU UNDERSTAND IT, AND THAT YOU AGREE TO BE BOUND BY ITS TERMS (THE "LICENSE" OR "AGREEMENT"). IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT, YOU ARE NOT PERMITTED AND NOT AUTHORIZED TO DOWNLOAD OR USE THIS PRODUCT.</p>
|
||||
|
||||
<b><p>1. Grant of License for Registered Users</p></b>
|
||||
|
||||
<p>Quoord Systems Limited ("Quoord" or "Tapatalk") grants you a limited, non-exclusive, non-transferable license to upload, install and otherwise use the Tapatalk Plugin software in conjunction with a Tapatalk compatible forum (the "Product"), including any documentation files accompanying the Product ("Documentation"), provided that: (i) all copyright notices are maintained on the Product; and (ii) you agree to be bound by the terms of this License Agreement, and (iii) the Product is used for the limited purpose contemplated in the provision of this License Agreement. The Product and Documentation shall be used only by you or your organization.</p>
|
||||
|
||||
<b><p>2. Ownership</p></b>
|
||||
|
||||
<p>You have no ownership rights in the Product. Rather, you have a license to use the Product as long as this License Agreement remains in full force and effect. Ownership of the Product, Documentation and all intellectual property rights therein shall remain at all times with Quoord Systems Limited. Any other use of the Product by any person, business, corporation, government organization or any other entity is strictly forbidden and is a violation of this License Agreement.
|
||||
</p>
|
||||
|
||||
<b><p>3. Copyright</p></b>
|
||||
|
||||
<p>The Product and Documentation contain material that is protected by copyright law, nationally and internationally. It is also protected by United States Copyright Law, trade secret law, and by international treaty provisions. All rights not granted to you herein are expressly reserved by Quoord Systems Limited. You may not remove any proprietary notice of Quoord Systems Limited from any copy of the Product or Documentation.
|
||||
</p>
|
||||
|
||||
<b><p>4. Restrictions</p></b>
|
||||
|
||||
<p>All licenses pertaining to the Product and Documentation must be granted explicitly in writing by Quoord. Accordingly, without such license or as set forth explicitly under this License Agreement you may not publish, display, disclose, rent, lease, modify, loan, distribute, or create derivative works based on the Product or any part thereof. You may not reverse engineer, decompile, translate, adapt, or disassemble the Product, nor shall you attempt to create the source code from the object code for the Product.
|
||||
</p>
|
||||
|
||||
<b><p>5. Confidentiality</p></b>
|
||||
|
||||
<p>You acknowledge that the Product contains proprietary trade secrets of Quoord Systems Limited and you hereby agree to maintain the confidentiality of the Product using at least as great a degree of care as you use to maintain the confidentiality of your own most confidential information.</p>
|
||||
|
||||
|
||||
<b><p>6. No Warranty</p></b>
|
||||
|
||||
<p>EXCEPT AS EXPRESSLY PROVIDED HEREIN, THE SOFTWARE AND ANY AND ALL PRODUCTS AND/OR SERVICES PROVIDED BY QUOORD IN CONNECTION WITH THE SOFTWARE ARE PROVIDED ON AN "AS IS" BASIS WITHOUT REPRESENTATION, WARRANTY OR CONDITION OF ANY KIND. QUOORD HEREBY DISCLAIMS ALL OTHER REPRESENTATIONS, WARRANTIES AND CONDITIONS, WHETHER EXPRESS OR IMPLIED INCLUDING, BUT NOT LIMITED TO, IMPLIED REPRESENTATIONS, WARRANTIES OR CONDITIONS OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p>
|
||||
|
||||
<b><p>7. LIMITATION OF LIABILITY</p></b>
|
||||
|
||||
<p>IN NO EVENT WILL QUOORD BE LIABLE (A) FOR ANY INCIDENTAL, INDIRECT, SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, LOSS OF INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE, EVEN IF QUOORD HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, (B)FOR, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR IMPLIED WARRANTIES ARISING FROM COURSE OF DEALING OR COURSE OF PERFORMANCE, LOST PROFITS, BUSINESS INTERRUPTION WHETHER OR NOT FORESEEABLE OR ALLEGED TO BE BASED ON BREACH OF WARRANTY, CONTRACT, NEGLIGENCE OR STRICT LIABILITY, LOSS OF DATA, OR ANY PERFORMANCE UNDER THE AGREEMENT, ARISING OUT OF THE USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF SUCH END-USER OR ANY OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY PROVIDED HEREIN. THE MAXIMUM REMEDY AVAILABLE TO EITHER PARTY IS ANY AMOUNT PAID FOR THE LICENSE TO QUOORD HEREUNDER. QUOORD MAKES NO WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, WITH REGARD TO ANY THIRD PARTY PRODUCTS, THIRD PARTY CONTENT OR ANY SOFTWARE, EQUIPMENT, OR HARDWARE OBTAINED FROM THIRD PARTIES.
|
||||
</p>
|
||||
|
||||
<b><p>8. SCOPE OF LIMITATIONS AND DISCLAIMERS</p></b>
|
||||
<p>THIS LICENSE AGREEMENT IS EXPRESSLY MADE SUBJECT TO ANY LAWS, REGULATIONS, ORDERS, OR OTHER RESTRICTIONS ON THE EXPORT FROM THE UNITED STATES OF AMERICA OF THE PRODUCT OR INFORMATION ABOUT SUCH PRODUCT WHICH MAY BE IMPOSED FROM TIME TO TIME BY THE GOVERNMENT OF THE UNITED STATES OF AMERICA. YOU SHALL NOT EXPORT THE PRODUCT, DOCUMENTATION, OR INFORMATION ABOUT THE PRODUCT AND DOCUMENTATION WITHOUT CONSENT OF Quoord Systems Limited AND COMPLIANCE WITH SUCH LAWS, REGULATIONS, ORDERS, OR OTHER RESTRICTIONS.
|
||||
</p>
|
||||
|
||||
<b><p>9. ENFORCEABILITY OF THIS AGREEMENT</p></b>
|
||||
|
||||
<p>IF ANY PROVISION OF THE AGREEMENT IS UNLAWFUL, VOID, OR FOR ANY REASON UNENFORCEABLE, THEN THAT PROVISION WILL BE DEEMED SEVERABLE FROM THE AGREEMENT AND WILL NOT AFFECT THE VALIDITY AND ENFORCEABILITY OF ANY REMAINING PROVISIONS.</p>
|
||||
|
||||
|
||||
<b><p>10. End-User Warranties</p></b>
|
||||
|
||||
<p>End-User warrants, represents and unconditionally guarantees to Quoord that (a) End-User has the right and ability to enter into this agreement to license the Quoord Product, (b) End-User and/or any parties which End-User may make the use of the Product available will not be used in any manner which may (i) infringe upon any United States copyright, patent, trademark, trade secret, or other proprietary right; (ii) materially violate any applicable law, statute, ordinance, regulation, right of publicity or privacy; (iii) knowingly contain viruses, Trojan horses, worms, time bombs, cancelbots, or other similar harmful or deleterious programming routines; (iv) contain or promote illegal or unlawful activity.</p>
|
||||
|
||||
<b><p>11. End-User Indemnification</p></b>
|
||||
|
||||
<p>End-User shall indemnify and hold harmless Quoord (and its subsidiaries, affiliates, directors, officers, agents, employees and contractors) of, from and with respect to any and all loss, cost, claim, damage, liability and expense (including, but not limited to, reasonable attorney's fees and all related costs and expenses) incurred by Quoord as a result of any breach by End-User of this License Agreement and any claim, judgment, or adjudication against Quoord related to or arising from any breach of this License Agreement.</p>
|
||||
|
||||
<b><p>12. Termination</p></b>
|
||||
|
||||
<p>This License Agreement is effective until it is terminated. Unless otherwise explicitly set forth in writing within another agreement, you may terminate this License Agreement at any time by destroying or returning to Quoord all copies of the Product and Documentation in your possession or under your control. Quoord may terminate this License Agreement for any reason, including, but not limited to, if Quoord finds that you have violated any of the terms of this License Agreement. Upon notification of termination, you agree to destroy or return to Quoord all copies of the Product and Documentation and to certify in writing that all known copies, including backup copies, have been destroyed. All provisions relating to confidentiality, proprietary rights, non-disclosure, limitation of liability and indemnification (specifically paragraphs 3 through 11) shall survive the termination of this License Agreement.</p>
|
||||
|
||||
<b><p>13. General</p></b>
|
||||
|
||||
<p>This License Agreement shall be construed, interpreted and governed by the laws of Hong Kong S.A.R. without regard to conflicts of law provisions thereof. The exclusive forum for any disputes arising out of or relating to this License Agreement shall be an appropriate court sitting in Hong Kong S.A.R. This License Agreement shall constitute the entire Agreement between the parties hereto. Any waiver or modification of this License Agreement shall only be effective if it is in writing and signed by both parties hereto. If any part of this License Agreement is found invalid or unenforceable by a court of competent jurisdiction, the remainder of this License Agreement shall be interpreted so as to reasonably effect the intention of the parties. No provision of the Agreement will be interpreted against any party because such party or its legal representative drafted such provision.</p>
|
||||
|
||||
<br/>
|
||||
Email: admin@tapatalk.com<br/>
|
||||
Rooms 1312-13, 13/F<br/>
|
||||
Hollywood Plaza<br/>
|
||||
610 Nathan Road<br/>
|
||||
Mongkok, Kowloon<br/>
|
||||
Hong Kong S.A.R.<br/>
|
||||
<br/>
|
||||
<hr/>
|
||||
BIN
OSJ Forum/libs/CWAC-AdapterWrapper.jar
Normal file
BIN
OSJ Forum/libs/CWAC-AdapterWrapper.jar
Normal file
Binary file not shown.
BIN
OSJ Forum/libs/CWAC-Bus.jar
Normal file
BIN
OSJ Forum/libs/CWAC-Bus.jar
Normal file
Binary file not shown.
BIN
OSJ Forum/libs/CWAC-Cache.jar
Normal file
BIN
OSJ Forum/libs/CWAC-Cache.jar
Normal file
Binary file not shown.
BIN
OSJ Forum/libs/CWAC-Task.jar
Normal file
BIN
OSJ Forum/libs/CWAC-Task.jar
Normal file
Binary file not shown.
@@ -13,3 +13,4 @@
|
||||
# Project target.
|
||||
target=android-16
|
||||
android.library.reference.1=../../exception_handler_library/ExceptionHandlerLib
|
||||
android.library.reference.2=../pulltorefresh/library
|
||||
|
||||
62
OSJ Forum/res/layout/header.xml
Normal file
62
OSJ Forum/res/layout/header.xml
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<QuickContactBadge
|
||||
android:id="@+id/quickContactBadge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:orientation="vertical"
|
||||
android:gravity="right" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_user"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/user"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/date"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/quickContactBadge"
|
||||
android:paddingLeft="5dip"
|
||||
android:text="@string/title"
|
||||
android:gravity="center"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/firstDivider"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dp"
|
||||
android:background="#0099CC"
|
||||
android:padding="10dip" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,45 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dip" >
|
||||
|
||||
<include layout="@layout/header" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:id="@+id/textView_post"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/quickContactBadge1"
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/title"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<QuickContactBadge
|
||||
android:id="@+id/quickContactBadge1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:src="@drawable/ic_launcher"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/quickContactBadge1"
|
||||
android:layout_marginTop="15dp"
|
||||
android:text="@string/post" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/textView3"
|
||||
android:layout_alignLeft="@+id/textView1"
|
||||
android:text="@string/user"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,54 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dip" >
|
||||
|
||||
<QuickContactBadge
|
||||
android:id="@+id/quickContactBadge1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
<include layout="@layout/header" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@+id/quickContactBadge1"
|
||||
android:text="@string/title"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/textView1"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/textView1"
|
||||
android:text="@string/latest_post"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
<TextView
|
||||
android:id="@+id/textView_latestPost"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/latest_post"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView2"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_toRightOf="@+id/quickContactBadge1"
|
||||
android:text="@string/user"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
<TextView
|
||||
android:id="@+id/textView_newPosts"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/textView_latestPost"
|
||||
android:text="@string/new_posts"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/textView2"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="@string/new_posts"
|
||||
android:visibility="gone"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@@ -16,4 +16,5 @@
|
||||
<string name="osj_server">https://oceanstatejeepsters.ipower.com/forum/mobiquo/mobiquo.php</string>
|
||||
<string name="legal">Legal</string>
|
||||
<string name="deleteing">Deleteing</string>
|
||||
<string name="date">Date</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,111 @@
|
||||
/***
|
||||
Copyright (c) 2008-2009 CommonsWare, LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
not use this file except in compliance with the License. You may obtain
|
||||
a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package com.commonsware.cwac.thumbnail;
|
||||
|
||||
import org.RickBarrette.osj.forum.Log;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListAdapter;
|
||||
|
||||
import com.commonsware.cwac.adapter.AdapterWrapper;
|
||||
import com.commonsware.cwac.cache.SimpleWebImageCache;
|
||||
|
||||
public class ThumbnailAdapter extends AdapterWrapper {
|
||||
private static final String TAG = "ThumbnailAdapter";
|
||||
private final int[] imageIds;
|
||||
private SimpleWebImageCache<ThumbnailBus, ThumbnailMessage> cache = null;
|
||||
private Activity host = null;
|
||||
|
||||
private final ThumbnailBus.Receiver<ThumbnailMessage> onCache = new ThumbnailBus.Receiver<ThumbnailMessage>() {
|
||||
@Override
|
||||
public void onReceive(final ThumbnailMessage message) {
|
||||
final ImageView image = message.getImageView();
|
||||
|
||||
host.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (image.getTag() != null && image.getTag().toString().equals(message.getUrl()))
|
||||
image.setImageDrawable(cache.get(message.getUrl()));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor wrapping a supplied ListAdapter
|
||||
*/
|
||||
public ThumbnailAdapter(final Activity host, final ListAdapter wrapped, final SimpleWebImageCache<ThumbnailBus, ThumbnailMessage> cache, final int[] imageIds) {
|
||||
super(wrapped);
|
||||
|
||||
this.host = host;
|
||||
this.imageIds = imageIds;
|
||||
this.cache = cache;
|
||||
|
||||
cache.getBus().register(getBusKey(), onCache);
|
||||
}
|
||||
|
||||
public void close() {
|
||||
cache.getBus().unregister(onCache);
|
||||
}
|
||||
|
||||
private String getBusKey() {
|
||||
return toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a View that displays the data at the specified position in the data
|
||||
* set. In this case, if we are at the end of the list and we are still in
|
||||
* append mode, we ask for a pending view and return it, plus kick off the
|
||||
* background task to append more data to the wrapped adapter.
|
||||
*
|
||||
* @param position
|
||||
* Position of the item whose data we want
|
||||
* @param convertView
|
||||
* View to recycle, if not null
|
||||
* @param parent
|
||||
* ViewGroup containing the returned View
|
||||
*/
|
||||
@Override
|
||||
public View getView(final int position, final View convertView, final ViewGroup parent) {
|
||||
final View result = super.getView(position, convertView, parent);
|
||||
|
||||
processView(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void processView(final View row) {
|
||||
Log.v(TAG, "Processing View");
|
||||
for (final int imageId : imageIds) {
|
||||
final ImageView image = (ImageView) row.findViewById(imageId);
|
||||
|
||||
if (image != null && image.getTag() != null) {
|
||||
final ThumbnailMessage msg = cache.getBus().createMessage(getBusKey());
|
||||
|
||||
msg.setImageView(image);
|
||||
msg.setUrl(image.getTag().toString());
|
||||
|
||||
try {
|
||||
cache.notify(msg.getUrl(), msg);
|
||||
} catch (final Throwable t) {
|
||||
Log.e(TAG, "Exception trying to fetch image", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/***
|
||||
Copyright (c) 2008-2009 CommonsWare, LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
not use this file except in compliance with the License. You may obtain
|
||||
a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package com.commonsware.cwac.thumbnail;
|
||||
|
||||
import com.commonsware.cwac.bus.AbstractBus;
|
||||
|
||||
public class ThumbnailBus extends AbstractBus<ThumbnailMessage, String, ThumbnailBus.MatchStrategy> {
|
||||
class MatchStrategy implements AbstractBus.Strategy<ThumbnailMessage, String> {
|
||||
@Override
|
||||
public boolean isMatch(final ThumbnailMessage message, final String filter) {
|
||||
return filter != null && message != null && filter.equals(message.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
public ThumbnailBus() {
|
||||
super();
|
||||
|
||||
setStrategy(new MatchStrategy());
|
||||
}
|
||||
|
||||
public ThumbnailMessage createMessage(final String key) {
|
||||
return new ThumbnailMessage(key);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/***
|
||||
Copyright (c) 2008-2009 CommonsWare, LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
not use this file except in compliance with the License. You may obtain
|
||||
a copy of the License at
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package com.commonsware.cwac.thumbnail;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
public class ThumbnailMessage {
|
||||
private final String key;
|
||||
private ImageView image;
|
||||
private String url;
|
||||
|
||||
public ThumbnailMessage(final String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public ImageView getImageView() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setImageView(final ImageView image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public void setUrl(final String url) {
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.handmark.pulltorefresh.extras.listfragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
|
||||
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
|
||||
import com.handmark.pulltorefresh.library.PullToRefreshListView;
|
||||
|
||||
/**
|
||||
* A sample implementation of how to the PullToRefreshListView with
|
||||
* ListFragment. This implementation simply replaces the ListView that
|
||||
* ListFragment creates with a new PullToRefreshListView. This means that
|
||||
* ListFragment still works 100% (e.g. <code>setListShown(...)</code>).
|
||||
*
|
||||
* The new PullToRefreshListView is created in the method
|
||||
* <code>onCreatePullToRefreshListView()</code>. If you wish to customise the
|
||||
* PullToRefreshListView then override this method and return your customised
|
||||
* instance.
|
||||
*
|
||||
* @author Chris Banes
|
||||
*
|
||||
*/
|
||||
public abstract class PullToRefreshListFragment extends ListFragment implements OnRefreshListener<ListView> {
|
||||
|
||||
private PullToRefreshListView mPullToRefreshListView;
|
||||
|
||||
/**
|
||||
* @return The {@link PullToRefreshListView} attached to this ListFragment.
|
||||
*/
|
||||
public final PullToRefreshListView getPullToRefreshListView() {
|
||||
return mPullToRefreshListView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
getPullToRefreshListView().setOnRefreshListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link PullToRefreshListView} which will replace the ListView
|
||||
* created from ListFragment. You should override this method if you wish to
|
||||
* customise the {@link PullToRefreshListView} from the default.
|
||||
*
|
||||
* @param inflater
|
||||
* - LayoutInflater which can be used to inflate from XML.
|
||||
* @param savedInstanceState
|
||||
* - Bundle passed through from
|
||||
* {@link ListFragment#onCreateView(LayoutInflater, ViewGroup, Bundle)
|
||||
* onCreateView(...)}
|
||||
* @return The {@link PullToRefreshListView} which will replace the
|
||||
* ListView.
|
||||
*/
|
||||
protected PullToRefreshListView onCreatePullToRefreshListView(final LayoutInflater inflater, final Bundle savedInstanceState) {
|
||||
return new PullToRefreshListView(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
|
||||
final View layout = super.onCreateView(inflater, container, savedInstanceState);
|
||||
|
||||
final ListView lv = (ListView) layout.findViewById(android.R.id.list);
|
||||
final ViewGroup parent = (ViewGroup) lv.getParent();
|
||||
|
||||
// Iterate through parent's children until we find the ListView, we need
|
||||
// to do it this way as we need to find out the child index
|
||||
for (int i = 0, z = parent.getChildCount(); i < z; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
|
||||
if (child == lv) {
|
||||
// Remove the ListView first
|
||||
parent.removeViewAt(i);
|
||||
|
||||
// Now create ListView, and add it in it's place...
|
||||
mPullToRefreshListView = onCreatePullToRefreshListView(inflater, savedInstanceState);
|
||||
parent.addView(mPullToRefreshListView, i, lv.getLayoutParams());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the mode of the Pull To Refresh ListView controlled by this fragment
|
||||
*
|
||||
* @param mode
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public void setMode(final Mode mode) {
|
||||
mPullToRefreshListView.setMode(mode);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,32 +24,59 @@ import org.RickBarrette.osj.forum.content.ForumContent.ForumItem;
|
||||
import org.RickBarrette.osj.forum.content.OnItemSelectedListener;
|
||||
import org.RickBarrette.osj.forum.content.TopicAdapter;
|
||||
import org.RickBarrette.osj.forum.content.TopicContent;
|
||||
import org.RickBarrette.osj.forum.database.DatabaseListener;
|
||||
import org.RickBarrette.osj.forum.database.ForumDatabase;
|
||||
import org.xmlrpc.android.XMLRPCClient;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.commonsware.cwac.cache.SimpleWebImageCache;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailAdapter;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailBus;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailMessage;
|
||||
import com.handmark.pulltorefresh.extras.listfragment.PullToRefreshListFragment;
|
||||
import com.handmark.pulltorefresh.library.PullToRefreshBase;
|
||||
|
||||
/**
|
||||
* This fragment will be used to display information about the forum
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ForumDetailFragment extends ListFragment {
|
||||
public class ForumDetailFragment extends PullToRefreshListFragment implements DatabaseListener {
|
||||
|
||||
public static final String ARG_ITEM_ID = "item_id";
|
||||
private int mActivatedPosition = ListView.INVALID_POSITION;
|
||||
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||
private static final String TAG = "ForumDetailFragment";
|
||||
|
||||
ForumItem mItem;
|
||||
private OnItemSelectedListener mCallbacks;
|
||||
private ForumDatabase mDb;
|
||||
|
||||
public ForumDetailFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mDb = new ForumDatabase(getActivity(), this);
|
||||
|
||||
refreshList();
|
||||
|
||||
if (TopicContent.ITEMS.size() == 0)
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDb.saveTopics(XMLRPCClient.getClient(getActivity()), mItem.content.get("forum_id"), false);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -69,19 +96,28 @@ public class ForumDetailFragment extends ListFragment {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments().containsKey(ARG_ITEM_ID))
|
||||
mItem = ForumContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
|
||||
}
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TopicContent.getTopics((String) mItem.content.get("forum_id"), getActivity());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setListAdapter(new TopicAdapter(getActivity()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
@Override
|
||||
public void onDatabaseCreate() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDatabaseUpgrade() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDatabaseUpgradeComplete() {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeletionComplete() {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +129,23 @@ public class ForumDetailFragment extends ListFragment {
|
||||
@Override
|
||||
public void onListItemClick(final ListView l, final View v, final int position, final long id) {
|
||||
super.onListItemClick(l, v, position, id);
|
||||
mCallbacks.onItemSelected(this, TopicContent.ITEMS.get(position).id);
|
||||
Log.v(TAG, "onListItemClick");
|
||||
mCallbacks.onItemSelected(this, TopicContent.ITEMS.get(position - 1).id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(final PullToRefreshBase<ListView> refreshView) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDb.saveTopics(XMLRPCClient.getClient(getActivity()), mItem.content.get("forum_id"), false);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreComplete() {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -103,6 +155,11 @@ public class ForumDetailFragment extends ListFragment {
|
||||
outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSyncComplete() {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(final View view, final Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
@@ -110,6 +167,23 @@ public class ForumDetailFragment extends ListFragment {
|
||||
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the listview
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
private void refreshList() {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TopicContent.getTopics((String) mItem.content.get("forum_id"), mDb);
|
||||
setListAdapter(new ThumbnailAdapter(getActivity(), new TopicAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null,
|
||||
101, new ThumbnailBus()), new int[] { R.id.quickContactBadge }));
|
||||
getPullToRefreshListView().onRefreshComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setActivatedPosition(final int position) {
|
||||
if (position == AdapterView.INVALID_POSITION)
|
||||
getListView().setItemChecked(mActivatedPosition, false);
|
||||
|
||||
@@ -28,17 +28,20 @@ import org.RickBarrette.osj.forum.database.ForumDatabase;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.handmark.pulltorefresh.extras.listfragment.PullToRefreshListFragment;
|
||||
import com.handmark.pulltorefresh.library.PullToRefreshBase;
|
||||
|
||||
/**
|
||||
* This fragment will be used to display a list of forums to the user
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public class ForumListFragment extends ListFragment implements DatabaseListener {
|
||||
public class ForumListFragment extends PullToRefreshListFragment implements DatabaseListener {
|
||||
|
||||
private ForumDatabase mDb;
|
||||
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||
@@ -49,12 +52,29 @@ public class ForumListFragment extends ListFragment implements DatabaseListener
|
||||
private static OnItemSelectedListener sForumCallbacks = new OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(final Fragment listFragment, final String id) {
|
||||
// TODO something
|
||||
}
|
||||
};
|
||||
|
||||
public ForumListFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mDb = new ForumDatabase(getActivity(), this);
|
||||
|
||||
refreshList();
|
||||
|
||||
if (ForumContent.ITEMS.size() == 0)
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDb.saveForums(false);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(final Activity activity) {
|
||||
super.onAttach(activity);
|
||||
@@ -64,25 +84,6 @@ public class ForumListFragment extends ListFragment implements DatabaseListener
|
||||
mCallbacks = (OnItemSelectedListener) activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.v(TAG, "onCreate()");
|
||||
|
||||
mDb = new ForumDatabase(getActivity(), this);
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDb.saveForums(true);
|
||||
}
|
||||
}).start();
|
||||
|
||||
if (ForumContent.ITEMS.size() == 0)
|
||||
ForumContent.getForum(mDb);
|
||||
setListAdapter(new ForumAdapter(getActivity()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDatabaseCreate() {
|
||||
// TODO Auto-generated method stub
|
||||
@@ -103,8 +104,7 @@ public class ForumListFragment extends ListFragment implements DatabaseListener
|
||||
|
||||
@Override
|
||||
public void onDeletionComplete() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,13 +116,23 @@ public class ForumListFragment extends ListFragment implements DatabaseListener
|
||||
@Override
|
||||
public void onListItemClick(final ListView listView, final View view, final int position, final long id) {
|
||||
super.onListItemClick(listView, view, position, id);
|
||||
mCallbacks.onItemSelected(this, ForumContent.ITEMS.get(position).id);
|
||||
Log.v(TAG, "onListItemClick");
|
||||
mCallbacks.onItemSelected(this, ForumContent.ITEMS.get(position - 1).id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(final PullToRefreshBase<ListView> refreshView) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDb.saveForums(false);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreComplete() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,13 +144,7 @@ public class ForumListFragment extends ListFragment implements DatabaseListener
|
||||
|
||||
@Override
|
||||
public void onSyncComplete() {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ForumContent.getForum(mDb);
|
||||
setListAdapter(new ForumAdapter(getActivity()));
|
||||
}
|
||||
});
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,6 +154,22 @@ public class ForumListFragment extends ListFragment implements DatabaseListener
|
||||
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the listview
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
private void refreshList() {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ForumContent.getForum(mDb);
|
||||
setListAdapter(new ForumAdapter(getActivity()));
|
||||
getPullToRefreshListView().onRefreshComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setActivatedPosition(final int position) {
|
||||
if (position == AdapterView.INVALID_POSITION)
|
||||
getListView().setItemChecked(mActivatedPosition, false);
|
||||
|
||||
@@ -24,27 +24,56 @@ import org.RickBarrette.osj.forum.content.ThreadAdapter;
|
||||
import org.RickBarrette.osj.forum.content.ThreadContent;
|
||||
import org.RickBarrette.osj.forum.content.TopicContent;
|
||||
import org.RickBarrette.osj.forum.content.TopicContent.TopicItem;
|
||||
import org.RickBarrette.osj.forum.database.DatabaseListener;
|
||||
import org.RickBarrette.osj.forum.database.ForumDatabase;
|
||||
import org.xmlrpc.android.XMLRPCClient;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class TopicDetailFragment extends ListFragment {
|
||||
import com.commonsware.cwac.cache.SimpleWebImageCache;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailAdapter;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailBus;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailMessage;
|
||||
import com.handmark.pulltorefresh.extras.listfragment.PullToRefreshListFragment;
|
||||
import com.handmark.pulltorefresh.library.PullToRefreshBase;
|
||||
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
|
||||
|
||||
public class TopicDetailFragment extends PullToRefreshListFragment implements DatabaseListener {
|
||||
|
||||
public static final String ARG_ITEM_ID = "item_id";
|
||||
private int mActivatedPosition = ListView.INVALID_POSITION;
|
||||
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||
private static final String TAG = "TopicDetailFragment";
|
||||
|
||||
TopicItem mItem;
|
||||
private OnItemSelectedListener mCallbacks;
|
||||
private ForumDatabase mDb;
|
||||
|
||||
public TopicDetailFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(final Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
setMode(Mode.PULL_UP_TO_REFRESH);
|
||||
mDb = new ForumDatabase(getActivity(), this);
|
||||
|
||||
refreshList();
|
||||
|
||||
if (ThreadContent.ITEMS.size() == 0)
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDb.saveThreads(XMLRPCClient.getClient(getActivity()), mItem.content.get("forum_id"), mItem.content.get("topic_id"));
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -67,19 +96,28 @@ public class TopicDetailFragment extends ListFragment {
|
||||
|
||||
if (mItem == null)
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ThreadContent.getThread((String) mItem.content.get("topic_id"), 0, 0, getActivity());
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setListAdapter(new ThreadAdapter(getActivity()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
@Override
|
||||
public void onDatabaseCreate() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDatabaseUpgrade() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDatabaseUpgradeComplete() {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeletionComplete() {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +129,23 @@ public class TopicDetailFragment extends ListFragment {
|
||||
@Override
|
||||
public void onListItemClick(final ListView l, final View v, final int position, final long id) {
|
||||
super.onListItemClick(l, v, position, id);
|
||||
mCallbacks.onItemSelected(this, TopicContent.ITEMS.get(position).id);
|
||||
Log.v(TAG, "onListItemClick");
|
||||
mCallbacks.onItemSelected(this, TopicContent.ITEMS.get(position - 1).id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(final PullToRefreshBase<ListView> refreshView) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDb.saveThreads(XMLRPCClient.getClient(getActivity()), mItem.content.get("forum_id"), mItem.content.get("topic_id"));
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreComplete() {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,6 +155,11 @@ public class TopicDetailFragment extends ListFragment {
|
||||
outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSyncComplete() {
|
||||
refreshList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(final View view, final Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
@@ -108,6 +167,23 @@ public class TopicDetailFragment extends ListFragment {
|
||||
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes the listview
|
||||
*
|
||||
* @author ricky barrette
|
||||
*/
|
||||
private void refreshList() {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ThreadContent.getThread((String) mItem.content.get("topic_id"), mDb);
|
||||
setListAdapter(new ThumbnailAdapter(getActivity(), new ThreadAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null,
|
||||
101, new ThumbnailBus()), new int[] { R.id.quickContactBadge }));
|
||||
getPullToRefreshListView().onRefreshComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setActivatedPosition(final int position) {
|
||||
if (position == AdapterView.INVALID_POSITION)
|
||||
getListView().setItemChecked(mActivatedPosition, false);
|
||||
|
||||
@@ -32,6 +32,11 @@ import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.commonsware.cwac.cache.SimpleWebImageCache;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailAdapter;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailBus;
|
||||
import com.commonsware.cwac.thumbnail.ThumbnailMessage;
|
||||
|
||||
public class TopicListFragment extends ListFragment {
|
||||
|
||||
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||
@@ -61,7 +66,8 @@ public class TopicListFragment extends ListFragment {
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setListAdapter(new TopicAdapter(getActivity()));
|
||||
setListAdapter(new ThumbnailAdapter(getActivity(), new TopicAdapter(getActivity()), new SimpleWebImageCache<ThumbnailBus, ThumbnailMessage>(null, null, 101,
|
||||
new ThumbnailBus()), new int[] { R.id.quickContactBadge }));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ThreadAdapter extends BaseAdapter {
|
||||
TextView user;
|
||||
TextView post;
|
||||
QuickContactBadge badage;
|
||||
TextView date;
|
||||
}
|
||||
|
||||
private final LayoutInflater mInflater;
|
||||
@@ -110,10 +111,11 @@ public class ThreadAdapter extends BaseAdapter {
|
||||
// views
|
||||
// we want to bind data to.
|
||||
holder = new ViewHolder();
|
||||
holder.title = (TextView) convertView.findViewById(R.id.textView1);
|
||||
holder.user = (TextView) convertView.findViewById(R.id.textView2);
|
||||
holder.post = (TextView) convertView.findViewById(R.id.textView3);
|
||||
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge1);
|
||||
holder.title = (TextView) convertView.findViewById(R.id.textView_title);
|
||||
holder.user = (TextView) convertView.findViewById(R.id.textView_user);
|
||||
holder.post = (TextView) convertView.findViewById(R.id.textView_post);
|
||||
holder.date = (TextView) convertView.findViewById(R.id.textView_date);
|
||||
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else
|
||||
@@ -129,6 +131,9 @@ public class ThreadAdapter extends BaseAdapter {
|
||||
holder.title.setText((String) getItem(position).get("post_title"));
|
||||
holder.user.setText((String) getItem(position).get("post_author_name"));
|
||||
holder.post.setText((String) getItem(position).get("post_content"));
|
||||
holder.date.setText((String) getItem(position).get("post_time"));
|
||||
holder.badage.setImageResource(R.drawable.ic_launcher);
|
||||
holder.badage.setTag("http://www.gravatar.com/avatar/9b4f3d34ca3ce31198efac149c3a1ca2?s=300&d=identicon&r=PG");
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,6 @@ import java.util.Map;
|
||||
import org.RickBarrette.osj.forum.Log;
|
||||
import org.RickBarrette.osj.forum.database.ForumDatabase;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* This class is used to maintain an instance of a thread's data content
|
||||
*
|
||||
@@ -85,13 +83,10 @@ public class ThreadContent {
|
||||
* @param context
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void getThread(final String topicId, final int startNumber, final int lastNumber, final Context context) {
|
||||
public static void getThread(final String topicId, final ForumDatabase db) {
|
||||
ITEMS.clear();
|
||||
ITEM_MAP.clear();
|
||||
|
||||
final ForumDatabase db = new ForumDatabase(context);
|
||||
final List<String> list = db.getThreads(topicId);
|
||||
|
||||
int index = 0;
|
||||
for (final String item : list)
|
||||
addItem(new ThreadItem(Integer.valueOf(index++).toString(), db.getThread(item)));
|
||||
|
||||
@@ -44,6 +44,7 @@ public class TopicAdapter extends BaseAdapter {
|
||||
TextView user;
|
||||
TextView newPosts;
|
||||
QuickContactBadge badage;
|
||||
TextView date;
|
||||
}
|
||||
|
||||
private final LayoutInflater mInflater;
|
||||
@@ -110,11 +111,12 @@ public class TopicAdapter extends BaseAdapter {
|
||||
// views
|
||||
// we want to bind data to.
|
||||
holder = new ViewHolder();
|
||||
holder.title = (TextView) convertView.findViewById(R.id.textView1);
|
||||
holder.lastestPost = (TextView) convertView.findViewById(R.id.textView2);
|
||||
holder.user = (TextView) convertView.findViewById(R.id.textView3);
|
||||
holder.newPosts = (TextView) convertView.findViewById(R.id.textView4);
|
||||
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge1);
|
||||
holder.title = (TextView) convertView.findViewById(R.id.textView_title);
|
||||
holder.lastestPost = (TextView) convertView.findViewById(R.id.textView_latestPost);
|
||||
holder.user = (TextView) convertView.findViewById(R.id.textView_user);
|
||||
holder.newPosts = (TextView) convertView.findViewById(R.id.textView_newPosts);
|
||||
holder.badage = (QuickContactBadge) convertView.findViewById(R.id.quickContactBadge);
|
||||
holder.date = (TextView) convertView.findViewById(R.id.textView_date);
|
||||
|
||||
convertView.setTag(holder);
|
||||
} else
|
||||
@@ -131,6 +133,9 @@ public class TopicAdapter extends BaseAdapter {
|
||||
holder.user.setText((String) getItem(position).get("topic_author_name"));
|
||||
holder.lastestPost.setText((String) getItem(position).get("short_content"));
|
||||
holder.newPosts.setVisibility(Boolean.parseBoolean((String) getItem(position).get("new_post")) ? View.VISIBLE : View.GONE);
|
||||
holder.badage.setImageResource(R.drawable.ic_launcher);
|
||||
holder.badage.setTag("http://www.gravatar.com/avatar/9b4f3d34ca3ce31198efac149c3a1ca2?s=300&d=identicon&r=PG");
|
||||
holder.date.setText((String) getItem(position).get("last_reply_time"));
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,6 @@ import java.util.Map;
|
||||
import org.RickBarrette.osj.forum.Log;
|
||||
import org.RickBarrette.osj.forum.database.ForumDatabase;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* This class is used to maintain an instance of a topic's content data
|
||||
*
|
||||
@@ -83,11 +81,10 @@ public class TopicContent {
|
||||
* @return
|
||||
* @author ricky barrette
|
||||
*/
|
||||
public static void getTopics(final String forumId, final Context context) {
|
||||
public static void getTopics(final String forumId, final ForumDatabase db) {
|
||||
ITEMS.clear();
|
||||
ITEM_MAP.clear();
|
||||
|
||||
final ForumDatabase db = new ForumDatabase(context);
|
||||
final List<String> list = db.getTopics(forumId);
|
||||
|
||||
int index = 0;
|
||||
|
||||
1
pulltorefresh
Submodule
1
pulltorefresh
Submodule
Submodule pulltorefresh added at a38ed2fc7f
Reference in New Issue
Block a user