Shadows for extendable list view (live updates screen)
This commit is contained in:
parent
6f18610082
commit
f78f7cc045
5 changed files with 61 additions and 18 deletions
|
@ -16,6 +16,7 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
|
|
@ -4,24 +4,40 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:background="?attr/expandable_list_item_background">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/section_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
tools:text="Live updates"/>
|
||||
<include layout="@layout/shadow_bottom"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/liveUpdatesSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<include layout="@layout/shadow_top"/>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/section_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
tools:text="Live updates"/>
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/liveUpdatesSwitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
10
OsmAnd/res/layout/shadow_bottom.xml
Normal file
10
OsmAnd/res/layout/shadow_bottom.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<View
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/bottomShadowView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="6dp"
|
||||
android:background="@drawable/bg_shadow_list_bottom"
|
||||
tools:showIn="@layout/list_group_title_with_switch"/>
|
9
OsmAnd/res/layout/shadow_top.xml
Normal file
9
OsmAnd/res/layout/shadow_top.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<View
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="4dp"
|
||||
android:background="@drawable/bg_shadow_list_top"
|
||||
tools:showIn="@layout/list_group_title_with_switch"/>
|
|
@ -72,6 +72,10 @@ public class LiveUpdatesFragment extends Fragment {
|
|||
|
||||
adapter = new LocalIndexesAdapter(this);
|
||||
listView.setAdapter(adapter);
|
||||
View topShadowView = inflater.inflate(R.layout.shadow_top, listView, false);
|
||||
listView.addHeaderView(topShadowView);
|
||||
View bottomShadowView = inflater.inflate(R.layout.shadow_bottom, listView, false);
|
||||
listView.addFooterView(bottomShadowView);
|
||||
new LoadLocalIndexTask(adapter, this).execute();
|
||||
return view;
|
||||
}
|
||||
|
@ -192,7 +196,9 @@ public class LiveUpdatesFragment extends Fragment {
|
|||
v.setBackgroundColor(typedValue.data);
|
||||
|
||||
SwitchCompat liveUpdatesSwitch = (SwitchCompat) v.findViewById(R.id.liveUpdatesSwitch);
|
||||
View topShadowView = v.findViewById(R.id.bottomShadowView);
|
||||
if (groupPosition == SHOULD_UPDATE_GROUP_POSITION) {
|
||||
topShadowView.setVisibility(View.GONE);
|
||||
liveUpdatesSwitch.setVisibility(View.VISIBLE);
|
||||
OsmandApplication application = (OsmandApplication) ctx.getApplicationContext();
|
||||
final OsmandSettings settings = application.getSettings();
|
||||
|
@ -206,6 +212,7 @@ public class LiveUpdatesFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
topShadowView.setVisibility(View.VISIBLE);
|
||||
liveUpdatesSwitch.setVisibility(View.GONE);
|
||||
}
|
||||
return v;
|
||||
|
|
Loading…
Reference in a new issue