Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

Commit 259d561

Browse files
author
Langston Smith
authored
Fixes to Localization Plugin XML so that language switch buttons appear (#1186)
1 parent eaf01ce commit 259d561

11 files changed

+62
-125
lines changed

MapboxAndroidDemo/src/china/res/layout/activity_basic_simple_china_mapview.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
android:layout_height="match_parent"
88
tools:context=".examples.basics.SimpleMapViewActivity">
99

10-
<!-- Set the starting camera position and map style using xml-->
1110
<com.mapbox.mapboxsdk.plugins.china.maps.ChinaMapView
1211
android:id="@+id/mapView"
1312
android:layout_width="match_parent"

MapboxAndroidDemo/src/china/res/layout/activity_basic_simple_kotlin.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
android:layout_height="match_parent"
77
tools:context=".examples.basics.SimpleMapViewActivity">
88

9-
<!-- Set the starting camera position and map style using xml-->
109
<com.mapbox.mapboxsdk.plugins.china.maps.ChinaMapView
1110
android:id="@+id/mapView"
1211
android:layout_width="match_parent"

MapboxAndroidDemo/src/china/res/layout/activity_localization_plugin.xml

Lines changed: 29 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,84 +5,58 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent">
77

8-
<com.mapbox.mapboxsdk.plugins.china.maps.ChinaMapView
8+
<com.mapbox.mapboxsdk.maps.MapView
99
android:id="@+id/mapView"
1010
android:layout_width="match_parent"
1111
android:layout_height="match_parent"
1212
app:mapbox_cameraTargetLat="35.830744"
1313
app:mapbox_cameraTargetLng="136.711369"
1414
app:mapbox_cameraZoom="4.5257" />
1515

16-
<androidx.constraintlayout.widget.ConstraintLayout
17-
android:layout_width="match_parent"
18-
android:layout_height="wrap_content">
16+
<LinearLayout
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:layout_marginStart="8dp"
20+
android:layout_marginLeft="8dp"
21+
android:layout_marginTop="16dp"
22+
android:orientation="horizontal">
1923

20-
<androidx.cardview.widget.CardView
21-
android:id="@+id/language_one_cardview"
24+
<Button
25+
android:id="@+id/language_one_button"
2226
android:layout_width="wrap_content"
2327
android:layout_height="wrap_content"
24-
android:layout_marginTop="8dp"
25-
android:backgroundTint="@color/mapboxOrangeDark"
26-
app:layout_constraintEnd_toStartOf="@+id/language_two_cardview"
27-
app:layout_constraintHorizontal_bias="0.5"
28-
app:layout_constraintStart_toStartOf="parent"
29-
app:layout_constraintTop_toBottomOf="parent">
30-
31-
<TextView
32-
android:layout_width="match_parent"
33-
android:layout_height="match_parent"
34-
android:layout_margin="16dp"
35-
android:text="@string/arabic"
36-
android:textColor="@color/mapboxWhite" />
37-
38-
</androidx.cardview.widget.CardView>
28+
android:background="@color/mapboxOrangeDark"
29+
android:text="@string/arabic"
30+
android:textColor="@color/mapboxWhite" />
3931

40-
<androidx.cardview.widget.CardView
41-
android:id="@+id/language_two_cardview"
32+
<Button
33+
android:id="@+id/language_two_button"
4234
android:layout_width="wrap_content"
4335
android:layout_height="wrap_content"
44-
android:backgroundTint="@color/mapboxPurpleDark"
45-
app:layout_constraintEnd_toStartOf="@+id/language_three_cardview"
46-
app:layout_constraintHorizontal_bias="0.5"
47-
app:layout_constraintStart_toEndOf="@+id/language_one_cardview"
48-
app:layout_constraintTop_toTopOf="@id/language_one_cardview">
36+
android:layout_marginStart="32dp"
37+
android:layout_marginLeft="32dp"
38+
android:background="@color/mapboxPurpleDark"
39+
android:text="@string/russian"
40+
android:textColor="@color/mapboxWhite" />
4941

50-
<TextView
51-
android:layout_width="match_parent"
52-
android:layout_height="match_parent"
53-
android:layout_margin="16dp"
54-
android:text="@string/russian"
55-
android:textColor="@color/mapboxWhite" />
5642

57-
</androidx.cardview.widget.CardView>
58-
59-
60-
<androidx.cardview.widget.CardView
61-
android:id="@+id/language_three_cardview"
43+
<Button
44+
android:id="@+id/language_three_button"
6245
android:layout_width="wrap_content"
6346
android:layout_height="wrap_content"
64-
android:backgroundTint="@color/mapboxGreenDark"
65-
app:layout_constraintEnd_toEndOf="parent"
66-
app:layout_constraintHorizontal_bias="0.5"
67-
app:layout_constraintStart_toEndOf="@+id/language_two_cardview"
68-
app:layout_constraintTop_toTopOf="@id/language_two_cardview">
69-
70-
<TextView
71-
android:layout_width="match_parent"
72-
android:layout_height="match_parent"
73-
android:layout_margin="16dp"
74-
android:text="@string/chinese"
75-
android:textColor="@color/mapboxWhite" />
47+
android:layout_marginStart="32dp"
48+
android:layout_marginLeft="32dp"
49+
android:background="@color/mapboxGreenDark"
50+
android:text="@string/chinese"
51+
android:textColor="@color/mapboxWhite" />
7652

77-
</androidx.cardview.widget.CardView>
78-
79-
</androidx.constraintlayout.widget.ConstraintLayout>
53+
</LinearLayout>
8054

8155
<com.google.android.material.floatingactionbutton.FloatingActionButton
8256
android:id="@+id/match_map_to_device_language"
8357
android:layout_width="wrap_content"
8458
android:layout_height="wrap_content"
85-
android:layout_gravity="bottom|right"
59+
android:layout_gravity="bottom|end"
8660
android:layout_marginEnd="16dp"
8761
android:layout_marginRight="16dp"
8862
android:layout_marginBottom="16dp"
@@ -91,5 +65,4 @@
9165
app:srcCompat="@drawable/ic_swap_horiz_white_24dp"
9266
mapbox:fabSize="small" />
9367

94-
9568
</FrameLayout>

MapboxAndroidDemo/src/china/res/layout/activity_query_redo_search_in_area.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
android:layout_width="match_parent"
55
android:layout_height="match_parent">
66

7-
<!-- Set the starting camera position and map style using xml-->
87
<com.mapbox.mapboxsdk.plugins.china.maps.ChinaMapView
98
android:id="@+id/mapView"
109
android:layout_width="match_parent"

MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/examples/plugins/LocalizationPluginActivity.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,24 @@ protected void onCreate(Bundle savedInstanceState) {
4444

4545
@Override
4646
public void onMapReady(@NonNull final MapboxMap mapboxMap) {
47-
4847
mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() {
4948
@Override
5049
public void onStyleLoaded(@NonNull Style style) {
5150
localizationPlugin = new LocalizationPlugin(mapView, mapboxMap, style);
5251

53-
findViewById(R.id.language_one_cardview).setOnClickListener(new View.OnClickListener() {
52+
findViewById(R.id.language_one_button).setOnClickListener(new View.OnClickListener() {
5453
@Override
5554
public void onClick(View view) {
5655
localizationPlugin.setMapLanguage(MapLocale.ARABIC);
5756
}
5857
});
59-
findViewById(R.id.language_two_cardview).setOnClickListener(new View.OnClickListener() {
58+
findViewById(R.id.language_two_button).setOnClickListener(new View.OnClickListener() {
6059
@Override
6160
public void onClick(View view) {
6261
localizationPlugin.setMapLanguage(MapLocale.RUSSIAN);
6362
}
6463
});
65-
findViewById(R.id.language_three_cardview).setOnClickListener(new View.OnClickListener() {
64+
findViewById(R.id.language_three_button).setOnClickListener(new View.OnClickListener() {
6665
@Override
6766
public void onClick(View view) {
6867
localizationPlugin.setMapLanguage(MapLocale.SIMPLIFIED_CHINESE);
@@ -86,7 +85,6 @@ public void onClick(View view) {
8685
}
8786
}
8887
});
89-
9088
Toast.makeText(LocalizationPluginActivity.this, R.string.instruction_description,
9189
Toast.LENGTH_LONG).show();
9290
}

MapboxAndroidDemo/src/main/res/layout/activity_basic_simple_kotlin.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
android:layout_height="match_parent"
77
tools:context=".examples.basics.MapViewActivityKotlin">
88

9-
<!-- Set the starting camera position and map style using xml-->
109
<com.mapbox.mapboxsdk.maps.MapView
1110
android:id="@+id/mapView"
1211
android:layout_width="match_parent"

MapboxAndroidDemo/src/main/res/layout/activity_basic_simple_mapview.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
android:layout_height="match_parent"
88
tools:context=".examples.basics.SimpleMapViewActivity">
99

10-
<!-- Set the starting camera position and map style using xml-->
1110
<com.mapbox.mapboxsdk.maps.MapView
1211
android:id="@+id/mapView"
1312
android:layout_width="match_parent"

MapboxAndroidDemo/src/main/res/layout/activity_localization_plugin.xml

Lines changed: 29 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -13,83 +13,56 @@
1313
app:mapbox_cameraTargetLng="136.711369"
1414
app:mapbox_cameraZoom="4.5257" />
1515

16-
<androidx.constraintlayout.widget.ConstraintLayout
17-
android:layout_width="match_parent"
18-
android:layout_height="wrap_content">
16+
<LinearLayout
17+
android:layout_width="wrap_content"
18+
android:layout_height="wrap_content"
19+
android:layout_marginStart="8dp"
20+
android:layout_marginLeft="8dp"
21+
android:layout_marginTop="16dp"
22+
android:orientation="horizontal">
1923

20-
<androidx.cardview.widget.CardView
21-
android:id="@+id/language_one_cardview"
24+
<Button
25+
android:id="@+id/language_one_button"
2226
android:layout_width="wrap_content"
2327
android:layout_height="wrap_content"
24-
android:layout_marginTop="8dp"
25-
android:backgroundTint="@color/mapboxOrangeDark"
26-
app:layout_constraintEnd_toStartOf="@+id/language_two_cardview"
27-
app:layout_constraintHorizontal_bias="0.5"
28-
app:layout_constraintStart_toStartOf="parent"
29-
app:layout_constraintTop_toBottomOf="parent">
28+
android:background="@color/mapboxOrangeDark"
29+
android:text="@string/arabic"
30+
android:textColor="@color/mapboxWhite" />
3031

31-
<TextView
32-
android:layout_width="match_parent"
33-
android:layout_height="match_parent"
34-
android:layout_margin="16dp"
35-
android:text="@string/arabic"
36-
android:textColor="@color/mapboxWhite" />
37-
38-
</androidx.cardview.widget.CardView>
39-
40-
<androidx.cardview.widget.CardView
41-
android:id="@+id/language_two_cardview"
32+
<Button
33+
android:id="@+id/language_two_button"
4234
android:layout_width="wrap_content"
4335
android:layout_height="wrap_content"
44-
android:backgroundTint="@color/mapboxPurpleDark"
45-
app:layout_constraintEnd_toStartOf="@+id/language_three_cardview"
46-
app:layout_constraintHorizontal_bias="0.5"
47-
app:layout_constraintStart_toEndOf="@+id/language_one_cardview"
48-
app:layout_constraintTop_toTopOf="@id/language_one_cardview">
49-
50-
<TextView
51-
android:layout_width="match_parent"
52-
android:layout_height="match_parent"
53-
android:layout_margin="16dp"
54-
android:text="@string/russian"
55-
android:textColor="@color/mapboxWhite" />
36+
android:layout_marginStart="32dp"
37+
android:layout_marginLeft="32dp"
38+
android:background="@color/mapboxPurpleDark"
39+
android:text="@string/russian"
40+
android:textColor="@color/mapboxWhite" />
5641

57-
</androidx.cardview.widget.CardView>
5842

59-
60-
<androidx.cardview.widget.CardView
61-
android:id="@+id/language_three_cardview"
43+
<Button
44+
android:id="@+id/language_three_button"
6245
android:layout_width="wrap_content"
6346
android:layout_height="wrap_content"
64-
android:backgroundTint="@color/mapboxGreenDark"
65-
app:layout_constraintEnd_toEndOf="parent"
66-
app:layout_constraintHorizontal_bias="0.5"
67-
app:layout_constraintStart_toEndOf="@+id/language_two_cardview"
68-
app:layout_constraintTop_toTopOf="@id/language_two_cardview">
69-
70-
<TextView
71-
android:layout_width="match_parent"
72-
android:layout_height="match_parent"
73-
android:layout_margin="16dp"
74-
android:text="@string/chinese"
75-
android:textColor="@color/mapboxWhite" />
76-
77-
</androidx.cardview.widget.CardView>
47+
android:layout_marginStart="32dp"
48+
android:layout_marginLeft="32dp"
49+
android:background="@color/mapboxGreenDark"
50+
android:text="@string/chinese"
51+
android:textColor="@color/mapboxWhite" />
7852

79-
</androidx.constraintlayout.widget.ConstraintLayout>
53+
</LinearLayout>
8054

8155
<com.google.android.material.floatingactionbutton.FloatingActionButton
8256
android:id="@+id/match_map_to_device_language"
8357
android:layout_width="wrap_content"
8458
android:layout_height="wrap_content"
85-
android:layout_gravity="bottom|right"
86-
android:layout_marginBottom="16dp"
59+
android:layout_gravity="bottom|end"
8760
android:layout_marginEnd="16dp"
8861
android:layout_marginRight="16dp"
62+
android:layout_marginBottom="16dp"
8963
app:layout_constraintBottom_toBottomOf="parent"
9064
app:layout_constraintEnd_toEndOf="parent"
9165
app:srcCompat="@drawable/ic_swap_horiz_white_24dp"
9266
mapbox:fabSize="small" />
9367

94-
9568
</FrameLayout>

MapboxAndroidDemo/src/main/res/layout/activity_offline_cache_manipulation.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
android:background="@color/materialGrey"
99
tools:context=".examples.offline.CacheManagementActivity">
1010

11-
<!-- Set the starting camera position and map style using xml-->
1211
<com.mapbox.mapboxsdk.maps.MapView
1312
android:id="@+id/mapView"
1413
android:layout_width="0dp"

MapboxAndroidDemo/src/main/res/layout/activity_query_redo_search_in_area.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
android:layout_width="match_parent"
55
android:layout_height="match_parent">
66

7-
<!-- Set the starting camera position and map style using xml-->
87
<com.mapbox.mapboxsdk.maps.MapView
98
android:id="@+id/mapView"
109
android:layout_width="match_parent"

0 commit comments

Comments
 (0)