From 8f260375b46bec8681a2618841aac6e205a0bdef Mon Sep 17 00:00:00 2001 From: Robert Lin Date: Wed, 6 Sep 2017 12:51:10 -0700 Subject: [PATCH] Revert "Fixes #98: Redesigned AppDetails page (#131)" This reverts commit 53717e49fbe9dd24fc564d8a5afe29658c5ea310. --- app/build.gradle | 2 +- .../screens/details/AppDetailsFragment.java | 35 +--- .../main/res/drawable/ic_close_white_24dp.xml | 9 - .../res/layout/fragment_appdetails_layout.xml | 174 ++++++++---------- app/src/main/res/menu/appdetails_fragment.xml | 3 +- app/src/main/res/values/strings.xml | 2 +- 6 files changed, 88 insertions(+), 137 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_close_white_24dp.xml diff --git a/app/build.gradle b/app/build.gradle index 5b00ef3..ffede2a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -155,7 +155,7 @@ tasks.withType(Test) { systemProperty "robolectric.logging", "stdout" } ext { - supportLibVersion = '25.3.1' + supportLibVersion = '25.1.0' } //noinspection GroovyAssignabilityCheck configurations.all { diff --git a/app/src/main/java/subreddit/android/appstore/screens/details/AppDetailsFragment.java b/app/src/main/java/subreddit/android/appstore/screens/details/AppDetailsFragment.java index 3984aef..410473f 100644 --- a/app/src/main/java/subreddit/android/appstore/screens/details/AppDetailsFragment.java +++ b/app/src/main/java/subreddit/android/appstore/screens/details/AppDetailsFragment.java @@ -9,8 +9,6 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.customtabs.CustomTabsIntent; -import android.support.design.widget.AppBarLayout; -import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.FloatingActionButton; import android.support.v4.content.ContextCompat; import android.support.v4.view.ViewPager; @@ -56,19 +54,16 @@ public class AppDetailsFragment extends BasePresenterFragment implements AppDetailsContract.View, ScreenshotsAdapter.ScreenshotClickedListener, View.OnClickListener, Toolbar.OnMenuItemClickListener { + @BindView(R.id.description) TextView description; + @BindView(R.id.tag_container) FlowLayout tagContainer; @BindView(R.id.download_fab) FloatingActionButton downloadButton; @BindView(R.id.details_toolbar) Toolbar toolbar; - @BindView(R.id.collapsingToolbar) CollapsingToolbarLayout collapsingToolbar; - @BindView(R.id.appbar) AppBarLayout appBar; - @BindView(R.id.icon_frame) View iconFrame; @BindView(R.id.icon_image) ImageView iconImage; @BindView(R.id.icon_placeholder) View iconPlaceholder; + @BindView(R.id.title_primary) TextView primaryTitle; @BindView(R.id.title_secondary) TextView secondaryTitle; - @BindView(R.id.tag_container) FlowLayout tagContainer; - @BindView(R.id.screenshot_pager) ViewPager screenshotPager; - @BindView(R.id.description) TextView description; private static final String REDDIT_MSG_URL_HEADER="https://www.reddit.com/message/compose/?to=/r/Android&subject=**RAS Flag Report**&message="; @@ -121,7 +116,7 @@ public void onClick(DialogInterface dialogInterface, int i) { if (flagMessage.getText().toString().isEmpty()) { Toast.makeText(getContext(), getContext().getResources().getString(R.string.no_message), Toast.LENGTH_LONG).show(); } else { - openInChrome(REDDIT_MSG_URL_HEADER + "*****" + collapsingToolbar.getTitle() +" REPORT" + "*****" + "%0A" +(flagMessage.getText().toString().trim())); + openInChrome(REDDIT_MSG_URL_HEADER + "*****" + toolbar.getSubtitle() +" REPORT" + "*****" + "%0A" +(flagMessage.getText().toString().trim())); } } }) @@ -137,23 +132,13 @@ public void onClick(DialogInterface dialogInterface, int i) { public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.fragment_appdetails_layout, container, false); unbinder = ButterKnife.bind(this, layout); - toolbar.setContentInsetStartWithNavigation(0); - - appBar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { - @Override - public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { - float scrollRange = (float) appBarLayout.getTotalScrollRange(); - fadeHeaderItems(scrollRange, verticalOffset); - } - }); - return layout; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); - toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp); + toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_48px); toolbar.setNavigationOnClickListener(this); toolbar.inflateMenu(R.menu.appdetails_fragment); toolbar.setOnMenuItemClickListener(this); @@ -238,7 +223,7 @@ public void displayDetails(@Nullable AppInfo appInfo) { getActivity().finish(); return; } - collapsingToolbar.setTitle(appInfo.getAppName()); + primaryTitle.setText(appInfo.getAppName()); secondaryTitle.setText(appInfo.getSecondaryCategory()); downloads = new ArrayList<>(appInfo.getDownloads()); contacts = new ArrayList<>(appInfo.getContacts()); @@ -260,6 +245,7 @@ public void displayDetails(@Nullable AppInfo appInfo) { tagContainer.addView(tv); } tagContainer.setVisibility(appInfo.getTags().isEmpty() ? View.GONE : View.VISIBLE); + toolbar.setSubtitle(appInfo.getAppName()); createMenus(); } @@ -331,11 +317,4 @@ public void displayIcon(@Nullable AppInfo appInfo) { public void onScreenshotClicked(String url) { new ScreenshotDialog(getContext(), screenshotUrls, screenshotUrls.indexOf(url)).show(); } - - private void fadeHeaderItems(float scrollRange, int verticalOffset) { - float fadeFactor = 1.0f - Math.abs(2 * verticalOffset / scrollRange); - secondaryTitle.setAlpha(fadeFactor); - tagContainer.setAlpha(fadeFactor); - iconFrame.setAlpha(fadeFactor); - } } diff --git a/app/src/main/res/drawable/ic_close_white_24dp.xml b/app/src/main/res/drawable/ic_close_white_24dp.xml deleted file mode 100644 index 1e2d044..0000000 --- a/app/src/main/res/drawable/ic_close_white_24dp.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/src/main/res/layout/fragment_appdetails_layout.xml b/app/src/main/res/layout/fragment_appdetails_layout.xml index 98d8540..047bf33 100644 --- a/app/src/main/res/layout/fragment_appdetails_layout.xml +++ b/app/src/main/res/layout/fragment_appdetails_layout.xml @@ -1,141 +1,121 @@ - - - + + + android:layout_height="match_parent" + android:orientation="vertical"> - - - + android:background="@color/colorPrimary" + android:theme="@style/AppTheme.Dark" + app:title="@string/screen_details"/> + + + + + + + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal" + android:padding="16dp"> + android:layout_width="40dp" + android:layout_height="40dp" + android:layout_gravity="top" + android:layout_marginEnd="16dp" + android:layout_marginRight="16dp" + android:visibility="gone"> + + - - - - + android:orientation="vertical"> - - + - + + + - + - + android:padding="16dp" + tools:text="Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."/> - - - - - - - - + + + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/menu/appdetails_fragment.xml b/app/src/main/res/menu/appdetails_fragment.xml index 7312725..de019ce 100644 --- a/app/src/main/res/menu/appdetails_fragment.xml +++ b/app/src/main/res/menu/appdetails_fragment.xml @@ -3,8 +3,9 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> + app:showAsAction="always"/> Filter Search Details - Contact developer + Contact Download Google Play F-Droid