Skip to content

Commit

Permalink
refactor layouts; nextprev, timecard
Browse files Browse the repository at this point in the history
refactored nextprev buttons to separate layout file. refactored
"timecard" to separate layout file. cleanup layout_main. next/prev
buttons moved to bottom right. related to #43 .
  • Loading branch information
forrestguice committed Aug 21, 2016
1 parent dee9b96 commit 26238f2
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 176 deletions.
35 changes: 6 additions & 29 deletions app/src/main/res/layout-land/layout_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,47 +83,24 @@

<ViewFlipper
android:id="@+id/info_time_flipper"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="15dp" android:layout_marginStart="15dp"
android:elevation="5dp"
tools:ignore="UnusedAttribute">


<LinearLayout
style="@style/SunsetTimeCard"
android:id="@+id/info_time_all_today" android:layout_width="wrap_content">

<include layout="@layout/info_time_all" />

<LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">

<include layout="@layout/info_time_daylength" />
</LinearLayout>

android:layout_width="match_parent" android:layout_height="wrap_content"
android:id="@+id/info_time_all_today">
<include layout="@layout/info_time_card"/>
</LinearLayout>


<LinearLayout
style="@style/SunsetTimeCard"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:id="@+id/info_time_all_tomorrow">

<include layout="@layout/info_time_all" />

<LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">

<include layout="@layout/info_time_daylength" />
</LinearLayout>

<include layout="@layout/info_time_card"/>
</LinearLayout>


</ViewFlipper>

</LinearLayout>
Expand Down
33 changes: 2 additions & 31 deletions app/src/main/res/layout-v14/info_time_all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="6"
android:columnCount="3"
android:useDefaultMargins="true">

<!-- Table Head (Date) -->
Expand Down Expand Up @@ -225,7 +225,7 @@

<LinearLayout style="@style/SunsetTimeLayout"
android:layout_row="5" android:layout_column="0" android:layout_columnSpan="3">
<View android:layout_width="260dp" style="@style/SunsetTimeHorizontalRule" />
<View android:layout_width="240dp" style="@style/SunsetTimeHorizontalRule" />
</LinearLayout>


Expand Down Expand Up @@ -255,34 +255,5 @@

</GridLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:paddingTop="10dp">

<View
android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" />

<ImageButton
android:id="@+id/info_time_prevbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:src="?attr/icActionPrevious"
android:background="@drawable/ic_transparent"
android:contentDescription="@string/prevDay" />

<ImageButton
android:id="@+id/info_time_nextbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:src="?attr/icActionNext"
android:background="@drawable/ic_transparent"
android:contentDescription="@string/nextDay" />

</LinearLayout>

</LinearLayout>
</merge>
94 changes: 12 additions & 82 deletions app/src/main/res/layout/info_time_all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,68 +24,26 @@
android:orientation="vertical">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="3dp" android:paddingBottom="3dp">

<!-- Table Head (Date) -->
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:minWidth="125dp">

<TextView
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:id="@+id/text_date"
tools:text="Today\nApril 1, 2016"

android:textStyle="bold"
android:layout_gravity="bottom"
android:textSize="16sp"
android:textColor="@drawable/btn_datetxt" />

android:layout_gravity="bottom">
<include layout="@layout/table_colhead_date" />
</LinearLayout>

<LinearLayout android:layout_width="75dp" android:layout_height="wrap_content"
android:orientation="horizontal" android:gravity="right"
android:layout_gravity="bottom|end"
android:paddingTop="3dp" android:paddingBottom="3dp"
tools:ignore="RtlHardcoded">

<TextView style="@style/SunsetTimeTextView"
android:textColor="@color/sunIcon_color_rising"
android:text="@string/sunrise_short"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textStyle="bold"/>

<ImageView
style="@style/SunsetTimeImageView"
android:id="@+id/icon_time_sunrise"
android:background="@drawable/ic_sunrise"
android:layout_gravity="center"
android:layout_margin="5dp"
tools:ignore="contentDescription" />

<!-- Table Head (Rise) -->
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom">
<include layout="@layout/table_colhead_rise"/>
</LinearLayout>

<LinearLayout android:layout_height="wrap_content" android:layout_width="75dp"
android:orientation="horizontal" android:gravity="right"
android:layout_gravity="bottom|end"
tools:ignore="RtlHardcoded">

<ImageView
style="@style/SunsetTimeImageView"
android:id="@+id/icon_time_sunset"
android:background="@drawable/ic_sunset"
android:layout_gravity="center"
android:layout_margin="5dp"
tools:ignore="contentDescription" />

<TextView style="@style/SunsetTimeTextView"
android:textColor="@color/sunIcon_color_setting"
android:text="@string/sunset_short"
android:textSize="16sp"
android:textStyle="bold"/>

<!-- Table Head (Set) -->
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom">
<include layout="@layout/table_colhead_set"/>
</LinearLayout>
</LinearLayout>

Expand Down Expand Up @@ -353,34 +311,6 @@

</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:paddingTop="10dp">

<View
android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" />

<ImageButton
android:id="@+id/info_time_prevbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:src="?attr/icActionPrevious"
android:background="@drawable/ic_transparent"
android:contentDescription="@string/prevDay" />

<ImageButton
android:id="@+id/info_time_nextbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:src="?attr/icActionNext"
android:background="@drawable/ic_transparent"
android:contentDescription="@string/nextDay" />

</LinearLayout>

</LinearLayout>
</merge>
33 changes: 33 additions & 0 deletions app/src/main/res/layout/info_time_card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<RelativeLayout style="@style/SunsetTimeCard" android:layout_width="match_parent" android:layout_height="wrap_content">

<LinearLayout android:id="@+id/cardContent"
style="@style/SunsetTimeCard" android:layout_width="match_parent">

<!-- rise/set table -->
<include layout="@layout/info_time_all"/>

<!-- day length -->
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp" android:animateLayoutChanges="true">
<include layout="@layout/info_time_daylength"/>
</LinearLayout>

<!-- next/prev buttons -->

</LinearLayout>

<FrameLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@id/cardContent" android:layout_alignRight="@id/cardContent">
<include layout="@layout/info_time_nextprev" />
</FrameLayout>


</RelativeLayout>
</merge>
28 changes: 28 additions & 0 deletions app/src/main/res/layout/info_time_nextprev.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<LinearLayout android:orientation="horizontal"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end">

<View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1"/>

<ImageButton
android:id="@+id/info_time_prevbtn"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end"
android:src="?attr/icActionPrevious"
android:background="@drawable/ic_transparent"
android:contentDescription="@string/prevDay"/>

<ImageButton
android:id="@+id/info_time_nextbtn"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end"
android:src="?attr/icActionNext"
android:background="@drawable/ic_transparent"
android:contentDescription="@string/nextDay"/>

</LinearLayout>
</merge>
45 changes: 11 additions & 34 deletions app/src/main/res/layout/layout_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical" >

<!-- Action Bar -->
<android.support.v7.widget.Toolbar
android:id="@+id/app_menubar"
android:layout_width="match_parent"
Expand All @@ -41,8 +42,10 @@
android:animateLayoutChanges="true"
tools:ignore="UnusedAttribute">

<!-- Clock -->
<include layout="@layout/info_time_now" />

<!-- Flipper: Note -->
<FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content">

<ViewFlipper
Expand Down Expand Up @@ -84,54 +87,28 @@

</LinearLayout>

<!-- Flipper: Time Card -->
<ViewFlipper
android:id="@+id/info_time_flipper"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:elevation="5dp"
tools:ignore="UnusedAttribute">

<!-- Times for Today -->
<LinearLayout
style="@style/SunsetTimeCard"
android:id="@+id/info_time_all_today"
android:layout_width="wrap_content"
android:animateLayoutChanges="true"
android:layout_width="match_parent" android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">

<include layout="@layout/info_time_all" />

<LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:animateLayoutChanges="true"
tools:ignore="UnusedAttribute">

<include layout="@layout/info_time_daylength" />
</LinearLayout>

<include layout="@layout/info_time_card"/>
</LinearLayout>


<!-- Times for Tomorrow -->
<LinearLayout
style="@style/SunsetTimeCard"
android:id="@+id/info_time_all_tomorrow"
android:animateLayoutChanges="true"
android:layout_width="match_parent" android:layout_height="wrap_content"
tools:ignore="UnusedAttribute">

<include layout="@layout/info_time_all" />

<LinearLayout
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical"
android:animateLayoutChanges="true"
tools:ignore="UnusedAttribute">

<include layout="@layout/info_time_daylength" />

</LinearLayout>

<include layout="@layout/info_time_card"/>
</LinearLayout>

</ViewFlipper>
Expand Down

0 comments on commit 26238f2

Please sign in to comment.