当前位置: 首页>>代码示例>>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;未经允许,请勿转载。