Search in sources :

Example 26 with HORIZONTAL

use of android.support.v7.widget.LinearLayoutManager.HORIZONTAL in project mongol-library by suragch.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // data to populate the RecyclerView with
    ArrayList<String> apiDemos = new ArrayList<>();
    apiDemos.add("MongolLabel");
    apiDemos.add("MongolTextView");
    apiDemos.add("Unicode");
    apiDemos.add("Unicode <--> Menksoft");
    apiDemos.add("MongolFont");
    apiDemos.add("MongolEditText");
    apiDemos.add("Keyboard");
    apiDemos.add("Keyboard Candidate View");
    apiDemos.add("MongolToast");
    apiDemos.add("MongolButton");
    apiDemos.add("MongolAlertDialog");
    apiDemos.add("Horizontal RecyclerView");
    apiDemos.add("Custom System Keyboard");
    // apiDemos.add("Testing");
    // set up the RecyclerView
    RecyclerView recyclerView = findViewById(R.id.rvApiDemoList);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    adapter = new MainActivityRecyclerViewAdapter(this, apiDemos);
    adapter.setClickListener(this);
    recyclerView.setAdapter(adapter);
    // show the version number
    String versionName = net.studymongolian.mongollibrary.BuildConfig.VERSION_NAME;
    String labelText = "mongol-library " + versionName;
    TextView tvVersion = findViewById(R.id.version);
    tvVersion.setText(labelText);
}
Also used : ArrayList(java.util.ArrayList) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 27 with HORIZONTAL

use of android.support.v7.widget.LinearLayoutManager.HORIZONTAL in project android-advancedrecyclerview by h6ah4i.

the class ItemSlidingAnimator method slideInternal.

private static void slideInternal(final RecyclerView.ViewHolder holder, boolean horizontal, int translationX, int translationY) {
    if (!(holder instanceof SwipeableItemViewHolder)) {
        return;
    }
    final View containerView = SwipeableViewHolderUtils.getSwipeableContainerView(holder);
    ViewCompat.animate(containerView).cancel();
    containerView.setTranslationX(translationX);
    containerView.setTranslationY(translationY);
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 28 with HORIZONTAL

use of android.support.v7.widget.LinearLayoutManager.HORIZONTAL in project android-client by GenesisVision.

the class DividerItemDecoration method onDrawOver.

@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
    if (mDivider == null) {
        super.onDrawOver(c, parent, state);
        return;
    }
    if (getOrientation(parent) == LinearLayoutManager.VERTICAL) {
        final int left = parent.getPaddingLeft() + mPaddingLeft;
        final int right = parent.getWidth() - parent.getPaddingRight() - mPaddingRight;
        final int childCount = parent.getChildCount();
        for (int i = 1; i < childCount; i++) {
            final View child = parent.getChildAt(i);
            final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
            final int size = mDivider.getIntrinsicHeight();
            final int top = child.getTop() - params.topMargin;
            final int bottom = top + size;
            mDivider.setBounds(left, top, right, bottom);
            mDivider.draw(c);
        }
    } else {
        // horizontal
        final int top = parent.getPaddingTop();
        final int bottom = parent.getHeight() - parent.getPaddingBottom();
        final int childCount = parent.getChildCount();
        for (int i = 1; i < childCount; i++) {
            final View child = parent.getChildAt(i);
            final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
            final int size = mDivider.getIntrinsicWidth();
            final int left = child.getLeft() - params.leftMargin;
            final int right = left + size;
            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 29 with HORIZONTAL

use of android.support.v7.widget.LinearLayoutManager.HORIZONTAL in project silverblog_android by SilverBlogTeam.

the class post_preview method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_post_preview);
    Toolbar toolbar = findViewById(R.id.toolbar);
    Context context = getApplicationContext();
    setSupportActionBar(toolbar);
    Intent intent = getIntent();
    TextView title = findViewById(R.id.title);
    title.setText(intent.getStringExtra(Intent.EXTRA_SUBJECT));
    // RichText.fromMarkdown().into((TextView) findViewById(R.id.markdown_view));
    RxMDConfiguration rxMDConfiguration = new RxMDConfiguration.Builder(context).setDefaultImageSize(100, // default image width & height
    100).setBlockQuotesColor(// default color of block quotes
    Color.LTGRAY).setHeader1RelativeSize(// default relative size of header1
    1.6f).setHeader2RelativeSize(// default relative size of header2
    1.5f).setHeader3RelativeSize(// default relative size of header3
    1.4f).setHeader4RelativeSize(// default relative size of header4
    1.3f).setHeader5RelativeSize(// default relative size of header5
    1.2f).setHeader6RelativeSize(// default relative size of header6
    1.1f).setHorizontalRulesColor(// default color of horizontal rules's background
    Color.LTGRAY).setInlineCodeBgColor(// default color of inline code's background
    Color.LTGRAY).setCodeBgColor(// default color of code's background
    Color.LTGRAY).setTodoColor(// default color
    Color.DKGRAY).setTodoDoneColor(// default color of done
    Color.DKGRAY).setUnOrderListColor(// default color of unorder list
    Color.BLACK).setLinkColor(// default color of link text
    R.color.colorPrimaryDark).setLinkUnderline(// default value of whether displays link underline
    true).setRxMDImageLoader(// default image loader
    new DefaultLoader(context)).setDebug(// default value of debug
    false).build();
    RxMarkdown.with(intent.getStringExtra(Intent.EXTRA_TEXT), this).config(rxMDConfiguration).factory(TextFactory.create()).intoObservable().subscribeOn(Schedulers.computation()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Subscriber<CharSequence>() {

        @Override
        public void onCompleted() {
        }

        @Override
        public void onError(Throwable e) {
        }

        @Override
        public void onNext(CharSequence charSequence) {
            TextView markdown = findViewById(R.id.markdown_view);
            markdown.setMovementMethod(ScrollingMovementMethod.getInstance());
            markdown.setText(charSequence, TextView.BufferType.SPANNABLE);
        }
    });
}
Also used : Context(android.content.Context) Intent(android.content.Intent) TextView(android.widget.TextView) RxMDConfiguration(com.yydcdut.rxmarkdown.RxMDConfiguration) DefaultLoader(com.yydcdut.rxmarkdown.loader.DefaultLoader) Toolbar(android.support.v7.widget.Toolbar)

Example 30 with HORIZONTAL

use of android.support.v7.widget.LinearLayoutManager.HORIZONTAL in project RecyclerViewDecoration by arjinmc.

the class RecyclerViewItemDecoration method drawHorizontal.

/**
 * draw horizontal decoration
 *
 * @param c
 * @param parent
 */
private void drawHorizontal(Canvas c, RecyclerView parent) {
    int childrenCount = parent.getChildCount();
    if (mDrawableRid != 0) {
        if (mFirstLineVisible) {
            View childView = parent.getChildAt(0);
            int myY = childView.getTop();
            if (!isIgnoreType(parent.getAdapter().getItemViewType(parent.getChildLayoutPosition(childView)))) {
                if (hasNinePatch) {
                    Rect rect = new Rect(mPaddingStart, myY - mCurrentThickness, parent.getWidth() - mPaddingEnd, myY);
                    mNinePatch.draw(c, rect);
                } else {
                    c.drawBitmap(mBmp, mPaddingStart, myY - mCurrentThickness, mPaint);
                }
            }
        }
        for (int i = 0; i < childrenCount; i++) {
            if (!mLastLineVisible && i == childrenCount - 1)
                break;
            View childView = parent.getChildAt(i);
            if (!isIgnoreType(parent.getAdapter().getItemViewType(parent.getChildLayoutPosition(childView)))) {
                int myY = childView.getBottom();
                if (hasNinePatch) {
                    Rect rect = new Rect(mPaddingStart, myY, parent.getWidth() - mPaddingEnd, myY + mCurrentThickness);
                    mNinePatch.draw(c, rect);
                } else {
                    c.drawBitmap(mBmp, mPaddingStart, myY, mPaint);
                }
            }
        }
    } else {
        boolean isPureLine = isPureLine();
        if (!isPureLine) {
            PathEffect effects = new DashPathEffect(new float[] { 0, 0, mDashWidth, mThickness }, mDashGap);
            mPaint.setPathEffect(effects);
        }
        if (mFirstLineVisible) {
            View childView = parent.getChildAt(0);
            if (!isIgnoreType(parent.getAdapter().getItemViewType(parent.getChildLayoutPosition(childView)))) {
                int myY = childView.getTop() - mThickness / 2;
                Path path = new Path();
                path.moveTo(mPaddingStart, myY);
                path.lineTo(parent.getWidth() - mPaddingEnd, myY);
                c.drawPath(path, mPaint);
            }
        }
        for (int i = 0; i < childrenCount; i++) {
            if (!mLastLineVisible && i == childrenCount - 1)
                break;
            View childView = parent.getChildAt(i);
            if (!isIgnoreType(parent.getAdapter().getItemViewType(parent.getChildLayoutPosition(childView)))) {
                int myY = childView.getBottom() + mThickness / 2;
                Path path = new Path();
                path.moveTo(mPaddingStart, myY);
                path.lineTo(parent.getWidth() - mPaddingEnd, myY);
                c.drawPath(path, mPaint);
            }
        }
    }
}
Also used : Path(android.graphics.Path) Rect(android.graphics.Rect) DashPathEffect(android.graphics.DashPathEffect) PathEffect(android.graphics.PathEffect) DashPathEffect(android.graphics.DashPathEffect) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) Paint(android.graphics.Paint)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)33 View (android.view.View)31 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)7 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 OrientationHelperEx (com.alibaba.android.vlayout.OrientationHelperEx)6 TextView (android.widget.TextView)5 ImageView (android.widget.ImageView)4 Context (android.content.Context)3 ViewGroup (android.view.ViewGroup)3 LayoutParams (com.alibaba.android.vlayout.VirtualLayoutManager.LayoutParams)3 Intent (android.content.Intent)2 Bitmap (android.graphics.Bitmap)2 Drawable (android.graphics.drawable.Drawable)2 Bundle (android.os.Bundle)2 NonNull (android.support.annotation.NonNull)2 GridLayoutManager (android.support.v7.widget.GridLayoutManager)2 SuppressLint (android.annotation.SuppressLint)1 Activity (android.app.Activity)1 AlertDialog (android.app.AlertDialog)1 PendingIntent (android.app.PendingIntent)1