(greendroid) Merge commit 'e60715acccdc494d825529b4d217f52298c4c83e'

Conflicts:
	greendroid/GDCatalog/res/values/dimens.xml
	greendroid/GreenDroid/res/values/gd_colors.xml
pull/14/head
Tim Su 13 years ago
commit e1e448c89c

@ -1,9 +1,4 @@
*/bin/*
*/gen/*
*.DS_Store
*.pyc
# Prevent Git from versioning the GreenDroid library in the samples project.
GDCatalog/src/greendroid/*
GDCatalog/res/*/gd_*
*.pyc

@ -0,0 +1,40 @@
#GreenDroid Changes History
##Changes from March 22, 2011 (version 0.11)
- [CHANGE] Refactor on some GreenDroid style. Styles related to `ItemView`s are now named `@style/GreenDroid.Widget.ItemView.<The-Item-View>`
* This change may impact your code if you are extending GreenDroid's styles. There is no impact otherwise
- [CHANGE] The `SegmentedBar` style has been refactored to be in accordance with other widget styles. It is now in `@style/GreenDroid.Widget`
- [CHANGE] All XML files have been re-indented with tabs instead of spaces (used in Java files)
- [FIXED] `ActionBar` title background has previously inherited from the `ActionBar`. As a result, using translucent backgrounds was quite hazardous.
* Starting for now, the `ActionBar` title has no background. The background is only given by the `ActionBar` itself.
- [FIXED] The `ImageLoaderCallback.onImageLoadingFailed(ImageLoader loader, Throwable exception)` was sometimes called with a null `Throwable`.
- [NEW] New `setBitmapFactoryOptions(BitmapFactory.Options)` and `setInDensity(int)` / `greendroid:inDensity` methods to `AsyncImageView`
* May be used to bypass the default image loading behavior. By default images loaded from the network are all considered
as mdpi images. Using a `BitmapFactory.Options` object with a inDensity to `DisplayMetrics.DENSITY_HIGH` will load images as hdpi images.
- [NEW] Add of new Javadoc on some GreenDroid's classes (`AsyncImageView`, `Time`, `ImageProcessor`, etc.)
- [NEW] Add of new `ActionBarItem.Type`. Almost 10 new icons are now available. Icons are extracted from the [Android Assets Studio][android_assets_studio] project by Roman Nurik
- [NEW] GreenDroid now has a version number! This makes GreenDroid's versions and history tracking way easier.
##Changes from March 1, 2011 (version 0.10)
- [NEW] Add of a complete image loader system: `AsyncImageView` widget, `ImageLoader`, `ImageCache`, etc.
- [FIXED] Class check issue in `GDTabActivity`
- [NEW] `GDListActivity` does not force normal `ActionBar` mode anymore
- [NEW] Add of a new `ActionBar.Type`: `ÀctionBar.Type.Empty`
* In this mode, the `ActionBar` has no "Home" button
- [NEW] `addActionBarItem()` methods now return the newly added `ActionBarItem`
- [NEW] `ActionBarItem` can be "tagged". This makes `ActionBarItem` click handling way easier
- [NEW] Add of a `removeItem(ActionBarItem)` in the `ActionBar` widget
- [NEW] Add of a new `ActionBarDrawable` class that helps the developer easily creating `Drawable`s for `ActionBar`s
* The `ActionBarDrawable` takes a `Drawable` and automatically fill the shape with the white or black color
depending on its current state. It allows you to decrease the size of your project. (GreenDroid's size
has also decreased thanks to this optimization)
- [NEW] Add of a `GDMapActivity`
* In order to use it you have to replace GreenDroid by the new GreenDroid-GoogleAPI library.
GreenDroid-GoogleAPIs already integrates the GreenDroid library.
- [NEW] Add of a new `ActionBarActivity` extra parameter: `ÀctionBarActivity.GD_ACTION_BAR_VISIBILITY`
* Enable `ActionBar` visibility changes from parameters passed via an `Intent`. This may be useful when using
a reusable `GDActivity` inside a `GDTabActivity`.
[android_assets_studio]: http://j.mp/androidassetstudio

@ -23,15 +23,16 @@
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="@drawable/greendroid_icon"
android:icon="@drawable/ic_gdcatalog"
android:label="@string/app_name"
android:theme="@style/Theme.GDCatalog"
android:name=".CatalogApplication"
android:debuggable="true">
android:name=".CatalogApplication">
<activity
android:name=".CatalogActivity">
<activity android:name=".CatalogActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
@ -39,35 +40,28 @@
</activity>
<activity
android:name=".BasicItemActivity"
android:label="@string/basic_item_label" />
<activity
android:name=".XmlItemActivity"
android:label="@string/xml_item_label" />
android:name=".InfoTabActivity"
android:label="@string/general_info_label"/>
<activity android:name=".WebContentActivity" />
<activity android:name=".AboutActivity" />
<activity android:name=".BasicItemActivity" />
<activity android:name=".XmlItemActivity" />
<activity
android:name=".TweakedItemViewActivity"
android:theme="@style/Theme.GDCatalog.TweakedItems"
android:label="@string/tweaked_item_view_label" />
android:theme="@style/Theme.GDCatalog.TweakedItems" />
<activity
android:name=".SegmentedActivity"
android:label="@string/segmented_label" />
<activity
android:name=".ActionBarActivity" />
<activity
android:name=".TabbedActionBarActivity" />
<activity
android:name=".TabbedActionBarActivity$FakeActivity" />
<activity android:name=".SegmentedActivity" />
<activity android:name=".ActionBarActivity" />
<activity android:name=".TabbedActionBarActivity" />
<activity android:name=".TabbedActionBarActivity$FakeActivity" />
<activity
android:name=".QuickActionActivity"
android:label="@string/quick_action_label" />
<activity android:name=".QuickActionActivity" />
<activity android:name=".SimpleAsyncImageViewActivity" />
<activity android:name=".AsyncImageViewListActivity" />
</application>
<uses-sdk android:minSdkVersion="4" />
</manifest>

@ -0,0 +1,56 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

@ -11,4 +11,4 @@
split.density=false
# Project target.
target=android-4
android.library.reference.1=../GreenDroid/
android.library.reference.1=../GreenDroid

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
**
** 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.
*/
-->
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true"
android:color="#f37300" />
<item
android:state_pressed="true"
android:color="#ffba00" />
<item
android:color="@color/gd_action_bar_tint" />
</selector>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 B

@ -19,23 +19,16 @@
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/gd_action_bar_home_alt" />
<item
android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/gd_action_bar_home_alt" />
android:drawable="@drawable/greendroid_application_logo_alt" />
<item
android:state_focused="true"
android:drawable="@drawable/gd_action_bar_home_alt" />
android:drawable="@drawable/greendroid_application_logo_alt" />
<item
android:state_focused="false"
android:state_pressed="false"
android:drawable="@drawable/gd_action_bar_home_normal" />
android:drawable="@drawable/greendroid_application_logo_normal" />
</selector>

@ -19,6 +19,7 @@
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true"
android:state_pressed="true"

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
**
** 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.
*/
-->
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="8dp"
android:background="@android:color/white">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/greendroid_logo" />
<TextView
android:id="@+id/about"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textColor="@android:color/black"
android:text="@string/about_content" />
</LinearLayout>
</ScrollView>

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
**
** 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.
*/
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:greendroid="http://schemas.android.com/apk/res/com.cyrilmottier.android.gdcatalog"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
<greendroid.widget.AsyncImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/image_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
greendroid:defaultSrc="@drawable/ic_gdcatalog" />
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/bottom_bar"
android:paddingTop="4dp">
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/show_image_1"
android:onClick="onShowImage1" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/show_image_2"
android:onClick="onShowImage2" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/show_image_3"
android:onClick="onShowImage3" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
**
** 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.
*/
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:greendroid="http://schemas.android.com/apk/res/com.cyrilmottier.android.gdcatalog"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp">
<greendroid.widget.AsyncImageView
android:id="@+id/async_image"
android:layout_width="@dimen/thumbnail_size"
android:layout_height="@dimen/thumbnail_size"
greendroid:defaultSrc="@drawable/ic_gdcatalog" />
<TextView
android:id="@+id/text"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:paddingLeft="10dp"
android:gravity="center_vertical|left" />
</LinearLayout>

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
**
** 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.
*/
-->
<greendroid.widget.ActionBarHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@id/gd_action_bar_host"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<greendroid.widget.ActionBar
android:id="@id/gd_action_bar"
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />
<FrameLayout
android:id="@id/gd_action_bar_content_view"
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_weight="1">
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="5dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:paddingTop="8dp"
android:paddingBottom="8dp">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/more_info_on_greendroid"
android:textColor="@android:color/white" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:focusable="true"
android:clickable="true"
android:gravity="center_horizontal"
android:paddingRight="20dp"
android:paddingLeft="20dp"
android:text="@string/app_url"
android:textColor="@color/link"
android:textStyle="bold"
android:onClick="onAppUrlClicked" />
</LinearLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="-2dp"
android:layout_marginRight="-2dp"
android:background="@null" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" />
</LinearLayout>
</TabHost>
</FrameLayout>
</greendroid.widget.ActionBarHost>

@ -24,7 +24,6 @@
android:padding="5dp">
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|top"
@ -32,7 +31,6 @@
android:onClick="onShowBar" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -40,7 +38,6 @@
android:onClick="onShowBar" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"

@ -19,7 +19,7 @@
<greendroid.widget.SegmentedHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/segmentedHost"
android:id="@+id/segmented_host"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2010 Cyril Mottier (http://www.cyrilmottier.com)
**
** 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.
*/
-->
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/web_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white" />

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2010 Cyril Mottier (http://www.cyrilmottier.com)
**
** 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.
*/
-->
<resources>
<string name="app_name">GDCatalog</string>
<string name="app_url">http://github.com/cyrilmottier/GreenDroid</string>
<string name="more_info_on_greendroid">For more information on the GreenDroid library, go to the GitHub project\'s web page:</string>
<!-- Activities labels -->
<string name="general_info_label">General information</string>
<string name="basic_item_label">Basic items</string>
<string name="xml_item_label">XML items</string>
<string name="tweaked_item_view_label">Tweaked itemviews</string>
<string name="segmented_label">SegmentedBar</string>
<string name="action_bar_activity_label">ActionBarActivity</string>
<string name="quick_action_label">QuickAction</string>
<string name="simple_async_image_view_label">Simple AsyncImageView</string>
<string name="async_image_view_list_view_label">AsyncImageView in ListView</string>
<string name="about">About</string>
<string name="license">License</string>
<!-- String used in the SegmentedActivity -->
<string name="segment_1">Jeff</string>
<string name="segment_2">Romain</string>
<string name="segment_3">Adam</string>
<string name="segment_4">Dan</string>
<string name="show_image_1">Set image 1</string>
<string name="show_image_2">Set image 2</string>
<string name="show_image_3">Set image 3</string>
<string name="first_screen">First screen</string>
<string name="refresh_pressed">You\'ve just pressed a ActionBarItem.Type.Refresh button</string>
<string name="custom_drawable">Custom drawable. Click on another item instead</string>
<string name="image_for_position">Image for position </string>
<string name="about_content">GreenDroid is a development library for the Android platform. It is intented to make UI developments easier and consistent through your applications.\n\nThe GreenDroid project has been initiated by <a href="http://www.cyrilmottier.com">Cyril Mottier</a></string>
</resources>

@ -20,12 +20,22 @@
<resources>
<string name="app_name">GDCatalog</string>
<string name="app_url">http://github.com/cyrilmottier/GreenDroid</string>
<string name="more_info_on_greendroid">Pour obtenir plus d\'informations sur la bibliothèque GreenDroid, rendez vous sur la page GitHub du projet :</string>
<!-- Activities labels -->
<string name="general_info_label">Informations générales</string>
<string name="basic_item_label">Items basiques</string>
<string name="xml_item_label">Items XML</string>
<string name="tweaked_item_view_label">Itemviews personnalisées</string>
<string name="segmented_label">Démo SegmentedBar</string>
<string name="quick_action_label">Démo QuickAction</string>
<string name="simple_async_image_view_label">AsyncImageView simple</string>
<string name="async_image_view_list_view_label">AsyncImageView dans une ListView</string>
<string name="about">A propos</string>
<string name="license">Licence</string>
<!-- String used in the SegmentedActivity -->
<string name="segment_1">Jeff</string>
@ -33,4 +43,8 @@
<string name="segment_3">Adam</string>
<string name="segment_4">Dan</string>
<string name="show_image_1">Afficher l\'image 1</string>
<string name="show_image_2">Afficher l\'image 2</string>
<string name="show_image_3">Afficher l\'image 3</string>
</resources>

@ -19,6 +19,7 @@
<resources>
<color name="action_bar_tint">#cacaca</color>
<dimen name="thumbnail_size">50dp</dimen>
<dimen name="thumbnail_radius">5dp</dimen>
</resources>
</resources>

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2010 Cyril Mottier (http://www.cyrilmottier.com)
**
** 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.
*/
-->
<resources>
<item type="id" name="action_bar_refresh" />
<item type="id" name="action_bar_export" />
<item type="id" name="action_bar_locate" />
<item type="id" name="action_bar_view_info" />
</resources>

@ -20,13 +20,23 @@
<resources>
<string name="app_name">GDCatalog</string>
<string name="app_url">http://github.com/cyrilmottier/GreenDroid</string>
<string name="more_info_on_greendroid">For more information on the GreenDroid library, go to the GitHub project\'s web page:</string>
<!-- Activities labels -->
<string name="general_info_label">General information</string>
<string name="basic_item_label">Basic items</string>
<string name="xml_item_label">XML items</string>
<string name="tweaked_item_view_label">Tweaked itemviews</string>
<string name="segmented_label">SegmentedBar demo</string>
<string name="quick_action_label">QuickAction demo</string>
<string name="segmented_label">SegmentedBar</string>
<string name="action_bar_activity_label">ActionBarActivity</string>
<string name="quick_action_label">QuickAction</string>
<string name="simple_async_image_view_label">Simple AsyncImageView</string>
<string name="async_image_view_list_view_label">AsyncImageView in ListView</string>
<string name="about">About</string>
<string name="license">License</string>
<!-- String used in the SegmentedActivity -->
<string name="segment_1">Jeff</string>
@ -34,4 +44,17 @@
<string name="segment_3">Adam</string>
<string name="segment_4">Dan</string>
<string name="show_image_1">Set image 1</string>
<string name="show_image_2">Set image 2</string>
<string name="show_image_3">Set image 3</string>
<string name="first_screen">First screen</string>
<string name="refresh_pressed">You\'ve just pressed a ActionBarItem.Type.Refresh button</string>
<string name="custom_drawable">Custom drawable. Click on another item instead</string>
<string name="image_for_position">Image for position </string>
<string name="about_content">GreenDroid is a development library for the Android platform. It is intented to make UI developments easier and consistent through your applications.\n\nThe GreenDroid project has been initiated by <a href="http://www.cyrilmottier.com">Cyril Mottier</a></string>
</resources>

@ -19,8 +19,8 @@
<resources>
<style name="SeparatorItemView" parent="GreenDroid.SeparatorItemView">
<item name="android:background">@drawable/header_bg</item>
<style name="SeparatorItemView" parent="GreenDroid.Widget.ItemView.SeparatorItemView">
<item name="android:background">@drawable/separator_bg</item>
</style>
<style name="TextAppearanceLarge" parent="@style/TextAppearance.Large">

@ -39,7 +39,7 @@
<drawable-item
greendroid:enabled="false"
greendroid:text="DrawableItem (disabled)"
greendroid:drawable="@drawable/greendroid_icon" />
greendroid:drawable="@drawable/ic_gdcatalog" />
<drawable-item
greendroid:text="DrawableItem (with no drawable)" />
@ -54,12 +54,12 @@
<thumbnail-item
greendroid:text="ThumbnailItem"
greendroid:subtitle="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."
greendroid:thumbnail="@drawable/greendroid_icon" />
greendroid:thumbnail="@drawable/ic_gdcatalog" />
<thumbnail-item
greendroid:enabled="false"
greendroid:text="ThumbnailItem (disabled)"
greendroid:subtitle="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."
greendroid:thumbnail="@drawable/greendroid_icon" />
greendroid:thumbnail="@drawable/ic_gdcatalog" />
</item-array>

@ -0,0 +1,35 @@
/*
* Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
*
* 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.cyrilmottier.android.gdcatalog;
import greendroid.app.GDActivity;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
public class AboutActivity extends GDActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarContentView(R.layout.about);
final TextView aboutText = (TextView) findViewById(R.id.about);
aboutText.setMovementMethod(LinkMovementMethod.getInstance());
}
}

@ -35,39 +35,36 @@ public class ActionBarActivity extends GDActivity {
super.onCreate(savedInstanceState);
setActionBarContentView(R.layout.text);
((TextView) findViewById(R.id.text)).setText("Screen 1");
((TextView) findViewById(R.id.text)).setText(R.string.first_screen);
addActionBarItem(Type.Refresh);
ActionBarItem item = getActionBar().newActionBarItem(NormalActionBarItem.class);
item.setDrawable(R.drawable.ic_title_export).setContentDescription(R.string.gd_export);
addActionBarItem(item);
addActionBarItem(Type.Locate);
addActionBarItem(Type.Refresh, R.id.action_bar_refresh);
addActionBarItem(getActionBar()
.newActionBarItem(NormalActionBarItem.class)
.setDrawable(R.drawable.ic_title_export)
.setContentDescription(R.string.gd_export), R.id.action_bar_export);
addActionBarItem(Type.Locate, R.id.action_bar_locate);
}
@Override
public boolean onHandleActionBarItemClick(ActionBarItem item, int position) {
switch (position) {
case 2:
Intent intent = new Intent(this, TabbedActionBarActivity.class);
startActivity(intent);
switch (item.getItemId()) {
case R.id.action_bar_locate:
startActivity(new Intent(this, TabbedActionBarActivity.class));
break;
case 0:
case R.id.action_bar_refresh:
final LoaderActionBarItem loaderItem = (LoaderActionBarItem) item;
mHandler.postDelayed(new Runnable() {
public void run() {
loaderItem.setLoading(false);
}
}, 2000);
Toast.makeText(this, "You've just pressed a ActionBarItem.Type.Refresh button", Toast.LENGTH_SHORT)
.show();
Toast.makeText(this, R.string.refresh_pressed, Toast.LENGTH_SHORT).show();
break;
case 1:
Toast.makeText(this, "Custom drawable. Click on another item instead", Toast.LENGTH_SHORT).show();
case R.id.action_bar_export:
Toast.makeText(this, R.string.custom_drawable, Toast.LENGTH_SHORT).show();
break;
default:

@ -0,0 +1,170 @@
/*
* Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
*
* 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.cyrilmottier.android.gdcatalog;
import greendroid.app.GDListActivity;
import greendroid.image.ImageProcessor;
import greendroid.widget.AsyncImageView;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuffXfermode;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.BaseAdapter;
import android.widget.TextView;
public class AsyncImageViewListActivity extends GDListActivity implements OnScrollListener {
private static final String BASE_URL_PREFIX = "http://www.cyrilmottier.com/files/greendroid/images/image";
private static final String BASE_URL_SUFFIX = ".png";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new MyAdapter(this));
getListView().setOnScrollListener(this);
}
private static class MyAdapter extends BaseAdapter implements ImageProcessor {
private static final StringBuilder BUILDER = new StringBuilder();
private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Rect mRectSrc = new Rect();
private final Rect mRectDest = new Rect();
private final String mImageForPosition;
static class ViewHolder {
public AsyncImageView imageView;
public TextView textView;
public StringBuilder textBuilder = new StringBuilder();
}
private Bitmap mMask;
private int mThumbnailSize;
private int mThumbnailRadius;
private LayoutInflater mInflater;
public MyAdapter(Context context) {
mInflater = LayoutInflater.from(context);
mImageForPosition = context.getString(R.string.image_for_position);
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
mThumbnailSize = context.getResources().getDimensionPixelSize(R.dimen.thumbnail_size);
mThumbnailRadius = context.getResources().getDimensionPixelSize(R.dimen.thumbnail_radius);
prepareMask();
}
private void prepareMask() {
mMask = Bitmap.createBitmap(mThumbnailSize, mThumbnailSize, Bitmap.Config.ARGB_8888);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.RED);
paint.setStyle(Paint.Style.FILL_AND_STROKE);
Canvas c = new Canvas(mMask);
c.drawRoundRect(new RectF(0, 0, mThumbnailSize, mThumbnailSize), mThumbnailRadius, mThumbnailRadius, paint);
}
public int getCount() {
return 100;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.image_item_view, parent, false);
holder = new ViewHolder();
holder.imageView = (AsyncImageView) convertView.findViewById(R.id.async_image);
holder.imageView.setImageProcessor(this);
holder.textView = (TextView) convertView.findViewById(R.id.text);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
BUILDER.setLength(0);
BUILDER.append(BASE_URL_PREFIX);
BUILDER.append(position);
BUILDER.append(BASE_URL_SUFFIX);
holder.imageView.setUrl(BUILDER.toString());
final StringBuilder textBuilder = holder.textBuilder;
textBuilder.setLength(0);
textBuilder.append(mImageForPosition);
textBuilder.append(position);
holder.textView.setText(textBuilder);
return convertView;
}
public Bitmap processImage(Bitmap bitmap) {
Bitmap result = Bitmap.createBitmap(mThumbnailSize, mThumbnailSize, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(result);
mRectSrc.set(0, 0, bitmap.getWidth(), bitmap.getHeight());
mRectDest.set(0, 0, mThumbnailSize, mThumbnailSize);
c.drawBitmap(bitmap, mRectSrc, mRectDest, null);
c.drawBitmap(mMask, 0, 0, mPaint);
return result;
}
}
public void onScroll(AbsListView arg0, int arg1, int arg2, int arg3) {
}
public void onScrollStateChanged(AbsListView listView, int scrollState) {
if (getListView() == listView) {
searchAsyncImageViews(listView, scrollState == OnScrollListener.SCROLL_STATE_FLING);
}
}
private void searchAsyncImageViews(ViewGroup viewGroup, boolean pause) {
final int childCount = viewGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
AsyncImageView image = (AsyncImageView) viewGroup.getChildAt(i).findViewById(R.id.async_image);
if (image != null) {
image.setPaused(pause);
}
}
}
}

@ -50,7 +50,7 @@ public class BasicItemActivity extends GDListActivity {
items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
items.add(new SeparatorItem("Class 3"));
items.add(new ThumbnailItem("Multi-axis", "Looks like a tiny place", R.drawable.class3));
items.add(new ThumbnailItem("Multi-axis", "Looks like a tiny plane", R.drawable.class3));
items.add(new DescriptionItem("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempus consequat leo, et tincidunt justo tristique in."));
items.add(new SeparatorItem("Class 4"));
@ -80,11 +80,9 @@ public class BasicItemActivity extends GDListActivity {
adapter.remove(item2);
adapter.remove(item3);
adapter.remove(progressItem);
adapter.insert(new ThumbnailItem("Ultralight aviation", "List of French 'ULM' classes", R.drawable.greendroid_icon), 0);
adapter.insert(new ThumbnailItem("Ultralight aviation", "List of French 'ULM' classes", R.drawable.ic_gdcatalog), 0);
adapter.notifyDataSetChanged();
}
},8000);
}
}

@ -15,62 +15,63 @@
*/
package com.cyrilmottier.android.gdcatalog;
import greendroid.app.GDActivity;
import greendroid.app.GDListActivity;
import greendroid.graphics.drawable.ActionBarDrawable;
import greendroid.widget.ActionBarItem;
import greendroid.widget.ItemAdapter;
import greendroid.widget.ActionBar.Type;
import greendroid.widget.NormalActionBarItem;
import greendroid.widget.item.TextItem;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;
public class CatalogActivity extends GDActivity {
private ListView mListView;
private Class<?>[] mDemoClasses = {
BasicItemActivity.class, XmlItemActivity.class, TweakedItemViewActivity.class, SegmentedActivity.class,
ActionBarActivity.class, QuickActionActivity.class
};
public CatalogActivity() {
super(Type.Dashboard);
}
public class CatalogActivity extends GDListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarContentView(R.layout.list);
ItemAdapter adapter = new ItemAdapter(this);
adapter.add(new TextItem("Basic items"));
adapter.add(new TextItem("XML items"));
adapter.add(new TextItem("Tweaked item cell"));
adapter.add(new TextItem("SegmentedBar"));
adapter.add(new TextItem("ActionBarActivity"));
adapter.add(new TextItem("QuickActionActivity"));
mListView = (ListView) findViewById(android.R.id.list);
mListView.setAdapter(adapter);
mListView.setOnItemClickListener(mItemClickHandler);
adapter.add(createTextItem(R.string.basic_item_label, BasicItemActivity.class));
adapter.add(createTextItem(R.string.xml_item_label, XmlItemActivity.class));
adapter.add(createTextItem(R.string.tweaked_item_view_label, TweakedItemViewActivity.class));
adapter.add(createTextItem(R.string.segmented_label, SegmentedActivity.class));
adapter.add(createTextItem(R.string.action_bar_activity_label, ActionBarActivity.class));
adapter.add(createTextItem(R.string.quick_action_label, QuickActionActivity.class));
adapter.add(createTextItem(R.string.simple_async_image_view_label, SimpleAsyncImageViewActivity.class));
adapter.add(createTextItem(R.string.async_image_view_list_view_label, AsyncImageViewListActivity.class));
setListAdapter(adapter);
addActionBarItem(getActionBar()
.newActionBarItem(NormalActionBarItem.class)
.setDrawable(new ActionBarDrawable(getResources(), R.drawable.ic_action_bar_info)), R.id.action_bar_view_info);
}
private OnItemClickListener mItemClickHandler = new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position >= 0 && position < mDemoClasses.length) {
Intent intent = new Intent(CatalogActivity.this, mDemoClasses[position]);
switch (position) {
case 4:
intent.putExtra(greendroid.app.ActionBarActivity.GD_ACTION_BAR_TITLE, "ActionBarActivity");
break;
}
startActivity(intent);
}
}
};
private TextItem createTextItem(int stringId, Class<?> klass) {
final TextItem textItem = new TextItem(getString(stringId));
textItem.setTag(klass);
return textItem;
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
final TextItem textItem = (TextItem) l.getAdapter().getItem(position);
Intent intent = new Intent(CatalogActivity.this, (Class<?>) textItem.getTag());
intent.putExtra(ActionBarActivity.GD_ACTION_BAR_TITLE, textItem.text);
startActivity(intent);
}
@Override
public boolean onHandleActionBarItemClick(ActionBarItem item, int position) {
switch (item.getItemId()) {
case R.id.action_bar_view_info:
startActivity(new Intent(this, InfoTabActivity.class));
return true;
default:
return super.onHandleActionBarItemClick(item, position);
}
}
}

@ -15,6 +15,8 @@
*/
package com.cyrilmottier.android.gdcatalog;
import android.content.Intent;
import android.net.Uri;
import greendroid.app.GDApplication;
public class CatalogApplication extends GDApplication {
@ -23,5 +25,10 @@ public class CatalogApplication extends GDApplication {
public Class<?> getHomeActivityClass() {
return CatalogActivity.class;
}
@Override
public Intent getMainApplicationIntent() {
return new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.app_url)));
}
}

@ -0,0 +1,49 @@
/*
* Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
*
* 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.cyrilmottier.android.gdcatalog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import greendroid.app.ActionBarActivity;
import greendroid.app.GDTabActivity;
public class InfoTabActivity extends GDTabActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.info);
final String aboutText = getString(R.string.about);
final Intent aboutIntent = new Intent(this, AboutActivity.class);
aboutIntent.putExtra(ActionBarActivity.GD_ACTION_BAR_VISIBILITY, View.GONE);
addTab(aboutText, aboutText, aboutIntent);
final String licenseText = getString(R.string.license);
final Intent licenseIntent = new Intent(this, WebContentActivity.class);
licenseIntent.putExtra(ActionBarActivity.GD_ACTION_BAR_VISIBILITY, View.GONE);
licenseIntent.putExtra(WebContentActivity.EXTRA_CONTENT_URL, "file:///android_asset/LICENSE.txt");
addTab(licenseText, licenseText, licenseIntent);
}
public void onAppUrlClicked(View v) {
final Uri appUri = Uri.parse(getString(R.string.app_url));
startActivity(new Intent(Intent.ACTION_VIEW, appUri));
}
}

@ -23,6 +23,11 @@ import greendroid.widget.QuickActionBar;
import greendroid.widget.QuickActionGrid;
import greendroid.widget.QuickActionWidget;
import greendroid.widget.QuickActionWidget.OnQuickActionClickListener;
import android.content.Context;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.LightingColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
@ -69,21 +74,21 @@ public class QuickActionActivity extends GDActivity {
private void prepareQuickActionBar() {
mBar = new QuickActionBar(this);
mBar.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_compose_alt, R.string.gd_compose));
mBar.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_export_alt, R.string.gd_export));
mBar.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_share_alt, R.string.gd_share));
mBar.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_compose, R.string.gd_compose));
mBar.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_export, R.string.gd_export));
mBar.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_share, R.string.gd_share));
mBar.setOnQuickActionClickListener(mActionListener);
}
private void prepareQuickActionGrid() {
mGrid = new QuickActionGrid(this);
mGrid.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_compose_alt, R.string.gd_compose));
mGrid.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_export_alt, R.string.gd_export));
mGrid.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_share_alt, R.string.gd_share));
mGrid.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_search_alt, R.string.gd_search));
mGrid.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_edit_alt, R.string.gd_edit));
mGrid.addQuickAction(new QuickAction(this, R.drawable.gd_action_bar_locate_alt, R.string.gd_locate));
mGrid.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_compose, R.string.gd_compose));
mGrid.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_export, R.string.gd_export));
mGrid.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_share, R.string.gd_share));
mGrid.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_search, R.string.gd_search));
mGrid.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_edit, R.string.gd_edit));
mGrid.addQuickAction(new MyQuickAction(this, R.drawable.gd_action_bar_locate, R.string.gd_locate));
mGrid.setOnQuickActionClickListener(mActionListener);
}
@ -93,4 +98,20 @@ public class QuickActionActivity extends GDActivity {
Toast.makeText(QuickActionActivity.this, "Item " + position + " clicked", Toast.LENGTH_SHORT).show();
}
};
private static class MyQuickAction extends QuickAction {
private static final ColorFilter BLACK_CF = new LightingColorFilter(Color.BLACK, Color.BLACK);
public MyQuickAction(Context ctx, int drawableId, int titleId) {
super(ctx, buildDrawable(ctx, drawableId), titleId);
}
private static Drawable buildDrawable(Context ctx, int drawableId) {
Drawable d = ctx.getResources().getDrawable(drawableId);
d.setColorFilter(BLACK_CF);
return d;
}
}
}

@ -35,7 +35,7 @@ public class SegmentedActivity extends GDActivity {
setActionBarContentView(R.layout.segmented_controls);
SegmentedHost segmentedHost = (SegmentedHost) findViewById(R.id.segmentedHost);
SegmentedHost segmentedHost = (SegmentedHost) findViewById(R.id.segmented_host);
mAdapter = new PeopleSegmentedAdapter();
mHandler.postDelayed(new Runnable() {

@ -0,0 +1,49 @@
/*
* Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
*
* 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.cyrilmottier.android.gdcatalog;
import greendroid.app.GDActivity;
import greendroid.widget.AsyncImageView;
import android.os.Bundle;
import android.view.View;
public class SimpleAsyncImageViewActivity extends GDActivity {
private static final String URLS_1 = "https://lh3.googleusercontent.com/_OHO4y8YcQbs/SoWDYIhFrjI/AAAAAAAAKX4/ETS4JGuUYX0/s400/P1080412.JPG";
private static final String URLS_2 = "https://lh6.googleusercontent.com/_OHO4y8YcQbs/So4a6aWih3I/AAAAAAAAKts/hGFcqaHsCuI/s400/P1080809.JPG";
private static final String URLS_3 = "https://lh4.googleusercontent.com/_OHO4y8YcQbs/SSYGHclokDI/AAAAAAAAFUs/qNyvU-4o5eI/s400/P1040275.JPG";
private AsyncImageView mImageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setActionBarContentView(R.layout.image);
mImageView = (AsyncImageView) findViewById(R.id.image_view);
}
public void onShowImage1(View v) {
mImageView.setUrl(URLS_1);
}
public void onShowImage2(View v) {
mImageView.setUrl(URLS_2);
}
public void onShowImage3(View v) {
mImageView.setUrl(URLS_3);
}
}

@ -33,21 +33,17 @@ public class TabbedActionBarActivity extends GDTabActivity {
super.onCreate(savedInstanceState);
setTitle("Screen 2");
Intent intent = new Intent(this, FakeActivity.class);
intent.putExtra(FakeActivity.EXTRA_COLOR, Color.BLACK);
intent.putExtra(FakeActivity.EXTRA_TEXT, "Content of tab #1");
addTab(TAB1, "Tab One", intent);
intent = new Intent(this, FakeActivity.class);
intent.putExtra(FakeActivity.EXTRA_COLOR, Color.rgb(20, 20, 20));
intent.putExtra(FakeActivity.EXTRA_TEXT, "Content of tab #2");
addTab(TAB2, "Tab Two", intent);
intent = new Intent(this, FakeActivity.class);
intent.putExtra(FakeActivity.EXTRA_COLOR, Color.rgb(40, 40, 40));
intent.putExtra(FakeActivity.EXTRA_TEXT, "Content of tab #3");
addTab(TAB3, "Tab Three", intent);
addTab(TAB1, "Tab One", Color.BLACK, "Content of tab #1");
addTab(TAB2, "Tab Two", Color.rgb(20, 20, 20), "Content of tab #2");
addTab(TAB3, "Tab Three", Color.rgb(40, 40, 40), "Content of tab #3");
}
private void addTab(String tag, CharSequence label, int color, String text) {
final Intent intent = new Intent(this, FakeActivity.class);
intent.putExtra(FakeActivity.EXTRA_COLOR, color);
intent.putExtra(FakeActivity.EXTRA_TEXT, text);
addTab(tag, label, intent);
}
public static class FakeActivity extends Activity {

@ -0,0 +1,40 @@
/*
* Copyright (C) 2011 Cyril Mottier (http://www.cyrilmottier.com)
*
* 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.cyrilmottier.android.gdcatalog;
import greendroid.app.GDActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.WebView;
public class WebContentActivity extends GDActivity {
public static final String EXTRA_CONTENT_URL = "com.cyrilmottier.android.gdcatalog.extra.CONTENT_URL";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String contentUrl = getIntent().getStringExtra(EXTRA_CONTENT_URL);
if (!TextUtils.isEmpty(contentUrl)) {
setActionBarContentView(R.layout.web_view);
final WebView webView = (WebView) findViewById(R.id.web_view);
webView.loadUrl(contentUrl);
}
}
}

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="GreenDroid_src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>GreenDroid-GoogleAPIs</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>GreenDroid_src</name>
<type>2</type>
<locationURI>_android_GreenDroid_612cb559/src</locationURI>
</link>
</linkedResources>
</projectDescription>

@ -17,8 +17,7 @@
*/
-->
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cyrilmottier.android.greendroid"
android:versionCode="1"
android:versionName="1.0" />

@ -0,0 +1,13 @@
# 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 use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=Google Inc.:Google APIs:4
android.library=true
android.library.reference.1=../GreenDroid/

@ -0,0 +1,256 @@
/*
* Copyright (C) 2010 Cyril Mottier (http://www.cyrilmottier.com)
*
* 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 greendroid.app;
import greendroid.app.ActionBarActivity;
import greendroid.app.GDApplication;
import greendroid.util.Config;
import greendroid.widget.ActionBar;
import greendroid.widget.ActionBar.OnActionBarListener;
import greendroid.widget.ActionBar.Type;
import greendroid.widget.ActionBarHost;
import greendroid.widget.ActionBarItem;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import com.cyrilmottier.android.greendroid.R;
import com.google.android.maps.MapActivity;
/**
* A special {@link MapActivity} that manages an ActionBar. See
* {@link GDActivity} for a complete documentation of all available features.
*
* @see GDActivity
* @author Cyril Mottier
*/
public abstract class GDMapActivity extends MapActivity implements ActionBarActivity {
private static final String LOG_TAG = GDMapActivity.class.getSimpleName();
private boolean mDefaultConstructorUsed = false;
private Type mActionBarType;
private ActionBarHost mActionBarHost;
public GDMapActivity() {
this(Type.Normal);
mDefaultConstructorUsed = true;
}
public GDMapActivity(ActionBar.Type actionBarType) {
super();
mActionBarType = actionBarType;
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
ensureLayout();
super.onRestoreInstanceState(savedInstanceState);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (mDefaultConstructorUsed) {
// HACK cyril: This should have been done is the default
// constructor. Unfortunately, the getApplication() method returns
// null there. Hence, this has to be done here.
if (getClass().equals(getGDApplication().getHomeActivityClass())) {
mActionBarType = Type.Dashboard;
}
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
ensureLayout();
}
public ActionBar.Type getActionBarType() {
return mActionBarType;
}
public int createLayout() {
switch (mActionBarType) {
case Dashboard:
return R.layout.gd_content_dashboard;
case Normal:
default:
return R.layout.gd_content_normal;
}
}
protected void ensureLayout() {
if (!verifyLayout()) {
setContentView(createLayout());
}
}
protected boolean verifyLayout() {
return mActionBarHost != null;
}
public GDApplication getGDApplication() {
return (GDApplication) getApplication();
}
@Override
public void onContentChanged() {
super.onContentChanged();
onPreContentChanged();
onPostContentChanged();
}
public void onPreContentChanged() {
mActionBarHost = (ActionBarHost) findViewById(R.id.gd_action_bar_host);
if (mActionBarHost == null) {
throw new RuntimeException(
"Your content must have an ActionBarHost whose id attribute is R.id.gd_action_bar_host");
}
mActionBarHost.getActionBar().setOnActionBarListener(mActionBarListener);
}
public void onPostContentChanged() {
boolean titleSet = false;
final Intent intent = getIntent();
if (intent != null) {
String title = intent.getStringExtra(ActionBarActivity.GD_ACTION_BAR_TITLE);
if (title != null) {
titleSet = true;
setTitle(title);
}
}
if (!titleSet) {
// No title has been set via the Intent. Let's look in the
// ActivityInfo
try {
final ActivityInfo activityInfo = getPackageManager().getActivityInfo(getComponentName(), 0);
if (activityInfo.labelRes != 0) {
setTitle(activityInfo.labelRes);
}
} catch (NameNotFoundException e) {
// Do nothing
}
}
final int visibility = intent.getIntExtra(ActionBarActivity.GD_ACTION_BAR_VISIBILITY, View.VISIBLE);
getActionBar().setVisibility(visibility);
}
@Override
public void setTitle(CharSequence title) {
getActionBar().setTitle(title);
}
@Override
public void setTitle(int titleId) {
setTitle(getString(titleId));
}
public ActionBar getActionBar() {
ensureLayout();
return mActionBarHost.getActionBar();
}
public ActionBarItem addActionBarItem(ActionBarItem item) {
return getActionBar().addItem(item);
}
public ActionBarItem addActionBarItem(ActionBarItem item, int itemId) {
return getActionBar().addItem(item, itemId);
}
public ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType) {
return getActionBar().addItem(actionBarItemType);
}
public ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType, int itemId) {
return getActionBar().addItem(actionBarItemType, itemId);
}
public FrameLayout getContentView() {
ensureLayout();
return mActionBarHost.getContentView();
}
public void setActionBarContentView(int resID) {
LayoutInflater.from(this).inflate(resID, getContentView());
}
public void setActionBarContentView(View view, LayoutParams params) {
getContentView().addView(view, params);
}
public void setActionBarContentView(View view) {
getContentView().addView(view);
}
public boolean onHandleActionBarItemClick(ActionBarItem item, int position) {
return false;
}
private OnActionBarListener mActionBarListener = new OnActionBarListener() {
public void onActionBarItemClicked(int position) {
if (position == OnActionBarListener.HOME_ITEM) {
final GDApplication app = getGDApplication();
switch (mActionBarType) {
case Normal:
final Class<?> klass = app.getHomeActivityClass();
if (klass != null && !klass.equals(GDMapActivity.this.getClass())) {
if (Config.GD_INFO_LOGS_ENABLED) {
Log.i(LOG_TAG, "Going back to the home activity");
}
Intent homeIntent = new Intent(GDMapActivity.this, klass);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(homeIntent);
}
break;
case Dashboard:
final Intent appIntent = app.getMainApplicationIntent();
if (appIntent != null) {
if (Config.GD_INFO_LOGS_ENABLED) {
Log.i(LOG_TAG, "Launching the main application Intent");
}
startActivity(appIntent);
}
break;
}
} else {
if (!onHandleActionBarItemClick(getActionBar().getItem(position), position)) {
if (Config.GD_WARNING_LOGS_ENABLED) {
Log.w(LOG_TAG, "Click on item at position " + position + " dropped down to the floor");
}
}
}
}
};
}

@ -18,6 +18,6 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cyrilmottier.android.greendroid"
android:versionCode="1"
android:versionName="1.0" />
package="com.cyrilmottier.android.greendroid"
android:versionCode="1"
android:versionName="1.0" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 682 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save