Search in sources :

Example 51 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project mongol-library by suragch.

the class MongolTextViewActivity method onPaddingClick.

public void onPaddingClick(View view) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Padding");
    final String[] paddings = { "0dp", "10dp", "10dp, 0dp, 20dp, 30dp" };
    builder.setSingleChoiceItems(paddings, mCheckedPaddingItem, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            float density = getResources().getDisplayMetrics().density;
            switch(which) {
                case 0:
                    mtvExample.setPadding(0, 0, 0, 0);
                    break;
                case 1:
                    int px = (int) (10 * density);
                    mtvExample.setPadding(px, px, px, px);
                    break;
                case 2:
                    int left = (int) (10 * density);
                    int top = (int) (0 * density);
                    int right = (int) (20 * density);
                    int bottom = (int) (30 * density);
                    mtvExample.setPadding(left, top, right, bottom);
                    break;
            }
            mCheckedPaddingItem = which;
            dialog.dismiss();
        }
    });
    AlertDialog dialog = builder.create();
    dialog.show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) DialogInterface(android.content.DialogInterface) SpannableString(android.text.SpannableString) TextPaint(android.text.TextPaint)

Example 52 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by omnirom.

the class InputMethodAndSubtypeEnabler method onCreate.

@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    // Input method id should be available from an Intent when this preference is launched as a
    // single Activity (see InputMethodAndSubtypeEnablerActivity). It should be available
    // from a preference argument when the preference is launched as a part of the other
    // Activity (like a right pane of 2-pane Settings app)
    final String targetImi = getStringExtraFromIntentOrArguments(android.provider.Settings.EXTRA_INPUT_METHOD_ID);
    final PreferenceScreen root = getPreferenceManager().createPreferenceScreen(getPrefContext());
    mManager = new InputMethodAndSubtypeEnablerManager(this);
    mManager.init(this, targetImi, root);
    setPreferenceScreen(root);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) InputMethodAndSubtypeEnablerManager(com.android.settingslib.inputmethod.InputMethodAndSubtypeEnablerManager)

Example 53 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project openhab-android by openhab.

the class DividerItemDecoration method onDraw.

@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
    if (mDivider == null) {
        return;
    }
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();
    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);
        if (suppressDividerForChild(child, parent)) {
            continue;
        }
        RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        int top = child.getBottom() + params.bottomMargin;
        int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 54 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project RecyclerViewItemAnimators by gabrielemariotti.

the class DividerItemDecoration method drawHorizontal.

public void drawHorizontal(Canvas c, RecyclerView parent) {
    final int top = parent.getPaddingTop();
    final int bottom = parent.getHeight() - parent.getPaddingBottom();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int left = child.getRight() + params.rightMargin;
        final int right = left + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 55 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project AndroidUtilLib by SiberiaDante.

the class SDGridItemDecoration method drawHorizontal.

private void drawHorizontal(Canvas c, RecyclerView parent, int childCount, int itemCount, int spanCount) {
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);
        int position = parent.getChildAdapterPosition(child);
        if (isLastRow(position, spanCount, itemCount))
            continue;
        final int left = child.getLeft();
        final int top = child.getBottom();
        final int right = isLastColumn(position, spanCount, childCount) ? child.getRight() : child.getRight() + mBuilder.dividerVerSize;
        final int bottom = child.getBottom() + mBuilder.dividerHorSize;
        c.drawRect(left, top, right, bottom, mHorPaint);
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) Paint(android.graphics.Paint)

Aggregations

View (android.view.View)315 RecyclerView (android.support.v7.widget.RecyclerView)294 Paint (android.graphics.Paint)47 TextView (android.widget.TextView)46 ImageView (android.widget.ImageView)29 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)27 ViewGroup (android.view.ViewGroup)15 Intent (android.content.Intent)13 Rect (android.graphics.Rect)12 Preference (android.support.v7.preference.Preference)12 GridLayoutManager (android.support.v7.widget.GridLayoutManager)11 SuppressLint (android.annotation.SuppressLint)10 AlertDialog (android.support.v7.app.AlertDialog)10 Bundle (android.os.Bundle)9 Bitmap (android.graphics.Bitmap)8 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)8 Button (android.widget.Button)8 PreferenceScreen (android.support.v7.preference.PreferenceScreen)7 ArrayList (java.util.ArrayList)7 Animator (android.animation.Animator)6