Skip to content

Commit de241a1

Browse files
committed
prefix resource strings
1 parent 95379c5 commit de241a1

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

VERSIONS.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def ROBOLECTRIC_VERSION = "3.0"
1313
def JUNIT_VERSION = "4.12"
1414
def FEST_ASSERT_CORE_VERSION = "2.0M10"
1515
def SUPPORT_TEST_VERSION = "0.5"
16+
def RESOURCE_PREFIX = "mauron85_bgloc_"
1617

1718
ext {
1819
hasRootProject = { ->
@@ -112,6 +113,10 @@ ext {
112113
return false
113114
}
114115

116+
getResourcePrefix = { ->
117+
return RESOURCE_PREFIX
118+
}
119+
115120
androidLibs = [
116121
supportAnnotations: [group: 'com.android.support', name: 'support-annotations', version: '23.1.1'],
117122
supportCompat: [group: 'com.android.support', name: 'support-compat', version: getSupportLibVersion()],

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ apply plugin: 'com.android.library'
22

33
apply from: './VERSIONS.gradle'
44
def applicationId = getApplicationId()
5-
def playServicesVersion = getPlayServicesVersion()
6-
def supportLibVersion = getSupportLibVersion()
75
def hasGradle3Support = getGradle3Support()
6+
def resourcePrefix = getResourcePrefix()
87

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

6867
defaultConfig {
69-
resValue "string", "mauron85_bgloc_content_authority", applicationId + '.mauron85.bgloc.provider'
70-
resValue "string", "mauron85_bgloc_account_type", applicationId + '.mauron85.bgloc.account'
68+
resValue "string", resourcePrefix + "account_name", 'Locations'
69+
resValue "string", resourcePrefix + "account_type", applicationId + '.mauron85.bgloc.account'
70+
resValue "string", resourcePrefix + "content_authority", applicationId + '.mauron85.bgloc.provider'
7171
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
7272
minSdkVersion project.ext.getMinSdkVersion()
7373
versionCode 1

src/main/java/com/marianhello/bgloc/ResourceResolver.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
*/
88
public class ResourceResolver {
99

10-
private static final String ACCOUNT_NAME_RESOURCE = "account_name";
11-
private static final String ACCOUNT_TYPE_RESOURCE = "mauron85_bgloc_account_type";
12-
private static final String AUTHORITY_TYPE_RESOURCE = "mauron85_bgloc_content_authority";
10+
private static final String RESOURCE_PREFIX = "mauron85_bgloc_";
11+
private static final String ACCOUNT_NAME_RESOURCE = RESOURCE_PREFIX + "account_name";
12+
private static final String ACCOUNT_TYPE_RESOURCE = RESOURCE_PREFIX + "account_type";
13+
private static final String AUTHORITY_TYPE_RESOURCE = RESOURCE_PREFIX + "content_authority";
1314

1415
private Context mContext;
1516

src/main/res/values/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<string name="app_name">app_name</string>
4-
<string name="account_name">Locations</string>
54
</resources>

0 commit comments

Comments
 (0)