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 95379c5 commit de241a1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 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", "mauron85_bgloc_content_authority", applicationId + '.mauron85.bgloc.provider'
resValue "string", "mauron85_bgloc_account_type", applicationId + '.mauron85.bgloc.account'
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
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 = "mauron85_bgloc_account_type";
private static final String AUTHORITY_TYPE_RESOURCE = "mauron85_bgloc_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>

0 comments on commit de241a1

Please sign in to comment.