Mholloway has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/373693 )
Change subject: Update Offline Library tutorial to have per-screen backgrounds ...................................................................... Update Offline Library tutorial to have per-screen backgrounds Updates the generic onboarding activity components as needed to implement the current design. Adds an optional styleable declaration for an onboarding screen background drawable. Adds per-screen background gradients as specified on the ticket. Bug: T172185 Change-Id: I5aa8e76b0884f0e7a9a25376ac93e1283b580116 --- M app/src/main/java/org/wikipedia/offline/OfflineTutorialActivity.java M app/src/main/java/org/wikipedia/offline/OfflineTutorialFragment.java M app/src/main/java/org/wikipedia/onboarding/OnboardingPageView.java A app/src/main/res/drawable/onboarding_gradient_background_offline_one.xml A app/src/main/res/drawable/onboarding_gradient_background_offline_three.xml A app/src/main/res/drawable/onboarding_gradient_background_offline_two.xml M app/src/main/res/layout/fragment_onboarding_pager.xml M app/src/main/res/layout/inflate_offline_tutorial_page_one.xml M app/src/main/res/layout/inflate_offline_tutorial_page_three.xml M app/src/main/res/layout/inflate_offline_tutorial_page_two.xml M app/src/main/res/layout/view_onboarding_page.xml M app/src/main/res/values/attrs.xml 12 files changed, 102 insertions(+), 65 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/93/373693/1 diff --git a/app/src/main/java/org/wikipedia/offline/OfflineTutorialActivity.java b/app/src/main/java/org/wikipedia/offline/OfflineTutorialActivity.java index d531b87..6033b7d 100644 --- a/app/src/main/java/org/wikipedia/offline/OfflineTutorialActivity.java +++ b/app/src/main/java/org/wikipedia/offline/OfflineTutorialActivity.java @@ -2,10 +2,11 @@ import android.content.Context; import android.content.Intent; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; +import android.view.WindowManager; -import org.wikipedia.R; import org.wikipedia.activity.SingleFragmentActivity; import org.wikipedia.onboarding.OnboardingFragment; @@ -18,7 +19,9 @@ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setStatusBarColor(R.color.green30); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + } } @Override diff --git a/app/src/main/java/org/wikipedia/offline/OfflineTutorialFragment.java b/app/src/main/java/org/wikipedia/offline/OfflineTutorialFragment.java index d51fcfc..6d689d1 100644 --- a/app/src/main/java/org/wikipedia/offline/OfflineTutorialFragment.java +++ b/app/src/main/java/org/wikipedia/offline/OfflineTutorialFragment.java @@ -1,12 +1,7 @@ package org.wikipedia.offline; -import android.os.Bundle; import android.support.annotation.NonNull; -import android.support.v4.content.ContextCompat; import android.support.v4.view.PagerAdapter; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; import org.wikipedia.R; import org.wikipedia.onboarding.OnboardingFragment; @@ -15,13 +10,6 @@ @NonNull public static OfflineTutorialFragment newInstance() { return new OfflineTutorialFragment(); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = super.onCreateView(inflater, container, savedInstanceState); - view.setBackground(ContextCompat.getDrawable(getContext(), R.drawable.onboarding_gradient_background_90)); - return view; } @Override diff --git a/app/src/main/java/org/wikipedia/onboarding/OnboardingPageView.java b/app/src/main/java/org/wikipedia/onboarding/OnboardingPageView.java index d7060ac..57347fa 100644 --- a/app/src/main/java/org/wikipedia/onboarding/OnboardingPageView.java +++ b/app/src/main/java/org/wikipedia/onboarding/OnboardingPageView.java @@ -99,7 +99,11 @@ String tertiaryText = array.getString(R.styleable.OnboardingPageView_tertiaryText); String switchText = array.getString(R.styleable.OnboardingPageView_switchText); int imageSize = array.getDimensionPixelSize(R.styleable.OnboardingPageView_imageSize, 0); + Drawable background = array.getDrawable(R.styleable.OnboardingPageView_background); + if (background != null) { + setBackground(background); + } FrameLayout.LayoutParams imageParams = (FrameLayout.LayoutParams) imageViewCentered.getLayoutParams(); imageParams.width = imageSize; imageParams.height = imageSize; diff --git a/app/src/main/res/drawable/onboarding_gradient_background_offline_one.xml b/app/src/main/res/drawable/onboarding_gradient_background_offline_one.xml new file mode 100644 index 0000000..358cfa0 --- /dev/null +++ b/app/src/main/res/drawable/onboarding_gradient_background_offline_one.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <gradient + android:startColor="@color/accent30" + android:centerColor="@color/green30" + android:endColor="@color/green50" + android:angle="90"/> +</shape> \ No newline at end of file diff --git a/app/src/main/res/drawable/onboarding_gradient_background_offline_three.xml b/app/src/main/res/drawable/onboarding_gradient_background_offline_three.xml new file mode 100644 index 0000000..62951cf --- /dev/null +++ b/app/src/main/res/drawable/onboarding_gradient_background_offline_three.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <gradient + android:startColor="@color/green30" + android:centerColor="@color/green50" + android:endColor="@color/accent50" + android:angle="90"/> +</shape> \ No newline at end of file diff --git a/app/src/main/res/drawable/onboarding_gradient_background_offline_two.xml b/app/src/main/res/drawable/onboarding_gradient_background_offline_two.xml new file mode 100644 index 0000000..cdd5bef --- /dev/null +++ b/app/src/main/res/drawable/onboarding_gradient_background_offline_two.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<shape xmlns:android="http://schemas.android.com/apk/res/android" + android:shape="rectangle"> + <gradient + android:startColor="@color/green30" + android:centerColor="@color/accent50" + android:endColor="@color/accent30" + android:angle="90"/> +</shape> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_onboarding_pager.xml b/app/src/main/res/layout/fragment_onboarding_pager.xml index dc5bdce..c2e482d 100644 --- a/app/src/main/res/layout/fragment_onboarding_pager.xml +++ b/app/src/main/res/layout/fragment_onboarding_pager.xml @@ -1,74 +1,80 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" - android:background="@drawable/onboarding_gradient_background_135"> + android:orientation="vertical"> <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_pager" android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_weight="1"/> + android:layout_height="match_parent"/> - <View + <LinearLayout android:layout_width="match_parent" - android:layout_height="0.5dp" - android:background="@color/white_translucent_40"/> + android:layout_height="wrap_content" + android:orientation="vertical" + android:layout_gravity="bottom"> - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:id="@+id/fragment_onboarding_skip_button" - style="@style/Widget.AppCompat.Button.Borderless" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="0dp" - android:text="@string/onboarding_skip" - android:textColor="@android:color/white" /> - - <com.rd.PageIndicatorView - android:id="@+id/view_onboarding_page_indicator" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - app:piv_radius="4dp" - app:piv_selectedColor="@android:color/white" - app:piv_unselectedColor="@color/white_translucent_40" - app:piv_viewPager="@id/fragment_pager" /> + <View + android:layout_width="match_parent" + android:layout_height="0.5dp" + android:background="@color/white_translucent_40"/> <FrameLayout - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="end|center_vertical"> - - <ImageView - android:id="@+id/fragment_onboarding_forward_button" - android:layout_width="40dp" - android:layout_height="40dp" - android:layout_gravity="end|center_vertical" - app:srcCompat="@drawable/ic_chevron_forward_white_24dp" - android:scaleType="center" - android:clickable="true" - android:background="?attr/selectableItemBackgroundBorderless" - android:contentDescription="@string/onboarding_continue"/> + android:layout_width="match_parent" + android:layout_height="wrap_content"> <TextView - android:id="@+id/fragment_onboarding_done_button" + android:id="@+id/fragment_onboarding_skip_button" style="@style/Widget.AppCompat.Button.Borderless" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="0dp" - android:text="@string/onboarding_get_started" + android:text="@string/onboarding_skip" android:textColor="@android:color/white" /> + + <com.rd.PageIndicatorView + android:id="@+id/view_onboarding_page_indicator" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + app:piv_radius="4dp" + app:piv_selectedColor="@android:color/white" + app:piv_unselectedColor="@color/white_translucent_40" + app:piv_viewPager="@id/fragment_pager" /> + + <FrameLayout + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="end|center_vertical"> + + <ImageView + android:id="@+id/fragment_onboarding_forward_button" + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_gravity="end|center_vertical" + app:srcCompat="@drawable/ic_chevron_forward_white_24dp" + android:scaleType="center" + android:clickable="true" + android:background="?attr/selectableItemBackgroundBorderless" + android:contentDescription="@string/onboarding_continue"/> + + <TextView + android:id="@+id/fragment_onboarding_done_button" + style="@style/Widget.AppCompat.Button.Borderless" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="0dp" + android:text="@string/onboarding_get_started" + android:textColor="@android:color/white" /> + + </FrameLayout> </FrameLayout> - </FrameLayout> + </LinearLayout> -</LinearLayout> \ No newline at end of file +</FrameLayout> \ No newline at end of file diff --git a/app/src/main/res/layout/inflate_offline_tutorial_page_one.xml b/app/src/main/res/layout/inflate_offline_tutorial_page_one.xml index 427247e..e65dd41 100644 --- a/app/src/main/res/layout/inflate_offline_tutorial_page_one.xml +++ b/app/src/main/res/layout/inflate_offline_tutorial_page_one.xml @@ -8,4 +8,5 @@ app:centeredImage="@drawable/ic_illustration_offlinelib_useredu_1" app:imageSize="240dp" app:primaryText="@string/offline_library_onboarding_build_library_title" - app:secondaryText="@string/offline_library_onboarding_build_library_subtitle" /> \ No newline at end of file + app:secondaryText="@string/offline_library_onboarding_build_library_subtitle" + app:background="@drawable/onboarding_gradient_background_offline_one"/> \ No newline at end of file diff --git a/app/src/main/res/layout/inflate_offline_tutorial_page_three.xml b/app/src/main/res/layout/inflate_offline_tutorial_page_three.xml index 1a61326..3e99525 100644 --- a/app/src/main/res/layout/inflate_offline_tutorial_page_three.xml +++ b/app/src/main/res/layout/inflate_offline_tutorial_page_three.xml @@ -8,4 +8,5 @@ app:centeredImage="@drawable/ic_illustration_offlinelib_useredu_3" app:imageSize="240dp" app:primaryText="@string/offline_library_onboarding_store_knowledge_title" - app:secondaryText="@string/offline_library_onboarding_store_knowledge_subtitle" /> \ No newline at end of file + app:secondaryText="@string/offline_library_onboarding_store_knowledge_subtitle" + app:background="@drawable/onboarding_gradient_background_offline_three"/> \ No newline at end of file diff --git a/app/src/main/res/layout/inflate_offline_tutorial_page_two.xml b/app/src/main/res/layout/inflate_offline_tutorial_page_two.xml index efc41e1..8988200 100644 --- a/app/src/main/res/layout/inflate_offline_tutorial_page_two.xml +++ b/app/src/main/res/layout/inflate_offline_tutorial_page_two.xml @@ -8,4 +8,5 @@ app:centeredImage="@drawable/ic_illustration_offlinelib_useredu_2" app:imageSize="240dp" app:primaryText="@string/offline_library_onboarding_uninterrupted_reading_title" - app:secondaryText="@string/offline_library_onboarding_uninterrupted_reading_subtitle" /> \ No newline at end of file + app:secondaryText="@string/offline_library_onboarding_uninterrupted_reading_subtitle" + app:background="@drawable/onboarding_gradient_background_offline_two"/> \ No newline at end of file diff --git a/app/src/main/res/layout/view_onboarding_page.xml b/app/src/main/res/layout/view_onboarding_page.xml index 19ace12..6d90c68 100644 --- a/app/src/main/res/layout/view_onboarding_page.xml +++ b/app/src/main/res/layout/view_onboarding_page.xml @@ -99,4 +99,9 @@ </LinearLayout> + <!-- Bottom control offset --> + <View + android:layout_width="match_parent" + android:layout_height="48dp"/> + </merge> \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 639aaf5..15084fa 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -72,5 +72,6 @@ <attr name="tertiaryText" format="string" /> <attr name="switchText" format="string" /> <attr name="imageSize" format="dimension" /> + <attr name="background" format="reference" /> </declare-styleable> </resources> \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/373693 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5aa8e76b0884f0e7a9a25376ac93e1283b580116 Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Mholloway <mhollo...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits