Merge branch 'nearby-view' into 'master'
Improve nearby swap splash layout See merge request fdroid/fdroidclient!800
This commit is contained in:
		
						commit
						765bd2892d
					
				@ -204,7 +204,7 @@ public class MainActivityEspressoTest {
 | 
			
		||||
                allOf(withText(R.string.main_menu__swap_nearby), isDisplayed()));
 | 
			
		||||
        nearbyBottonNavButton.perform(click());
 | 
			
		||||
        ViewInteraction findPeopleButton = onView(
 | 
			
		||||
                allOf(withId(R.id.button), withText(R.string.nearby_splash__find_people_button), isDisplayed()));
 | 
			
		||||
                allOf(withId(R.id.find_people_button), withText(R.string.nearby_splash__find_people_button), isDisplayed()));
 | 
			
		||||
        findPeopleButton.perform(click());
 | 
			
		||||
        onView(withText(R.string.swap_send_fdroid)).check(matches(isDisplayed()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -58,13 +58,13 @@ class NearbyViewBinder {
 | 
			
		||||
    NearbyViewBinder(final Activity activity, FrameLayout parent) {
 | 
			
		||||
        View swapView = activity.getLayoutInflater().inflate(R.layout.main_tab_swap, parent, true);
 | 
			
		||||
 | 
			
		||||
        TextView subtext = swapView.findViewById(R.id.text2);
 | 
			
		||||
        TextView subtext = swapView.findViewById(R.id.both_parties_need_fdroid_text);
 | 
			
		||||
        subtext.setText(activity.getString(R.string.nearby_splash__both_parties_need_fdroid,
 | 
			
		||||
                activity.getString(R.string.app_name)));
 | 
			
		||||
 | 
			
		||||
        ImageView nearbySplash = swapView.findViewById(R.id.image);
 | 
			
		||||
 | 
			
		||||
        Button startButton = swapView.findViewById(R.id.button);
 | 
			
		||||
        Button startButton = swapView.findViewById(R.id.find_people_button);
 | 
			
		||||
        startButton.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
@ -110,9 +110,10 @@ class NearbyViewBinder {
 | 
			
		||||
                || PackageManager.PERMISSION_GRANTED
 | 
			
		||||
                != ContextCompat.checkSelfPermission(activity, writeExternalStorage)) {
 | 
			
		||||
            nearbySplash.setVisibility(View.GONE);
 | 
			
		||||
            View readExternalStorage = swapView.findViewById(R.id.readExternalStorage);
 | 
			
		||||
            readExternalStorage.setVisibility(View.VISIBLE);
 | 
			
		||||
            Button requestReadExternalStorage = swapView.findViewById(R.id.requestReadExternalStorage);
 | 
			
		||||
            TextView readExternalStorageText = swapView.findViewById(R.id.read_external_storage_text);
 | 
			
		||||
            readExternalStorageText.setVisibility(View.VISIBLE);
 | 
			
		||||
            Button requestReadExternalStorage = swapView.findViewById(R.id.request_read_external_storage_button);
 | 
			
		||||
            requestReadExternalStorage.setVisibility(View.VISIBLE);
 | 
			
		||||
            requestReadExternalStorage.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
                @RequiresApi(api = 21)
 | 
			
		||||
                @Override
 | 
			
		||||
 | 
			
		||||
@ -1,102 +1,97 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<android.support.constraint.ConstraintLayout
 | 
			
		||||
    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:layout_width="match_parent"
 | 
			
		||||
    android:layout_height="match_parent"
 | 
			
		||||
    android:background="?attr/mainTabSwapBackground">
 | 
			
		||||
 | 
			
		||||
    <TextView
 | 
			
		||||
        android:id="@+id/text1"
 | 
			
		||||
        android:layout_width="0dp"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:layout_marginEnd="48dp"
 | 
			
		||||
        android:layout_marginLeft="48dp"
 | 
			
		||||
        android:layout_marginRight="48dp"
 | 
			
		||||
        android:layout_marginStart="48dp"
 | 
			
		||||
        android:layout_marginTop="48dp"
 | 
			
		||||
        android:text="@string/nearby_splash__download_apps_from_people_nearby"
 | 
			
		||||
        android:textAlignment="center"
 | 
			
		||||
        android:gravity="center"
 | 
			
		||||
        android:textSize="20sp"
 | 
			
		||||
        android:textColor="?attr/lightGrayTextColor"
 | 
			
		||||
        app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
        app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
        app:layout_constraintTop_toTopOf="parent" />
 | 
			
		||||
 | 
			
		||||
    <Button
 | 
			
		||||
        android:id="@+id/button"
 | 
			
		||||
        android:layout_width="wrap_content"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:text="@string/nearby_splash__find_people_button"
 | 
			
		||||
        style="@style/DetailsSecondaryButtonStyle"
 | 
			
		||||
        app:layout_constraintTop_toBottomOf="@+id/text1"
 | 
			
		||||
        app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
        app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
        android:layout_marginTop="24dp" />
 | 
			
		||||
 | 
			
		||||
    <TextView
 | 
			
		||||
        android:id="@+id/text2"
 | 
			
		||||
        android:layout_width="wrap_content"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        tools:text="@string/nearby_splash__both_parties_need_fdroid"
 | 
			
		||||
        android:textSize="15sp"
 | 
			
		||||
        android:textAlignment="center"
 | 
			
		||||
        android:gravity="center"
 | 
			
		||||
        android:textColor="?attr/lightGrayTextColor"
 | 
			
		||||
        app:layout_constraintTop_toBottomOf="@+id/button"
 | 
			
		||||
        app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
        app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
        android:layout_marginTop="24dp"
 | 
			
		||||
        android:layout_marginEnd="48dp"
 | 
			
		||||
        android:layout_marginRight="48dp"
 | 
			
		||||
        android:layout_marginStart="48dp"
 | 
			
		||||
        android:layout_marginLeft="48dp" />
 | 
			
		||||
 | 
			
		||||
    <LinearLayout
 | 
			
		||||
            android:id="@+id/readExternalStorage"
 | 
			
		||||
            android:layout_width="match_parent"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:visibility="gone"
 | 
			
		||||
            android:orientation="horizontal"
 | 
			
		||||
            app:layout_constraintTop_toBottomOf="@+id/text2"
 | 
			
		||||
            app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
            app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
            android:layout_marginTop="48dp"
 | 
			
		||||
            android:layout_marginEnd="24dp"
 | 
			
		||||
            android:layout_marginRight="24dp"
 | 
			
		||||
            android:layout_marginStart="24dp"
 | 
			
		||||
            android:layout_marginLeft="24dp">
 | 
			
		||||
        <TextView
 | 
			
		||||
                android:layout_width="0dp"
 | 
			
		||||
                android:layout_height="match_parent"
 | 
			
		||||
                android:layout_weight="1"
 | 
			
		||||
                android:text="@string/nearby_splash__read_external_storage"
 | 
			
		||||
                android:paddingRight="5dp"
 | 
			
		||||
                android:paddingEnd="5dp"
 | 
			
		||||
                android:textSize="17sp"
 | 
			
		||||
                android:textColor="?attr/lightGrayTextColor"/>
 | 
			
		||||
        <Button
 | 
			
		||||
                android:id="@+id/requestReadExternalStorage"
 | 
			
		||||
                android:layout_width="wrap_content"
 | 
			
		||||
                android:layout_height="match_parent"
 | 
			
		||||
                android:text="@string/nearby_splash__request_permission"
 | 
			
		||||
                style="@style/SwapTheme.Wizard.OptionButton"/>
 | 
			
		||||
    </LinearLayout>
 | 
			
		||||
        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:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="match_parent"
 | 
			
		||||
        android:background="?attr/mainTabSwapBackground">
 | 
			
		||||
 | 
			
		||||
    <ImageView
 | 
			
		||||
        android:id="@+id/image"
 | 
			
		||||
        android:layout_width="0dp"
 | 
			
		||||
        android:layout_height="0dp"
 | 
			
		||||
        android:src="@drawable/nearby_splash"
 | 
			
		||||
        android:importantForAccessibility="no"
 | 
			
		||||
        app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
        app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
        app:layout_constraintBottom_toBottomOf="parent"
 | 
			
		||||
        app:layout_constraintTop_toBottomOf="@+id/text2"
 | 
			
		||||
        android:layout_marginTop="36dp"
 | 
			
		||||
        android:tint="?attr/mainTabSwapSplashTint"
 | 
			
		||||
        android:scaleType="fitXY" />
 | 
			
		||||
            android:id="@+id/image"
 | 
			
		||||
            android:layout_width="0dp"
 | 
			
		||||
            android:layout_height="0dp"
 | 
			
		||||
            android:src="@drawable/nearby_splash"
 | 
			
		||||
            android:importantForAccessibility="no"
 | 
			
		||||
            app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
            app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
            app:layout_constraintBottom_toBottomOf="parent"
 | 
			
		||||
            app:layout_constraintTop_toBottomOf="@+id/both_parties_need_fdroid_text"
 | 
			
		||||
            android:layout_marginTop="36dp"
 | 
			
		||||
            android:tint="?attr/mainTabSwapSplashTint"
 | 
			
		||||
            android:scaleType="fitXY"
 | 
			
		||||
            tools:targetApi="jelly_bean"/>
 | 
			
		||||
 | 
			
		||||
    <TextView
 | 
			
		||||
            android:id="@+id/title"
 | 
			
		||||
            android:layout_width="0dp"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:layout_marginLeft="24dp"
 | 
			
		||||
            android:layout_marginRight="24dp"
 | 
			
		||||
            android:layout_marginTop="48dp"
 | 
			
		||||
            android:text="@string/nearby_splash__download_apps_from_people_nearby"
 | 
			
		||||
            android:textAlignment="center"
 | 
			
		||||
            android:gravity="center"
 | 
			
		||||
            android:textSize="20sp"
 | 
			
		||||
            android:textColor="?attr/lightGrayTextColor"
 | 
			
		||||
            app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
            app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
            app:layout_constraintTop_toTopOf="parent"/>
 | 
			
		||||
 | 
			
		||||
    <Button
 | 
			
		||||
            android:id="@+id/find_people_button"
 | 
			
		||||
            android:layout_width="wrap_content"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:text="@string/nearby_splash__find_people_button"
 | 
			
		||||
            style="@style/DetailsSecondaryButtonStyle"
 | 
			
		||||
            app:layout_constraintTop_toBottomOf="@+id/title"
 | 
			
		||||
            app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
            app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
            android:layout_marginTop="24dp" android:layout_marginLeft="8dp" android:layout_marginRight="8dp"/>
 | 
			
		||||
 | 
			
		||||
    <TextView
 | 
			
		||||
            android:id="@+id/both_parties_need_fdroid_text"
 | 
			
		||||
            android:layout_width="0dp"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            tools:text="@string/nearby_splash__both_parties_need_fdroid"
 | 
			
		||||
            android:textSize="15sp"
 | 
			
		||||
            android:textAlignment="center"
 | 
			
		||||
            android:gravity="center"
 | 
			
		||||
            android:textColor="?attr/lightGrayTextColor"
 | 
			
		||||
            app:layout_constraintTop_toBottomOf="@+id/find_people_button"
 | 
			
		||||
            app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
            app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
            android:layout_marginTop="24dp"
 | 
			
		||||
            android:layout_marginRight="24dp"
 | 
			
		||||
            android:layout_marginLeft="24dp"/>
 | 
			
		||||
 | 
			
		||||
    <TextView
 | 
			
		||||
            android:id="@+id/read_external_storage_text"
 | 
			
		||||
            android:layout_width="0dp"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:layout_weight="1"
 | 
			
		||||
            android:text="@string/nearby_splash__read_external_storage"
 | 
			
		||||
            android:textSize="20sp"
 | 
			
		||||
            android:textColor="?attr/lightGrayTextColor"
 | 
			
		||||
            android:textAlignment="center"
 | 
			
		||||
            android:gravity="center"
 | 
			
		||||
            android:layout_marginEnd="24dp" app:layout_constraintEnd_toEndOf="parent" android:layout_marginRight="24dp"
 | 
			
		||||
            android:layout_marginStart="24dp" app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
            android:layout_marginLeft="24dp" android:layout_marginTop="48dp"
 | 
			
		||||
            app:layout_constraintTop_toBottomOf="@+id/both_parties_need_fdroid_text"
 | 
			
		||||
            android:visibility="gone"
 | 
			
		||||
            tools:visibility="visible"/>
 | 
			
		||||
    <Button
 | 
			
		||||
            android:id="@+id/request_read_external_storage_button"
 | 
			
		||||
            android:layout_width="wrap_content"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:text="@string/nearby_splash__request_permission"
 | 
			
		||||
            style="@style/DetailsSecondaryButtonStyle"
 | 
			
		||||
            app:layout_constraintEnd_toEndOf="parent"
 | 
			
		||||
            android:layout_marginEnd="8dp" android:layout_marginRight="8dp"
 | 
			
		||||
            app:layout_constraintStart_toStartOf="parent" android:layout_marginLeft="8dp"
 | 
			
		||||
            android:layout_marginStart="8dp" android:layout_marginTop="24dp"
 | 
			
		||||
            app:layout_constraintTop_toBottomOf="@+id/read_external_storage_text"
 | 
			
		||||
            android:visibility="gone"
 | 
			
		||||
            tools:visibility="visible"/>
 | 
			
		||||
</android.support.constraint.ConstraintLayout>
 | 
			
		||||
@ -55,7 +55,7 @@ public class CategoryController extends RecyclerView.ViewHolder implements Loade
 | 
			
		||||
 | 
			
		||||
        appCardsAdapter = new AppPreviewAdapter(activity);
 | 
			
		||||
 | 
			
		||||
        viewAll = (Button) itemView.findViewById(R.id.button);
 | 
			
		||||
        viewAll = (Button) itemView.findViewById(R.id.view_all_button);
 | 
			
		||||
        viewAll.setOnClickListener(onViewAll);
 | 
			
		||||
 | 
			
		||||
        heading = (TextView) itemView.findViewById(R.id.name);
 | 
			
		||||
 | 
			
		||||
@ -11,7 +11,7 @@
 | 
			
		||||
        android:layout_width="wrap_content"
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
        app:layout_constraintBaseline_toBaselineOf="@+id/button"
 | 
			
		||||
        app:layout_constraintBaseline_toBaselineOf="@+id/view_all_button"
 | 
			
		||||
        android:textAppearance="@style/TextAppearance.AppCompat.Headline"
 | 
			
		||||
        android:textSize="18sp"
 | 
			
		||||
        android:textColor="?attr/categoryName"
 | 
			
		||||
@ -24,7 +24,7 @@
 | 
			
		||||
        android:focusableInTouchMode="true" />
 | 
			
		||||
 | 
			
		||||
    <Button
 | 
			
		||||
        android:id="@+id/button"
 | 
			
		||||
        android:id="@+id/view_all_button"
 | 
			
		||||
        tools:text="View all 10"
 | 
			
		||||
        android:layout_width="wrap_content"
 | 
			
		||||
        android:layout_height="0dp"
 | 
			
		||||
@ -64,7 +64,7 @@
 | 
			
		||||
        tools:src="@drawable/category_graphics"
 | 
			
		||||
        android:scaleType="fitStart"
 | 
			
		||||
        android:importantForAccessibility="no"
 | 
			
		||||
        tools:ignore="ContentDescription" />
 | 
			
		||||
        tools:ignore="ContentDescription" tools:targetApi="jelly_bean"/>
 | 
			
		||||
 | 
			
		||||
    <android.support.v7.widget.RecyclerView
 | 
			
		||||
        android:id="@+id/app_cards"
 | 
			
		||||
@ -79,7 +79,7 @@
 | 
			
		||||
        app:layout_constraintLeft_toLeftOf="parent"
 | 
			
		||||
        app:layout_constraintRight_toRightOf="parent"
 | 
			
		||||
        app:layout_constraintStart_toStartOf="parent"
 | 
			
		||||
        app:layout_constraintTop_toBottomOf="@+id/button"
 | 
			
		||||
        app:layout_constraintTop_toBottomOf="@+id/view_all_button"
 | 
			
		||||
        tools:listitem="@layout/app_card_normal"/>
 | 
			
		||||
 | 
			
		||||
</android.support.constraint.ConstraintLayout>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user