下面列出了android.app.Application#getString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
NotifyDeveloperHandler(Application context, Iterable<String> emailAddress, LogLevel minLevel, final ActivityStateListener stateListener) {
this.context = context;
this.emailAddress = Lists.newArrayList(emailAddress);
this.filter = new AtLeastFilter(minLevel);
this.activityState = new WeakReference<>(stateListener);
this.attachmentClassList = new ArrayList<>();
this.shakeDetector = new ShakeDetector(new ShakeDetector.Listener() {
@Override
public void hearShake() {
ActivityStateListener listener = activityState.get();
if (listener != null) {
if (listener.isAppInForeground()) {
beginPublishOnMainThread(new LogRecord(Level.INFO, "Report a problem with app"));
} else {
Log.i(TAG, "Ignore shake event - the app appears to be in background");
}
} else {
Log.i(TAG, "Ignore shake event - can't detect if app is in foreground (API < 14)");
}
}
});
this.emailSubject = context.getString(R.string.slf4android_email_subject) + context.getPackageName();
this.emailBody = context.getString(R.string.slf4android_email_extra_text);
}
@Test
public void testApplication() {
Application application = RuntimeEnvironment.application;
String appName = application.getString(R.string.app_name);
Assert.assertEquals("WanAndroid", appName);
}
@Inject
public DownloadsDatabase(@NonNull Application application) {
super(application, DATABASE_NAME, null, DATABASE_VERSION);
DEFAULT_DOWNLOADS_TITLE = application.getString(R.string.untitled);
}
@Inject
public BookmarkDatabase(@NonNull Application application) {
super(application, DATABASE_NAME, null, DATABASE_VERSION);
DEFAULT_BOOKMARK_TITLE = application.getString(R.string.untitled);
}
public GoogleSuggestionsModel(@NonNull Application application) {
super(application, ENCODING);
mSearchSubtitle = application.getString(R.string.suggestion);
}
public BaiduSuggestionsModel(@NonNull Application application) {
super(application, ENCODING);
mSearchSubtitle = application.getString(R.string.suggestion);
}
public DuckSuggestionsModel(@NonNull Application application) {
super(application, ENCODING);
mSearchSubtitle = application.getString(R.string.suggestion);
}
@Inject
public DownloadsDatabase(@NonNull Application application) {
super(application, DATABASE_NAME, null, DATABASE_VERSION);
DEFAULT_DOWNLOADS_TITLE = application.getString(R.string.untitled);
}
@Inject
public BookmarkDatabase(@NonNull Application application) {
super(application, DATABASE_NAME, null, DATABASE_VERSION);
DEFAULT_BOOKMARK_TITLE = application.getString(R.string.untitled);
}