use of android.support.annotation.NonNull in project reark by reark.
the class ContentProviderStoreCoreBase method createHandler.
@NonNull
public static Handler createHandler(@NonNull final String name) {
checkNotNull(name);
HandlerThread handlerThread = new HandlerThread(name);
handlerThread.start();
return new Handler(handlerThread.getLooper());
}
use of android.support.annotation.NonNull in project android-topeka by googlesamples.
the class QuizActivity method getSolvedStateListener.
@NonNull
private QuizFragment.SolvedStateListener getSolvedStateListener() {
return new QuizFragment.SolvedStateListener() {
@Override
public void onCategorySolved() {
setResultSolved();
setToolbarElevation(true);
displayDoneFab();
}
private void displayDoneFab() {
/* We're re-using the already existing fab and give it some
* new values. This has to run delayed due to the queued animation
* to hide the fab initially.
*/
if (null != mCircularReveal && mCircularReveal.isRunning()) {
mCircularReveal.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
showQuizFabWithDoneIcon();
mCircularReveal.removeListener(this);
}
});
} else {
showQuizFabWithDoneIcon();
}
}
private void showQuizFabWithDoneIcon() {
mQuizFab.setImageResource(R.drawable.ic_tick);
mQuizFab.setId(R.id.quiz_done);
mQuizFab.setVisibility(View.VISIBLE);
mQuizFab.setScaleX(0f);
mQuizFab.setScaleY(0f);
ViewCompat.animate(mQuizFab).scaleX(1).scaleY(1).setInterpolator(mInterpolator).setListener(null).start();
}
};
}
use of android.support.annotation.NonNull in project android-topeka by googlesamples.
the class CategoryAdapter method loadSolvedIconLollipop.
@NonNull
private LayerDrawable loadSolvedIconLollipop(Category category, int categoryImageResource) {
final Drawable done = loadTintedDoneDrawable();
final Drawable categoryIcon = loadTintedCategoryDrawable(category, categoryImageResource);
// ordering is back to front
Drawable[] layers = new Drawable[] { categoryIcon, done };
return new LayerDrawable(layers);
}
use of android.support.annotation.NonNull in project android-topeka by googlesamples.
the class CategorySelectionActivity method getStartIntent.
@NonNull
static Intent getStartIntent(Context context, Player player) {
Intent starter = new Intent(context, CategorySelectionActivity.class);
starter.putExtra(EXTRA_PLAYER, player);
return starter;
}
use of android.support.annotation.NonNull in project AndroidPicker by gzu-liyujiang.
the class AddressPicker method makeCenterView.
@NonNull
@Override
protected View makeCenterView() {
if (null == provider) {
throw new IllegalArgumentException("please set address provider before make view");
}
if (hideCounty) {
hideProvince = false;
}
int[] widths = getColumnWidths(hideProvince || hideCounty);
int provinceWidth = widths[0];
int cityWidth = widths[1];
int countyWidth = widths[2];
if (hideProvince) {
provinceWidth = 0;
cityWidth = widths[0];
countyWidth = widths[1];
}
LinearLayout layout = new LinearLayout(activity);
layout.setOrientation(LinearLayout.HORIZONTAL);
layout.setGravity(Gravity.CENTER);
final WheelView provinceView = new WheelView(activity);
provinceView.setLayoutParams(new LinearLayout.LayoutParams(provinceWidth, WRAP_CONTENT));
provinceView.setTextSize(textSize);
provinceView.setTextColor(textColorNormal, textColorFocus);
provinceView.setLineConfig(lineConfig);
provinceView.setOffset(offset);
provinceView.setCycleDisable(cycleDisable);
layout.addView(provinceView);
if (hideProvince) {
provinceView.setVisibility(View.GONE);
}
final WheelView cityView = new WheelView(activity);
cityView.setLayoutParams(new LinearLayout.LayoutParams(cityWidth, WRAP_CONTENT));
cityView.setTextSize(textSize);
cityView.setTextColor(textColorNormal, textColorFocus);
cityView.setLineConfig(lineConfig);
cityView.setOffset(offset);
cityView.setCycleDisable(cycleDisable);
layout.addView(cityView);
final WheelView countyView = new WheelView(activity);
countyView.setLayoutParams(new LinearLayout.LayoutParams(countyWidth, WRAP_CONTENT));
countyView.setTextSize(textSize);
countyView.setTextColor(textColorNormal, textColorFocus);
countyView.setLineConfig(lineConfig);
countyView.setOffset(offset);
countyView.setCycleDisable(cycleDisable);
layout.addView(countyView);
if (hideCounty) {
countyView.setVisibility(View.GONE);
}
provinceView.setItems(provider.provideFirstData(), selectedFirstIndex);
provinceView.setOnWheelListener(new WheelView.OnWheelListener() {
@Override
public void onSelected(boolean isUserScroll, int index, String item) {
selectedFirstItem = item;
selectedFirstIndex = index;
if (onWheelListener != null) {
onWheelListener.onProvinceWheeled(selectedFirstIndex, selectedFirstItem);
}
if (!isUserScroll) {
return;
}
LogUtils.verbose(this, "change cities after province wheeled");
//重置地级索引
selectedSecondIndex = 0;
//重置县级索引
selectedThirdIndex = 0;
//根据省份获取地市
List<String> cities = provider.provideSecondData(selectedFirstIndex);
if (cities.size() > 0) {
cityView.setItems(cities, selectedSecondIndex);
} else {
cityView.setItems(new ArrayList<String>());
}
//根据地市获取区县
List<String> counties = provider.provideThirdData(selectedFirstIndex, selectedSecondIndex);
if (counties.size() > 0) {
countyView.setItems(counties, selectedThirdIndex);
} else {
countyView.setItems(new ArrayList<String>());
}
}
});
cityView.setItems(provider.provideSecondData(selectedFirstIndex), selectedSecondIndex);
cityView.setOnWheelListener(new WheelView.OnWheelListener() {
@Override
public void onSelected(boolean isUserScroll, int index, String item) {
selectedSecondItem = item;
selectedSecondIndex = index;
if (onWheelListener != null) {
onWheelListener.onCityWheeled(selectedSecondIndex, selectedSecondItem);
}
if (!isUserScroll) {
return;
}
LogUtils.verbose(this, "change counties after city wheeled");
//重置县级索引
selectedThirdIndex = 0;
//根据地市获取区县
List<String> counties = provider.provideThirdData(selectedFirstIndex, selectedSecondIndex);
if (counties.size() > 0) {
//若不是用户手动滚动,说明联动需要指定默认项
countyView.setItems(counties, selectedThirdIndex);
} else {
countyView.setItems(new ArrayList<String>());
}
}
});
countyView.setItems(provider.provideThirdData(selectedFirstIndex, selectedSecondIndex), selectedThirdIndex);
countyView.setOnWheelListener(new WheelView.OnWheelListener() {
@Override
public void onSelected(boolean isUserScroll, int index, String item) {
selectedThirdItem = item;
selectedThirdIndex = index;
if (onWheelListener != null) {
onWheelListener.onCountyWheeled(selectedThirdIndex, selectedThirdItem);
}
}
});
return layout;
}
Aggregations