Skip to content
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
25 changes: 16 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ android {

buildConfigField 'String', 'WS_API_USER_ID', "\"$wsApiUserId\""
buildConfigField 'String', 'WS_API_KEY', "\"$wsApiKey\""
multiDexEnabled true

}
flavorDimensions "mode"
productFlavors {
Expand Down Expand Up @@ -164,23 +166,26 @@ ext {
androidxVersion = '1.1.0'
androidxCardViewVersion = '1.0.0'
androidxConstraintLayoutVersion = '1.1.3'
androidxTestVersion = '1.0.0'
assertjVersion = '3.13.2'
autoServiceVersion = '1.0-rc4'
androidxTestVersion = '1.2.0'
assertjVersion = '3.14.0'
autoServiceVersion = '1.0-rc6'
bubbleSeekbarVersion = '3.20'
butterknifeVersion = '10.2.0'
daggerVersion = '2.24'
glideVersion = '4.9.0'
daggerVersion = '2.25.2'
glideVersion = '4.10.0'
gsonVersion = '2.8.6'
jsonVersion = '20190722'
junitVersion = '4.12'
multiDexVersion = '2.0.1'
mockitoVersion = '2.28.2'
okHttpVersion = '3.12.0'
okHttpVersion = '4.2.2'
osmbonuspackVersion = '6.6.0'
osmdroidVersion = '6.1.0'
osmdroidMapforgeVersion = '6.1.2'
osmdroidVersion = '6.1.2'
playServicesVersion = '17.0.0'
retrofitVersion = '2.6.1' // Dictates version of okhttp in their dependencies which clashes in tests.
robolectricVersion = '4.3'
retrofitVersion = '2.6.2'
// Dictates version of okhttp in their dependencies which clashes in tests.
robolectricVersion = '4.3.1'
rxAndroidVersion = '2.1.1'
rxJavaVersion = '2.2.12'
securekeysVersion = '2.2.0' // Adjust the version in the project's build.gradle, too.
Expand All @@ -196,6 +201,7 @@ dependencies {
implementation "androidx.appcompat:appcompat:$androidxVersion"
implementation "androidx.cardview:cardview:$androidxCardViewVersion"
implementation "androidx.constraintlayout:constraintlayout:$androidxConstraintLayoutVersion"
implementation "androidx.multidex:multidex:$multiDexVersion"
implementation "androidx.preference:preference:$androidxVersion"
implementation "com.github.bumptech.glide:glide:$glideVersion"
implementation "com.github.MKergall:osmbonuspack:$osmbonuspackVersion"
Expand All @@ -213,6 +219,7 @@ dependencies {
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "org.osmdroid:osmdroid-android:$osmdroidVersion"
implementation "org.osmdroid:osmdroid-mapsforge:$osmdroidMapforgeVersion"

googleImplementation "com.google.android.gms:play-services-analytics:$playServicesVersion"

Expand Down
105 changes: 71 additions & 34 deletions app/src/google/res/xml/preferences.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!--

Reflect changes from `app/src/main/res/xml/preferences.xml`.

-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">

<ListPreference
android:defaultValue="@string/prefs_distance_unit_default"
android:entries="@array/prefs_distance_unit_entries"
android:entryValues="@array/prefs_distance_unit_entry_values"
android:key="@string/prefs_distance_unit_key"
android:summary="@string/prefs_distance_unit_summary"
android:title="@string/prefs_distance_unit_title" />

<ListPreference
android:key="@string/prefs_tile_source_key"
android:summary="@string/prefs_tile_source_summary"
android:title="@string/prefs_tile_source_title" />

<fi.bitrite.android.ws.ui.preference.RefreshIntervalPreference
android:defaultValue="@integer/prefs_message_refresh_interval_min_default"
android:dialogMessage="@string/prefs_message_refresh_interval_min_dialog_message"
android:inputType="number"
android:key="@string/prefs_message_refresh_interval_min_key"
android:title="@string/prefs_message_refresh_interval_min_title" />

<SwitchPreference
android:defaultValue="@bool/prefs_data_saver_mode_default"
android:key="@string/prefs_data_saver_mode_key"
android:title="@string/prefs_data_saver_mode_title"
android:summary="@string/prefs_data_saver_mode_summary"/>

<SwitchPreference
android:defaultValue="@bool/prefs_ga_collect_stats_default"
android:key="@string/prefs_ga_collect_stats_key"
android:summaryOff="@string/prefs_ga_collect_stats_summary_off"
android:summaryOn="@string/prefs_ga_collect_stats_summary_on"
android:title="@string/prefs_ga_collect_stats_title" />
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<PreferenceCategory
android:title="Map settings" >

<ListPreference
android:key="@string/prefs_online_map_source"
android:title="@string/prefs_online_map_source_title"
android:summary="@string/prefs_tile_source_summary" />

<SwitchPreference
android:key="@string/prefs_offline_map_enabled"
android:title="Use offline maps"
android:checked="false" />

<ListPreference
android:key="@string/prefs_offline_theme_selection"
android:title="Offline map style"
android:summary="@string/prefs_tile_source_summary" />

<MultiSelectListPreference
android:key="@string/prefs_offline_map_selection"
android:title="Offline map source"
app:isPreferenceVisible="false" />
</PreferenceCategory>

<PreferenceCategory
android:title="Messaging">

<fi.bitrite.android.ws.ui.preference.RefreshIntervalPreference
android:defaultValue="@integer/prefs_message_refresh_interval_min_default"
android:dialogMessage="@string/prefs_message_refresh_interval_min_dialog_message"
android:inputType="number"
android:key="@string/prefs_message_refresh_interval_min_key"
android:title="@string/prefs_message_refresh_interval_min_title" />
</PreferenceCategory>

<PreferenceCategory
android:title="Other">

<ListPreference
android:defaultValue="@string/prefs_distance_unit_default"
android:entries="@array/prefs_distance_unit_entries"
android:entryValues="@array/prefs_distance_unit_entry_values"
android:key="@string/prefs_distance_unit_key"
android:summary="@string/prefs_distance_unit_summary"
android:title="@string/prefs_distance_unit_title" />

<SwitchPreference
android:defaultValue="@bool/prefs_data_saver_mode_default"
android:key="@string/prefs_data_saver_mode_key"
android:title="@string/prefs_data_saver_mode_title"
android:summary="@string/prefs_data_saver_mode_summary"/>

<SwitchPreference
android:defaultValue="@bool/prefs_ga_collect_stats_default"
android:key="@string/prefs_ga_collect_stats_key"
android:summaryOff="@string/prefs_ga_collect_stats_summary_off"
android:summaryOn="@string/prefs_ga_collect_stats_summary_on"
android:title="@string/prefs_ga_collect_stats_title" />

</PreferenceCategory>


</PreferenceScreen>

2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- for offline maps and to cache on sdcard -->
<!-- WRITE_EXTERNAL_STORAGE includes READ_EXTERNAL_STORAGE -->
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<!-- Account Manager -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package fi.bitrite.android.ws;

import android.app.Application;
import android.content.SharedPreferences;

import com.bumptech.glide.request.RequestOptions;
import com.u.securekeys.SecureEnvironment;

import javax.inject.Inject;

import androidx.multidex.MultiDexApplication;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.HasAndroidInjector;
Expand All @@ -16,7 +16,7 @@
import fi.bitrite.android.ws.repository.SettingsRepository;
import fi.bitrite.android.ws.util.WSGlide;

public abstract class BaseWSAndroidApplication extends Application implements HasAndroidInjector {
public abstract class BaseWSAndroidApplication extends MultiDexApplication implements HasAndroidInjector {

public static final String TAG = "WSAndroidApplication";
private static AppInjector mAppInjector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public enum ErrorCause {
WrongAPIKey,
AccountTemporarilyBlocked,
IpTemporarilyBlocked,
Unknown;
Unknown
}
public final ErrorCause errorCause;

Expand Down
46 changes: 46 additions & 0 deletions app/src/main/java/fi/bitrite/android/ws/model/MapsForgeTheme.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package fi.bitrite.android.ws.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class MapsForgeTheme implements Serializable {
private String name;
private String id;
private Map<String, String> localizedNames;
private String filePath;

public MapsForgeTheme(String name, String id, String filePath) {
this.name = name;
this.id = id;
this.filePath = filePath;
localizedNames = new HashMap<>();
}

public String getId() {
return id;
}

public String getName() {
return name;
}

public String getFilePath() {
return filePath;
}

public String getLocalizedDisplayName(String lang) {
if (!localizedNames.containsKey(lang)) {
lang = "en";
}
if (localizedNames.get(lang) != null) {
return localizedNames.get(lang) + " (" + name + ")";
} else {
return name;
}
}

public void addLocalizedName(String lang, String name) {
localizedNames.put(lang, name);
}
}
Loading