Java tutorial
/* * Copyright 2015 GDG Minsk * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package by.gdgminsk.animationguide; import android.content.Context; import android.graphics.drawable.Drawable; import android.support.annotation.ColorRes; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; import android.support.v4.content.ContextCompat; public enum Sample { SLIDE_DIAL_PAD(R.string.sample_name_slide_dial_pad, R.drawable.bullet_blue), CONTACT_DETAILS( R.string.sample_name_open_contact_details, R.drawable.bullet_green), REVEAL_FROM_FAB( R.string.sample_name_reveal_from_fab, R.drawable.bullet_orange); private final int mLabelId; private final int mBulletDrawable; Sample(@StringRes int resId, @DrawableRes int bullet) { mLabelId = resId; mBulletDrawable = bullet; } public CharSequence getLabel(Context context) { return context.getText(mLabelId); } public Drawable getBullet(Context context) { return ContextCompat.getDrawable(context, mBulletDrawable); } }