Merge branch 'left-padding' into 'master'
Add left padding on first screenshot to match header See merge request fdroid/fdroidclient!851
This commit is contained in:
commit
7c0cb2064e
@ -6,6 +6,7 @@ import android.content.Context;
|
|||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.annotation.DrawableRes;
|
import android.support.annotation.DrawableRes;
|
||||||
@ -719,11 +720,13 @@ public class AppDetailsRecyclerViewAdapter
|
|||||||
private class ScreenShotsViewHolder extends AppDetailsViewHolder
|
private class ScreenShotsViewHolder extends AppDetailsViewHolder
|
||||||
implements ScreenShotsRecyclerViewAdapter.Listener {
|
implements ScreenShotsRecyclerViewAdapter.Listener {
|
||||||
final RecyclerView recyclerView;
|
final RecyclerView recyclerView;
|
||||||
LinearLayoutManagerSnapHelper snapHelper;
|
ItemDecorator itemDecorator;
|
||||||
|
|
||||||
ScreenShotsViewHolder(View view) {
|
ScreenShotsViewHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
recyclerView = (RecyclerView) view.findViewById(R.id.screenshots);
|
recyclerView = view.findViewById(R.id.screenshots);
|
||||||
|
itemDecorator = new ItemDecorator(context);
|
||||||
|
recyclerView.addItemDecoration(itemDecorator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -734,17 +737,31 @@ public class AppDetailsRecyclerViewAdapter
|
|||||||
recyclerView.setAdapter(adapter);
|
recyclerView.setAdapter(adapter);
|
||||||
recyclerView.setHasFixedSize(true);
|
recyclerView.setHasFixedSize(true);
|
||||||
recyclerView.setNestedScrollingEnabled(false);
|
recyclerView.setNestedScrollingEnabled(false);
|
||||||
if (snapHelper != null) {
|
|
||||||
snapHelper.attachToRecyclerView(null);
|
|
||||||
}
|
|
||||||
snapHelper = new LinearLayoutManagerSnapHelper(lm);
|
|
||||||
snapHelper.attachToRecyclerView(recyclerView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScreenshotClick(int position) {
|
public void onScreenshotClick(int position) {
|
||||||
context.startActivity(ScreenShotsActivity.getStartIntent(context, app.packageName, position));
|
context.startActivity(ScreenShotsActivity.getStartIntent(context, app.packageName, position));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ItemDecorator extends RecyclerView.ItemDecoration {
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
|
ItemDecorator(Context context) {
|
||||||
|
this.context = context.getApplicationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||||
|
int position = parent.getChildAdapterPosition(view);
|
||||||
|
int padding = (int) context.getResources().getDimension(R.dimen.details_activity_padding_screenshot);
|
||||||
|
if (position == 0) {
|
||||||
|
outRect.set(padding, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
|
||||||
|
} else {
|
||||||
|
outRect.set(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DonateViewHolder extends AppDetailsViewHolder {
|
private class DonateViewHolder extends AppDetailsViewHolder {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout 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"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
tools:context="org.fdroid.fdroid.views.AppDetailsActivity"
|
tools:context="org.fdroid.fdroid.views.AppDetailsActivity"
|
||||||
android:background="?attr/appDetailsBackground"
|
android:background="?attr/appDetailsBackground"
|
||||||
android:id="@+id/rootCoordinator">
|
android:id="@+id/rootCoordinator">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:id="@+id/app_bar"
|
android:id="@+id/app_bar"
|
||||||
@ -41,12 +41,10 @@
|
|||||||
app:popupTheme="@style/AppThemeLight.PopupOverlay" />
|
app:popupTheme="@style/AppThemeLight.PopupOverlay" />
|
||||||
|
|
||||||
</android.support.design.widget.CollapsingToolbarLayout>
|
</android.support.design.widget.CollapsingToolbarLayout>
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v7.widget.RecyclerView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/rvDetails"
|
android:id="@+id/rvDetails"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
<dimen name="material_listitem_height">48dp</dimen>
|
<dimen name="material_listitem_height">48dp</dimen>
|
||||||
<dimen name="app_bar_height">180dp</dimen>
|
<dimen name="app_bar_height">180dp</dimen>
|
||||||
<dimen name="details_activity_padding">16dp</dimen>
|
<dimen name="details_activity_padding">16dp</dimen>
|
||||||
|
<dimen name="details_activity_padding_screenshot">14dp</dimen>
|
||||||
|
|
||||||
<dimen name="details_activity__collapsable_lists__padding__vertical">3dp</dimen>
|
<dimen name="details_activity__collapsable_lists__padding__vertical">3dp</dimen>
|
||||||
<!-- This is in addition to the padding that almost all items in the app details screen have
|
<!-- This is in addition to the padding that almost all items in the app details screen have
|
||||||
|
Loading…
x
Reference in New Issue
Block a user