集成FadingActionBar官方DEMO
|
@ -439,6 +439,80 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- FadingActionBar官方DEMO -->
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.HomeActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/FadingActionBar"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="com.zftlive.android.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.LightActionBarActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.HeaderOverlayActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.LightBackgroundActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.ListViewActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.NavigationDrawerActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.NoParallaxActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.SampleFragmentActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.ScrollViewActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.ShortContentActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".sample.fadingactionbar.WebViewActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme.TranslucentActionBar"
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
|
||||
<!-- 静态注册短信广播接收器 -->
|
||||
<receiver android:name=".sample.sms.SMSBroadcastReceiver" >
|
||||
<intent-filter android:priority="2147483647" >
|
||||
|
|
After Width: | Height: | Size: 171 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 257 B |
After Width: | Height: | Size: 261 B |
After Width: | Height: | Size: 182 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 586 KiB |
After Width: | Height: | Size: 269 KiB |
After Width: | Height: | Size: 335 KiB |
After Width: | Height: | Size: 416 KiB |
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_activated="true" android:drawable="@drawable/ab_background" />
|
||||
<item android:drawable="@android:color/transparent" />
|
||||
</selector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<fragment
|
||||
android:tag="sampleFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
class="com.manuelpeinado.fadingactionbar.demo.SampleFragment" />
|
||||
|
||||
</FrameLayout>
|
|
@ -0,0 +1,5 @@
|
|||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
|
@ -0,0 +1,5 @@
|
|||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
|
@ -0,0 +1,31 @@
|
|||
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<!-- As the main content view, the view below consumes the entire
|
||||
space available using match_parent in both dimensions. -->
|
||||
<FrameLayout
|
||||
android:id="@+id/content_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<!-- android:layout_gravity="start" tells DrawerLayout to treat
|
||||
this as a sliding drawer on the left side for left-to-right
|
||||
languages and on the right side for right-to-left languages.
|
||||
The drawer is given a fixed width in dp and extends the full height of
|
||||
the container. A solid background is used for contrast
|
||||
with the content view. -->
|
||||
<ListView
|
||||
android:id="@+id/left_drawer"
|
||||
android:paddingTop="?android:attr/actionBarSize"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:choiceMode="singleChoice"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="0dp"
|
||||
android:background="#111"/>
|
||||
</android.support.v4.widget.DrawerLayout>
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:text="@string/loren_ipsum"
|
||||
android:textAppearance="@android:style/TextAppearance.Medium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:text="@string/loren_ipsum"
|
||||
android:textAppearance="@android:style/TextAppearance.Medium" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#3ff7"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:text="@string/short_text"
|
||||
android:textAppearance="@android:style/TextAppearance.Medium" />
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.manuelpeinado.fadingactionbar.view.ObservableWebViewWithHeader xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
|
@ -0,0 +1,12 @@
|
|||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="#fff"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:background="@drawable/activated_background_indicator"
|
||||
android:minHeight="48dp"/>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/image_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ny" />
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/image_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ny_light" />
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="#CFFF" >
|
||||
|
||||
<ImageButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_rating_good" />
|
||||
|
||||
</FrameLayout>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/action_change_dataset"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_change_dataset"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/action_settings"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/action_settings"/>
|
||||
|
||||
</menu>
|
|
@ -0,0 +1,99 @@
|
|||
American Museum of Natural History
|
||||
Rose Center for Earth and Space
|
||||
America's Response Monument
|
||||
Apollo Theater
|
||||
Bank of America Tower
|
||||
Battery Park
|
||||
Castle Clinton
|
||||
East Coast Memorial
|
||||
The Sphere
|
||||
Battery Park City Ferry Terminal
|
||||
Brill Building
|
||||
Bronx Zoo
|
||||
Brooklyn Botanic Garden
|
||||
Brooklyn Bridge (connects Brooklyn and Manhattan)
|
||||
Brooklyn Museum
|
||||
Brooklyn Public Library
|
||||
Bryant Park
|
||||
Carnegie Hall
|
||||
Cathedral of Saint John the Divine
|
||||
Central Park
|
||||
Central Park Zoo
|
||||
Strawberry Fields (memorial)
|
||||
Chelsea Piers
|
||||
Chrysler Building
|
||||
Citi Field
|
||||
Cleopatra's Needle
|
||||
College Point Little League Building
|
||||
Columbia University
|
||||
Columbus Circle
|
||||
Downtown Athletic Club
|
||||
East River Park
|
||||
East River State Park
|
||||
Empire State Building
|
||||
Federal Hall
|
||||
Firemen's Monument
|
||||
Flatiron Building
|
||||
Flushing Meadows-Corona Park
|
||||
George Gustav Heye Center
|
||||
George Washington Bridge
|
||||
Gracie Mansion
|
||||
Grand Army Plaza
|
||||
Grand Central Terminal
|
||||
General Grant National Memorial
|
||||
Green-Wood Cemetery
|
||||
®Ground Zero (World Trade Center site)
|
||||
Hall of Fame for Great Americans
|
||||
Harvard Club of New York
|
||||
Holland Tunnel
|
||||
Intrepid Sea, Air & Space Museum
|
||||
Lever House
|
||||
Lincoln Center for the Performing Arts
|
||||
Avery Fisher Hall
|
||||
David H. Koch Theater (formerly known as the New York State Theater)
|
||||
Metropolitan Opera
|
||||
Lincoln Tunnel
|
||||
Lipstick Building
|
||||
Madison Square Garden
|
||||
Manhattan Bridge
|
||||
Manhattan Municipal Building
|
||||
Metropolitan Museum of Art
|
||||
MetLife Building
|
||||
Museum of Modern Art
|
||||
New York City Hall
|
||||
New York Botanical Garden
|
||||
New York Evening Post Building
|
||||
New York Life Building
|
||||
New York Public Library
|
||||
New York Stock Exchange
|
||||
Odd Fellows Hall
|
||||
Paley Center for Media
|
||||
Pelham Bay Park
|
||||
Pennsylvania Station
|
||||
Pier 11/Wall Street
|
||||
Plaza Hotel
|
||||
Prison Ship Martyrs' Monument
|
||||
Prospect Park
|
||||
Prospect Park Zoo
|
||||
Queens Museum of Art
|
||||
Racquet and Tennis Club
|
||||
Rockefeller Center
|
||||
Radio City Music Hall
|
||||
St. Patrick's Cathedral
|
||||
Seagram Building
|
||||
Shea Stadium (demolished 2009)
|
||||
Silvercup Studios
|
||||
Solomon R. Guggenheim Museum
|
||||
Statue of Liberty
|
||||
Times Square
|
||||
Trinity Church
|
||||
United Nations Headquarters
|
||||
Vietnam Veterans Memorial Plaza
|
||||
The Waldorf-Astoria Hotel
|
||||
Washington Square Park, New York
|
||||
Campus of New York University
|
||||
Williamsburg Bridge
|
||||
Woodlawn Cemetery
|
||||
Woolworth Building
|
||||
World Financial Center
|
||||
Yankee Stadium
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="anim_type">
|
||||
<item>淡入淡出效果</item>
|
||||
<item>放大淡出效果</item>
|
||||
|
@ -14,4 +15,18 @@
|
|||
<item>缩小效果</item>
|
||||
<item>上下交错效果</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
<!-- FadingActionBar官方DEMO -->
|
||||
<string-array name="drawer_items">
|
||||
<item>New York</item>
|
||||
<item>Tokyo</item>
|
||||
<item>London</item>
|
||||
</string-array>
|
||||
|
||||
<array name="city_images">
|
||||
<item>@drawable/ny</item>
|
||||
<item>@drawable/tokyo</item>
|
||||
<item>@drawable/london</item>
|
||||
</array>
|
||||
|
||||
</resources>
|
|
@ -21,6 +21,7 @@
|
|||
<string name="DrawerLayoutActivity">DrawerLayout侧滑菜单</string>
|
||||
<string name="HVScorllListviewActivity">水平/垂直滚动+首行首列固定+翻页Listview</string>
|
||||
<string name="PulldownViewActivity">下拉ScrollView背景回弹效果</string>
|
||||
<string name="FadingActionBar">FadingActionBar官方DEMO</string>
|
||||
<!-- Android样例锦集label(结束) -->
|
||||
|
||||
|
||||
|
@ -132,5 +133,23 @@
|
|||
<string name="user_name">Ajava攻城师</string>
|
||||
<string name="user_des">谁能像优乐美一样把我捧在手心,我就能让他的儿子长的更帅女儿长的更漂亮</string>
|
||||
<string name="user_recommend_tip">TA推荐的好书</string>
|
||||
|
||||
<!-- FadingActionBar官方DEMO -->
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="new_york_city">New York City</string>
|
||||
<string name="activity_title_scrollview">ScrollView sample</string>
|
||||
<string name="activity_title_listview">ListView sample</string>
|
||||
<string name="activity_title_light_bg">Light background sample</string>
|
||||
<string name="activity_title_light_ab">Light action bar sample</string>
|
||||
<string name="activity_title_fragment">Fragment sample</string>
|
||||
<string name="activity_title_no_parallax">No parallax sample</string>
|
||||
<string name="activity_title_navigation">Navigation Drawer Example</string>
|
||||
<string name="loren_ipsum">Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc, quis gravida magna mi a libero. Fusce vulputate eleifend sapien. Vestibulum purus quam, scelerisque ut, mollis sed, nonummy id, metus. Nullam accumsan lorem in dui. Cras ultricies mi eu turpis hendrerit fringilla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In ac dui quis mi consectetuer lacinia. Nam pretium turpis et arcu. Duis arcu tortor, suscipit eget, imperdiet nec, imperdiet iaculis, ipsum. Sed aliquam ultrices mauris. Integer ante arcu, accumsan a, consectetuer eget, posuere ut, mauris. Praesent adipiscing. Phasellus ullamcorper ipsum rutrum nunc. Nunc nonummy metus. Vestibulum volutpat pretium libero. Cras id dui. Aenean ut eros et nisl sagittis vestibulum. Nullam nulla eros, ultricies sit amet, nonummy id, imperdiet feugiat, pede. Sed lectus. Donec mollis hendrerit risus. Phasellus nec sem in justo pellentesque facilisis. Etiam imperdiet imperdiet orci. Nunc nec neque. Phasellus leo dolor, tempus non, auctor et, hendrerit quis, nisi. Curabitur ligula sapien, tincidunt non, euismod vitae, posuere imperdiet, leo. Maecenas malesuada. Praesent congue erat at massa. Sed cursus turpis vitae tortor. Donec posuere vulputate arcu. Phasellus accumsan cursus velit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed aliquam, nisi quis porttitor congue, elit erat euismod orci, ac placerat dolor lectus quis orci. Phasellus consectetuer vestibulum elit. Aenean tellus metus, bibendum sed, posuere ac, mattis non, nunc. Vestibulum fringilla pede sit amet augue. In turpis. Pellentesque posuere. Praesent turpis. Aenean posuere, tortor sed cursus feugiat, nunc augue blandit nunc, eu sollicitudin urna dolor sagittis lacus. Donec elit libero, sodales nec, volutpat a, suscipit non, turpis. Nullam sagittis. Suspendisse pulvinar, augue ac venenatis condimentum, sem libero volutpat nibh, nec pellentesque velit pede quis nunc. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce id purus. Ut varius tincidunt libero. Phasellus dolor. Maecenas vestibulum mollis diam. Pellentesque ut neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In dui magna, posuere eget, vestibulum et, tempor auctor, justo. In ac felis quis tortor malesuada pretium. Pellentesque auctor neque nec urna. Proin sapien ipsum, porta a, auctor quis, euismod ut, mi. Aenean viverra rhoncus pede. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut non enim eleifend felis pretium feugiat. Vivamus quis mi. Phasellus a est. Phasellus magna. In hac habitasse platea dictumst. Curabitur at lacus ac velit ornare lobortis. Curabitur a felis in nunc fringilla tristique.</string>
|
||||
<string name="short_text">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</string>
|
||||
<string name="activity_title_header_overlay">Header Overlay Example</string>
|
||||
<string name="activity_title_short_content">Short Content Example (ScrollView)</string>
|
||||
<string name="choose_city">Choose a city</string>
|
||||
<string name="action_change_dataset">Change dataset</string>
|
||||
<string name="activity_title_webview">WebView sample</string>
|
||||
|
||||
</resources>
|
|
@ -90,4 +90,34 @@
|
|||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- FadingActionBar官方DEMO -->
|
||||
<style name="Widget" />
|
||||
|
||||
<style name="Widget.ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse" />
|
||||
|
||||
<style name="Widget.Light" />
|
||||
|
||||
<style name="Widget.Light.ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid" />
|
||||
|
||||
<style name="Widget.ActionBar.Transparent">
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Light.ActionBar.Transparent">
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.TranslucentActionBar">
|
||||
<item name="android:actionBarStyle">@style/Widget.ActionBar.Transparent</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Light.TranslucentActionBar" parent="@android:style/Theme.Holo.Light">
|
||||
<item name="android:actionBarStyle">@style/Widget.Light.ActionBar.Transparent</item>
|
||||
<item name="android:windowActionBarOverlay">true</item>
|
||||
<item name="android:windowContentOverlay">@null</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
public class ActivityInfo {
|
||||
public Class<? extends Activity> activityClass;
|
||||
public int titleResourceId;
|
||||
|
||||
public ActivityInfo(Class<? extends Activity> activityClass, int titleResourceId) {
|
||||
this.activityClass = activityClass;
|
||||
this.titleResourceId = titleResourceId;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class HeaderOverlayActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FadingActionBarHelper helper = new FadingActionBarHelper()
|
||||
.actionBarBackground(R.drawable.ab_background)
|
||||
.headerLayout(R.layout.header)
|
||||
.contentLayout(R.layout.activity_listview)
|
||||
.headerOverlayLayout(R.layout.header_overlay);
|
||||
setContentView(helper.createView(this));
|
||||
helper.initActionBar(this);
|
||||
|
||||
ListView listView = (ListView) findViewById(android.R.id.list);
|
||||
ArrayList<String> items = loadItems(R.raw.nyc_sites);
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);
|
||||
listView.setAdapter(adapter);
|
||||
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), "HeaderOverlayActivity");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A list of Strings read from the specified resource
|
||||
*/
|
||||
private ArrayList<String> loadItems(int rawResourceId) {
|
||||
try {
|
||||
ArrayList<String> countries = new ArrayList<String>();
|
||||
InputStream inputStream = getResources().openRawResource(rawResourceId);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
countries.add(line);
|
||||
}
|
||||
reader.close();
|
||||
return countries;
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_menu, menu);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class HomeActivity extends ListActivity {
|
||||
private List<ActivityInfo> activitiesInfo = Arrays.asList(
|
||||
new ActivityInfo(ScrollViewActivity.class, R.string.activity_title_scrollview),
|
||||
new ActivityInfo(ListViewActivity.class, R.string.activity_title_listview),
|
||||
new ActivityInfo(LightBackgroundActivity.class, R.string.activity_title_light_bg),
|
||||
new ActivityInfo(LightActionBarActivity.class, R.string.activity_title_light_ab),
|
||||
new ActivityInfo(SampleFragmentActivity.class, R.string.activity_title_fragment),
|
||||
new ActivityInfo(NoParallaxActivity.class, R.string.activity_title_no_parallax),
|
||||
new ActivityInfo(NavigationDrawerActivity.class, R.string.activity_title_navigation),
|
||||
new ActivityInfo(HeaderOverlayActivity.class, R.string.activity_title_header_overlay),
|
||||
new ActivityInfo(WebViewActivity.class, R.string.activity_title_webview),
|
||||
new ActivityInfo(ShortContentActivity.class, R.string.activity_title_short_content));
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_home);
|
||||
String[] titles = getActivityTitles();
|
||||
setListAdapter(new ArrayAdapter<String>(
|
||||
this, android.R.layout.simple_list_item_1, android.R.id.text1, titles));
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
Class<? extends Activity> class_ = activitiesInfo.get(position).activityClass;
|
||||
Intent intent = new Intent(this, class_);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private String[] getActivityTitles() {
|
||||
String[] result = new String[activitiesInfo.size()];
|
||||
int i = 0;
|
||||
for (ActivityInfo info : activitiesInfo) {
|
||||
result[i++] = getString(info.titleResourceId);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
|
||||
|
||||
public class LightActionBarActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FadingActionBarHelper helper = new FadingActionBarHelper()
|
||||
.actionBarBackground(R.drawable.ab_background_light)
|
||||
.headerLayout(R.layout.header_light)
|
||||
.contentLayout(R.layout.activity_scrollview)
|
||||
.lightActionBar(true);
|
||||
setContentView(helper.createView(this));
|
||||
helper.initActionBar(this);
|
||||
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_menu, menu);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
|
||||
|
||||
public class LightBackgroundActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
FadingActionBarHelper helper = new FadingActionBarHelper()
|
||||
.actionBarBackground(R.drawable.ab_background)
|
||||
.headerLayout(R.layout.header_light)
|
||||
.contentLayout(R.layout.activity_scrollview);
|
||||
setContentView(helper.createView(this));
|
||||
helper.initActionBar(this);
|
||||
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_menu, menu);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
|
||||
public class ListViewActivity extends Activity {
|
||||
private ArrayAdapter<String> adapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FadingActionBarHelper helper = new FadingActionBarHelper()
|
||||
.actionBarBackground(R.drawable.ab_background)
|
||||
.headerLayout(R.layout.header)
|
||||
.contentLayout(R.layout.activity_listview);
|
||||
setContentView(helper.createView(this));
|
||||
helper.initActionBar(this);
|
||||
|
||||
ListView listView = (ListView) findViewById(android.R.id.list);
|
||||
ArrayList<String> items = loadItems(R.raw.nyc_sites);
|
||||
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, items);
|
||||
listView.setAdapter(adapter);
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A list of Strings read from the specified resource
|
||||
*/
|
||||
private ArrayList<String> loadItems(int rawResourceId) {
|
||||
try {
|
||||
ArrayList<String> countries = new ArrayList<String>();
|
||||
InputStream inputStream = getResources().openRawResource(rawResourceId);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
countries.add(line);
|
||||
}
|
||||
reader.close();
|
||||
return countries;
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.listview_activity_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_change_dataset) {
|
||||
changeDataset();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void changeDataset() {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Antonio Leiva
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
public class NavigationDrawerActivity extends Activity implements AdapterView.OnItemClickListener {
|
||||
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerList;
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
|
||||
private CharSequence mDrawerTitle;
|
||||
private CharSequence mTitle;
|
||||
private String[] mCityNames;
|
||||
private int[] mCityImages;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_navigation_drawer);
|
||||
|
||||
mTitle = mDrawerTitle = getTitle();
|
||||
mCityNames = getResources().getStringArray(R.array.drawer_items);
|
||||
TypedArray typedArray = getResources().obtainTypedArray(R.array.city_images);
|
||||
mCityImages = new int [typedArray.length()];
|
||||
for (int i = 0; i < typedArray.length(); ++i) {
|
||||
mCityImages[i] = typedArray.getResourceId(i, 0);
|
||||
}
|
||||
typedArray.recycle();
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
mDrawerList = (ListView) findViewById(R.id.left_drawer);
|
||||
|
||||
// set a custom shadow that overlays the main content when the drawer opens
|
||||
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
||||
// set up the drawer's list view with items and click listener
|
||||
mDrawerList.setAdapter(new ArrayAdapter<String>(this,
|
||||
R.layout.drawer_list_item, mCityNames));
|
||||
mDrawerList.setOnItemClickListener(this);
|
||||
|
||||
// enable ActionBar app icon to behave as action to toggle nav drawer
|
||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
getActionBar().setHomeButtonEnabled(true);
|
||||
|
||||
// ActionBarDrawerToggle ties together the the proper interactions
|
||||
// between the sliding drawer and the action bar app icon
|
||||
mDrawerToggle = new ActionBarDrawerToggle(
|
||||
this, /* host Activity */
|
||||
mDrawerLayout, /* DrawerLayout object */
|
||||
R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
|
||||
R.string.drawer_open, /* "open drawer" description for accessibility */
|
||||
R.string.drawer_close /* "close drawer" description for accessibility */
|
||||
) {
|
||||
public void onDrawerClosed(View view) {
|
||||
getActionBar().setTitle(mTitle);
|
||||
}
|
||||
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
getActionBar().setTitle(mDrawerTitle);
|
||||
}
|
||||
};
|
||||
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
selectItem(0);
|
||||
}
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
// Sync the toggle state after onRestoreInstanceState has occurred.
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
// Pass any configuration change to the drawer toggles
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
return mDrawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
selectItem(position);
|
||||
}
|
||||
|
||||
private void selectItem(int position) {
|
||||
// update the main content by replacing fragments
|
||||
Fragment fragment = new SampleFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(SampleFragment.ARG_IMAGE_RES, mCityImages[position]);
|
||||
args.putInt(SampleFragment.ARG_ACTION_BG_RES, R.drawable.ab_background);
|
||||
fragment.setArguments(args);
|
||||
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
|
||||
|
||||
// update selected item and title, then close the drawer
|
||||
mDrawerList.setItemChecked(position, true);
|
||||
setTitle(mCityNames[position]);
|
||||
mDrawerLayout.closeDrawer(mDrawerList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(CharSequence title) {
|
||||
mTitle = title;
|
||||
getActionBar().setTitle(mTitle);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
|
||||
|
||||
public class NoParallaxActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FadingActionBarHelper helper = new FadingActionBarHelper()
|
||||
.actionBarBackground(R.drawable.ab_background)
|
||||
.headerLayout(R.layout.header)
|
||||
.contentLayout(R.layout.activity_scrollview)
|
||||
.parallax(false);
|
||||
setContentView(helper.createView(this));
|
||||
helper.initActionBar(this);
|
||||
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
* Copyright (C) 2013 Antonio Leiva
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
|
||||
public class SampleFragment extends Fragment {
|
||||
private FadingActionBarHelper mFadingHelper;
|
||||
private Bundle mArguments;
|
||||
|
||||
public static final String ARG_IMAGE_RES = "image_source";
|
||||
public static final String ARG_ACTION_BG_RES = "image_action_bs_res";
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = mFadingHelper.createView(inflater);
|
||||
|
||||
if (mArguments != null){
|
||||
ImageView img = (ImageView) view.findViewById(R.id.image_header);
|
||||
img.setImageResource(mArguments.getInt(ARG_IMAGE_RES));
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
||||
mArguments = getArguments();
|
||||
int actionBarBg = mArguments != null ? mArguments.getInt(ARG_ACTION_BG_RES) : R.drawable.ab_background_light;
|
||||
|
||||
mFadingHelper = new FadingActionBarHelper()
|
||||
.actionBarBackground(actionBarBg)
|
||||
.headerLayout(R.layout.header_light)
|
||||
.contentLayout(R.layout.activity_scrollview)
|
||||
.lightActionBar(actionBarBg == R.drawable.ab_background_light);
|
||||
mFadingHelper.initActionBar(activity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
|
||||
public class SampleFragmentActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_fragment);
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_menu, menu);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
|
||||
public class ScrollViewActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FadingActionBarHelper helper = new FadingActionBarHelper()
|
||||
.actionBarBackground(R.drawable.ab_background)
|
||||
.headerLayout(R.layout.header)
|
||||
.contentLayout(R.layout.activity_scrollview);
|
||||
setContentView(helper.createView(this));
|
||||
helper.initActionBar(this);
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_menu, menu);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
|
||||
public class ShortContentActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FadingActionBarHelper helper = new FadingActionBarHelper()
|
||||
.actionBarBackground(R.drawable.ab_background)
|
||||
.headerLayout(R.layout.header)
|
||||
.contentLayout(R.layout.activity_short_content);
|
||||
setContentView(helper.createView(this));
|
||||
helper.initActionBar(this);
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_menu, menu);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (C) 2013 Manuel Peinado
|
||||
*
|
||||
* 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.zftlive.android.sample.fadingactionbar;
|
||||
|
||||
import com.zftlive.android.R;
|
||||
import com.zftlive.android.common.ActionBarManager;
|
||||
import com.zftlive.android.view.fadingactionbar.FadingActionBarHelper;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
||||
public class WebViewActivity extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
FadingActionBarHelper helper = new FadingActionBarHelper()
|
||||
.actionBarBackground(R.drawable.ab_background)
|
||||
.headerLayout(R.layout.header)
|
||||
.contentLayout(R.layout.activity_webview);
|
||||
setContentView(helper.createView(this));
|
||||
helper.initActionBar(this);
|
||||
|
||||
WebView webView = (WebView) findViewById(R.id.webView);
|
||||
webView.setWebViewClient(new WebViewClient());
|
||||
webView.loadUrl("http://en.wikipedia.org/wiki/New_York_City");
|
||||
//初始化带返回按钮的标题栏
|
||||
ActionBarManager.initBackTitle(this, getActionBar(), this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_menu, menu);
|
||||
return true;
|
||||
}
|
||||
}
|