Skip to content

Feature/tile download UI #285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion MapboxSearch/gradle/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ ext {
common_sdk_version = '24.7.0-rc.1'
mapbox_base_version = '0.8.0'

search_native_version = '2.5.0-rc.2'
// TODO: align with main
search_native_version = '0.1.0-MATCH-CTX-SNAPSHOT'

detekt_version = '1.19.0'

Expand Down
2 changes: 2 additions & 0 deletions MapboxSearch/sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
android:windowSoftInputMode="adjustNothing"
/>

<activity android:name=".TileDownloadUiActivity" />

<activity android:name=".AddressAutofillUiActivity" />
<activity android:name=".api.AddressAutofillKotlinExampleActivity" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ class MainActivity : AppCompatActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.open_tile_download_ui_example -> {
startActivity(Intent(this, TileDownloadUiActivity::class.java))
true
}
R.id.open_address_autofill_ui_example -> {
startActivity(Intent(this, AddressAutofillUiActivity::class.java))
true
Expand Down

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions MapboxSearch/sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout 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/root"
Expand All @@ -23,6 +22,7 @@
android:layout_height="wrap_content"
android:elevation="4dp"
android:theme="@style/ToolbarTheme"
tools:menu="@menu/main_activity_options_menu"
/>

<com.mapbox.search.ui.view.SearchResultsView
Expand Down
147 changes: 147 additions & 0 deletions MapboxSearch/sample/src/main/res/layout/activity_tiles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame"
tools:visibility="visible"
>

<com.mapbox.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:mapbox_logoGravity="bottom"
>

</com.mapbox.maps.MapView>

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="4dp"
android:theme="@style/ToolbarTheme"
tools:menu="@menu/simple_ui_activity_options_menu"
/>

<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/search_container_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?actionBarSize"
>

<com.mapbox.search.ui.view.place.SearchPlaceBottomSheetView
android:id="@+id/search_place_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:elevation="@dimen/search_card_elevation"
/>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
>

<androidx.appcompat.widget.SwitchCompat
android:id="@+id/searchTypeSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:textOff="@string/offline"
android:textOn="@string/online"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/tapHelpText"
app:layout_constraintTop_toTopOf="parent"
app:showText="true"
/>


<TextView
android:id="@+id/tapHelpText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0"
android:text="@string/tap_a_point_on_map_to_start_download"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@+id/searchTypeSwitch"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
>

</TextView>

</androidx.constraintlayout.widget.ConstraintLayout>

<LinearLayout
android:id="@+id/circleInputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.8"
android:background="#00F6F5F5"
android:orientation="vertical"
android:padding="16dp"
>

<EditText
android:id="@+id/circleCenterPoint"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F3EDED"
android:clickable="false"
android:enabled="true"
android:importantForAutofill="no"
android:inputType="number"
android:textAlignment="center"
android:visibility="invisible"
tools:ignore="LabelFor"
/>

<EditText
android:id="@+id/circleInputText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F3EDED"
android:clickable="false"
android:enabled="true"
android:hint="@string/radius_from_center_in_km"
android:importantForAutofill="no"
android:inputType="number"
android:text="@string/default_radius"
android:textAlignment="center"
android:visibility="visible"
/>

<Button
android:id="@+id/submitCircleRadius"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/set_km_radius_and_download"
android:visibility="visible"
/>

</LinearLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

<com.mapbox.search.ui.view.SearchResultsView
android:id="@+id/search_results_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?actionBarSize"
android:clipToPadding="false"
android:paddingTop="22dp"
android:paddingBottom="22dp"
android:visibility="gone"
/>

</FrameLayout>
18 changes: 18 additions & 0 deletions MapboxSearch/sample/src/main/res/layout/index_region_center.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>

<ImageView
android:id="@+id/circleCenterMarker"
app:srcCompat="@drawable/proximity"
android:layout_width="30sp"
android:layout_height="30sp"
android:importantForAccessibility="no"
>

</ImageView>

</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>

<TextView
android:id="@+id/regionDownloadPercent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="@string/downloaded_100pc"
android:textColor="@color/backgroundDark"
android:textSize="15sp"
/>

</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
>

<item
android:id="@+id/open_tile_download_ui_example"
android:title="@string/action_tile_download_ui_example"
/>

<item
android:id="@+id/open_address_autofill_ui_example"
android:title="@string/action_address_autofill_ui_example"
Expand Down
12 changes: 11 additions & 1 deletion MapboxSearch/sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<resources>

<string name="action_address_autofill_ui_example">Address autofill UI example</string>
<string name="action_tile_download_ui_example">Tile Download UI</string>

<string name="action_address_autofill_ui_example">Address autofill UI</string>
<string name="action_address_autofill_example">Address autofill</string>

<string name="action_discover_ui_example">Discover UI</string>
Expand Down Expand Up @@ -67,4 +69,12 @@
<string name="kotlin_examples">Kotlin Examples</string>
<string name="start">Start</string>
<string name="working">Working…</string>
<string name="offline">Offline</string>
<string name="online">Online</string>
<string name="tap_a_point_on_map_to_start_download">Tap a point on map to start download</string>
<string name="downloaded_pc_text">Downloaded %s%%</string>
<string name="downloaded_100pc">Downloaded 100%</string>
<string name="radius_from_center_in_km">Radius from center in KM</string>
<string name="default_radius">10</string>
<string name="set_km_radius_and_download">Set km radius and download</string>
</resources>