diff options
-rw-r--r-- | res/layout/fragment_pager_list.xml | 112 | ||||
-rw-r--r-- | res/values/dimens.xml | 1 | ||||
-rw-r--r-- | src/com/cyngn/theme/chooser/ThemeFragment.java | 16 |
3 files changed, 67 insertions, 62 deletions
diff --git a/res/layout/fragment_pager_list.xml b/res/layout/fragment_pager_list.xml index d84c5bf..31e1ca0 100644 --- a/res/layout/fragment_pager_list.xml +++ b/res/layout/fragment_pager_list.xml @@ -16,8 +16,9 @@ android:scrollbars="none" android:fillViewport="true" android:drawSelectorOnTop="false"> - <RelativeLayout - android:layout_width="wrap_content" + <LinearLayout + android:orientation="vertical" + android:layout_width="match_parent" android:layout_height="wrap_content"> <FrameLayout android:id="@+id/shadow_frame" @@ -49,6 +50,57 @@ android:background="@android:color/white"/> </FrameLayout> + <!-- Title card --> + <FrameLayout + android:id="@+id/title_card" + android:layout_width="@dimen/theme_preview_width" + android:layout_height="wrap_content" + android:layout_gravity="center_horizontal" + android:background="@drawable/card_themepreview_bg"> + <LinearLayout + android:id="@+id/title_layout" + android:layout_width="match_parent" + android:layout_height="@dimen/title_card_height" + android:alpha="0"> + <TextView + android:id="@+id/title" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:layout_marginStart="16dp" + android:gravity="center_vertical" + android:ellipsize="end" + android:singleLine="true" + android:textColor="#78000000"/> + + <ImageView + android:id="@+id/apply" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginRight="16dp" + android:src="@drawable/ic_theme_apply2"/> + + <ImageView + android:id="@+id/overflow" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_marginRight="8dp" + android:src="@drawable/ic_overflow_dark"/> + </LinearLayout> + <ProgressBar + android:id="@+id/apply_progress" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_gravity="center_vertical|right" + android:padding="@dimen/apply_progress_padding" + android:indeterminate="false" + android:max="100" + android:progress="0" + android:progressDrawable="@drawable/apply_progress_bar" + android:visibility="gone" + style="@android:style/Widget.ProgressBar.Horizontal"/> + </FrameLayout> + <!-- Each card in this layout should have a Space below it with one final Space for devices that have a navbar --> <LinearLayout @@ -56,8 +108,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" - android:layout_below="@id/shadow_frame" - android:layout_marginTop="@dimen/expanded_card_margin_top" + android:layout_marginTop="@dimen/additional_cards_margin_top" android:visibility="invisible"> <com.cyngn.theme.chooser.WallpaperCardView android:id="@+id/wallpaper_card" @@ -72,7 +123,6 @@ android:visibility="gone" android:layout_width="match_parent" android:layout_height="@dimen/wallpaper_card_height" - android:layout_below="@id/wallpaper_card" themes:labelText="@string/lockscreen_label" /> <Space android:layout_width="match_parent" @@ -103,56 +153,6 @@ android:layout_width="match_parent" android:layout_height="@*android:dimen/system_bar_height" /> </LinearLayout> - <FrameLayout - android:id="@+id/title_card" - android:layout_width="@dimen/theme_preview_width" - android:layout_height="wrap_content" - android:layout_below="@id/shadow_frame" - android:layout_centerHorizontal="true" - android:background="@drawable/card_themepreview_bg"> - <LinearLayout - android:id="@+id/title_layout" - android:layout_width="match_parent" - android:layout_height="@dimen/title_card_height" - android:alpha="0"> - <TextView - android:id="@+id/title" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_weight="1" - android:layout_marginStart="16dp" - android:gravity="center_vertical" - android:ellipsize="end" - android:singleLine="true" - android:textColor="#78000000"/> - - <ImageView - android:id="@+id/apply" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginRight="16dp" - android:src="@drawable/ic_theme_apply2"/> - - <ImageView - android:id="@+id/overflow" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginRight="8dp" - android:src="@drawable/ic_overflow_dark"/> - </LinearLayout> - <ProgressBar - android:id="@+id/apply_progress" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center_vertical|right" - android:padding="@dimen/apply_progress_padding" - android:indeterminate="false" - android:max="100" - android:progress="0" - android:progressDrawable="@drawable/apply_progress_bar" - android:visibility="gone" - style="@android:style/Widget.ProgressBar.Horizontal"/> - </FrameLayout> - </RelativeLayout> + </LinearLayout> </ScrollView> </LinearLayout>
\ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 1e2fbd7..49a6d9d 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -40,6 +40,7 @@ <dimen name="collapsed_icon_card_margin_top">48dp</dimen> <dimen name="collapsed_navbar_card_margin_top">25dp</dimen> <dimen name="expanded_card_margin_top">16dp</dimen> + <dimen name="additional_cards_margin_top">-36dp</dimen> <dimen name="wallpaper_card_height">168dp</dimen> <dimen name="title_card_height">48dp</dimen> diff --git a/src/com/cyngn/theme/chooser/ThemeFragment.java b/src/com/cyngn/theme/chooser/ThemeFragment.java index f6823ea..58c45af 100644 --- a/src/com/cyngn/theme/chooser/ThemeFragment.java +++ b/src/com/cyngn/theme/chooser/ThemeFragment.java @@ -735,6 +735,7 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb int[] location = new int[2]; mTitleCard.getLocationOnScreen(location); final int prevY = location[1]; + final int position = parent.indexOfChild(mTitleCard); final ViewTreeObserver observer = mScrollContent.getViewTreeObserver(); observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @@ -764,13 +765,16 @@ public class ThemeFragment extends Fragment implements LoaderManager.LoaderCallb .withEndAction(new Runnable() { public void run() { root.getOverlay().remove(mTitleCard); - parent.addView(mTitleCard); + parent.addView(mTitleCard, position); if (expand) { - mTitleCard.setVisibility(View.GONE); - } else if (applyTheme) { - // since the title card is the last animation when collapsing - // we will handle applying the theme, if applicable, here - applyTheme(); + mTitleCard.setVisibility(View.INVISIBLE); + } else { + mTitleCard.setVisibility(View.VISIBLE); + if (applyTheme) { + // The title card is the last animation when collapsing so + // we will handle applying the theme, if applicable, here + applyTheme(); + } } } }); |