Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Commit

Permalink
Basic subitems specification (#796)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Shatunov committed Mar 18, 2014
1 parent 69d19d3 commit 4db2a9b
Show file tree
Hide file tree
Showing 84 changed files with 1,981 additions and 505 deletions.
2 changes: 1 addition & 1 deletion addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

<modules>
<module>slider</module>
<module>preferences</module>
<module>preferences</module>
</modules>
</project>
8 changes: 8 additions & 0 deletions addons/slider/res/drawable/slider_menu_expander_holo_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="https://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/expander_open_holo_dark" android:state_expanded="true" />
<!-- TODO Fix shadows -->
<item>
<rotate android:drawable="@drawable/expander_close_holo_dark" android:fromDegrees="90" android:toDegrees="90" android:pivotX="50%" android:pivotY="50%" />
</item>
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="https://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/expander_open_holo_light" android:state_expanded="true" />
<!-- TODO Fix shadows -->
<item>
<rotate android:drawable="@drawable/expander_close_holo_light" android:fromDegrees="90" android:toDegrees="90" android:pivotX="50%" android:pivotY="50%" />
</item>
</selector>
4 changes: 2 additions & 2 deletions addons/slider/res/layout-w720dp/slider_default_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<fragment
android:id="@id/leftView"
android:name="org.holoeverywhere.slider.SliderMenu$SliderMenuFragment"
android:name="org.holoeverywhere.slider.SliderMenuFragment"
android:layout_width="@dimen/menu_width"
android:layout_height="match_parent" />

Expand All @@ -16,4 +16,4 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<ExpandableListView xmlns:android="https://schemas.android.com/apk/res/android"
android:id="@+id/slider_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="@null"
android:background="?sliderMenuPanelBackground" />
4 changes: 2 additions & 2 deletions addons/slider/res/layout/slider_default_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<fragment
android:id="@id/leftView"
android:name="org.holoeverywhere.slider.SliderMenu$SliderMenuFragment"
android:name="org.holoeverywhere.slider.SliderMenuFragment"
android:layout_width="@dimen/menu_width"
android:layout_height="match_parent" />
</DrawerLayout>
</DrawerLayout>
4 changes: 2 additions & 2 deletions addons/slider/res/layout/slider_default_list_layout.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ListView xmlns:android="https://schemas.android.com/apk/res/android"
android:id="@android:id/list"
android:id="@+id/slider_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?sliderMenuPanelBackground" />
android:background="?sliderMenuPanelBackground" />
5 changes: 5 additions & 0 deletions addons/slider/res/layout/slider_default_menu_stub.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ViewStubHolo xmlns:android="https://schemas.android.com/apk/res/android"
android:id="@+id/slider_menu"
android:layout_width="match_parent"
android:layout_height="match_parent" />
31 changes: 31 additions & 0 deletions addons/slider/res/layout/slider_menu_expandable_child_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="https://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?listPreferredItemHeightSmall"
android:background="?selectableItemBackground"
android:minHeight="?listPreferredItemHeightSmall"
android:orientation="horizontal">

<View
android:id="@+id/groupIndicator"
android:layout_width="6dp"
android:layout_height="match_parent"
android:layout_marginRight="6dp" />

<ImageView
android:id="@android:id/icon1"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="8dp"
android:maxHeight="52dp"
android:maxWidth="52dp" />

<TextView
android:id="@android:id/text1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textAppearance="?android:textAppearanceMedium" />
</LinearLayout>
37 changes: 37 additions & 0 deletions addons/slider/res/layout/slider_menu_expandable_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="https://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?listPreferredItemHeightSmall"
android:background="?selectableItemBackground"
android:minHeight="?listPreferredItemHeightSmall"
android:orientation="horizontal">

<View
android:id="@+id/selectionHandler"
android:layout_width="6dp"
android:layout_height="match_parent"
android:layout_marginRight="6dp" />

<ImageView
android:id="@android:id/icon1"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="8dp"
android:maxHeight="52dp"
android:maxWidth="52dp" />

<TextView
android:id="@android:id/text1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:textAppearance="?android:textAppearanceMedium" />

<org.holoeverywhere.slider.SliderMenuGroupIndicatorView
android:id="@+id/slider_menu_group_indicator"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="?sliderMenuGroupIndicator" />
</LinearLayout>
8 changes: 4 additions & 4 deletions addons/slider/res/layout/slider_menu_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
<View
android:id="@+id/selectionHandler"
android:layout_width="6dp"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:layout_marginRight="6dp" />

<ImageView
android:id="@android:id/icon1"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:maxHeight="52dp"
android:maxWidth="52dp" />

<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:textAppearance="?android:textAppearanceMedium" />
</LinearLayout>
1 change: 1 addition & 0 deletions addons/slider/res/values/rb_attrs.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="sliderMenuGroupIndicator" format="reference" />
<attr name="sliderMenuPanelBackground" format="reference|color" />
<attr name="textAppearanceSliderItem" format="reference" />
<attr name="textAppearanceSliderItemInverse" format="reference" />
Expand Down
3 changes: 3 additions & 0 deletions addons/slider/res/values/rb_styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@
<style name="Holo.Theme.Slider" parent="Holo.Theme">
<item name="android:homeAsUpIndicator">?homeAsUpIndicator</item>
<item name="homeAsUpIndicator">@drawable/ic_drawer_dark</item>
<item name="sliderMenuGroupIndicator">@drawable/slider_menu_expander_holo_dark</item>
<item name="sliderMenuPanelBackground">@color/slider_menu_panel_background_holo_dark</item>
<item name="textAppearanceSliderItem">?android:textAppearanceMedium</item>
<item name="textAppearanceSliderItemInverse">?android:textAppearanceMediumInverse</item>
</style>
<style name="Holo.Theme.Slider.Light" parent="Holo.Theme.Light">
<item name="android:homeAsUpIndicator">?homeAsUpIndicator</item>
<item name="homeAsUpIndicator">@drawable/ic_drawer_light</item>
<item name="sliderMenuGroupIndicator">@drawable/slider_menu_expander_holo_light</item>
<item name="sliderMenuPanelBackground">@color/slider_menu_panel_background_holo_light</item>
<item name="textAppearanceSliderItem">?android:textAppearanceMedium</item>
<item name="textAppearanceSliderItemInverse">?android:textAppearanceMediumInverse</item>
</style>
<style name="Holo.Theme.Slider.Light.DarkActionBar" parent="Holo.Theme.Light.DarkActionBar">
<item name="android:homeAsUpIndicator">?homeAsUpIndicator</item>
<item name="homeAsUpIndicator">@drawable/ic_drawer_dark</item>
<item name="sliderMenuGroupIndicator">@drawable/slider_menu_expander_holo_light</item>
<item name="sliderMenuPanelBackground">@color/slider_menu_panel_background_holo_light</item>
<item name="textAppearanceSliderItem">?android:textAppearanceMedium</item>
<item name="textAppearanceSliderItemInverse">?android:textAppearanceMediumInverse</item>
Expand Down
1 change: 1 addition & 0 deletions addons/slider/resbuilder/attrs/attrs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
attrs:
sliderMenuPanelBackground: reference:color
sliderMenuGroupIndicator: reference
styleable:
SliderMenu:
- textAppearanceSliderItemInverse|reference
Expand Down
2 changes: 2 additions & 0 deletions addons/slider/resbuilder/styles/themes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ blocks:
textAppearanceSliderItemInverse: ?android:textAppearanceMediumInverse
Dark < Base:
sliderMenuPanelBackground: :color/slider_menu_panel_background_holo_dark
sliderMenuGroupIndicator: :drawable/slider_menu_expander_holo_dark
Light < Base:
sliderMenuPanelBackground: :color/slider_menu_panel_background_holo_light
sliderMenuGroupIndicator: :drawable/slider_menu_expander_holo_light
styles:
Holo.Internal.SliderTheme < Holo.Theme.Slider: null
Holo.Internal.SliderTheme.Light < Holo.Theme.Slider.Light: null
Expand Down
8 changes: 3 additions & 5 deletions addons/slider/src/org/holoeverywhere/addon/AddonSlider.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package org.holoeverywhere.addon;

import android.annotation.SuppressLint;
Expand Down Expand Up @@ -199,16 +198,15 @@ public SliderMenu obtainDefaultSliderMenu(int menuLayout) {
return mSliderMenu;
}
mMenuLayout = menuLayout;
mMenuContext = obtainMenuContext(true);
setDrawerLayout(R.layout.slider_default_layout);
setOverlayActionBar(true);
mSliderMenu = new SliderMenu(this);
mSliderMenu.setHandleHomeKey(true);
mSliderMenu.makeDefaultMenu(mMenuContext);
mSliderMenu.makeDefaultMenu(obtainMenuContext(mSliderMenu, true));
return mSliderMenu;
}

public Context obtainMenuContext(boolean useActionBarStyle) {
public Context obtainMenuContext(SliderMenu sliderMenu, boolean useActionBarStyle) {
if (mMenuContext != null) {
return mMenuContext;
}
Expand All @@ -217,7 +215,7 @@ public Context obtainMenuContext(boolean useActionBarStyle) {
if (themeType == ThemeManager.MIXED && useActionBarStyle) {
themeType = ThemeManager.DARK;
}
return mMenuContext = new ContextThemeWrapperPlus(activity, SliderMenu.getThemeForType(themeType));
return mMenuContext = new ContextThemeWrapperPlus(activity, sliderMenu.getThemeForType(themeType));
}

public SliderMenu obtainSliderMenu() {
Expand Down
Loading

0 comments on commit 4db2a9b

Please sign in to comment.