Fix layout issues on pre-lollipop

pull/201/head
Alinson S. Xavier 9 years ago
parent 7c14725d88
commit d537ba0dfa

@ -84,7 +84,7 @@ public class BaseScreen
ColorDrawable drawable = new ColorDrawable(color); ColorDrawable drawable = new ColorDrawable(color);
actionBar.setBackgroundDrawable(drawable); actionBar.setBackgroundDrawable(drawable);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) if (SDK_INT >= LOLLIPOP)
{ {
int darkerColor = ColorUtils.mixColors(color, Color.BLACK, 0.75f); int darkerColor = ColorUtils.mixColors(color, Color.BLACK, 0.75f);
activity.getWindow().setStatusBarColor(darkerColor); activity.getWindow().setStatusBarColor(darkerColor);
@ -94,8 +94,8 @@ public class BaseScreen
View view = activity.findViewById(R.id.toolbarShadow); View view = activity.findViewById(R.id.toolbarShadow);
if (view != null) view.setVisibility(View.GONE); if (view != null) view.setVisibility(View.GONE);
// view = activity.findViewById(R.id.headerShadow); view = activity.findViewById(R.id.headerShadow);
// if (view != null) view.setVisibility(View.GONE); if (view != null) view.setVisibility(View.GONE);
} }
} }
@ -258,7 +258,7 @@ public class BaseScreen
private void setStatusBarColor(int baseColor) private void setStatusBarColor(int baseColor)
{ {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return; if (SDK_INT < LOLLIPOP) return;
int darkerColor = ColorUtils.mixColors(baseColor, Color.BLACK, 0.75f); int darkerColor = ColorUtils.mixColors(baseColor, Color.BLACK, 0.75f);
activity.getWindow().setStatusBarColor(darkerColor); activity.getWindow().setStatusBarColor(darkerColor);
@ -266,7 +266,7 @@ public class BaseScreen
private void setupToolbarElevation(Toolbar toolbar) private void setupToolbarElevation(Toolbar toolbar)
{ {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return; if (SDK_INT < LOLLIPOP) return;
toolbar.setElevation(InterfaceUtils.dpToPixels(activity, 2)); toolbar.setElevation(InterfaceUtils.dpToPixels(activity, 2));

@ -245,6 +245,7 @@
<View <View
android:id="@+id/toolbarShadow" android:id="@+id/toolbarShadow"
style="@style/ToolbarShadow"/> style="@style/ToolbarShadow"
android:layout_below="@id/toolbar"/>
</RelativeLayout> </RelativeLayout>

@ -88,4 +88,9 @@
android:layout_below="@id/toolbar" android:layout_below="@id/toolbar"
style="@style/ToolbarShadow"/> style="@style/ToolbarShadow"/>
<View
android:id="@+id/headerShadow"
android:layout_below="@id/header"
style="@style/ToolbarShadow"/>
</RelativeLayout> </RelativeLayout>

@ -17,7 +17,7 @@
~ with this program. If not, see <http://www.gnu.org/licenses/>. ~ with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<LinearLayout <RelativeLayout
android:id="@+id/container" android:id="@+id/container"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
@ -28,12 +28,15 @@
<android.support.v7.widget.Toolbar <android.support.v7.widget.Toolbar
android:id="@+id/toolbar" android:id="@+id/toolbar"
style="@style/Toolbar" style="@style/Toolbar"
app:popupTheme="?toolbarPopupTheme"/> app:popupTheme="?toolbarPopupTheme"
android:layout_alignParentTop="true"/>
<!-- Separate file so that we can use the layout editor to preview it -->
<include layout="@layout/show_habit_inner"/>
<View <View
android:id="@+id/toolbarShadow" android:id="@+id/toolbarShadow"
style="@style/ToolbarShadow"/> style="@style/ToolbarShadow"
android:layout_below="@id/toolbar"/>
<!-- Separate file so that we can use the layout editor to preview it --> </RelativeLayout>
<include layout="@layout/show_habit_inner"/>
</LinearLayout>

@ -23,6 +23,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/toolbar"
android:background="?windowBackgroundColor" android:background="?windowBackgroundColor"
android:clipToPadding="false" android:clipToPadding="false"
android:fillViewport="true" android:fillViewport="true"
@ -36,9 +37,9 @@
android:id="@+id/subtitleCard" android:id="@+id/subtitleCard"
style="@style/ShowHabit.Subtitle"/> style="@style/ShowHabit.Subtitle"/>
<!--<View--> <View
<!--android:id="@+id/headerShadow"--> android:id="@+id/headerShadow"
<!--style="@style/ToolbarShadow"/>--> style="@style/ToolbarShadow"/>
<org.isoron.uhabits.activities.habits.show.views.OverviewCard <org.isoron.uhabits.activities.habits.show.views.OverviewCard
android:id="@+id/overviewCard" android:id="@+id/overviewCard"

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
~
~ This file is part of Loop Habit Tracker.
~
~ Loop Habit Tracker is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by the
~ Free Software Foundation, either version 3 of the License, or (at your
~ option) any later version.
~
~ Loop Habit Tracker is distributed in the hope that it will be useful, but
~ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along
~ with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<resources>
<dimen name="progressbarOffset">-6dp</dimen>
</resources>

@ -29,6 +29,6 @@
<dimen name="smallerTextSize">12sp</dimen> <dimen name="smallerTextSize">12sp</dimen>
<dimen name="tinyTextSize">10sp</dimen> <dimen name="tinyTextSize">10sp</dimen>
<dimen name="habitNameWidth">160dp</dimen> <dimen name="habitNameWidth">160dp</dimen>
<dimen name="progressbarOffset">-10dp</dimen> <dimen name="progressbarOffset">-6dp</dimen>
<dimen name="checkmarkWidget_heightBreakpoint">55dp</dimen> <dimen name="checkmarkWidget_heightBreakpoint">55dp</dimen>
</resources> </resources>

@ -25,8 +25,9 @@
</style> </style>
<style name="ListHabits.Header"> <style name="ListHabits.Header">
<item name="android:background">?headerBackground</item> <item name="android:background">?headerBackgroundColor</item>
<item name="android:paddingRight">4dp</item> <item name="android:paddingRight">4dp</item>
<item name="android:gravity">end</item>
</style> </style>
<style name="ListHabits.Star"> <style name="ListHabits.Star">

Loading…
Cancel
Save