
Almost all of the nearby/swap view classes could be condensed into a single base class that is instantiated in the view XML. This is the first step towards making that happen. It also lays the groundwork where "steps" are all SwapViews. The original concept of "steps" put all steps together, whether F-Droid could control them or not. For example, the Views were mixed with the system Bluetooth prompts. This is the first step towards converting the steps to always be SwapViews, which are always under control of this app. When coming back to a SwapView/step, it does not seem feasible to handle automatically restarting things like permissions and Bluetooth prompts. If there is a way, it should be possible to first load the proper SwapView instance, then trigger the system prompt. The makes the SwapView a pure View, without any Controller in it.
214 lines
8.2 KiB
XML
214 lines
8.2 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- TODO: Add paddingStart in places where there is only paddingLeft. However Android Studio lint
|
|
gives an error, which is discussed here:
|
|
http://stackoverflow.com/questions/27449776/conflicting-lint-messages-regarding-paddingstart-usage?lq=1
|
|
-->
|
|
<org.fdroid.fdroid.views.swap.StartSwapView
|
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
xmlns:tools="http://schemas.android.com/tools"
|
|
xmlns:swap="http://schemas.android.com/apk/res-auto"
|
|
swap:toolbarColor="@color/swap_bright_blue"
|
|
swap:toolbarTitle="@string/swap_nearby"
|
|
android:orientation="vertical"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
tools:context=".views.swap.SwapWorkflowActivity">
|
|
|
|
<!-- Misc header -->
|
|
<include layout="@layout/start_swap_header"/>
|
|
|
|
<!-- Bluetooth swap status + toggle -->
|
|
<LinearLayout
|
|
android:id="@+id/bluetooth_info"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_below="@id/header"
|
|
android:padding="10dp"
|
|
android:orientation="horizontal">
|
|
|
|
<ImageView
|
|
android:layout_width="24dp"
|
|
android:layout_height="24dp"
|
|
android:tint="@color/swap_grey_icon"
|
|
android:src="@drawable/ic_bluetooth_white"/>
|
|
|
|
<LinearLayout
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:paddingLeft="15dp"
|
|
android:paddingStart="15dp"
|
|
android:layout_weight="1.00"
|
|
tools:ignore="RtlSymmetry">
|
|
|
|
<TextView
|
|
android:id="@+id/bluetooth_visible"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
tools:text="@string/swap_visible_bluetooth"
|
|
android:textSize="18sp"/>
|
|
|
|
<TextView
|
|
android:id="@+id/device_id_bluetooth"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
tools:text="SP-120"
|
|
android:textColor="@color/swap_light_text"/>
|
|
|
|
</LinearLayout>
|
|
|
|
<android.support.v7.widget.SwitchCompat
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:enabled="false"
|
|
android:id="@+id/switch_bluetooth"/>
|
|
|
|
</LinearLayout>
|
|
|
|
<!-- WiFi swap status + toggle -->
|
|
<LinearLayout
|
|
android:id="@+id/wifi_info"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_below="@id/bluetooth_info"
|
|
android:padding="10dp"
|
|
android:orientation="horizontal">
|
|
|
|
<ImageView
|
|
android:layout_width="24dp"
|
|
android:layout_height="24dp"
|
|
android:tint="@color/swap_grey_icon"
|
|
android:src="@drawable/ic_network_wifi_white"/>
|
|
|
|
<LinearLayout
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:orientation="vertical"
|
|
android:paddingLeft="15dp"
|
|
android:paddingStart="15dp"
|
|
android:layout_weight="1.00"
|
|
tools:ignore="RtlSymmetry">
|
|
|
|
<TextView
|
|
android:id="@+id/wifi_visible"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
tools:text="@string/swap_not_visible_wifi"
|
|
android:textSize="18sp"/>
|
|
|
|
<TextView
|
|
android:id="@+id/device_id_wifi"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:text="@string/swap_wifi_device_name"
|
|
android:textColor="@color/swap_light_text"/>
|
|
|
|
<TextView
|
|
android:id="@+id/wifi_network"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
tools:text="wifi network name"
|
|
android:textColor="@color/swap_bright_blue"
|
|
android:textSize="16sp"/>
|
|
|
|
</LinearLayout>
|
|
|
|
<android.support.v7.widget.SwitchCompat
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:enabled="false"
|
|
android:id="@+id/switch_wifi"/>
|
|
|
|
</LinearLayout>
|
|
|
|
<!-- Feedback for "searching for nearby people..." -->
|
|
<LinearLayout
|
|
android:id="@+id/feedback_searching"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_below="@+id/wifi_info"
|
|
android:paddingStart="20dp"
|
|
android:paddingEnd="20dp"
|
|
android:paddingBottom="5dp"
|
|
android:paddingTop="20dp">
|
|
|
|
<TextView
|
|
android:id="@+id/text_people_nearby"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:text="@string/swap_people_nearby"
|
|
android:textColor="@color/swap_light_text"
|
|
android:layout_weight="1.00"/>
|
|
|
|
<ProgressBar
|
|
android:id="@+id/searching_people_nearby"
|
|
android:layout_width="24dp"
|
|
android:layout_height="24dp"
|
|
android:indeterminate="true"/>
|
|
|
|
</LinearLayout>
|
|
|
|
|
|
<!-- Buttons to help the user when they can't find any peers. Shown at bottom of relative layout -->
|
|
<LinearLayout
|
|
android:id="@+id/cant_find_peers"
|
|
android:orientation="horizontal"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_alignParentBottom="true">
|
|
|
|
<Button
|
|
android:id="@+id/btn_send_fdroid"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:drawableLeft="@drawable/ic_fdroid_grey"
|
|
android:drawableStart="@drawable/ic_fdroid_grey"
|
|
android:text="@string/swap_send_fdroid"
|
|
android:drawablePadding="10dp"
|
|
android:paddingLeft="25dp"
|
|
android:paddingRight="25dp"
|
|
android:paddingEnd="25dp"
|
|
android:background="@android:color/transparent"/>
|
|
|
|
<Button
|
|
android:id="@+id/btn_qr_scanner"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:drawableLeft="@drawable/ic_qr_grey"
|
|
android:drawableStart="@drawable/ic_qr_grey"
|
|
android:text="@string/swap_scan_qr"
|
|
android:drawablePadding="10dp"
|
|
android:paddingLeft="25dp"
|
|
android:paddingRight="25dp"
|
|
android:paddingEnd="25dp"
|
|
android:background="@android:color/transparent"/>
|
|
|
|
</LinearLayout>
|
|
|
|
<!-- Heading for "can't find peers" -->
|
|
<TextView
|
|
android:id="@+id/header_cant_find_peers"
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_above="@id/cant_find_peers"
|
|
android:text="@string/swap_cant_find_peers"
|
|
android:paddingLeft="20dp"
|
|
android:paddingStart="20dp"
|
|
android:paddingRight="20dp"
|
|
android:paddingEnd="20dp"
|
|
android:paddingTop="20dp"
|
|
android:textColor="@color/swap_light_text"/>
|
|
|
|
<!-- List of all currently known peers (i.e. bluetooth and wifi devices that have been identified -->
|
|
<ListView
|
|
android:id="@+id/list_people_nearby"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_below="@id/feedback_searching"
|
|
android:layout_above="@id/header_cant_find_peers">
|
|
|
|
</ListView>
|
|
|
|
</org.fdroid.fdroid.views.swap.StartSwapView>
|