Skip to content

Commit

Permalink
Forward-proof iosched for non-tablet, Honeycomb+ devices. Also treat …
Browse files Browse the repository at this point in the history
…'large' devices as tablets, not just 'xlarge' devices.
  • Loading branch information
Roman Nurik committed Jul 12, 2011
1 parent 773650e commit 5f38f39
Show file tree
Hide file tree
Showing 120 changed files with 201 additions and 39 deletions.
File renamed without changes.
File renamed without changes.
Binary file added android/res/drawable-hdpi-v11/ic_title_export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/res/drawable-hdpi-v11/ic_title_map.png
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.
Binary file added android/res/drawable-hdpi-v11/ic_title_search.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/res/drawable-hdpi-v11/ic_title_share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/res/drawable-hdpi-v11/ic_title_today.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added android/res/drawable-mdpi-v11/btn_default.9.png
Binary file added android/res/drawable-mdpi-v11/btn_focused.9.png
Binary file added android/res/drawable-mdpi-v11/btn_pressed.9.png
Binary file added android/res/drawable-mdpi-v11/tab_background.9.png
Binary file added android/res/drawable-mdpi-v11/tab_selected.9.png
Binary file added android/res/drawable-mdpi-v11/tab_unselected.9.png
19 changes: 19 additions & 0 deletions android/res/drawable/window_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
Copyright 2011 Google Inc.
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.
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
</layer-list>
19 changes: 19 additions & 0 deletions android/res/drawable/window_background_home.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
Copyright 2011 Google Inc.
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.
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/background_noise" />
</layer-list>
File renamed without changes.
File renamed without changes.
27 changes: 27 additions & 0 deletions android/res/layout-v11/tab_indicator.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!--
Copyright 2011 Google Inc.
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.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tab_label"
android:layout_width="0dp"
android:layout_height="@dimen/tab_height"
android:layout_weight="1"
android:layout_marginLeft="@dimen/tab_side_padding"
android:layout_marginRight="@dimen/tab_side_padding"
android:gravity="center"
android:textColor="@color/accent_1"
android:textSize="@dimen/text_size_small"
android:textStyle="bold"
android:background="@drawable/tab_indicator" />
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,5 @@
-->

<resources>
<style name="Theme.IOSched" parent="android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/window_background</item>
<item name="android:actionBarStyle">@style/ActionBar</item>
<item name="textHeaderMaxLines">2</item>
<item name="trackAbstractMaxLines">2</item>
</style>
<integer name="text_header_max_lines">2</integer>
</resources>
File renamed without changes.
19 changes: 19 additions & 0 deletions android/res/values-large-v11/integers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
Copyright 2011 Google Inc.
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>
<integer name="track_abstract_max_lines">6</integer>
</resources>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,11 @@
-->

<resources>
<!-- Start with the Holographic Light theme -->
<style name="Theme.IOSched" parent="android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/window_background</item>
<item name="android:actionBarStyle">@style/ActionBar</item>
<item name="textHeaderMaxLines">3</item>
<item name="trackAbstractMaxLines">6</item>
</style>

<style name="Theme.IOSched.Home" parent="style/Theme.IOSched">
<item name="android:windowBackground">@drawable/window_background_home</item>
<item name="android:actionBarStyle">@null</item>
</style>

<style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/actionbar_background</item>
<item name="android:textColor">@color/accent_1</item>
<item name="android:titleTextStyle">@style/ActionBarText</item>
</style>

<style name="ActionBarText" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/accent_1</item>
<item name="android:textStyle">bold</item>
</style>

<style name="ListItemContainerBase">
<item name="android:minHeight">?android:attr/listPreferredItemHeight</item>
<item name="android:background">?android:attr/activatedBackgroundIndicator</item>
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions android/res/values-v11/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!--
Copyright 2011 Google Inc.
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>
<dimen name="colorstrip_height">4dp</dimen>
</resources>
43 changes: 43 additions & 0 deletions android/res/values-v11/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!--
Copyright 2011 Google Inc.
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>
<!-- Start with the Holographic Light theme -->
<style name="Theme.IOSched" parent="android:style/Theme.Holo.Light">
<item name="android:windowBackground">@drawable/window_background</item>
<item name="android:actionBarStyle">@style/ActionBar</item>

<!-- custom attributes -->
<item name="textHeaderMaxLines">@integer/text_header_max_lines</item>
<item name="trackAbstractMaxLines">@integer/track_abstract_max_lines</item>
</style>

<style name="Theme.IOSched.Home" parent="style/Theme.IOSched">
<item name="android:windowBackground">@drawable/window_background_home</item>
<item name="android:actionBarStyle">@style/ActionBar</item>
</style>

<style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@color/actionbar_background</item>
<item name="android:textColor">@color/accent_1</item>
<item name="android:titleTextStyle">@style/ActionBarText</item>
</style>

<style name="ActionBarText" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/accent_1</item>
<item name="android:textStyle">bold</item>
</style>
</resources>
20 changes: 20 additions & 0 deletions android/res/values/integers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
Copyright 2011 Google Inc.
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>
<integer name="text_header_max_lines">3</integer>
<integer name="track_abstract_max_lines">2</integer>
</resources>
4 changes: 2 additions & 2 deletions android/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
<item name="android:windowContentOverlay">@null</item>

<!-- custom attributes -->
<item name="textHeaderMaxLines">3</item>
<item name="trackAbstractMaxLines">2</item>
<item name="textHeaderMaxLines">@integer/text_header_max_lines</item>
<item name="trackAbstractMaxLines">@integer/track_abstract_max_lines</item>

<!-- for programmatic instantiation -->
<item name="actionbarCompatButtonStyle">@style/ActionBarCompatButton</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ public void goHome() {
final Intent intent = new Intent(mActivity, HomeActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mActivity.startActivity(intent);
mActivity.overridePendingTransition(R.anim.home_enter, R.anim.home_exit);

if (!UIUtils.isHoneycomb()) {
mActivity.overridePendingTransition(R.anim.home_enter, R.anim.home_exit);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@ public void setupHomeActivity() {
super.setupHomeActivity();
// NOTE: there needs to be a content view set before this is called, so this method
// should be called in onPostCreate.
mActivity.getActionBar().setDisplayOptions(
0,
ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
if (UIUtils.isTablet(mActivity)) {
mActivity.getActionBar().setDisplayOptions(
0,
ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
} else {
mActivity.getActionBar().setDisplayOptions(
ActionBar.DISPLAY_USE_LOGO,
ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
}
}

/** {@inheritDoc} */
Expand All @@ -76,9 +82,15 @@ public void setupSubActivity() {
super.setupSubActivity();
// NOTE: there needs to be a content view set before this is called, so this method
// should be called in onPostCreate.
mActivity.getActionBar().setDisplayOptions(
ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO,
ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO);
if (UIUtils.isTablet(mActivity)) {
mActivity.getActionBar().setDisplayOptions(
ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO,
ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO);
} else {
mActivity.getActionBar().setDisplayOptions(
0,
ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_USE_LOGO);
}
}

/**
Expand All @@ -93,6 +105,9 @@ public void setActionBarTitle(CharSequence title) {
*/
@Override
public void setActionBarColor(int color) {
if (!UIUtils.isTablet(mActivity)) {
super.setActionBarColor(color);
}
}

/** {@inheritDoc} */
Expand Down
12 changes: 7 additions & 5 deletions android/src/com/google/android/apps/iosched/util/UIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,14 @@ public static boolean isHoneycomb() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}

public static boolean isHoneycombTablet(Context context) {
// Can use static final constants like HONEYCOMB, declared in later versions
// of the OS since they are inlined at compile time. This is guaranteed behavior.
return isHoneycomb() && (context.getResources().getConfiguration().screenLayout
public static boolean isTablet(Context context) {
return (context.getResources().getConfiguration().screenLayout
& Configuration.SCREENLAYOUT_SIZE_MASK)
== Configuration.SCREENLAYOUT_SIZE_XLARGE;
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
}

public static boolean isHoneycombTablet(Context context) {
return isHoneycomb() && isTablet(context);
}

public static long getCurrentTime(final Context context) {
Expand Down

0 comments on commit 5f38f39

Please sign in to comment.