Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding GDPreferenceActivity and a color strip #84

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion GreenDroid/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
2 changes: 2 additions & 0 deletions GreenDroid/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/gen
/bin
11 changes: 11 additions & 0 deletions GreenDroid/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
4 changes: 3 additions & 1 deletion GreenDroid/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cyrilmottier.android.greendroid"
android:versionCode="1"
android:versionName="1.0" />
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7" android:maxSdkVersion="17"/>
</manifest>
17 changes: 17 additions & 0 deletions GreenDroid/project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

android.library=true
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=android-7
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_content_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_content_empty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_content_normal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_expandable_list_content_empty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_expandable_list_content_normal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_list_content_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_list_content_empty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_list_content_normal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
54 changes: 54 additions & 0 deletions GreenDroid/res/layout/gd_preference_list_content.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?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.
*/
-->

<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_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_height"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >

<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
android:scrollbarAlwaysDrawVerticalTrack="true" />
</FrameLayout>

</greendroid.widget.ActionBarHost>
8 changes: 8 additions & 0 deletions GreenDroid/res/layout/gd_tab_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
android:layout_height="@dimen/gd_action_bar_height"
android:layout_width="fill_parent"
android:background="?attr/gdActionBarBackground" />

<FrameLayout
android:id="@id/gd_action_bar_colorstrip"
android:layout_width="fill_parent"
android:layout_height="@dimen/gd_action_bar_colorstrip_height"
android:background="?attr/gdActionBarColorstripBackground"
android:foreground="?attr/gdActionBarColorstripForeground"
android:visibility="?attr/gdActionBarColorstripVisibility" />

<FrameLayout
android:id="@id/gd_action_bar_content_view"
Expand Down
10 changes: 10 additions & 0 deletions GreenDroid/res/values/gd_attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@
<attr name="gdActionBarItemColorNormal" format="reference|color" />
<attr name="gdActionBarItemColorAlt" format="reference|color" />
<attr name="gdActionBarMaxItems" format="integer" />
<attr name="gdActionBarColorstripBackground" format="reference|color" />
<attr name="gdActionBarColorstripForeground" format="reference|color" />
<attr name="gdActionBarColorstripVisibility">
<!-- Visible on screen; the default value. -->
<enum name="visible" value="0" />
<!-- Not displayed, but taken into account during layout (space is left for it). -->
<enum name="invisible" value="1" />
<!-- Completely hidden, as if the view had not been added. -->
<enum name="gone" value="2" />
</attr>

<attr name="gdActionBarStyle" format="reference" />
<attr name="gdActionBarTitleStyle" format="reference" />
Expand Down
1 change: 1 addition & 0 deletions GreenDroid/res/values/gd_dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<dimen name="gd_progress_bar_margin">6dp</dimen>

<dimen name="gd_action_bar_height">45dp</dimen>
<dimen name="gd_action_bar_colorstrip_height">6dp</dimen>

<dimen name="gd_arrow_offset">5dp</dimen>

Expand Down
1 change: 1 addition & 0 deletions GreenDroid/res/values/gd_ids.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@
<item type="id" name="gd_action_bar" />
<item type="id" name="gd_action_bar_host" />
<item type="id" name="gd_action_bar_content_view" />
<item type="id" name="gd_action_bar_colorstrip" />

</resources>
6 changes: 6 additions & 0 deletions GreenDroid/res/values/gd_themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
<item name="gdActionBarItemColorNormal">@android:color/white</item>
<item name="gdActionBarItemColorAlt">@android:color/black</item>
<item name="gdActionBarMaxItems">3</item>
<item name="gdActionBarColorstripBackground">@drawable/gd_action_bar_colorstrip</item>
<item name="gdActionBarColorstripForeground">@drawable/gd_action_bar_colorstrip_shadow</item>
<item name="gdActionBarColorstripVisibility">visible</item>

<item name="gdActionBarStyle">@style/GreenDroid.Widget.ActionBar</item>
<item name="gdActionBarTitleStyle">@style/GreenDroid.Widget.ActionBar.Title</item>
Expand Down Expand Up @@ -182,6 +185,9 @@
<item name="gdActionBarItemColorNormal">@android:color/white</item>
<item name="gdActionBarItemColorAlt">@android:color/black</item>
<item name="gdActionBarMaxItems">3</item>
<item name="gdActionBarColorstripBackground">@drawable/gd_action_bar_colorstrip</item>
<item name="gdActionBarColorstripForeground">@drawable/gd_action_bar_colorstrip_shadow</item>
<item name="gdActionBarColorstripVisibility">visible</item>

<item name="gdActionBarStyle">@style/GreenDroid.Widget.ActionBar</item>
<item name="gdActionBarTitleStyle">@style/GreenDroid.Widget.ActionBar.Title</item>
Expand Down
2 changes: 1 addition & 1 deletion GreenDroid/src/greendroid/app/ActionBarActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public interface ActionBarActivity {
* @see ActionBarActivity#addActionBarItem(greendroid.widget.ActionBarItem.Type)
* @return The {@link ActionBar} currently displayed on screen
*/
ActionBar getActionBar();
ActionBar getGDActionBar();

/**
* A simple utility method that casts the Application returned by
Expand Down
16 changes: 8 additions & 8 deletions GreenDroid/src/greendroid/app/GDActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,38 +248,38 @@ public void onPostContentChanged() {
}

final int visibility = intent.getIntExtra(ActionBarActivity.GD_ACTION_BAR_VISIBILITY, View.VISIBLE);
getActionBar().setVisibility(visibility);
getGDActionBar().setVisibility(visibility);
}

@Override
public void setTitle(CharSequence title) {
getActionBar().setTitle(title);
getGDActionBar().setTitle(title);
}

@Override
public void setTitle(int titleId) {
setTitle(getString(titleId));
}

public ActionBar getActionBar() {
public ActionBar getGDActionBar() {
ensureLayout();
return mActionBarHost.getActionBar();
}

public ActionBarItem addActionBarItem(ActionBarItem item) {
return getActionBar().addItem(item);
return getGDActionBar().addItem(item);
}

public ActionBarItem addActionBarItem(ActionBarItem item, int itemId) {
return getActionBar().addItem(item, itemId);
return getGDActionBar().addItem(item, itemId);
}

public ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType) {
return getActionBar().addItem(actionBarItemType);
return getGDActionBar().addItem(actionBarItemType);
}

public ActionBarItem addActionBarItem(ActionBarItem.Type actionBarItemType, int itemId) {
return getActionBar().addItem(actionBarItemType, itemId);
return getGDActionBar().addItem(actionBarItemType, itemId);
}

public FrameLayout getContentView() {
Expand Down Expand Up @@ -384,7 +384,7 @@ public void onActionBarItemClicked(int position) {
}

} else {
if (!onHandleActionBarItemClick(getActionBar().getItem(position), position)) {
if (!onHandleActionBarItemClick(getGDActionBar().getItem(position), position)) {
if (Config.GD_WARNING_LOGS_ENABLED) {
Log.w(LOG_TAG, "Click on item at position " + position + " dropped down to the floor");
}
Expand Down
Loading