Search in sources :

Example 81 with NonNull

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());
}
Also used : HandlerThread(android.os.HandlerThread) Handler(android.os.Handler) ObjectLockHandler(io.reark.reark.utils.ObjectLockHandler) NonNull(android.support.annotation.NonNull)

Example 82 with NonNull

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();
        }
    };
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ViewPropertyAnimatorListenerAdapter(android.support.v4.view.ViewPropertyAnimatorListenerAdapter) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) NonNull(android.support.annotation.NonNull)

Example 83 with NonNull

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);
}
Also used : LayerDrawable(android.graphics.drawable.LayerDrawable) LayerDrawable(android.graphics.drawable.LayerDrawable) Drawable(android.graphics.drawable.Drawable) NonNull(android.support.annotation.NonNull)

Example 84 with NonNull

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;
}
Also used : Intent(android.content.Intent) NonNull(android.support.annotation.NonNull)

Example 85 with NonNull

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;
}
Also used : WheelView(cn.qqtheme.framework.widget.WheelView) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) LinearLayout(android.widget.LinearLayout) NonNull(android.support.annotation.NonNull)

Aggregations

NonNull (android.support.annotation.NonNull)747 View (android.view.View)94 TextView (android.widget.TextView)90 ArrayList (java.util.ArrayList)83 Intent (android.content.Intent)53 ContentValues (android.content.ContentValues)46 Bundle (android.os.Bundle)46 Test (org.junit.Test)45 AlertDialog (android.support.v7.app.AlertDialog)41 Cursor (android.database.Cursor)38 List (java.util.List)34 IOException (java.io.IOException)32 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)31 LayoutInflater (android.view.LayoutInflater)29 RecyclerView (android.support.v7.widget.RecyclerView)28 ImageView (android.widget.ImageView)28 File (java.io.File)28 DialogAction (com.afollestad.materialdialogs.DialogAction)25 HashMap (java.util.HashMap)25 Bitmap (android.graphics.Bitmap)24