Skip to content

Commit

Permalink
prefix resource strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mauron85 committed Nov 20, 2018
1 parent 287f7ce commit 6ec6d4f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 13 deletions.
5 changes: 5 additions & 0 deletions VERSIONS.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def ROBOLECTRIC_VERSION = "3.0"
def JUNIT_VERSION = "4.12"
def FEST_ASSERT_CORE_VERSION = "2.0M10"
def SUPPORT_TEST_VERSION = "0.5"
def RESOURCE_PREFIX = "mauron85_bgloc_"

ext {
hasRootProject = { ->
Expand Down Expand Up @@ -112,6 +113,10 @@ ext {
return false
}

getResourcePrefix = { ->
return RESOURCE_PREFIX
}

androidLibs = [
supportAnnotations: [group: 'com.android.support', name: 'support-annotations', version: '23.1.1'],
supportCompat: [group: 'com.android.support', name: 'support-compat', version: getSupportLibVersion()],
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ apply plugin: 'com.android.library'

apply from: './VERSIONS.gradle'
def applicationId = getApplicationId()
def playServicesVersion = getPlayServicesVersion()
def supportLibVersion = getSupportLibVersion()
def hasGradle3Support = getGradle3Support()
def resourcePrefix = getResourcePrefix()

// https://hackernoon.com/android-how-to-add-gradle-dependencies-using-foreach-c4cbcc070458
def oreoDependencies = [
Expand Down Expand Up @@ -66,8 +65,9 @@ android {
publishNonDefault true

defaultConfig {
resValue "string", "content_authority", applicationId + '.provider'
resValue "string", "account_type", applicationId
resValue "string", resourcePrefix + "account_name", 'Locations'
resValue "string", resourcePrefix + "account_type", applicationId + '.mauron85.bgloc.account'
resValue "string", resourcePrefix + "content_authority", applicationId + '.mauron85.bgloc.provider'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
minSdkVersion project.ext.getMinSdkVersion()
versionCode 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.marianhello.backgroundgeolocation;

abstract public class TestConstants {
public static final String Authority = "com.marianhello.app.provider";
public static final String Authority = "com.marianhello.app.mauron85.bgloc.provider";
}
2 changes: 1 addition & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</service>
<provider
android:name="com.marianhello.bgloc.data.provider.LocationContentProvider"
android:authorities="@string/content_authority"
android:authorities="@string/mauron85_bgloc_content_authority"
android:exported="false"
android:syncable="true"/>
<service android:enabled="true" android:exported="false" android:name="com.marianhello.bgloc.LocationService" />
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/marianhello/bgloc/ResourceResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
*/
public class ResourceResolver {

private static final String ACCOUNT_NAME_RESOURCE = "account_name";
private static final String ACCOUNT_TYPE_RESOURCE = "account_type";
private static final String AUTHORITY_TYPE_RESOURCE = "content_authority";
private static final String RESOURCE_PREFIX = "mauron85_bgloc_";
private static final String ACCOUNT_NAME_RESOURCE = RESOURCE_PREFIX + "account_name";
private static final String ACCOUNT_TYPE_RESOURCE = RESOURCE_PREFIX + "account_type";
private static final String AUTHORITY_TYPE_RESOURCE = RESOURCE_PREFIX + "content_authority";

private Context mContext;

Expand Down
1 change: 0 additions & 1 deletion src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">app_name</string>
<string name="account_name">Locations</string>
</resources>
2 changes: 1 addition & 1 deletion src/main/res/xml/authenticator.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator
xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="@string/account_type"
android:accountType="@string/mauron85_bgloc_account_type"
android:icon="@mipmap/ic_launcher"
android:smallIcon="@mipmap/ic_launcher"
android:label="@string/app_name"/>
4 changes: 2 additions & 2 deletions src/main/res/xml/syncadapter.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<sync-adapter
xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="@string/content_authority"
android:accountType="@string/account_type"
android:contentAuthority="@string/mauron85_bgloc_content_authority"
android:accountType="@string/mauron85_bgloc_account_type"
android:userVisible="false"
android:supportsUploading="true"
android:allowParallelSyncs="false"
Expand Down

0 comments on commit 6ec6d4f

Please sign in to comment.