Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use proper color scheme and toolbar design #974

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(
this,
android.R.layout.simple_list_item_1,
your_array_list );
your_array_list);

lv.setAdapter(arrayAdapter);

Expand Down Expand Up @@ -119,50 +119,38 @@ public void onClick(View v) {

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.demo, menu);
MenuItem item = menu.findItem(R.id.action_toggle);
if (mLayout != null) {
if (mLayout.getPanelState() == PanelState.HIDDEN) {
item.setTitle(R.string.action_show);
} else {
item.setTitle(R.string.action_hide);
}
}
return true;
}

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
return super.onPrepareOptionsMenu(menu);
super.onPrepareOptionsMenu(menu);
menu.findItem(R.id.action_toggle)
.setChecked(true)
.setIcon(R.drawable.ic_check_box_checked);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
switch (item.getItemId()) {
case R.id.action_toggle: {
if (mLayout != null) {
if (mLayout.getPanelState() != PanelState.HIDDEN) {
mLayout.setPanelState(PanelState.HIDDEN);
item.setTitle(R.string.action_show);
item.setIcon(R.drawable.ic_check_box_unchecked);
} else {
mLayout.setPanelState(PanelState.COLLAPSED);
item.setTitle(R.string.action_hide);
item.setIcon(R.drawable.ic_check_box_checked);
}
}
return true;
}
case R.id.action_anchor: {
if (mLayout != null) {
if (mLayout.getAnchorPoint() == 1.0f) {
mLayout.setAnchorPoint(0.7f);
mLayout.setPanelState(PanelState.ANCHORED);
item.setTitle(R.string.action_anchor_disable);
} else {
mLayout.setAnchorPoint(1.0f);
mLayout.setPanelState(PanelState.COLLAPSED);
item.setTitle(R.string.action_anchor_enable);
}
mLayout.setAnchorPoint(0.7f);
mLayout.setPanelState(PanelState.ANCHORED);
}
return true;
}
Expand Down
9 changes: 9 additions & 0 deletions demo/src/main/res/drawable/ic_check_box_checked.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.11,0 2,-0.9 2,-2L21,5c0,-1.1 -0.89,-2 -2,-2zM10,17l-5,-5 1.41,-1.41L10,14.17l7.59,-7.59L19,8l-9,9z"/>
</vector>
9 changes: 9 additions & 0 deletions demo/src/main/res/drawable/ic_check_box_unchecked.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M19,5v14H5V5h14m0,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>
5 changes: 5 additions & 0 deletions demo/src/main/res/drawable/ic_more_vert.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
</vector>
9 changes: 9 additions & 0 deletions demo/src/main/res/drawable/ic_vertical_align.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M8,19h3v4h2v-4h3l-4,-4 -4,4zM16,5h-3L13,1h-2v4L8,5l4,4 4,-4zM4,11v2h16v-2L4,11z"/>
</vector>
10 changes: 7 additions & 3 deletions demo/src/main/res/layout/activity_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<android.support.v7.widget.Toolbar
xmlns:sothree="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
sothree:theme="@style/ActionBar"
android:layout_width="match_parent"/>
sothree:titleTextColor="@android:color/white"
tools:ignore="UnusedAttribute"
tools:title="@string/app_name" />

<TextView
android:id="@+id/main"
android:layout_width="match_parent"
Expand Down
29 changes: 19 additions & 10 deletions demo/src/main/res/menu/demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@
xmlns:sothree="http://schemas.android.com/apk/res-auto">

<item
android:id="@+id/action_toggle"
android:orderInCategory="100"
sothree:showAsAction="never"
android:title="@string/action_hide"/>

<item
android:id="@+id/action_anchor"
android:orderInCategory="200"
sothree:showAsAction="never"
android:title="@string/action_anchor_enable"/>
android:icon="@drawable/ic_more_vert"
android:title="@string/hello"
sothree:showAsAction="ifRoom">
<menu>

<item
android:id="@+id/action_toggle"
android:icon="@drawable/ic_check_box_checked"
android:orderInCategory="100"
android:title="@string/action_menu_panel"
sothree:showAsAction="never" />

<item
android:id="@+id/action_anchor"
android:orderInCategory="200"
android:icon="@drawable/ic_vertical_align"
android:title="@string/action_menu_anchor_point"
sothree:showAsAction="never" />
</menu>
</item>
</menu>
6 changes: 2 additions & 4 deletions demo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
<resources>
<string name="app_name">Sliding Up Panel Demo</string>
<string name="action_settings">Settings</string>
<string name="action_hide">Hide Panel</string>
<string name="action_show">Show Panel</string>
<string name="action_anchor_enable">Enable Anchor Point</string>
<string name="action_anchor_disable">Disable Anchor Point</string>
<string name="action_menu_panel">Panel</string>
<string name="action_menu_anchor_point">Snap to Anchor Point</string>
<string name="hello"><![CDATA[<b>The Awesome Sliding Up Panel</b><br/> Brought to you by<br/><a href="http://umanoapp.com">http://umanoapp.com</a>]]></string>
<string name="follow"><![CDATA[Follow us<br/>on <a href="http://twitter.com/umanoapp">Twitter</a>]]></string>
</resources>
6 changes: 4 additions & 2 deletions demo/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#ffff9431</item>
<item name="colorPrimaryDark">#ffD56600</item>
<item name="colorPrimary">#de6b35</item>
<item name="colorPrimaryDark">#8f4426</item>
<item name="colorAccent">#64ccda</item>
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
Expand All @@ -21,6 +22,7 @@

<style name="ActionBar" parent="ThemeOverlay.AppCompat.ActionBar">
<item name="android:displayOptions">homeAsUp</item>
<item name="colorControlNormal">@android:color/white</item>
</style>

</resources>