Replace SlidingDrawer with compatibility DrawerLayout
Remove actionable references (requires v7 overhaul) Darken background and remove unused views Fix alignment of pseudo action bar to list
This commit is contained in:
parent
52b423f42b
commit
8c8b952434
|
@ -12,5 +12,4 @@
|
|||
|
||||
# Project target.
|
||||
target=android-21
|
||||
android.library.reference.1=../../third-party/SlidingMenu
|
||||
android.library.reference.2=../../third-party/SwitchCompat
|
||||
android.library.reference.1=../../third-party/SwitchCompat
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle" android:padding="10dp" >
|
||||
<solid android:color="#D0000000"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:gravity="center"
|
||||
android:src="@drawable/menuback"
|
||||
android:tileMode="disabled" >
|
||||
|
||||
</bitmap>
|
||||
android:tileMode="disabled" />
|
||||
</item>
|
||||
</layer-list>
|
|
@ -1,233 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/background"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/browser_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/browser"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/disk_unknown" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/browser_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/browser"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/settings_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/config" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/config_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/settings"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/input_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/input"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/input" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/input_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/input"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/about_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/about"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/question" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/about"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rateme_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rate"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/star" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rateme_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/rateme"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/cloud_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cloud"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/cloud" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cloud_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/cloud"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/message_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/messages"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/messages"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -1,51 +1,285 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/root_list"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/header_list"
|
||||
<!-- The main content view -->
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/root_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:orientation="horizontal" >
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:id="@+id/header_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/header_menu"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:src="@drawable/ic_drawer" />
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/header_icon"
|
||||
<ImageView
|
||||
android:id="@+id/header_menu"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:src="@drawable/ic_drawer" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/header_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/menu_heading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="fill_parent"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/app_name"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textSize="32dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/menu_heading"
|
||||
android:layout_width="wrap_content"
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/root_list" />
|
||||
</FrameLayout>
|
||||
<!-- The navigation drawer -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/left_drawer"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="@drawable/background"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/browser_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:text="@string/app_name"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textSize="32dp" />
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/browser"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/disk_unknown" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/browser_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/browser"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/settings_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/config"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/config" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/config_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/settings"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/input_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/input"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/input" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/input_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/input"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/about_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/about"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/question" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/about"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rateme_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/rate"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/star" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rateme_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/rateme"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/cloud_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="32dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cloud"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/cloud" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cloud_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/cloud"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/message_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/game_selector"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical|left"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/messages"
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="2dp"
|
||||
android:gravity="center_vertical|left"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message_title"
|
||||
style="@android:style/TextAppearance.Large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/messages"
|
||||
android:textAppearance="@style/BaseText"
|
||||
android:textSize="28dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v4.widget.DrawerLayout>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.jeremyfeinstein.slidingmenu.lib.SlidingMenu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/slidingmenumain"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" />
|
|
@ -4,6 +4,4 @@
|
|||
<dimen name="padding_medium">16dp</dimen>
|
||||
<dimen name="padding_large">16dp</dimen>
|
||||
|
||||
<dimen name="slidingmenu_offset">120dp</dimen>
|
||||
|
||||
</resources>
|
|
@ -3,10 +3,6 @@
|
|||
<dimen name="padding_small">8dp</dimen>
|
||||
<dimen name="padding_medium">8dp</dimen>
|
||||
<dimen name="padding_large">16dp</dimen>
|
||||
|
||||
<dimen name="slidingmenu_offset">80dp</dimen>
|
||||
<dimen name="list_padding">10dp</dimen>
|
||||
<dimen name="shadow_width">15dp</dimen>
|
||||
|
||||
<integer name="num_cols">1</integer>
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@
|
|||
<item>Controller D</item>
|
||||
</string-array>
|
||||
|
||||
<string name="drawer_open">Menu Opened</string>
|
||||
<string name="drawer_shut">Menu Closed</string>
|
||||
<string name="browser">Browser</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="paths">Paths</string>
|
||||
|
|
|
@ -20,11 +20,15 @@ import android.os.Bundle;
|
|||
import android.os.Environment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -35,9 +39,6 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.OnOpenListener;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
|
||||
import com.reicast.emulator.config.Config;
|
||||
import com.reicast.emulator.config.InputFragment;
|
||||
import com.reicast.emulator.config.OptionsFragment;
|
||||
|
@ -45,8 +46,14 @@ import com.reicast.emulator.debug.GenerateLogs;
|
|||
import com.reicast.emulator.emu.JNIdc;
|
||||
import com.reicast.emulator.periph.Gamepad;
|
||||
|
||||
public class MainActivity extends SlidingFragmentActivity implements
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
|
||||
public class MainActivity extends FragmentActivity implements
|
||||
FileBrowser.OnItemSelectedListener, OptionsFragment.OnClickListener {
|
||||
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
|
||||
private SharedPreferences mPrefs;
|
||||
private static File sdcard = Environment.getExternalStorageDirectory();
|
||||
|
@ -55,8 +62,6 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
private TextView menuHeading;
|
||||
private boolean hasAndroidMarket = false;
|
||||
|
||||
private SlidingMenu sm;
|
||||
|
||||
private UncaughtExceptionHandler mUEHandler;
|
||||
|
||||
Gamepad pad = new Gamepad();
|
||||
|
@ -65,7 +70,6 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.mainuilayout_fragment);
|
||||
setBehindContentView(R.layout.drawer_menu);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
getWindow().getDecorView().setOnSystemUiVisibilityChangeListener (new OnSystemUiVisibilityChangeListener() {
|
||||
|
@ -171,15 +175,23 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
}
|
||||
|
||||
menuHeading = (TextView) findViewById(R.id.menu_heading);
|
||||
|
||||
sm = getSlidingMenu();
|
||||
sm.setShadowWidthRes(R.dimen.shadow_width);
|
||||
sm.setShadowDrawable(R.drawable.shadow);
|
||||
sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
|
||||
sm.setFadeDegree(0.35f);
|
||||
sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
|
||||
sm.setOnOpenListener(new OnOpenListener() {
|
||||
public void onOpen() {
|
||||
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
mDrawerToggle = new ActionBarDrawerToggle(
|
||||
MainActivity.this, /* host Activity */
|
||||
mDrawerLayout, /* DrawerLayout object */
|
||||
R.drawable.ic_drawer, /* nav drawer icon to replace 'Up' caret */
|
||||
R.string.drawer_open, /* "open drawer" description */
|
||||
R.string.drawer_shut /* "close drawer" description */
|
||||
) {
|
||||
/** Called when a drawer has settled in a completely closed state. */
|
||||
public void onDrawerClosed(View view) {
|
||||
super.onDrawerClosed(view);
|
||||
}
|
||||
|
||||
/** Called when a drawer has settled in a completely open state. */
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
super.onDrawerOpened(drawerView);
|
||||
findViewById(R.id.browser_menu).setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
FileBrowser browseFrag = (FileBrowser) getSupportFragmentManager()
|
||||
|
@ -203,7 +215,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
"MAIN_BROWSER").addToBackStack(null)
|
||||
.commit();
|
||||
setTitle(R.string.browser);
|
||||
sm.toggle(true);
|
||||
toggleDrawer(true);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -225,7 +237,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
optionsFrag, "OPTIONS_FRAG")
|
||||
.addToBackStack(null).commit();
|
||||
setTitle(R.string.settings);
|
||||
sm.toggle(true);
|
||||
toggleDrawer(true);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -245,7 +257,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
.replace(R.id.fragment_container, inputFrag,
|
||||
"INPUT_FRAG").addToBackStack(null).commit();
|
||||
setTitle(R.string.input);
|
||||
sm.toggle(true);
|
||||
toggleDrawer(true);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -265,7 +277,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
.replace(R.id.fragment_container, aboutFrag,
|
||||
"ABOUT_FRAG").addToBackStack(null).commit();
|
||||
setTitle(R.string.about);
|
||||
sm.toggle(true);
|
||||
toggleDrawer(true);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -286,7 +298,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
cloudFrag, "CLOUD_FRAG")
|
||||
.addToBackStack(null).commit();
|
||||
setTitle(R.string.cloud);
|
||||
sm.toggle(true);
|
||||
toggleDrawer(true);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -300,10 +312,9 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
// vib.vibrate(50);
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri
|
||||
.parse("market://details?id="
|
||||
+ getPackageName())));
|
||||
.parse("market://details?id=" + getPackageName())));
|
||||
//setTitle(R.string.rateme);
|
||||
sm.toggle(true);
|
||||
toggleDrawer(true);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
@ -317,11 +328,15 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Set the drawer toggle as the DrawerListener
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
|
||||
findViewById(R.id.header_list).setOnTouchListener(new OnTouchListener() {
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
sm.toggle(true);
|
||||
toggleDrawer(false);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
@ -329,6 +344,14 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
});
|
||||
}
|
||||
|
||||
public void toggleDrawer(boolean close) {
|
||||
if (mDrawerLayout.isDrawerOpen(Gravity.LEFT)) {
|
||||
mDrawerLayout.closeDrawer(Gravity.LEFT);
|
||||
} else if (!close) {
|
||||
mDrawerLayout.openDrawer(Gravity.LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
public void generateErrorLog() {
|
||||
new GenerateLogs(MainActivity.this).execute(getFilesDir().getAbsolutePath());
|
||||
}
|
||||
|
@ -492,6 +515,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -518,7 +542,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
|
||||
}
|
||||
if (keyCode == KeyEvent.KEYCODE_MENU) {
|
||||
sm.toggle(true);
|
||||
toggleDrawer(false);
|
||||
}
|
||||
|
||||
return super.onKeyDown(keyCode, event);
|
||||
|
@ -584,6 +608,7 @@ public class MainActivity extends SlidingFragmentActivity implements
|
|||
@Override
|
||||
public void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<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/classes"/>
|
||||
</classpath>
|
|
@ -1,20 +0,0 @@
|
|||
*.class
|
||||
|
||||
# Package Files #
|
||||
*.dex
|
||||
*.war
|
||||
*.ear
|
||||
*.apk
|
||||
bin/
|
||||
bin
|
||||
gen/
|
||||
release/
|
||||
release
|
||||
gen
|
||||
.metadata/
|
||||
.metadata
|
||||
.idea/
|
||||
.idea
|
||||
*.project
|
||||
.DS_Store
|
||||
target/
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.jeremyfeinstein.slidingmenu.lib"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="5"
|
||||
android:targetSdkVersion="17" />
|
||||
|
||||
</manifest>
|
|
@ -1,202 +0,0 @@
|
|||
|
||||
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:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) 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
|
||||
|
||||
(d) 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
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="SlidingMenu" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="LIBRARY_PROJECT" value="true" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android 4.2.2" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
Binary file not shown.
|
@ -1,64 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>slidingmenu</artifactId>
|
||||
<name>SlidingMenu</name>
|
||||
<packaging>apklib</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.jeremyfeinstein.slidingmenu</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>1.3-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>android</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.android</groupId>
|
||||
<artifactId>support-v4</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
|
||||
<artifactId>android-maven-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<nativeLibrariesDirectory>ignored</nativeLibrariesDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>attach-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<type>jar</type>
|
||||
<file>${project.build.directory}/${project.build.finalName}.jar</file>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,20 +0,0 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
|
@ -1,13 +0,0 @@
|
|||
# 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,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
android.library=true
|
||||
# Project target.
|
||||
target=android-16
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.jeremyfeinstein.slidingmenu.lib.SlidingMenu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/slidingmenumain"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" />
|
|
@ -1,45 +0,0 @@
|
|||
<!--
|
||||
Copyright 2011 The Android Open Source Project
|
||||
|
||||
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>
|
||||
|
||||
<declare-styleable name="SlidingMenu">
|
||||
<attr name="mode">
|
||||
<enum name="left" value="0" />
|
||||
<enum name="right" value="1" />
|
||||
</attr>
|
||||
<attr name="viewAbove" format="reference" />
|
||||
<attr name="viewBehind" format="reference" />
|
||||
<attr name="behindOffset" format="dimension" />
|
||||
<attr name="behindWidth" format="dimension" />
|
||||
<attr name="behindScrollScale" format="float" />
|
||||
<attr name="touchModeAbove">
|
||||
<enum name="margin" value="0" />
|
||||
<enum name="fullscreen" value="1" />
|
||||
</attr>
|
||||
<attr name="touchModeBehind">
|
||||
<enum name="margin" value="0" />
|
||||
<enum name="fullscreen" value="1" />
|
||||
</attr>
|
||||
<attr name="shadowDrawable" format="reference" />
|
||||
<attr name="shadowWidth" format="dimension" />
|
||||
<attr name="fadeEnabled" format="boolean" />
|
||||
<attr name="fadeDegree" format="float" />
|
||||
<attr name="selectorEnabled" format="boolean" />
|
||||
<attr name="selectorDrawable" format="reference" />
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<item name="selected_view" type="id"/>
|
||||
|
||||
</resources>
|
|
@ -1,95 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.CanvasTransformer;
|
||||
|
||||
public class CanvasTransformerBuilder {
|
||||
|
||||
private CanvasTransformer mTrans;
|
||||
|
||||
private static Interpolator lin = new Interpolator() {
|
||||
public float getInterpolation(float t) {
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
private void initTransformer() {
|
||||
if (mTrans == null)
|
||||
mTrans = new CanvasTransformer() {
|
||||
public void transformCanvas(Canvas canvas, float percentOpen) { }
|
||||
};
|
||||
}
|
||||
|
||||
public CanvasTransformer zoom(final int openedX, final int closedX,
|
||||
final int openedY, final int closedY,
|
||||
final int px, final int py) {
|
||||
return zoom(openedX, closedX, openedY, closedY, px, py, lin);
|
||||
}
|
||||
|
||||
public CanvasTransformer zoom(final int openedX, final int closedX,
|
||||
final int openedY, final int closedY,
|
||||
final int px, final int py, final Interpolator interp) {
|
||||
initTransformer();
|
||||
mTrans = new CanvasTransformer() {
|
||||
public void transformCanvas(Canvas canvas, float percentOpen) {
|
||||
mTrans.transformCanvas(canvas, percentOpen);
|
||||
float f = interp.getInterpolation(percentOpen);
|
||||
canvas.scale((openedX - closedX) * f + closedX,
|
||||
(openedY - closedY) * f + closedY, px, py);
|
||||
}
|
||||
};
|
||||
return mTrans;
|
||||
}
|
||||
|
||||
public CanvasTransformer rotate(final int openedDeg, final int closedDeg,
|
||||
final int px, final int py) {
|
||||
return rotate(openedDeg, closedDeg, px, py, lin);
|
||||
}
|
||||
|
||||
public CanvasTransformer rotate(final int openedDeg, final int closedDeg,
|
||||
final int px, final int py, final Interpolator interp) {
|
||||
initTransformer();
|
||||
mTrans = new CanvasTransformer() {
|
||||
public void transformCanvas(Canvas canvas, float percentOpen) {
|
||||
mTrans.transformCanvas(canvas, percentOpen);
|
||||
float f = interp.getInterpolation(percentOpen);
|
||||
canvas.rotate((openedDeg - closedDeg) * f + closedDeg,
|
||||
px, py);
|
||||
}
|
||||
};
|
||||
return mTrans;
|
||||
}
|
||||
|
||||
public CanvasTransformer translate(final int openedX, final int closedX,
|
||||
final int openedY, final int closedY) {
|
||||
return translate(openedX, closedX, openedY, closedY, lin);
|
||||
}
|
||||
|
||||
public CanvasTransformer translate(final int openedX, final int closedX,
|
||||
final int openedY, final int closedY, final Interpolator interp) {
|
||||
initTransformer();
|
||||
mTrans = new CanvasTransformer() {
|
||||
public void transformCanvas(Canvas canvas, float percentOpen) {
|
||||
mTrans.transformCanvas(canvas, percentOpen);
|
||||
float f = interp.getInterpolation(percentOpen);
|
||||
canvas.translate((openedX - closedX) * f + closedX,
|
||||
(openedY - closedY) * f + closedY);
|
||||
}
|
||||
};
|
||||
return mTrans;
|
||||
}
|
||||
|
||||
public CanvasTransformer concatTransformer(final CanvasTransformer t) {
|
||||
initTransformer();
|
||||
mTrans = new CanvasTransformer() {
|
||||
public void transformCanvas(Canvas canvas, float percentOpen) {
|
||||
mTrans.transformCanvas(canvas, percentOpen);
|
||||
t.transformCanvas(canvas, percentOpen);
|
||||
}
|
||||
};
|
||||
return mTrans;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,439 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.CanvasTransformer;
|
||||
|
||||
public class CustomViewBehind extends ViewGroup {
|
||||
|
||||
private static final String TAG = "CustomViewBehind";
|
||||
|
||||
private static final int MARGIN_THRESHOLD = 48; // dips
|
||||
private int mTouchMode = SlidingMenu.TOUCHMODE_MARGIN;
|
||||
|
||||
private CustomViewAbove mViewAbove;
|
||||
|
||||
private View mContent;
|
||||
private View mSecondaryContent;
|
||||
private int mMarginThreshold;
|
||||
private int mWidthOffset;
|
||||
private CanvasTransformer mTransformer;
|
||||
private boolean mChildrenEnabled;
|
||||
|
||||
public CustomViewBehind(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public CustomViewBehind(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mMarginThreshold = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
MARGIN_THRESHOLD, getResources().getDisplayMetrics());
|
||||
}
|
||||
|
||||
public void setCustomViewAbove(CustomViewAbove customViewAbove) {
|
||||
mViewAbove = customViewAbove;
|
||||
}
|
||||
|
||||
public void setCanvasTransformer(CanvasTransformer t) {
|
||||
mTransformer = t;
|
||||
}
|
||||
|
||||
public void setWidthOffset(int i) {
|
||||
mWidthOffset = i;
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setMarginThreshold(int marginThreshold) {
|
||||
mMarginThreshold = marginThreshold;
|
||||
}
|
||||
|
||||
public int getMarginThreshold() {
|
||||
return mMarginThreshold;
|
||||
}
|
||||
|
||||
public int getBehindWidth() {
|
||||
return mContent.getWidth();
|
||||
}
|
||||
|
||||
public void setContent(View v) {
|
||||
if (mContent != null)
|
||||
removeView(mContent);
|
||||
mContent = v;
|
||||
addView(mContent);
|
||||
}
|
||||
|
||||
public View getContent() {
|
||||
return mContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the secondary (right) menu for use when setMode is called with SlidingMenu.LEFT_RIGHT.
|
||||
* @param v the right menu
|
||||
*/
|
||||
public void setSecondaryContent(View v) {
|
||||
if (mSecondaryContent != null)
|
||||
removeView(mSecondaryContent);
|
||||
mSecondaryContent = v;
|
||||
addView(mSecondaryContent);
|
||||
}
|
||||
|
||||
public View getSecondaryContent() {
|
||||
return mSecondaryContent;
|
||||
}
|
||||
|
||||
public void setChildrenEnabled(boolean enabled) {
|
||||
mChildrenEnabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scrollTo(int x, int y) {
|
||||
super.scrollTo(x, y);
|
||||
if (mTransformer != null)
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent e) {
|
||||
return !mChildrenEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent e) {
|
||||
return !mChildrenEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
if (mTransformer != null) {
|
||||
canvas.save();
|
||||
mTransformer.transformCanvas(canvas, mViewAbove.getPercentOpen());
|
||||
super.dispatchDraw(canvas);
|
||||
canvas.restore();
|
||||
} else
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
final int width = r - l;
|
||||
final int height = b - t;
|
||||
mContent.layout(0, 0, width-mWidthOffset, height);
|
||||
if (mSecondaryContent != null)
|
||||
mSecondaryContent.layout(0, 0, width-mWidthOffset, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int width = getDefaultSize(0, widthMeasureSpec);
|
||||
int height = getDefaultSize(0, heightMeasureSpec);
|
||||
setMeasuredDimension(width, height);
|
||||
final int contentWidth = getChildMeasureSpec(widthMeasureSpec, 0, width-mWidthOffset);
|
||||
final int contentHeight = getChildMeasureSpec(heightMeasureSpec, 0, height);
|
||||
mContent.measure(contentWidth, contentHeight);
|
||||
if (mSecondaryContent != null)
|
||||
mSecondaryContent.measure(contentWidth, contentHeight);
|
||||
}
|
||||
|
||||
private int mMode;
|
||||
private boolean mFadeEnabled;
|
||||
private final Paint mFadePaint = new Paint();
|
||||
private float mScrollScale;
|
||||
private Drawable mShadowDrawable;
|
||||
private Drawable mSecondaryShadowDrawable;
|
||||
private int mShadowWidth;
|
||||
private float mFadeDegree;
|
||||
|
||||
public void setMode(int mode) {
|
||||
if (mode == SlidingMenu.LEFT || mode == SlidingMenu.RIGHT) {
|
||||
if (mContent != null)
|
||||
mContent.setVisibility(View.VISIBLE);
|
||||
if (mSecondaryContent != null)
|
||||
mSecondaryContent.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
mMode = mode;
|
||||
}
|
||||
|
||||
public int getMode() {
|
||||
return mMode;
|
||||
}
|
||||
|
||||
public void setScrollScale(float scrollScale) {
|
||||
mScrollScale = scrollScale;
|
||||
}
|
||||
|
||||
public float getScrollScale() {
|
||||
return mScrollScale;
|
||||
}
|
||||
|
||||
public void setShadowDrawable(Drawable shadow) {
|
||||
mShadowDrawable = shadow;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setSecondaryShadowDrawable(Drawable shadow) {
|
||||
mSecondaryShadowDrawable = shadow;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setShadowWidth(int width) {
|
||||
mShadowWidth = width;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setFadeEnabled(boolean b) {
|
||||
mFadeEnabled = b;
|
||||
}
|
||||
|
||||
public void setFadeDegree(float degree) {
|
||||
if (degree > 1.0f || degree < 0.0f)
|
||||
throw new IllegalStateException("The BehindFadeDegree must be between 0.0f and 1.0f");
|
||||
mFadeDegree = degree;
|
||||
}
|
||||
|
||||
public int getMenuPage(int page) {
|
||||
page = (page > 1) ? 2 : ((page < 1) ? 0 : page);
|
||||
if (mMode == SlidingMenu.LEFT && page > 1) {
|
||||
return 0;
|
||||
} else if (mMode == SlidingMenu.RIGHT && page < 1) {
|
||||
return 2;
|
||||
} else {
|
||||
return page;
|
||||
}
|
||||
}
|
||||
|
||||
public void scrollBehindTo(View content, int x, int y) {
|
||||
int vis = View.VISIBLE;
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
if (x >= content.getLeft()) vis = View.INVISIBLE;
|
||||
scrollTo((int)((x + getBehindWidth())*mScrollScale), y);
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
if (x <= content.getLeft()) vis = View.INVISIBLE;
|
||||
scrollTo((int)(getBehindWidth() - getWidth() +
|
||||
(x-getBehindWidth())*mScrollScale), y);
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
mContent.setVisibility(x >= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
|
||||
mSecondaryContent.setVisibility(x <= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
|
||||
vis = x == 0 ? View.INVISIBLE : View.VISIBLE;
|
||||
if (x <= content.getLeft()) {
|
||||
scrollTo((int)((x + getBehindWidth())*mScrollScale), y);
|
||||
} else {
|
||||
scrollTo((int)(getBehindWidth() - getWidth() +
|
||||
(x-getBehindWidth())*mScrollScale), y);
|
||||
}
|
||||
}
|
||||
if (vis == View.INVISIBLE)
|
||||
Log.v(TAG, "behind INVISIBLE");
|
||||
setVisibility(vis);
|
||||
}
|
||||
|
||||
public int getMenuLeft(View content, int page) {
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
switch (page) {
|
||||
case 0:
|
||||
return content.getLeft() - getBehindWidth();
|
||||
case 2:
|
||||
return content.getLeft();
|
||||
}
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
switch (page) {
|
||||
case 0:
|
||||
return content.getLeft();
|
||||
case 2:
|
||||
return content.getLeft() + getBehindWidth();
|
||||
}
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
switch (page) {
|
||||
case 0:
|
||||
return content.getLeft() - getBehindWidth();
|
||||
case 2:
|
||||
return content.getLeft() + getBehindWidth();
|
||||
}
|
||||
}
|
||||
return content.getLeft();
|
||||
}
|
||||
|
||||
public int getAbsLeftBound(View content) {
|
||||
if (mMode == SlidingMenu.LEFT || mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
return content.getLeft() - getBehindWidth();
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
return content.getLeft();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getAbsRightBound(View content) {
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
return content.getLeft();
|
||||
} else if (mMode == SlidingMenu.RIGHT || mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
return content.getLeft() + getBehindWidth();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean marginTouchAllowed(View content, int x) {
|
||||
int left = content.getLeft();
|
||||
int right = content.getRight();
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
return (x >= left && x <= mMarginThreshold + left);
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
return (x <= right && x >= right - mMarginThreshold);
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
return (x >= left && x <= mMarginThreshold + left) ||
|
||||
(x <= right && x >= right - mMarginThreshold);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setTouchMode(int i) {
|
||||
mTouchMode = i;
|
||||
}
|
||||
|
||||
public boolean menuOpenTouchAllowed(View content, int currPage, float x) {
|
||||
switch (mTouchMode) {
|
||||
case SlidingMenu.TOUCHMODE_FULLSCREEN:
|
||||
return true;
|
||||
case SlidingMenu.TOUCHMODE_MARGIN:
|
||||
return menuTouchInQuickReturn(content, currPage, x);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean menuTouchInQuickReturn(View content, int currPage, float x) {
|
||||
if (mMode == SlidingMenu.LEFT || (mMode == SlidingMenu.LEFT_RIGHT && currPage == 0)) {
|
||||
return x >= content.getLeft();
|
||||
} else if (mMode == SlidingMenu.RIGHT || (mMode == SlidingMenu.LEFT_RIGHT && currPage == 2)) {
|
||||
return x <= content.getRight();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean menuClosedSlideAllowed(float dx) {
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
return dx > 0;
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
return dx < 0;
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean menuOpenSlideAllowed(float dx) {
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
return dx < 0;
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
return dx > 0;
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void drawShadow(View content, Canvas canvas) {
|
||||
if (mShadowDrawable == null || mShadowWidth <= 0) return;
|
||||
int left = 0;
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
left = content.getLeft() - mShadowWidth;
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
left = content.getRight();
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
if (mSecondaryShadowDrawable != null) {
|
||||
left = content.getRight();
|
||||
mSecondaryShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight());
|
||||
mSecondaryShadowDrawable.draw(canvas);
|
||||
}
|
||||
left = content.getLeft() - mShadowWidth;
|
||||
}
|
||||
mShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight());
|
||||
mShadowDrawable.draw(canvas);
|
||||
}
|
||||
|
||||
public void drawFade(View content, Canvas canvas, float openPercent) {
|
||||
if (!mFadeEnabled) return;
|
||||
final int alpha = (int) (mFadeDegree * 255 * Math.abs(1-openPercent));
|
||||
mFadePaint.setColor(Color.argb(alpha, 0, 0, 0));
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
left = content.getLeft() - getBehindWidth();
|
||||
right = content.getLeft();
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
left = content.getRight();
|
||||
right = content.getRight() + getBehindWidth();
|
||||
} else if (mMode == SlidingMenu.LEFT_RIGHT) {
|
||||
left = content.getLeft() - getBehindWidth();
|
||||
right = content.getLeft();
|
||||
canvas.drawRect(left, 0, right, getHeight(), mFadePaint);
|
||||
left = content.getRight();
|
||||
right = content.getRight() + getBehindWidth();
|
||||
}
|
||||
canvas.drawRect(left, 0, right, getHeight(), mFadePaint);
|
||||
}
|
||||
|
||||
private boolean mSelectorEnabled = true;
|
||||
private Bitmap mSelectorDrawable;
|
||||
private View mSelectedView;
|
||||
|
||||
public void drawSelector(View content, Canvas canvas, float openPercent) {
|
||||
if (!mSelectorEnabled) return;
|
||||
if (mSelectorDrawable != null && mSelectedView != null) {
|
||||
String tag = (String) mSelectedView.getTag(R.id.selected_view);
|
||||
if (tag.equals(TAG+"SelectedView")) {
|
||||
canvas.save();
|
||||
int left, right, offset;
|
||||
offset = (int) (mSelectorDrawable.getWidth() * openPercent);
|
||||
if (mMode == SlidingMenu.LEFT) {
|
||||
right = content.getLeft();
|
||||
left = right - offset;
|
||||
canvas.clipRect(left, 0, right, getHeight());
|
||||
canvas.drawBitmap(mSelectorDrawable, left, getSelectorTop(), null);
|
||||
} else if (mMode == SlidingMenu.RIGHT) {
|
||||
left = content.getRight();
|
||||
right = left + offset;
|
||||
canvas.clipRect(left, 0, right, getHeight());
|
||||
canvas.drawBitmap(mSelectorDrawable, right - mSelectorDrawable.getWidth(), getSelectorTop(), null);
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setSelectorEnabled(boolean b) {
|
||||
mSelectorEnabled = b;
|
||||
}
|
||||
|
||||
public void setSelectedView(View v) {
|
||||
if (mSelectedView != null) {
|
||||
mSelectedView.setTag(R.id.selected_view, null);
|
||||
mSelectedView = null;
|
||||
}
|
||||
if (v != null && v.getParent() != null) {
|
||||
mSelectedView = v;
|
||||
mSelectedView.setTag(R.id.selected_view, TAG+"SelectedView");
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private int getSelectorTop() {
|
||||
int y = mSelectedView.getTop();
|
||||
y += (mSelectedView.getHeight() - mSelectorDrawable.getHeight()) / 2;
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setSelectorBitmap(Bitmap b) {
|
||||
mSelectorDrawable = b;
|
||||
refreshDrawableState();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
|
||||
public interface MenuInterface {
|
||||
|
||||
public abstract void scrollBehindTo(int x, int y,
|
||||
CustomViewBehind cvb, float scrollScale);
|
||||
|
||||
public abstract int getMenuLeft(CustomViewBehind cvb, View content);
|
||||
|
||||
public abstract int getAbsLeftBound(CustomViewBehind cvb, View content);
|
||||
|
||||
public abstract int getAbsRightBound(CustomViewBehind cvb, View content);
|
||||
|
||||
public abstract boolean marginTouchAllowed(View content, int x, int threshold);
|
||||
|
||||
public abstract boolean menuOpenTouchAllowed(View content, int currPage, int x);
|
||||
|
||||
public abstract boolean menuTouchInQuickReturn(View content, int currPage, int x);
|
||||
|
||||
public abstract boolean menuClosedSlideAllowed(int x);
|
||||
|
||||
public abstract boolean menuOpenSlideAllowed(int x);
|
||||
|
||||
public abstract void drawShadow(Canvas canvas, Drawable shadow, int width);
|
||||
|
||||
public abstract void drawFade(Canvas canvas, int alpha,
|
||||
CustomViewBehind cvb, View content);
|
||||
|
||||
public abstract void drawSelector(View content, Canvas canvas, float percentOpen);
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,152 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib.app;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
public class SlidingActivity extends Activity implements SlidingActivityBase {
|
||||
|
||||
private SlidingActivityHelper mHelper;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mHelper = new SlidingActivityHelper(this);
|
||||
mHelper.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onPostCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
mHelper.onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#findViewById(int)
|
||||
*/
|
||||
@Override
|
||||
public View findViewById(int id) {
|
||||
View v = super.findViewById(id);
|
||||
if (v != null)
|
||||
return v;
|
||||
return mHelper.findViewById(id);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mHelper.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(int)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(int id) {
|
||||
setContentView(getLayoutInflater().inflate(id, null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(android.view.View)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(View v) {
|
||||
setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(View v, LayoutParams params) {
|
||||
super.setContentView(v, params);
|
||||
mHelper.registerAboveContentView(v, params);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
|
||||
*/
|
||||
public void setBehindContentView(int id) {
|
||||
setBehindContentView(getLayoutInflater().inflate(id, null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
|
||||
*/
|
||||
public void setBehindContentView(View v) {
|
||||
setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
|
||||
*/
|
||||
public void setBehindContentView(View v, LayoutParams params) {
|
||||
mHelper.setBehindContentView(v, params);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
|
||||
*/
|
||||
public SlidingMenu getSlidingMenu() {
|
||||
return mHelper.getSlidingMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
|
||||
*/
|
||||
public void toggle() {
|
||||
mHelper.toggle();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
|
||||
*/
|
||||
public void showContent() {
|
||||
mHelper.showContent();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
|
||||
*/
|
||||
public void showMenu() {
|
||||
mHelper.showMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
|
||||
*/
|
||||
public void showSecondaryMenu() {
|
||||
mHelper.showSecondaryMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
|
||||
*/
|
||||
public void setSlidingActionBarEnabled(boolean b) {
|
||||
mHelper.setSlidingActionBarEnabled(b);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
|
||||
*/
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
boolean b = mHelper.onKeyUp(keyCode, event);
|
||||
if (b) return b;
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib.app;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
public interface SlidingActivityBase {
|
||||
|
||||
/**
|
||||
* Set the behind view content to an explicit view. This view is placed directly into the behind view 's view hierarchy.
|
||||
* It can itself be a complex view hierarchy.
|
||||
*
|
||||
* @param view The desired content to display.
|
||||
* @param layoutParams Layout parameters for the view.
|
||||
*/
|
||||
public void setBehindContentView(View view, LayoutParams layoutParams);
|
||||
|
||||
/**
|
||||
* Set the behind view content to an explicit view. This view is placed directly into the behind view 's view hierarchy.
|
||||
* It can itself be a complex view hierarchy. When calling this method, the layout parameters of the specified
|
||||
* view are ignored. Both the width and the height of the view are set by default to MATCH_PARENT. To use your
|
||||
* own layout parameters, invoke setContentView(android.view.View, android.view.ViewGroup.LayoutParams) instead.
|
||||
*
|
||||
* @param view The desired content to display.
|
||||
*/
|
||||
public void setBehindContentView(View view);
|
||||
|
||||
/**
|
||||
* Set the behind view content from a layout resource. The resource will be inflated, adding all top-level views
|
||||
* to the behind view.
|
||||
*
|
||||
* @param layoutResID Resource ID to be inflated.
|
||||
*/
|
||||
public void setBehindContentView(int layoutResID);
|
||||
|
||||
/**
|
||||
* Gets the SlidingMenu associated with this activity.
|
||||
*
|
||||
* @return the SlidingMenu associated with this activity.
|
||||
*/
|
||||
public SlidingMenu getSlidingMenu();
|
||||
|
||||
/**
|
||||
* Toggle the SlidingMenu. If it is open, it will be closed, and vice versa.
|
||||
*/
|
||||
public void toggle();
|
||||
|
||||
/**
|
||||
* Close the SlidingMenu and show the content view.
|
||||
*/
|
||||
public void showContent();
|
||||
|
||||
/**
|
||||
* Open the SlidingMenu and show the menu view.
|
||||
*/
|
||||
public void showMenu();
|
||||
|
||||
/**
|
||||
* Open the SlidingMenu and show the secondary (right) menu view. Will default to the regular menu
|
||||
* if there is only one.
|
||||
*/
|
||||
public void showSecondaryMenu();
|
||||
|
||||
/**
|
||||
* Controls whether the ActionBar slides along with the above view when the menu is opened,
|
||||
* or if it stays in place.
|
||||
*
|
||||
* @param slidingActionBarEnabled True if you want the ActionBar to slide along with the SlidingMenu,
|
||||
* false if you want the ActionBar to stay in place
|
||||
*/
|
||||
public void setSlidingActionBarEnabled(boolean slidingActionBarEnabled);
|
||||
|
||||
}
|
|
@ -1,219 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib.app;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.R;
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
public class SlidingActivityHelper {
|
||||
|
||||
private Activity mActivity;
|
||||
|
||||
private SlidingMenu mSlidingMenu;
|
||||
|
||||
private View mViewAbove;
|
||||
|
||||
private View mViewBehind;
|
||||
|
||||
private boolean mBroadcasting = false;
|
||||
|
||||
private boolean mOnPostCreateCalled = false;
|
||||
|
||||
private boolean mEnableSlide = true;
|
||||
|
||||
/**
|
||||
* Instantiates a new SlidingActivityHelper.
|
||||
*
|
||||
* @param activity the associated activity
|
||||
*/
|
||||
public SlidingActivityHelper(Activity activity) {
|
||||
mActivity = activity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets mSlidingMenu as a newly inflated SlidingMenu. Should be called within the activitiy's onCreate()
|
||||
*
|
||||
* @param savedInstanceState the saved instance state (unused)
|
||||
*/
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
mSlidingMenu = (SlidingMenu) LayoutInflater.from(mActivity).inflate(R.layout.slidingmenumain, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Further SlidingMenu initialization. Should be called within the activitiy's onPostCreate()
|
||||
*
|
||||
* @param savedInstanceState the saved instance state (unused)
|
||||
*/
|
||||
public void onPostCreate(Bundle savedInstanceState) {
|
||||
if (mViewBehind == null || mViewAbove == null) {
|
||||
throw new IllegalStateException("Both setBehindContentView must be called " +
|
||||
"in onCreate in addition to setContentView.");
|
||||
}
|
||||
|
||||
mOnPostCreateCalled = true;
|
||||
|
||||
mSlidingMenu.attachToActivity(mActivity,
|
||||
mEnableSlide ? SlidingMenu.SLIDING_WINDOW : SlidingMenu.SLIDING_CONTENT);
|
||||
|
||||
final boolean open;
|
||||
final boolean secondary;
|
||||
if (savedInstanceState != null) {
|
||||
open = savedInstanceState.getBoolean("SlidingActivityHelper.open");
|
||||
secondary = savedInstanceState.getBoolean("SlidingActivityHelper.secondary");
|
||||
} else {
|
||||
open = false;
|
||||
secondary = false;
|
||||
}
|
||||
new Handler().post(new Runnable() {
|
||||
public void run() {
|
||||
if (open) {
|
||||
if (secondary) {
|
||||
mSlidingMenu.showSecondaryMenu(false);
|
||||
} else {
|
||||
mSlidingMenu.showMenu(false);
|
||||
}
|
||||
} else {
|
||||
mSlidingMenu.showContent(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Controls whether the ActionBar slides along with the above view when the menu is opened,
|
||||
* or if it stays in place.
|
||||
*
|
||||
* @param slidingActionBarEnabled True if you want the ActionBar to slide along with the SlidingMenu,
|
||||
* false if you want the ActionBar to stay in place
|
||||
*/
|
||||
public void setSlidingActionBarEnabled(boolean slidingActionBarEnabled) {
|
||||
if (mOnPostCreateCalled)
|
||||
throw new IllegalStateException("enableSlidingActionBar must be called in onCreate.");
|
||||
mEnableSlide = slidingActionBarEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle).
|
||||
*
|
||||
* @param id the resource id of the desired view
|
||||
* @return The view if found or null otherwise.
|
||||
*/
|
||||
public View findViewById(int id) {
|
||||
View v;
|
||||
if (mSlidingMenu != null) {
|
||||
v = mSlidingMenu.findViewById(id);
|
||||
if (v != null)
|
||||
return v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to retrieve per-instance state from an activity before being killed so that the state can be
|
||||
* restored in onCreate(Bundle) or onRestoreInstanceState(Bundle) (the Bundle populated by this method
|
||||
* will be passed to both).
|
||||
*
|
||||
* @param outState Bundle in which to place your saved state.
|
||||
*/
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
outState.putBoolean("SlidingActivityHelper.open", mSlidingMenu.isMenuShowing());
|
||||
outState.putBoolean("SlidingActivityHelper.secondary", mSlidingMenu.isSecondaryMenuShowing());
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the above content view.
|
||||
*
|
||||
* @param v the above content view to register
|
||||
* @param params LayoutParams for that view (unused)
|
||||
*/
|
||||
public void registerAboveContentView(View v, LayoutParams params) {
|
||||
if (!mBroadcasting)
|
||||
mViewAbove = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the activity content to an explicit view. This view is placed directly into the activity's view
|
||||
* hierarchy. It can itself be a complex view hierarchy. When calling this method, the layout parameters
|
||||
* of the specified view are ignored. Both the width and the height of the view are set by default to
|
||||
* MATCH_PARENT. To use your own layout parameters, invoke setContentView(android.view.View,
|
||||
* android.view.ViewGroup.LayoutParams) instead.
|
||||
*
|
||||
* @param v The desired content to display.
|
||||
*/
|
||||
public void setContentView(View v) {
|
||||
mBroadcasting = true;
|
||||
mActivity.setContentView(v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the behind view content to an explicit view. This view is placed directly into the behind view 's view hierarchy.
|
||||
* It can itself be a complex view hierarchy.
|
||||
*
|
||||
* @param view The desired content to display.
|
||||
* @param layoutParams Layout parameters for the view. (unused)
|
||||
*/
|
||||
public void setBehindContentView(View view, LayoutParams layoutParams) {
|
||||
mViewBehind = view;
|
||||
mSlidingMenu.setMenu(mViewBehind);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the SlidingMenu associated with this activity.
|
||||
*
|
||||
* @return the SlidingMenu associated with this activity.
|
||||
*/
|
||||
public SlidingMenu getSlidingMenu() {
|
||||
return mSlidingMenu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the SlidingMenu. If it is open, it will be closed, and vice versa.
|
||||
*/
|
||||
public void toggle() {
|
||||
mSlidingMenu.toggle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the SlidingMenu and show the content view.
|
||||
*/
|
||||
public void showContent() {
|
||||
mSlidingMenu.showContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the SlidingMenu and show the menu view.
|
||||
*/
|
||||
public void showMenu() {
|
||||
mSlidingMenu.showMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the SlidingMenu and show the secondary menu view. Will default to the regular menu
|
||||
* if there is only one.
|
||||
*/
|
||||
public void showSecondaryMenu() {
|
||||
mSlidingMenu.showSecondaryMenu();
|
||||
}
|
||||
|
||||
/**
|
||||
* On key up.
|
||||
*
|
||||
* @param keyCode the key code
|
||||
* @param event the event
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && mSlidingMenu.isMenuShowing()) {
|
||||
showContent();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
public class SlidingFragmentActivity extends FragmentActivity implements SlidingActivityBase {
|
||||
|
||||
private SlidingActivityHelper mHelper;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mHelper = new SlidingActivityHelper(this);
|
||||
mHelper.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onPostCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
mHelper.onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#findViewById(int)
|
||||
*/
|
||||
@Override
|
||||
public View findViewById(int id) {
|
||||
View v = super.findViewById(id);
|
||||
if (v != null)
|
||||
return v;
|
||||
return mHelper.findViewById(id);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.support.v4.app.FragmentActivity#onSaveInstanceState(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mHelper.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(int)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(int id) {
|
||||
setContentView(getLayoutInflater().inflate(id, null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(android.view.View)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(View v) {
|
||||
setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(View v, LayoutParams params) {
|
||||
super.setContentView(v, params);
|
||||
mHelper.registerAboveContentView(v, params);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
|
||||
*/
|
||||
public void setBehindContentView(int id) {
|
||||
setBehindContentView(getLayoutInflater().inflate(id, null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
|
||||
*/
|
||||
public void setBehindContentView(View v) {
|
||||
setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
|
||||
*/
|
||||
public void setBehindContentView(View v, LayoutParams params) {
|
||||
mHelper.setBehindContentView(v, params);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
|
||||
*/
|
||||
public SlidingMenu getSlidingMenu() {
|
||||
return mHelper.getSlidingMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
|
||||
*/
|
||||
public void toggle() {
|
||||
mHelper.toggle();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
|
||||
*/
|
||||
public void showContent() {
|
||||
mHelper.showContent();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
|
||||
*/
|
||||
public void showMenu() {
|
||||
mHelper.showMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
|
||||
*/
|
||||
public void showSecondaryMenu() {
|
||||
mHelper.showSecondaryMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
|
||||
*/
|
||||
public void setSlidingActionBarEnabled(boolean b) {
|
||||
mHelper.setSlidingActionBarEnabled(b);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
|
||||
*/
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
boolean b = mHelper.onKeyUp(keyCode, event);
|
||||
if (b) return b;
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib.app;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
public class SlidingListActivity extends ListActivity implements SlidingActivityBase {
|
||||
|
||||
private SlidingActivityHelper mHelper;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mHelper = new SlidingActivityHelper(this);
|
||||
mHelper.onCreate(savedInstanceState);
|
||||
ListView listView = new ListView(this);
|
||||
listView.setId(android.R.id.list);
|
||||
setContentView(listView);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onPostCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
mHelper.onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#findViewById(int)
|
||||
*/
|
||||
@Override
|
||||
public View findViewById(int id) {
|
||||
View v = super.findViewById(id);
|
||||
if (v != null)
|
||||
return v;
|
||||
return mHelper.findViewById(id);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mHelper.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(int)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(int id) {
|
||||
setContentView(getLayoutInflater().inflate(id, null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(android.view.View)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(View v) {
|
||||
setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(View v, LayoutParams params) {
|
||||
super.setContentView(v, params);
|
||||
mHelper.registerAboveContentView(v, params);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
|
||||
*/
|
||||
public void setBehindContentView(int id) {
|
||||
setBehindContentView(getLayoutInflater().inflate(id, null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
|
||||
*/
|
||||
public void setBehindContentView(View v) {
|
||||
setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
|
||||
*/
|
||||
public void setBehindContentView(View v, LayoutParams params) {
|
||||
mHelper.setBehindContentView(v, params);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
|
||||
*/
|
||||
public SlidingMenu getSlidingMenu() {
|
||||
return mHelper.getSlidingMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
|
||||
*/
|
||||
public void toggle() {
|
||||
mHelper.toggle();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
|
||||
*/
|
||||
public void showContent() {
|
||||
mHelper.showContent();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
|
||||
*/
|
||||
public void showMenu() {
|
||||
mHelper.showMenu();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
|
||||
*/
|
||||
public void showSecondaryMenu() {
|
||||
mHelper.showSecondaryMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
|
||||
*/
|
||||
public void setSlidingActionBarEnabled(boolean b) {
|
||||
mHelper.setSlidingActionBarEnabled(b);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
|
||||
*/
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
boolean b = mHelper.onKeyUp(keyCode, event);
|
||||
if (b) return b;
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
package com.jeremyfeinstein.slidingmenu.lib.app;
|
||||
|
||||
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
|
||||
public class SlidingPreferenceActivity extends PreferenceActivity implements SlidingActivityBase {
|
||||
|
||||
private SlidingActivityHelper mHelper;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
mHelper = new SlidingActivityHelper(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
mHelper.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onPostCreate(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
public void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
mHelper.onPostCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#findViewById(int)
|
||||
*/
|
||||
@Override
|
||||
public View findViewById(int id) {
|
||||
View v = super.findViewById(id);
|
||||
if (v != null)
|
||||
return v;
|
||||
return mHelper.findViewById(id);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
|
||||
*/
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mHelper.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(int)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(int id) {
|
||||
setContentView(getLayoutInflater().inflate(id, null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(android.view.View)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(View v) {
|
||||
setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
|
||||
*/
|
||||
@Override
|
||||
public void setContentView(View v, LayoutParams params) {
|
||||
super.setContentView(v, params);
|
||||
mHelper.registerAboveContentView(v, params);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
|
||||
*/
|
||||
public void setBehindContentView(int id) {
|
||||
setBehindContentView(getLayoutInflater().inflate(id, null));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
|
||||
*/
|
||||
public void setBehindContentView(View v) {
|
||||
setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
|
||||
*/
|
||||
public void setBehindContentView(View v, LayoutParams params) {
|
||||
mHelper.setBehindContentView(v, params);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
|
||||
*/
|
||||
public SlidingMenu getSlidingMenu() {
|
||||
return mHelper.getSlidingMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
|
||||
*/
|
||||
public void toggle() {
|
||||
mHelper.toggle();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
|
||||
*/
|
||||
public void showContent() {
|
||||
mHelper.showContent();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
|
||||
*/
|
||||
public void showMenu() {
|
||||
mHelper.showMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
|
||||
*/
|
||||
public void showSecondaryMenu() {
|
||||
mHelper.showSecondaryMenu();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
|
||||
*/
|
||||
public void setSlidingActionBarEnabled(boolean b) {
|
||||
mHelper.setSlidingActionBarEnabled(b);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
|
||||
*/
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
boolean b = mHelper.onKeyUp(keyCode, event);
|
||||
if (b) return b;
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue