Last active
January 2, 2016 10:19
-
-
Save Michenux/8288768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.michenux.drodrolib.accounts; | |
import android.text.TextUtils; | |
public class AccountUtils { | |
public static String buildAccountType(String flavor, String accountName, boolean debug) { | |
StringBuilder authority = new StringBuilder(); | |
if ( !TextUtils.isEmpty(flavor)) { | |
authority.append(flavor); | |
authority.append('.'); | |
} | |
authority.append(accountName); | |
if (debug) { | |
authority.append(".debug"); | |
} | |
return authority.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.michenux.drodrolib.content; | |
import android.text.TextUtils; | |
public class ContentProviderUtils { | |
public static String buildAuthority( String packageName, String flavor, String name) { | |
StringBuilder authority = new StringBuilder(packageName); | |
if ( !TextUtils.isEmpty(flavor)) { | |
authority.append('.'); | |
authority.append(flavor); | |
} | |
authority.append('.'); | |
authority.append(name); | |
return authority.toString(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String AUTHORITY = ContentProviderUtils.buildAuthority( | |
BuildConfig.PACKAGE_NAME, BuildConfig.FLAVOR, "friends"); | |
public static final String ACCOUNT_TYPE = AccountUtils.buildAccountType( | |
BuildConfig.FLAVOR, "michenux.net", BuildConfig.DEBUG); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment