From 068e0c6b4d591234c3251d9268a3a51661f53353 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 21 Apr 2017 21:19:48 +0100 Subject: [PATCH] Expose appName from App and use it. --- app/src/main/java/com/etesync/syncadapter/App.java | 4 ++++ app/src/main/java/com/etesync/syncadapter/HttpClient.java | 2 +- .../main/java/com/etesync/syncadapter/ui/AboutActivity.java | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/etesync/syncadapter/App.java b/app/src/main/java/com/etesync/syncadapter/App.java index 1a018e24..11d599ab 100644 --- a/app/src/main/java/com/etesync/syncadapter/App.java +++ b/app/src/main/java/com/etesync/syncadapter/App.java @@ -88,6 +88,9 @@ public class App extends Application { public static final String OVERRIDE_PROXY_HOST_DEFAULT = "localhost"; public static final int OVERRIDE_PROXY_PORT_DEFAULT = 8118; + @Getter + private static String appName; + @Getter private CustomCertManager certManager; @@ -123,6 +126,7 @@ public class App extends Application { uidGenerator = new UidGenerator(null, android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.ANDROID_ID)); + appName = getString(R.string.app_name); accountType = getString(R.string.account_type); addressBookAccountType = getString(R.string.account_type_address_book); addressBooksAuthority = getString(R.string.address_books_authority); diff --git a/app/src/main/java/com/etesync/syncadapter/HttpClient.java b/app/src/main/java/com/etesync/syncadapter/HttpClient.java index d6454974..cef0db3d 100644 --- a/app/src/main/java/com/etesync/syncadapter/HttpClient.java +++ b/app/src/main/java/com/etesync/syncadapter/HttpClient.java @@ -41,7 +41,7 @@ public class HttpClient { static { String date = new SimpleDateFormat("yyyy/MM/dd", Locale.US).format(new Date(BuildConfig.buildTime)); - userAgent = "EteSync/" + BuildConfig.VERSION_NAME + " (" + date + "; okhttp3) Android/" + Build.VERSION.RELEASE; + userAgent = App.getAppName() + "/" + BuildConfig.VERSION_NAME + " (" + date + "; okhttp3) Android/" + Build.VERSION.RELEASE; } private HttpClient() { diff --git a/app/src/main/java/com/etesync/syncadapter/ui/AboutActivity.java b/app/src/main/java/com/etesync/syncadapter/ui/AboutActivity.java index 6cd33770..f749547b 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/AboutActivity.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/AboutActivity.java @@ -72,7 +72,7 @@ public class AboutActivity extends AppCompatActivity { private final static ComponentInfo components[] = { new ComponentInfo( - "EteSync", BuildConfig.VERSION_NAME, Constants.webUri.toString(), + App.getAppName(), BuildConfig.VERSION_NAME, Constants.webUri.toString(), DateFormatUtils.format(BuildConfig.buildTime, "yyyy") + " Tom Hacohen", R.string.about_license_info_no_warranty, "gpl-3.0-standalone.html" ), new ComponentInfo(