當前位置: 首頁>>代碼示例>>Java>>正文


Java BuildConfig類代碼示例

本文整理匯總了Java中com.example.app.BuildConfig的典型用法代碼示例。如果您正苦於以下問題:Java BuildConfig類的具體用法?Java BuildConfig怎麽用?Java BuildConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BuildConfig類屬於com.example.app包,在下文中一共展示了BuildConfig類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: provideRetrofit

import com.example.app.BuildConfig; //導入依賴的package包/類
@Provides
@Singleton
Retrofit provideRetrofit(
    OkHttpClient client,
    @Named("apiUrl")
    String endPoint,
    Gson gson,
    ThreadExecutor threadExecutor
) {
  return new Retrofit.Builder()
      .baseUrl(endPoint)
      .addConverterFactory(GsonConverterFactory.create(gson))
      .addCallAdapterFactory(RxJavaCallAdapterFactory.createWithScheduler(Schedulers.from(threadExecutor)))
      .client(client)
      .validateEagerly(BuildConfig.DEBUG)
      .build();
}
 
開發者ID:vichid,項目名稱:ship-android-fast,代碼行數:18,代碼來源:ApiModule.java

示例2: onCreate

import com.example.app.BuildConfig; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // launch the app login activity when a guest user tries to favorite a Tweet
    final Callback<Tweet> actionCallback = new Callback<Tweet>() {
        @Override
        public void success(Result<Tweet> result) {
            // Intentionally blank
        }
        @Override
        public void failure(TwitterException exception) {
            if (exception instanceof TwitterAuthException) {
                startActivity(TwitterCoreMainActivity.newIntent(getActivity()));
            }
        }
    };

    final UserTimeline userTimeline = new UserTimeline.Builder().screenName("twitterdev").build();
    final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(getActivity())
            .setTimeline(userTimeline)
            .setViewStyle(R.style.tw__TweetLightWithActionsStyle)
            .setOnActionCallback(actionCallback)
            .build();

    moPubAdAdapter = new TwitterMoPubAdAdapter(getActivity(), adapter);
    final TwitterStaticNativeAdRenderer adRenderer = new TwitterStaticNativeAdRenderer();
    moPubAdAdapter.registerAdRenderer(adRenderer);
    moPubAdAdapter.loadAds(BuildConfig.MOPUB_AD_UNIT_ID);

    setListAdapter(moPubAdAdapter);
}
 
開發者ID:twitter,項目名稱:twitter-kit-android,代碼行數:33,代碼來源:UserTimelineFragment.java

示例3: provideUserAgentHeader

import com.example.app.BuildConfig; //導入依賴的package包/類
@Provides
@Singleton
@Named("userAgent")
String provideUserAgentHeader() {
  return String.format(
      Locale.getDefault(),
      "Android;%s;%s;%d;%s;%s;%d;",
      Build.BRAND,
      Build.MODEL,
      Build.VERSION.SDK_INT,
      BuildConfig.APPLICATION_ID,
      BuildConfig.VERSION_NAME,
      BuildConfig.VERSION_CODE
  );
}
 
開發者ID:vichid,項目名稱:ship-android-fast,代碼行數:16,代碼來源:DataModule.java

示例4: provideApiLogLevel

import com.example.app.BuildConfig; //導入依賴的package包/類
@Provides
@Singleton
HttpLoggingInterceptor provideApiLogLevel() {
  HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
  if (BuildConfig.DEBUG) {
    interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
  } else {
    interceptor.setLevel(HttpLoggingInterceptor.Level.NONE);
  }
  return interceptor;
}
 
開發者ID:vichid,項目名稱:ship-android-fast,代碼行數:12,代碼來源:DataModule.java

示例5: create

import com.example.app.BuildConfig; //導入依賴的package包/類
/**
 * Creates a String representing an error message.
 *
 * @param context Context needed to retrieve string resources.
 * @param exception An exception used as a condition to retrieve the correct error message.
 * @return {@link String} an error message.
 */
public static String create(Context context, Exception exception) {

  if (BuildConfig.DEBUG) {
    return exception.getMessage();
  } else if (exception instanceof NetworkConnectionException) {
    return context.getString(R.string.exception_message_no_connection);
  } else if (exception instanceof ServerIssueException) {
    return context.getString(R.string.exception_message_server_issue);
  }

  return context.getString(R.string.exception_message_generic);
}
 
開發者ID:vichid,項目名稱:ship-android-fast,代碼行數:20,代碼來源:ErrorMessageFactory.java

示例6: provideApiUrl

import com.example.app.BuildConfig; //導入依賴的package包/類
@Provides
@Singleton
@Named("apiUrl")
String provideApiUrl() {
  return BuildConfig.API_URL;
}
 
開發者ID:vichid,項目名稱:ship-android-fast,代碼行數:7,代碼來源:DataModule.java


注:本文中的com.example.app.BuildConfig類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。