Add main screen that scans for RTT enabled APs.

Bug: 111830148
Test: Manually tested.
Change-Id: I0559ad13f06518faae556d999e73ecacbb4634e1
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/AndroidManifest.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/AndroidManifest.xml
index 59a56af..0315270 100644
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/AndroidManifest.xml
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/AndroidManifest.xml
@@ -32,12 +32,12 @@
         android:label="@string/app_name"
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
-        android:theme="@style/AppTheme">
+        android:theme="@style/CustomAppTheme">
 
         <activity
             android:name=".MainActivity"
             android:label="@string/app_name"
-            android:theme="@style/CustomAppTheme.NoActionBar">
+            android:theme="@style/CustomAppTheme">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
@@ -48,8 +48,7 @@
         <activity
             android:name=".LocationPermissionRequestActivity"
             android:label="@string/title_activity_location_permission_request"
-            android:theme="@style/CustomAppTheme.NoActionBar" >
+            android:theme="@style/CustomAppTheme" >
         </activity>
     </application>
-
 </manifest>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/java/com/example/android/wifirttscan/MainActivity.java b/connectivity/wifirtt/WifiRttScan/Application/src/main/java/com/example/android/wifirttscan/MainActivity.java
index 15a1ecd..7acf225 100644
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/java/com/example/android/wifirttscan/MainActivity.java
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/java/com/example/android/wifirttscan/MainActivity.java
@@ -16,18 +16,29 @@
 package com.example.android.wifirttscan;
 
 import android.Manifest.permission;
+import android.annotation.SuppressLint;
+import android.content.BroadcastReceiver;
+import android.content.Context;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.pm.PackageManager;
+import android.net.wifi.ScanResult;
+import android.net.wifi.WifiManager;
+import android.net.wifi.rtt.RangingRequest;
 import android.os.Bundle;
+import android.support.annotation.NonNull;
 import android.support.v4.app.ActivityCompat;
 import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.RecyclerView.LayoutManager;
 import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
 import android.view.View;
 import android.widget.TextView;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Displays list of Access Points enabled with WifiRTT (to check distance). Requests location
  * permissions if they are not approved via secondary splash screen explaining why they are needed.
@@ -38,49 +49,56 @@
 
     private boolean mLocationPermissionApproved = false;
 
+    List<ScanResult> mAccessPointsSupporting80211mc;
+
+    private WifiManager mWifiManager;
+    private WifiScanReceiver mWifiScanReceiver;
+
     private TextView mOutputTextView;
+    private RecyclerView mRecyclerView;
+
+    private MyAdapter mAdapter;
+
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
-        Toolbar toolbar = findViewById(R.id.toolbar);
-        setSupportActionBar(toolbar);
 
-        mOutputTextView = findViewById(R.id.mainOutputTextView);
+        mOutputTextView = findViewById(R.id.access_point_summary_text_view);
+
+        mRecyclerView = findViewById(R.id.recycler_view);
+
+        // Improve performance if you know that changes in content do not change the layout size
+        // of the RecyclerView
+        mRecyclerView.setHasFixedSize(true);
+
+        // use a linear layout manager
+        LayoutManager layoutManager = new LinearLayoutManager(this);
+        mRecyclerView.setLayoutManager(layoutManager);
+
+        mAccessPointsSupporting80211mc = new ArrayList<>();
+
+        mAdapter = new MyAdapter(mAccessPointsSupporting80211mc);
+        mRecyclerView.setAdapter(mAdapter);
+
+        mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
+        mWifiScanReceiver = new WifiScanReceiver();
     }
 
     public void onClickFindDistancesToAccessPoints(View view) {
         if (mLocationPermissionApproved) {
-            Log.d(TAG, "Location Permissions approved! Retrieving Access Points.");
-            // TODO: Implement WifiManager + WifiRTT
+            logToUi(getString(R.string.retrieving_access_points));
+            mWifiManager.startScan();
 
         } else {
-            // On 23+ (M+) devices, fine location not granted. Request permission.
+            // On 23+ (M+) devices, fine location permission not granted. Request permission.
             Intent startIntent = new Intent(this, LocationPermissionRequestActivity.class);
             startActivity(startIntent);
         }
     }
 
     @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        // Inflate the menu; this adds items to the action bar if it is present.
-        getMenuInflater().inflate(R.menu.menu_main, menu);
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        int id = item.getItemId();
-
-        if (id == R.id.action_settings) {
-            return true;
-        }
-
-        return super.onOptionsItemSelected(item);
-    }
-
-    @Override
     protected void onResume() {
         Log.d(TAG, "onResume()");
         super.onResume();
@@ -88,5 +106,67 @@
         mLocationPermissionApproved =
                 ActivityCompat.checkSelfPermission(this, permission.ACCESS_FINE_LOCATION)
                         == PackageManager.PERMISSION_GRANTED;
+
+        registerReceiver(
+                mWifiScanReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
+    }
+
+    @Override
+    protected void onPause() {
+        Log.d(TAG, "onPause()");
+        super.onPause();
+        unregisterReceiver(mWifiScanReceiver);
+    }
+
+    private void logToUi(final String message) {
+        if (!message.isEmpty()) {
+            Log.d(TAG, message);
+            mOutputTextView.setText(message);
+        }
+    }
+
+    private class WifiScanReceiver extends BroadcastReceiver {
+
+        private List<ScanResult> find80211mcSupportedAccessPoints(
+                @NonNull List<ScanResult> originalList) {
+            List<ScanResult> newList = new ArrayList<>();
+
+            for (ScanResult scanResult : originalList) {
+
+                if (scanResult.is80211mcResponder()) {
+                    newList.add(scanResult);
+                }
+
+                if (newList.size() >= RangingRequest.getMaxPeers()) {
+                    break;
+                }
+            }
+            return newList;
+        }
+
+        // This is checked via mLocationPermissionApproved boolean
+        @SuppressLint("MissingPermission")
+        public void onReceive(Context context, Intent intent) {
+
+            List<ScanResult> scanResults = mWifiManager.getScanResults();
+
+            if (scanResults != null) {
+
+                if (mLocationPermissionApproved) {
+                    mAccessPointsSupporting80211mc = find80211mcSupportedAccessPoints(scanResults);
+
+                    mAdapter.swapData(mAccessPointsSupporting80211mc);
+
+                    logToUi(scanResults.size() +
+                            " APs discovered, " +
+                            mAccessPointsSupporting80211mc.size() +
+                            " RTT capable.");
+
+                } else {
+                    // TODO (jewalker): Add Snackbar regarding permissions
+                    Log.d(TAG, "Permissions not allowed.");
+                }
+            }
+        }
     }
 }
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/java/com/example/android/wifirttscan/MyAdapter.java b/connectivity/wifirtt/WifiRttScan/Application/src/main/java/com/example/android/wifirttscan/MyAdapter.java
new file mode 100644
index 0000000..29f84e8
--- /dev/null
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/java/com/example/android/wifirttscan/MyAdapter.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2018 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.example.android.wifirttscan;
+
+import android.net.wifi.ScanResult;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.RecyclerView.ViewHolder;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import java.util.List;
+
+/**
+ * Displays the ssid and bssid from a list of {@link ScanResult}s including a header at the top of
+ * the {@link RecyclerView} to label the data.
+ */
+public class MyAdapter extends RecyclerView.Adapter<ViewHolder> {
+
+    private static final int HEADER_POSITION = 0;
+
+    private static final int TYPE_HEADER = 0;
+    private static final int TYPE_ITEM = 1;
+
+    private List<ScanResult> mWifiAccessPointsWithRtt;
+
+    public static class ViewHolderHeader extends RecyclerView.ViewHolder {
+        public ViewHolderHeader(View view) {
+            super(view);;
+        }
+    }
+
+    public static class ViewHolderItem extends RecyclerView.ViewHolder {
+        public TextView mSsidTextView;
+        public TextView mBssidTextView;
+
+        public ViewHolderItem(View view) {
+            super(view);
+            mSsidTextView = view.findViewById(R.id.ssid_text_view);
+            mBssidTextView = view.findViewById(R.id.bssid_text_view);
+        }
+    }
+
+    public MyAdapter(List<ScanResult> list) {
+        mWifiAccessPointsWithRtt = list;
+    }
+
+    public void swapData(List<ScanResult> list) {
+
+        // Always clear with any update, as even an empty list means no WifiRtt devices were found.
+        mWifiAccessPointsWithRtt.clear();
+
+        if ((list != null) && (list.size() > 0)) {
+            mWifiAccessPointsWithRtt.addAll(list);
+        }
+
+        notifyDataSetChanged();
+    }
+
+    @Override
+    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+
+        ViewHolder viewHolder;
+
+        if (viewType == TYPE_HEADER) {
+            viewHolder = new ViewHolderHeader(LayoutInflater.from(parent.getContext())
+                    .inflate(R.layout.recycler_row_header, parent, false));
+
+        } else if (viewType == TYPE_ITEM) {
+            viewHolder = new ViewHolderItem(LayoutInflater.from(parent.getContext())
+                    .inflate(R.layout.recycler_row_item, parent, false));
+        } else {
+            throw new RuntimeException(viewType + " isn't a valid view type.");
+        }
+
+        return viewHolder;
+    }
+
+    @Override
+    public void onBindViewHolder(ViewHolder viewHolder, int position) {
+
+        if (viewHolder instanceof ViewHolderHeader) {
+            // No updates need to be made to header view (defaults remain same).
+
+        } else if (viewHolder instanceof ViewHolderItem) {
+            ViewHolderItem viewHolderItem = (ViewHolderItem) viewHolder;
+            ScanResult currentScanResult = getItem(position);
+
+            viewHolderItem.mSsidTextView.setText(currentScanResult.SSID);
+            viewHolderItem.mBssidTextView.setText(currentScanResult.BSSID);
+
+        } else {
+            throw new RuntimeException(viewHolder + " isn't a valid view holder.");
+        }
+    }
+
+    /*
+     * Because we added a header item to the list, we need to decrement the position by one to get
+     * the proper place in the list.
+     */
+    private ScanResult getItem(int position) {
+        return mWifiAccessPointsWithRtt.get(position - 1);
+    }
+
+    // Returns size of list plus the header item (adds extra item).
+    @Override
+    public int getItemCount() {
+        return mWifiAccessPointsWithRtt.size() + 1;
+    }
+
+    @Override
+    public int getItemViewType(int position) {
+        if (position == HEADER_POSITION) {
+            return TYPE_HEADER;
+        } else {
+            return TYPE_ITEM;
+        }
+    }
+}
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/activity_location_permission_request.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/activity_location_permission_request.xml
index a64bd1d..ecd8c4e 100644
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/activity_location_permission_request.xml
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/activity_location_permission_request.xml
@@ -18,13 +18,15 @@
     android:id="@+id/relativeLayout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="#4c9699"
+    android:background="@color/colorSecondary"
     tools:layout_editor_absoluteY="81dp">
 
     <ImageView
         android:id="@+id/imageView"
         android:layout_width="0dp"
         android:layout_height="140dp"
+        android:layout_marginLeft="16dp"
+        android:layout_marginRight="16dp"
         android:layout_marginTop="48dp"
         android:src="@drawable/ic_round_network_wifi_white_24px"
         app:layout_constraintHorizontal_bias="0.0"
@@ -37,8 +39,8 @@
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginBottom="8dp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginStart="8dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginStart="16dp"
         android:layout_marginTop="16dp"
         android:text="@string/main_message_activity_location_permission_request"
         android:textAppearance="?android:attr/textAppearanceLarge"
@@ -56,8 +58,8 @@
         android:layout_width="0dp"
         android:layout_height="0dp"
         android:layout_marginBottom="8dp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginStart="8dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginStart="16dp"
         android:layout_marginTop="8dp"
         android:text="@string/details_message_activity_location_permission_request"
         android:textAppearance="?android:attr/textAppearanceMedium"
@@ -72,7 +74,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginBottom="8dp"
-        android:layout_marginStart="8dp"
+        android:layout_marginStart="16dp"
         android:background="@android:color/transparent"
         android:onClick="onClickDenyPermissionRequest"
         android:stateListAnimator="@null"
@@ -86,7 +88,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginBottom="8dp"
-        android:layout_marginEnd="8dp"
+        android:layout_marginEnd="16dp"
         android:background="@android:color/transparent"
         android:onClick="onClickApprovePermissionRequest"
         android:stateListAnimator="@null"
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/activity_main.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/activity_main.xml
index 14395a1..62a54c2 100644
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/activity_main.xml
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/activity_main.xml
@@ -11,28 +11,60 @@
   See the License for the specific language governing permissions and
   limitations under the License.
   -->
-<android.support.design.widget.CoordinatorLayout
+<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:id="@+id/coordinatorLayout"
     tools:context=".MainActivity">
 
-    <android.support.design.widget.AppBarLayout
-        android:layout_width="match_parent"
+    <android.support.v7.widget.RecyclerView
+        android:id="@+id/recycler_view"
+        android:layout_width="0dp"
+        android:layout_height="0dp"
+        android:layout_marginBottom="8dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginTop="8dp"
+        android:scrollbars="vertical"
+        app:layout_constraintBottom_toTopOf="@+id/access_point_summary_text_view"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.69"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintVertical_bias="1.0" />
+
+    <TextView
+        android:id="@+id/access_point_summary_text_view"
+        android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:theme="@style/CustomAppTheme.AppBarOverlay">
+        android:layout_marginBottom="8dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginStart="16dp"
+        android:layout_marginTop="8dp"
+        android:text="@string/introduction_text"
+        android:textAlignment="center"
+        android:visibility="visible"
+        app:layout_constraintBottom_toTopOf="@+id/scan_wifi_button"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintHorizontal_bias="0.0"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintVertical_bias="0.991" />
 
-        <android.support.v7.widget.Toolbar
-            android:id="@+id/toolbar"
-            android:layout_width="match_parent"
-            android:layout_height="?attr/actionBarSize"
-            android:background="?attr/colorPrimary"
-            app:popupTheme="@style/CustomAppTheme.PopupOverlay" />
-
-    </android.support.design.widget.AppBarLayout>
-
-    <include layout="@layout/content_main" />
-
-</android.support.design.widget.CoordinatorLayout>
+    <Button
+        android:id="@+id/scan_wifi_button"
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="8dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginStart="16dp"
+        android:onClick="onClickFindDistancesToAccessPoints"
+        android:text="@string/scan_wifi_button_label"
+        android:visibility="visible"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent" />
+</android.support.constraint.ConstraintLayout>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/content_main.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/content_main.xml
deleted file mode 100644
index 21ced2d..0000000
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/content_main.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright 2018 Google Inc. All rights reserved.
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-       http://www.apache.org/licenses/LICENSE-2.0
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-<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"
-    app:layout_behavior="@string/appbar_scrolling_view_behavior"
-    tools:context=".MainActivity"
-    tools:showIn="@layout/activity_main">
-
-    <TextView
-        android:id="@+id/mainOutputTextView"
-        android:layout_width="0dp"
-        android:layout_height="0dp"
-        android:layout_marginBottom="8dp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="8dp"
-        android:text="Test output"
-        android:visibility="visible"
-        app:layout_constraintBottom_toTopOf="@+id/findDistanceToAccessPointsButton"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintHorizontal_bias="0.563"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintVertical_bias="0.039" />
-
-    <Button
-        android:id="@+id/findDistanceToAccessPointsButton"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginBottom="8dp"
-        android:layout_marginEnd="8dp"
-        android:layout_marginStart="8dp"
-        android:layout_marginTop="8dp"
-        android:text="Get Access Points"
-        android:visibility="visible"
-        android:onClick="onClickFindDistancesToAccessPoints"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintVertical_bias="0.941" />
-
-</android.support.constraint.ConstraintLayout>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/recycler_row_header.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/recycler_row_header.xml
new file mode 100644
index 0000000..1675759
--- /dev/null
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/recycler_row_header.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright 2016 Google Inc.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center"
+    android:paddingTop="@dimen/recycler_row_padding"
+    android:paddingBottom="@dimen/recycler_row_padding"
+    android:orientation="horizontal">
+
+    <TextView
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_vertical"
+        android:textAlignment="center"
+        android:textSize="@dimen/recycler_row_header_text_size"
+        android:text="@string/recycler_row_header_label_ssid"
+        android:id="@+id/ssid_text_view"/>
+
+    <TextView
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_vertical"
+        android:textAlignment="center"
+        android:text="@string/recycler_row_header_label_bssid"
+        android:textSize="@dimen/recycler_row_header_text_size"
+        android:id="@+id/bssid_text_view"/>
+</LinearLayout>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/recycler_row_item.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/recycler_row_item.xml
new file mode 100644
index 0000000..268852a
--- /dev/null
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/layout/recycler_row_item.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright 2016 Google Inc.
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:layout_gravity="center"
+    android:paddingTop="@dimen/recycler_row_padding"
+    android:paddingBottom="@dimen/recycler_row_padding"
+    android:orientation="horizontal">
+
+    <TextView
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_vertical"
+        android:textAlignment="center"
+        android:textSize="@dimen/recycler_row_item_text_size"
+        android:id="@+id/ssid_text_view"/>
+
+    <TextView
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_weight="1"
+        android:gravity="center_vertical"
+        android:textAlignment="center"
+        android:textSize="@dimen/recycler_row_item_text_size"
+        android:id="@+id/bssid_text_view"/>
+</LinearLayout>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/menu/menu_main.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/menu/menu_main.xml
deleted file mode 100644
index 133572a..0000000
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/menu/menu_main.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright 2018 Google Inc. All rights reserved.
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-       http://www.apache.org/licenses/LICENSE-2.0
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  -->
-<menu 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"
-    tools:context="com.example.android.watchface.testwifircc1.MainActivity">
-    <item
-        android:id="@+id/action_settings"
-        android:orderInCategory="100"
-        android:title="@string/action_settings"
-        app:showAsAction="never" />
-</menu>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/colors.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/colors.xml
index ac5f69e..48f51a2 100644
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/colors.xml
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/colors.xml
@@ -14,5 +14,6 @@
 <resources>
     <color name="colorPrimary">#3F51B5</color>
     <color name="colorPrimaryDark">#303F9F</color>
+    <color name="colorSecondary">#9fa8da</color>
     <color name="colorAccent">#FF4081</color>
 </resources>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/dimens.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/dimens.xml
index 8c82622..5103147 100644
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/dimens.xml
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/dimens.xml
@@ -12,5 +12,7 @@
   limitations under the License.
   -->
 <resources>
-    <dimen name="fab_margin">16dp</dimen>
+    <dimen name="recycler_row_padding">5dp</dimen>
+    <dimen name="recycler_row_header_text_size">30sp</dimen>
+    <dimen name="recycler_row_item_text_size">20sp</dimen>
 </resources>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/strings.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/strings.xml
index 4fa9c34..860f3dc 100644
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/strings.xml
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/strings.xml
@@ -14,10 +14,16 @@
 <resources>
     <string name="action_settings">Settings</string>
 
-    <string name="title_activity_location_permission_request">LocationPermissionRequestActivity</string>
-    <string name="main_message_activity_location_permission_request">See distances with Wifi RTT by letting us read your phone\'s location.</string>
-    <string name="details_message_activity_location_permission_request">Your phone needs access to your phone\'s location to show the distances to local Access Points.</string>
+    <string name="title_activity_location_permission_request">Location Permission Required</string>
+
+    <string name="main_message_activity_location_permission_request">See distances to access points with Wifi RTT (permission required).</string>
+    <string name="details_message_activity_location_permission_request">This app needs access to your phone\'s location to show the distances between this device and Wifi RTT enabled access points.</string>
     <string name="no_thanks_activity_location_permission_request">No Thanks</string>
     <string name="continue_activity_location_permission_request">Continue</string>
+    <string name="recycler_row_header_label_ssid">SSID</string>
+    <string name="recycler_row_header_label_bssid">BSSID</string>
+    <string name="retrieving_access_points">Retrieving Access Points...</string>
+    <string name="scan_wifi_button_label">Scan WiFi</string>
+    <string name="introduction_text">Click the button below to scan access points.</string>
 
 </resources>
diff --git a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/styles.xml b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/styles.xml
index 4b18872..2d82d15 100644
--- a/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/styles.xml
+++ b/connectivity/wifirtt/WifiRttScan/Application/src/main/res/values/styles.xml
@@ -18,6 +18,7 @@
         <!-- Customize your theme here. -->
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
+        <item name="colorSecondary">@color/colorSecondary</item>
         <item name="colorAccent">@color/colorAccent</item>
     </style>
 
diff --git a/connectivity/wifirtt/WifiRttScan/gradle.properties b/connectivity/wifirtt/WifiRttScan/gradle.properties
index 89f9d70..0bc4294 100644
--- a/connectivity/wifirtt/WifiRttScan/gradle.properties
+++ b/connectivity/wifirtt/WifiRttScan/gradle.properties
@@ -1,16 +1,3 @@
-# Copyright 2018 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
 
 # Project-wide Gradle settings.
 
diff --git a/connectivity/wifirtt/WifiRttScan/template-params.xml b/connectivity/wifirtt/WifiRttScan/template-params.xml
index 7d594f5..ebfd051 100644
--- a/connectivity/wifirtt/WifiRttScan/template-params.xml
+++ b/connectivity/wifirtt/WifiRttScan/template-params.xml
@@ -24,6 +24,8 @@
     <compileSdkVersion>28</compileSdkVersion>
     <targetSdkVersion>28</targetSdkVersion>
 
+    <multiDexEnabled>true</multiDexEnabled>
+
     <!-- Include additional dependencies here.-->
     <!-- dependency>com.google.android.gms:play-services:5.0.+</dependency -->