GVKun编程网logo

com.facebook.litho.widget.LinearLayoutInfo的实例源码(facebook源代码)

25

在本文中,我们将带你了解com.facebook.litho.widget.LinearLayoutInfo的实例源码在这篇文章中,我们将为您详细介绍com.facebook.litho.widget

在本文中,我们将带你了解com.facebook.litho.widget.LinearLayoutInfo的实例源码在这篇文章中,我们将为您详细介绍com.facebook.litho.widget.LinearLayoutInfo的实例源码的方方面面,并解答facebook源代码常见的疑惑,同时我们还将给您一些技巧,以帮助您实现更有效的android.support.design.widget.CoordinatorLayout.LayoutParams的实例源码、android.support.v7.widget.LinearLayoutCompat.LayoutParams的实例源码、android.support.v7.widget.LinearLayoutCompat的实例源码、android.support.v7.widget.LinearLayoutManager的实例源码

本文目录一览:

com.facebook.litho.widget.LinearLayoutInfo的实例源码(facebook源代码)

com.facebook.litho.widget.LinearLayoutInfo的实例源码(facebook源代码)

项目:litho-picasso    文件:Demos.java   
public static void initialize(Context context) {
  final ComponentContext c = new ComponentContext(context);
  final RecyclerBinder glideRecyclerBinder = new RecyclerBinder(
      c,4.0f,new LinearLayoutInfo(c,OrientationHelper.VERTICAL,false));
  DataModel.populateBinderWithSampleDataForGlide(glideRecyclerBinder,c);

  demoModels = new LinkedHashMap<>();
  demoModels.put(
      "Lithography - Picasso",LithographyRootComponent.create(c)
          .recyclerBinder(glideRecyclerBinder)
          .build());
  demoModels.put("Playground",PlaygroundComponent.create(c).build());
}
项目:redux-observable    文件:HomeActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_repos);
    bindViews(this);
    componentContext = new ComponentContext(this);
    recyclerBinder = new RecyclerBinder(
            componentContext,new LinearLayoutInfo(this,false));
    sRefresh.setonRefreshListener(() -> store.dispatch(HomeAction.REFRESH));
}
项目:litho-glide    文件:GlideArtist.java   
@Override public Component createComponent(ComponentContext c) {
  final RecyclerBinder imageRecyclerBinder = new RecyclerBinder.Builder().layoutInfo(
      new LinearLayoutInfo(c,OrientationHelper.HORIZONTAL,false)).build(c);

  for (String image : images) {
    ComponentRenderInfo.Builder imageComponentInfoBuilder = ComponentRenderInfo.create();
    imageComponentInfoBuilder.component(
        GlideSingleImageComponent.create(c).image(image).aspectRatio(2).build());
    imageRecyclerBinder.insertItemAt(imageRecyclerBinder.getItemCount(),imageComponentInfoBuilder.build());
  }

  return FeedItemCard.create(c).artist(this).binder(imageRecyclerBinder).build();
}
项目:litho-glide    文件:DemoListComponentSpec.java   
@OnCreateLayout static ComponentLayout onCreateLayout(ComponentContext c) {
  final RecyclerBinder recyclerBinder = new RecyclerBinder.Builder().layoutInfo(
      new LinearLayoutInfo(c,false)).build(c);

  Demos.addAllToBinder(recyclerBinder,c);

  return Recycler.create(c)
      .binder(recyclerBinder)
      .flexShrink(0)
      .testKey(MAIN_SCREEN)
      .buildWithLayout();
}
项目:litho-glide    文件:Demos.java   
public static void initialize(Context context) {
  final ComponentContext c = new ComponentContext(context);
  final RecyclerBinder glideRecyclerBinder = new RecyclerBinder.Builder().layoutInfo(
      new LinearLayoutInfo(c,false)).build(c);
  DataModel.populateBinderWithSampleDataForGlide(glideRecyclerBinder,c);

  demoModels = new LinkedHashMap<>();
  demoModels.put("Lithography - Glide",LithographyRootComponent.create(c).recyclerBinder(glideRecyclerBinder).build());
  demoModels.put("Playground",PlaygroundComponent.create(c).build());
}
项目:litho-picasso    文件:PicassoArtist.java   
@Override
public Component createComponent(ComponentContext c) {
  final RecyclerBinder imageRecyclerBinder =
      new RecyclerBinder(c,false));

  for (String image : images) {
    ComponentInfo.Builder imageComponentInfoBuilder = ComponentInfo.create();
    imageComponentInfoBuilder.component(
        PicassoSingleImageComponent.create(c).image(image).fit(true).build());
    imageRecyclerBinder.insertItemAt(imageRecyclerBinder.getItemCount(),imageComponentInfoBuilder.build());
  }

  return FeedItemCard.create(c).artist(this).binder(imageRecyclerBinder).build();
}
项目:litho-picasso    文件:DemoListComponentSpec.java   
@OnCreateLayout
static ComponentLayout onCreateLayout(ComponentContext c) {
  final RecyclerBinder recyclerBinder = new RecyclerBinder(
      c,false));

  Demos.addAllToBinder(recyclerBinder,c);

  return Recycler.create(c)
      .binder(recyclerBinder)
      .withLayout().flexShrink(0)
      .testKey(MAIN_SCREEN)
      .build();
}
项目:redux-observable    文件:HomeActivity.java   
private void renderContent(List<HomeSection> sections) {
    sRefresh.setRefreshing(false);
    ComponentInfo.Builder componentInfoBuilder;

    for (HomeSection section : sections) {

        componentInfoBuilder = ComponentInfo.create();

        if (section instanceof SingleBannerSection) {
            componentInfoBuilder
                    .component(
                            SingleBannerComponent
                                    .create(componentContext)
                                    .payload((SingleBannerSection) section)
                                    .key(((SingleBannerSection) section).title())
                                    .build()
                    );
        } else if (section instanceof TripleBannerSection) {

            componentInfoBuilder
                    .component(
                            TripleBannersComponent.create(componentContext)
                                    .payload((TripleBannerSection) section)
                                    .key(((TripleBannerSection) section).title())
                                    .build()
                    );
        } else if (section instanceof ProductSlideSection) {

            final RecyclerBinder productSlideBinder = new RecyclerBinder(componentContext,false));

            for (Product product : ((ProductSlideSection) section).products()) {
                componentInfoBuilder = ComponentInfo.create();
                componentInfoBuilder
                        .component(
                                ProductComponent.create(componentContext)
                                        .product(product)
                                        .key(product.id())
                                        .build()
                        );
                productSlideBinder.insertItemAt(productSlideBinder.getItemCount(),componentInfoBuilder.build());
            }

            componentInfoBuilder = ComponentInfo.create();
            componentInfoBuilder
                    .component(
                            ProductSlideComponent.create(componentContext)
                                    .title(((ProductSlideSection) section).title())
                                    .recyclerBinder(productSlideBinder)
                                    .key(((ProductSlideSection) section).title())
                                    .build()
                    );
        }
        recyclerBinder.insertItemAt(recyclerBinder.getItemCount(),componentInfoBuilder.build());
    }

    ltView.setComponent(
            HomeListComponent
                    .create(componentContext)
                    .binder(recyclerBinder)
                    .build()
    );
}

android.support.design.widget.CoordinatorLayout.LayoutParams的实例源码

android.support.design.widget.CoordinatorLayout.LayoutParams的实例源码

项目:boohee_v5.6    文件:HeaderScrollingViewBehavior.java   
protected void layoutChild(CoordinatorLayout parent,View child,int layoutDirection) {
    View header = findFirstDependency(parent.getDependencies(child));
    if (header != null) {
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        Rect available = this.mTempRect1;
        available.set(parent.getPaddingLeft() + lp.leftMargin,header.getBottom() + lp.topMargin,(parent.getWidth() - parent.getPaddingRight()) - lp.rightMargin,((parent.getHeight() + header.getBottom()) - parent.getPaddingBottom()) - lp.bottomMargin);
        Rect out = this.mTempRect2;
        GravityCompat.apply(resolveGravity(lp.gravity),child.getMeasuredWidth(),child.getMeasuredHeight(),available,out,layoutDirection);
        int overlap = getoverlapPixelsForOffset(header);
        child.layout(out.left,out.top - overlap,out.right,out.bottom - overlap);
        this.mVerticalLayoutGap = out.top - header.getBottom();
        return;
    }
    super.layoutChild(parent,child,layoutDirection);
    this.mVerticalLayoutGap = 0;
}
项目:boohee_v5.6    文件:FloatingActionButton.java   
private boolean updateFabVisibility(CoordinatorLayout parent,AppBarLayout appBarLayout,FloatingActionButton child) {
    if (((LayoutParams) child.getLayoutParams()).getAnchorId() != appBarLayout.getId() || child.getUserSetVisibility() != 0) {
        return false;
    }
    if (this.mTmpRect == null) {
        this.mTmpRect = new Rect();
    }
    Rect rect = this.mTmpRect;
    ViewGroupUtils.getDescendantRect(parent,appBarLayout,rect);
    if (rect.bottom <= appBarLayout.getMinimumHeightForVisibleOverlappingContent()) {
        child.hide(null,false);
    } else {
        child.show(null,false);
    }
    return true;
}
项目:boohee_v5.6    文件:FloatingActionButton.java   
private void offsetIfNeeded(CoordinatorLayout parent,FloatingActionButton fab) {
    Rect padding = fab.mShadowPadding;
    if (padding != null && padding.centerX() > 0 && padding.centerY() > 0) {
        LayoutParams lp = (LayoutParams) fab.getLayoutParams();
        int offsetTB = 0;
        int offsetLR = 0;
        if (fab.getRight() >= parent.getWidth() - lp.rightMargin) {
            offsetLR = padding.right;
        } else if (fab.getLeft() <= lp.leftMargin) {
            offsetLR = -padding.left;
        }
        if (fab.getBottom() >= parent.getBottom() - lp.bottomMargin) {
            offsetTB = padding.bottom;
        } else if (fab.getTop() <= lp.topMargin) {
            offsetTB = -padding.top;
        }
        fab.offsetTopAndBottom(offsetTB);
        fab.offsetLeftAndRight(offsetLR);
    }
}
项目:RxBinding    文件:SwipedismissBehaviorObservable.java   
@Override protected void subscribeActual(Observer<? super View> observer) {
  if (!checkMainThread(observer)) {
    return;
  }
  if (!(view.getLayoutParams() instanceof LayoutParams)) {
    throw new IllegalArgumentException("The view is not in a Coordinator Layout.");
  }
  LayoutParams params = (LayoutParams) view.getLayoutParams();
  final SwipedismissBehavior behavior = (SwipedismissBehavior) params.getBehavior();
  if (behavior == null) {
    throw new IllegalStateException("There's no behavior set on this view.");
  }
  Listener listener = new Listener(behavior,observer);
  observer.onSubscribe(listener);
  behavior.setListener(listener);
}
项目:CoordinatorExamples    文件:SwipeBehaviorExampleActivity.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_swipe_behavior);


    final SwipedismissBehavior swipe = new SwipedismissBehavior();
    swipe.setSwipeDirection(SwipedismissBehavior.SWIPE_DIRECTION_ANY);
    swipe.setListener(new SwipedismissBehavior.OndismissListener() {
        @Override public void ondismiss(View view) {
            Toast.makeText(SwipeBehaviorExampleActivity.this,"Card swiped !!",Toast.LENGTH_SHORT).show();
        }

        @Override public void onDragStateChanged(int state) {}
    });

    CardView cardView = (CardView) findViewById(R.id.swype_card);
    LayoutParams coordinatorParams = (LayoutParams) cardView.getLayoutParams();
    coordinatorParams.setBehavior(swipe);
}
项目:joy-library    文件:FloatingActionButtonBehavior.java   
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent,FloatingActionButton floatingActionButton,View dependency) {

    if (dependency instanceof AppBarLayout) {

        AppBarLayout appBarLayout = (AppBarLayout) dependency;
        LayoutParams lp = (LayoutParams) floatingActionButton.getLayoutParams();
        int distancetoScroll = floatingActionButton.getHeight() + lp.bottomMargin;
        float ratio = ViewCompat.getY(appBarLayout) / (float) appBarLayout.getTotalScrollRange();
        ViewCompat.setTranslationY(floatingActionButton,-distancetoScroll * ratio);
        return true;
    }
    return super.onDependentViewChanged(parent,floatingActionButton,dependency);
}
项目:core-ui    文件:FloatingActionButtonBehavior.java   
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent,View dependency) {
    if (dependency instanceof AppBarLayout) {
        AppBarLayout appBarLayout = (AppBarLayout) dependency;
        LayoutParams lp = (LayoutParams) floatingActionButton.getLayoutParams();
        int distancetoScroll = floatingActionButton.getHeight() + lp.bottomMargin;
        float ratio = ViewCompat.getY(appBarLayout) / (float) appBarLayout.getTotalScrollRange();
        ViewCompat.setTranslationY(floatingActionButton,dependency);
}
项目:DrawerBehavior    文件:ContentScrimDrawer.java   
Base(CoordinatorLayout parent,View child) {
  super(parent.getContext());
  // Draw at the same level of the child.
  parent.addView(this,parent.indexOfChild(child),new LayoutParams(MATCH_PARENT,MATCH_PARENT));
}

android.support.v7.widget.LinearLayoutCompat.LayoutParams的实例源码

android.support.v7.widget.LinearLayoutCompat.LayoutParams的实例源码

项目:boohee_v5.6    文件:ScrollingTabContainerView.java   
private void performCollapse() {
    if (!isCollapsed()) {
        if (this.mTabSpinner == null) {
            this.mTabSpinner = createSpinner();
        }
        removeView(this.mTabLayout);
        addView(this.mTabSpinner,new ViewGroup.LayoutParams(-2,-1));
        if (this.mTabSpinner.getAdapter() == null) {
            this.mTabSpinner.setAdapter(new TabAdapter());
        }
        if (this.mTabSelector != null) {
            removeCallbacks(this.mTabSelector);
            this.mTabSelector = null;
        }
        this.mTabSpinner.setSelection(this.mSelectedTabIndex);
    }
}
项目:shengyiplus-android    文件:TableActivity.java   
private void checkInterfaceOrientation(Configuration config) {
        Boolean isLandscape = (config.orientation == Configuration.ORIENTATION_LANDSCAPE);

        if (isLandscape) {
//            mAnimloading.setVisibility(View.VISIBLE);
            WindowManager.LayoutParams lp = getwindow().getAttributes();
            lp.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
            getwindow().setAttributes(lp);
            getwindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
//            new LoadReportData().execute();
        } else {
            WindowManager.LayoutParams attr = getwindow().getAttributes();
            attr.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
            getwindow().setAttributes(attr);
            getwindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        }
    }
项目:boohee_v5.6    文件:ScrollingTabContainerView.java   
public ScrollingTabContainerView(Context context) {
    super(context);
    setHorizontalScrollBarEnabled(false);
    ActionBarPolicy abp = ActionBarPolicy.get(context);
    setContentHeight(abp.getTabContainerHeight());
    this.mStackedTabMaxWidth = abp.getStackedTabMaxWidth();
    this.mTabLayout = createTabLayout();
    addView(this.mTabLayout,-1));
}
项目:boohee_v5.6    文件:ScrollingTabContainerView.java   
private boolean performExpand() {
    if (isCollapsed()) {
        removeView(this.mTabSpinner);
        addView(this.mTabLayout,-1));
        setTabSelected(this.mTabSpinner.getSelectedItemPosition());
    }
    return false;
}
项目:boohee_v5.6    文件:ScrollingTabContainerView.java   
private LinearLayoutCompat createTabLayout() {
    LinearLayoutCompat tabLayout = new LinearLayoutCompat(getContext(),null,R.attr.actionBarTabBarStyle);
    tabLayout.setMeasureWithLargestChildEnabled(true);
    tabLayout.setGravity(17);
    tabLayout.setLayoutParams(new LayoutParams(-2,-1));
    return tabLayout;
}
项目:boohee_v5.6    文件:ScrollingTabContainerView.java   
private TabView createTabView(Tab tab,boolean forAdapter) {
    TabView tabView = new TabView(getContext(),tab,forAdapter);
    if (forAdapter) {
        tabView.setBackgroundDrawable(null);
        tabView.setLayoutParams(new AbsListView.LayoutParams(-1,this.mContentHeight));
    } else {
        tabView.setFocusable(true);
        if (this.mTabClickListener == null) {
            this.mTabClickListener = new TabClickListener();
        }
        tabView.setonClickListener(this.mTabClickListener);
    }
    return tabView;
}
项目:boohee_v5.6    文件:ScrollingTabContainerView.java   
public void addTab(Tab tab,boolean setSelected) {
    TabView tabView = createTabView(tab,false);
    this.mTabLayout.addView(tabView,new LayoutParams(0,-1,1.0f));
    if (this.mTabSpinner != null) {
        ((TabAdapter) this.mTabSpinner.getAdapter()).notifyDataSetChanged();
    }
    if (setSelected) {
        tabView.setSelected(true);
    }
    if (this.mAllowCollapse) {
        requestLayout();
    }
}
项目:boohee_v5.6    文件:ScrollingTabContainerView.java   
public void addTab(Tab tab,int position,position,1.0f));
    if (this.mTabSpinner != null) {
        ((TabAdapter) this.mTabSpinner.getAdapter()).notifyDataSetChanged();
    }
    if (setSelected) {
        tabView.setSelected(true);
    }
    if (this.mAllowCollapse) {
        requestLayout();
    }
}
项目:FMTech    文件:ScrollingTabContainerView.java   
private boolean performExpand()
{
  if (!isCollapsed()) {
    return false;
  }
  removeView(this.mTabSpinner);
  addView(this.mTabLayout,-1));
  setTabSelected(this.mTabSpinner.getSelectedItemPosition());
  return false;
}
项目:boohee_v5.6    文件:ScrollingTabContainerView.java   
private Spinner createSpinner() {
    Spinner spinner = new AppCompatSpinner(getContext(),R.attr.actionDropDownStyle);
    spinner.setLayoutParams(new LayoutParams(-2,-1));
    spinner.setonItemSelectedListener(this);
    return spinner;
}

android.support.v7.widget.LinearLayoutCompat的实例源码

android.support.v7.widget.LinearLayoutCompat的实例源码

项目:CommonFramework    文件:RefreshRecyclerView.java   
/**
 * 初始化默认的HeaderView 与 FooterView
 *
 * @param context
 */
private void init(Context context) {
    // inflate得到的view需要代码设置LayoutParams
    // HeaderView
    mHeaderView = LinearLayoutCompat.inflate(context,R.layout.recyclerview_refresh_headerview,null);
    mHeaderViewStateIcon = mHeaderView.findViewById(R.id.refresh_headerview_stateIcon);
    mHeaderViewHint = (TextView) mHeaderView.findViewById(R.id.refresh_headerview_hint);
    mHeaderViewLastRefreshTime = (TextView) mHeaderView.findViewById(R.id.refresh_headerview_lastRefreshTime);

    // 直接从布局中获取高度即可
    mHeaderViewHeight = getResources().getDimensionPixelOffset(R.dimen.recyclerview_refresh_headerview_height);

    // 这里需要手动设置LayoutParams,否则getLayoutParams为空
    // 并且,在使用inflate得到的布局,没有设置手动设置LayoutParams的情况下,有些布局会出问题,特别是使用LinearLayout时。
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,mHeaderViewHeight);
    lp.setMargins(0,-mHeaderViewHeight,0);
    mHeaderView.setLayoutParams(lp);
    mHeaderView.requestLayout();

    // FooterView
    mFooterView = LinearLayoutCompat.inflate(context,R.layout.recyclerview_refresh_footerview,null);
    mFooterViewStateIcon = mFooterView.findViewById(R.id.refresh_footerview_stateIcon);
    mFooterViewHint = (TextView) mFooterView.findViewById(R.id.refresh_footerview_hint);
}
项目:AnimationsDemo    文件:DetailEventsFragment.java   
@Override
    public void showEvents(List<DetailEvent> events) {
        int headerHeight = getResources().getDimensionPixelSize(R.dimen.header_bg_height);
        rvDetailEvents.setLayoutManager(new linearlayoutmanager(getActivity()));
        mAdapter = new DetailEventAdapter(events,headerHeight);
        View view = new View(getActivity());
        view.setLayoutParams(new LinearLayoutCompat.LayoutParams(-1,headerHeight));
        mAdapter.addHeaderView(view);
        rvDetailEvents.setAdapter(mAdapter);
//        final StickyRecyclerHeadersdecoration header = new StickyRecyclerHeadersdecoration(mAdapter);
//        rvDetailEvents.addItemdecoration(header);
        rvDetailEvents.addItemdecoration(new DividerItemdecoration(getActivity(),DividerItemdecoration.VERTICAL));
        rvDetailEvents.setItemAnimator(new SlideInLeftAnimator());
        rvDetailEvents.getItemAnimator().setAddDuration(500);
        rvDetailEvents.getItemAnimator().setRemoveDuration(500);
    }
项目:MoonlightNote    文件:MoonlightDetailFragment.java   
private void initBottomSheetItem() {
    LinearLayoutCompat takePhoto = mView.findViewById(R.id.bottom_sheet_item_take_photo);
    LinearLayoutCompat chooseImage = mView.findViewById(R.id.bottom_sheet_item_choose_image);
    LinearLayoutCompat recording = mView.findViewById(R.id.bottom_sheet_item_recording);
    LinearLayoutCompat movetoTrash = mView.findViewById(R.id.bottom_sheet_item_move_to_trash);
    LinearLayoutCompat permanentDelete = mView.findViewById(R.id.bottom_sheet_item_permanent_delete);
    LinearLayoutCompat makeAcopy = mView.findViewById(R.id.bottom_sheet_item_make_a_copy);
    LinearLayoutCompat send = mView.findViewById(R.id.bottom_sheet_item_send);
    takePhoto.setonClickListener(this);
    chooseImage.setonClickListener(this);
    recording.setonClickListener(this);
    movetoTrash.setonClickListener(this);
    permanentDelete.setonClickListener(this);
    makeAcopy.setonClickListener(this);
    send.setonClickListener(this);
}
项目:FloatingActionButtonMenu    文件:FloatingActionButtonMenu.java   
private void initMenuItems()
{
    for (int i = 0; i < getChildCount() - 1; i++)
    {
        View item = getChildAt(i);
        item.setonClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                if(null !=mOnMenuItemClickListener)
                {
                    mOnMenuItemClickListener.onMenuItemClick((FloatingActionButton) view,view.getId());
                }
                collapse();
            }
        });
        LayoutParams params = (LinearLayoutCompat.LayoutParams) item.getLayoutParams();
        params.topMargin = getResources().getDimensionPixelSize(R.dimen.fab_margin);
    }
}
项目:oasis    文件:oaDialog.java   
public oaDialog(Context context,final Tools.oaCallBack callBack) {
    super(context);
    super.requestwindowFeature(Window.FEATURE_NO_TITLE);
    super.setContentView(R.layout.custom_dialog);
    displayMetrics metrics = context.getResources().getdisplayMetrics();
    int width = metrics.widthPixels;
    super.getwindow().setLayout(width - 10,LinearLayoutCompat.LayoutParams.WRAP_CONTENT);

    relativeLayout = find(R.id.layout_actionbar);
    imageTitle = find(R.id.imagetitle);
    text = find(R.id.contenttext);
    inputlayout = find(R.id.textinputlayout);
    ((Button) find(R.id.button_ok)).setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            callBack.returnString(text.getText().toString());
            oaDialog.super.dismiss();
        }
    });

}
项目:Uoccin    文件:EpisodeFragment.java   
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_episode,container,false);

    img_thmb = (ImageView) view.findViewById(R.id.img_thumb);
    txt_name = (TextView) view.findViewById(R.id.txt_name);
    txt_date = (TextView) view.findViewById(R.id.txt_date);
    txt_plot = (TextView) view.findViewById(R.id.txt_plot);
    txt_subs = (TextView) view.findViewById(R.id.txt_subs);
    Box_gues = (LinearLayoutCompat) view.findViewById(R.id.Box_gues);
    txt_gues = (TextView) view.findViewById(R.id.txt_guests);
    Box_writ = (LinearLayoutCompat) view.findViewById(R.id.Box_writ);
    txt_writ = (TextView) view.findViewById(R.id.txt_writers);
    Box_dire = (LinearLayoutCompat) view.findViewById(R.id.Box_dire);
    txt_dire = (TextView) view.findViewById(R.id.txt_director);

    return view;
}
项目:CustomTabletUI    文件:CircLeverticalContainer.java   
private void init(Context context,int childCount) {
    LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    layoutParams.gravity = Gravity.CENTER_VERTICAL;
    this.setLayoutParams(layoutParams);

    this.childCount = childCount;
    this.setorientation(LinearLayoutCompat.VERTICAL);

    if (this.childCount > 0) {
        LinearLayout.LayoutParams childParams = new LinearLayout.LayoutParams((CircleAppConstants.viewHeight)/ 5,(CircleAppConstants.viewHeight) / 5);
        childParams.gravity = Gravity.CENTER_VERTICAL|Gravity.CENTER_HORIZONTAL;
        for(int i = 0; i< this.childCount; i++){
            ChildCircleContainer childCircleContainer = new ChildCircleContainer(getContext(),(CircleAppConstants.viewHeight),onChildClick);
            childCircleContainer.setPadding(10,10,10);
            childCircleContainer.setLayoutParams(childParams);
            this.addView(childCircleContainer);
        }

    }
}
项目:MyCTFWriteUps    文件:ScrollingTabContainerView.java   
public void addTab(android.support.v7.app.ActionBar.Tab tab,int i,boolean flag)
{
    tab = createTabView(tab,false);
    mTabLayout.addView(tab,i,new android.support.v7.widget.LinearLayoutCompat.LayoutParams(0,-1,1.0F));
    if (mTabSpinner != null)
    {
        ((TabAdapter)mTabSpinner.getAdapter()).notifyDataSetChanged();
    }
    if (flag)
    {
        tab.setSelected(true);
    }
    if (mAllowCollapse)
    {
        requestLayout();
    }
}
项目:MyCTFWriteUps    文件:ScrollingTabContainerView.java   
public void addTab(android.support.v7.app.ActionBar.Tab tab,1.0F));
    if (mTabSpinner != null)
    {
        ((TabAdapter)mTabSpinner.getAdapter()).notifyDataSetChanged();
    }
    if (flag)
    {
        tab.setSelected(true);
    }
    if (mAllowCollapse)
    {
        requestLayout();
    }
}
项目:ExpandRecyclerView    文件:RecyclerViewStyleHelper.java   
/**
 * transform to ViewPager
 *
 * @param recyclerView {@link RecyclerView}
 * @param orientation  the orientation of Linearlayout
 */
public static void toViewPager(RecyclerView recyclerView,@LinearLayoutCompat.OrientationMode int orientation) {
    recyclerView.setLayoutManager(new linearlayoutmanager(recyclerView.getContext(),orientation,false));
    new PagerSnapHelper().attachToRecyclerView(recyclerView);
}
项目:BackgroundProgress    文件:BackgroundProgress.java   
private void init(Context context,AttributeSet attrs) {
    TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.BackgroundProgress);
    try {
        showTxt = typedArray.getString(R.styleable.BackgroundProgress_showTxt);
        isGradient = typedArray.getBoolean(R.styleable.BackgroundProgress_isGradient,true);
    } catch (Exception e) {
        showTxt = null;
        isGradient = true;
    }

    typedArray.recycle();

    View view = LayoutInflater.from(context).inflate(R.layout.bp,null);

    backgroundProgressView = (BackgroundProgressView) view.findViewById(R.id.progress);
    tv = (TextView) view.findViewById(R.id.tv);

    if (TextUtils.isEmpty(showTxt)) {
        tv.setVisibility(GONE);
    } else {
        tv.setText(showTxt);
    }

    backgroundProgressView.set_isGradient(isGradient);


    ViewGroup.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
    addView(view,layoutParams);
}
项目:AnimationsDemo    文件:DetailEventAdapter.java   
@Override
public RecyclerView.ViewHolder onCreateHeaderViewHolder(ViewGroup parent) {
    View view = new View(parent.getContext());
    view.setLayoutParams(new LinearLayoutCompat.LayoutParams(-1,headerHeight));
    return new RecyclerView.ViewHolder(view) {
    };
}
项目:StretchView    文件:RightSampleActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_right_sample);

    sv = (StretchView) findViewById(R.id.sv);
    sv.setDrawHelper(new ArcDrawHelper(sv,ContextCompat.getColor(RightSampleActivity.this,R.color.colorPrimary),40));

    rcv = (RecyclerView) findViewById(R.id.rcv);
    rcv.setLayoutManager(new linearlayoutmanager(RightSampleActivity.this,linearlayoutmanager.HORIZONTAL,false));
    rcv.addItemdecoration(new Rcvdecoration(0,(int) getResources().getDimension(R.dimen.divider_horzontal),LinearLayoutCompat.HORIZONTAL));
    rcv.setAdapter(new RecyclerView.Adapter() {
        @Override
        public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType) {
            return new VH(LayoutInflater.from(RightSampleActivity.this).inflate(R.layout.item_horizontal,parent,false));
        }

        @Override
        public void onBindViewHolder(RecyclerView.ViewHolder holder,int position) {

        }

        @Override
        public int getItemCount() {
            return 10;
        }
    });
}
项目:StretchView    文件:Rcvdecoration.java   
/**
 * get the item_vertical top spacing
 *
 * @param itemPosition itemPosition
 * @return int
 */
private int getItemTopSpacing(int itemPosition) {
    if (isFirstItem(itemPosition) && orientation == LinearLayoutCompat.VERTICAL) {
        return verticalItemSpacingInPx;
    }
    return verticalItemSpacingInPx >> 1;
}
项目:Tab_Navigator    文件:TabContainer.java   
@SuppressWarnings("unchecked") private void onChage() {
  removeAllViews();

  for (int i = 0; i < mTAdapter.getCount(); ++i) {
    View tabView = mTAdapter.getView(i,this,mTAdapter.getItem(i));

    LinearLayoutCompat.LayoutParams layoutParams = new LayoutParams(0,-1);
    layoutParams.weight = 1;

    addView(tabView,layoutParams);
  }

  invalidate();
}
项目:rview    文件:ReviewLabelsView.java   
public ReviewLabelsView(Context context,AttributeSet attrs,int defStyleAttr) {
    super(context,attrs,defStyleAttr);
    setorientation(HORIZONTAL);

    mAccount = Preferences.getAccount(context);

    // Separate labels and scores
    mLabelsLayout = new LinearLayout(context);
    mLabelsLayout.setorientation(LinearLayout.VERTICAL);
    addView(mLabelsLayout,new LinearLayoutCompat.LayoutParams(WRAP_CONTENT,WRAP_CONTENT));
    mscoresLayout = new LinearLayout(context);
    mscoresLayout.setorientation(LinearLayout.VERTICAL);
    addView(mscoresLayout,WRAP_CONTENT));
}
项目:BrainPhaser    文件:CategoryAdapter.java   
/**
 * Called to create the ViewHolder at the given position.
 *
 * @param parent   parent to assign the newly created view to
 * @param viewType ignored
 */
@Override
public CategoryViewHolder onCreateViewHolder(ViewGroup parent,int viewType) {
    View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_category,false);
    v.setLayoutParams(new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT,LinearLayoutCompat.LayoutParams.WRAP_CONTENT));

    return new CategoryViewHolder(v,mListener);
}
项目:BrainPhaser    文件:StatisticsAdapter.java   
/**
 * Called to create the ViewHolder at the given position.
 *
 * @param parent   parent to assign the newly created view to
 * @param viewType ignored
 */
@Override
public StatisticViewHolder onCreateViewHolder(ViewGroup parent,int viewType) {
    View v;
    int layout;

    Context parentContext = parent.getContext();

    if (viewType == StatisticViewHolder.TYPE_LARGE) {
        layout = R.layout.list_item_statistic_most_played;

    } else if (viewType == StatisticViewHolder.TYPE_SMALL) {
        layout = R.layout.list_item_statistic_pie_chart;
    } else {
        throw new RuntimeException("Invalid view type!");
    }

    v = LayoutInflater.from(parentContext).inflate(layout,false);

    LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(
            LinearLayoutCompat.LayoutParams.MATCH_PARENT,LinearLayoutCompat.LayoutParams.WRAP_CONTENT);

    v.setLayoutParams(layoutParams);

    return new StatisticViewHolder(v,mUserLogicFactory,mChallengeDataSource,mApplication,mUser,mCategoryId);
}
项目:zhizhihuhu    文件:Zhihulistadapter.java   
public FooterViewHolder(View itemView) {
    super(itemView);
    ButterKnife.bind(this,itemView);
    LinearLayoutCompat.LayoutParams params =
            new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ScreenUtil.instance(mContext).dip2px(40));
    itemView.setLayoutParams(params);
}
项目:truth-android    文件:LinearLayoutCompatSubject.java   
public static SubjectFactory<LinearLayoutCompatSubject,LinearLayoutCompat> type() {
  return new SubjectFactory<LinearLayoutCompatSubject,LinearLayoutCompat>() {
    @Override
    public LinearLayoutCompatSubject getSubject(FailureStrategy fs,LinearLayoutCompat that) {
      return new LinearLayoutCompatSubject(fs,that);
    }
  };
}
项目:Type    文件:MainActivity.java   
private void setupControlPanel() {
    controlPanel = (LinearLayoutCompat) findViewById(R.id.control);
    bulletButton = (StatusImageButton) findViewById(R.id.bullet);
    quoteButton = (StatusImageButton) findViewById(R.id.quote);
    attachmentButton = (AppCompatimageButton) findViewById(R.id.attachment);
    dotsButton = (AppCompatimageButton) findViewById(R.id.dots);
    playButton = (AppCompatimageButton) findViewById(R.id.play);

    bulletButton.setonClickListener(this);
    quoteButton.setonClickListener(this);
    attachmentButton.setonClickListener(this);
    dotsButton.setonClickListener(this);
    playButton.setonClickListener(this);

    bulletButton.setonLongClickListener(this);
    quoteButton.setonLongClickListener(this);
    attachmentButton.setonLongClickListener(this);
    dotsButton.setonLongClickListener(this);
    playButton.setonLongClickListener(this);

    RxBus.getInstance().toObservable(BlockEvent.class)
            .subscribe(new Action1<BlockEvent>() {
                @Override
                public void call(BlockEvent event) {
                    bulletButton.setActivated(event.isBullet());
                    quoteButton.setActivated(event.isQuote());
                }
            });
}
项目:Type    文件:MainActivity.java   
private void setupStylePanel() {
    stylePanel = (LinearLayoutCompat) findViewById(R.id.style);
    boldButton = (StatusImageButton) findViewById(R.id.bold);
    italicButton = (StatusImageButton) findViewById(R.id.italic);
    underlineButton = (StatusImageButton) findViewById(R.id.underline);
    strikethroughButton = (StatusImageButton) findViewById(R.id.strikethrough);
    linkButton = (StatusImageButton) findViewById(R.id.link);

    boldButton.setonClickListener(this);
    italicButton.setonClickListener(this);
    underlineButton.setonClickListener(this);
    strikethroughButton.setonClickListener(this);
    linkButton.setonClickListener(this);

    boldButton.setonLongClickListener(this);
    italicButton.setonLongClickListener(this);
    underlineButton.setonLongClickListener(this);
    strikethroughButton.setonLongClickListener(this);
    linkButton.setonLongClickListener(this);

    RxBus.getInstance().toObservable(FormatEvent.class)
            .subscribe(new Action1<FormatEvent>() {
                @Override
                public void call(FormatEvent event) {
                    boldButton.setActivated(event.isBold());
                    italicButton.setActivated(event.isItalic());
                    underlineButton.setActivated(event.isUnderline());
                    strikethroughButton.setActivated(event.isstrikethrough());
                    linkButton.setActivated(event.isLink());
                }
            });
}
项目:WhiteRead    文件:MzituFragment.java   
private void setTopLayoutData() {
    if (mMzitutopModelList == null || mMzitutopModelList.size() < 4 || topView != null) {
        return;
    }

    topView = LayoutInflater.from(mContext).inflate(R.layout.mzitu_header_top,null,false);
    mTopLayout = (LinearLayout) topView.findViewById(R.id.mTopLayout);
    for (final MzituModel item : mMzitutopModelList) {
        ImageView mImage = new ImageView(mContext);
        mImage.setLayoutParams(new LinearLayoutCompat.LayoutParams(UtilsDynamicSize.defaultdisplayWidth / 4,UtilsDynamicSize.defaultdisplayWidth / 4));
        mImage.setPadding(4,4,0);
        Glide.with(mContext)
                .load(item.imagePath)//目标URL
                .placeholder(R.drawable.load_image_ing)
                .error(R.drawable.load_image_fail) //图片获取失败时默认显示的图片
                .diskCacheStrategy(diskCacheStrategy.ALL) //缓存全尺寸图片,也缓存其他尺寸图片
                .centerCrop()
                .crossFade().into(mImage);

        mImage.setonClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (!UtilsViewEvent.isFastDoubleClick()) {
                    getDetailData(item.link);
                }
            }
        });

        mTopLayout.addView(mImage);
    }

    mRecyclerView.addHeaderView(topView);
    mRefreshAdapter.setHeaderViewsNumber(mRecyclerView.getTopViewCount());
}
项目:FloatingToolbar    文件:FloatingToolbar.java   
private void createMenuLayout() {
    mMenuLayout = new LinearLayoutCompat(getContext());

    LayoutParams layoutParams
            = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);

    mMenuLayout.setId(genViewId());
    addView(mMenuLayout,layoutParams);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        mMenuLayout.setPaddingrelative(0,0);
    } else {
        mMenuLayout.setPadding(0,0);
    }
}
项目:FMTech    文件:ActivityChooserView.java   
protected final void onMeasure(int paramInt1,int paramInt2)
{
  LinearLayoutCompat localLinearLayoutCompat = this.mActivityChooserContent;
  if (this.mDefaultActivityButton.getVisibility() != 0) {
    paramInt2 = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(paramInt2),1073741824);
  }
  measureChild(localLinearLayoutCompat,paramInt1,paramInt2);
  setMeasuredDimension(localLinearLayoutCompat.getMeasuredWidth(),localLinearLayoutCompat.getMeasuredHeight());
}
项目:product-catalogue-android    文件:ProductActivity.java   
private void generateThumbnail(String url,final int position,int size) {
  ImageView imageView = new ImageView(this);
  imageView.setLayoutParams(new LinearLayoutCompat.LayoutParams(size,size));
  imageView.setBackgroundResource(R.drawable.thumbnail_bg);
  Picasso.with(this).load(url).fit().centerInside().into(imageView);
  imageView.setonClickListener(new View.OnClickListener() {
    @Override public void onClick(View v) {
      imagesPager.setCurrentItem(position,true);
    }
  });
  thumbnails.addView(imageView);
}
项目:CustomTabletUI    文件:LeftCircleContainer.java   
private void init(Context context,int width) {

        LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams((int)(width),(int)(width));
        layoutParams.gravity = Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL;
        this.setLayoutParams(layoutParams);

        LeftOuterCircleView leftOuterCircleView1 = new LeftOuterCircleView(context,width,false);
        LeftOuterCircleView leftOuterCircleView2 = new LeftOuterCircleView(context,(width - 40 ),true);

        circleTitleView = new CircleTitleView(context,(int) (width));
        circleTitleView.setTextColor(getContext().getResources().getColor(android.R.color.white));
        circleTitleView.setTextSize(20);
        circleTitleView.setTypeface(Typeface.DEFAULT,Typeface.BOLD_ITALIC);
        circleTitleView.setText("App Name");

        this.addView(leftOuterCircleView1);
        this.addView(leftOuterCircleView2);
        addCircle(1,width - 78,(float) 0.0,0.85);
        addCircle(2,width - 150,0.97);
        addCircle(3,width - 170,0.97);
        addCircle(4,width - 190,0.98);
        addCircle(5,width - 210,0.98);
        addCircle(6,width - 230,0.85);
        addCircle(7,width - 280,0.85);
        addCircle(0,width - 35,0.9);
        addCircle(0,width - 92,(float)0.1,0.9);

        this.addView(circleTitleView);

        animateClockwise(leftOuterCircleView1);

        animateAntiClockwise(leftOuterCircleView2);

    }
项目:MyBlogDemo    文件:HorizontalPicker.java   
public HorizontalPicker(Context context,defStyleAttr);
    setorientation(VERTICAL);
    header = new LinearLayout(context);
    header.setorientation(LinearLayout.HORIZONTAL);
    float density = getResources().getdisplayMetrics().density;
    addView(header,new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int) (density * 56)));
    mDetailContainer = new FrameLayout(context);
    addView(mDetailContainer,new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT));
}
项目:WiFiPV    文件:FragmentDialog.java   
public void onResume()
{
    super.onResume();
    Window window = getDialog().getwindow();
    window.setLayout(LinearLayoutCompat.LayoutParams.WRAP_CONTENT,getResources().getDimensionPixelSize(R.dimen.dialog_height));
}
项目:MyCTFWriteUps    文件:ScrollingTabContainerView.java   
private Spinner createSpinner()
{
    AppCompatSpinner appcompatspinner = new AppCompatSpinner(getContext(),android.support.v7.appcompat.R.attr.actionDropDownStyle);
    appcompatspinner.setLayoutParams(new android.support.v7.widget.LinearLayoutCompat.LayoutParams(-2,-1));
    appcompatspinner.setonItemSelectedListener(this);
    return appcompatspinner;
}
项目:MyCTFWriteUps    文件:ScrollingTabContainerView.java   
private LinearLayoutCompat createTabLayout()
{
    LinearLayoutCompat linearlayoutcompat = new LinearLayoutCompat(getContext(),android.support.v7.appcompat.R.attr.actionBarTabBarStyle);
    linearlayoutcompat.setMeasureWithLargestChildEnabled(true);
    linearlayoutcompat.setGravity(17);
    linearlayoutcompat.setLayoutParams(new android.support.v7.widget.LinearLayoutCompat.LayoutParams(-2,-1));
    return linearlayoutcompat;
}
项目:MyCTFWriteUps    文件:ActivityChooserView.java   
protected void onMeasure(int i,int j)
{
    LinearLayoutCompat linearlayoutcompat = mActivityChooserContent;
    int k = j;
    if (mDefaultActivityButton.getVisibility() != 0)
    {
        k = android.view.View.MeasureSpec.makeMeasureSpec(android.view.View.MeasureSpec.getSize(j),0x40000000);
    }
    measureChild(linearlayoutcompat,k);
    setMeasuredDimension(linearlayoutcompat.getMeasuredWidth(),linearlayoutcompat.getMeasuredHeight());
}
项目:ChatExchange-old    文件:TutorialStuff.java   
public static void chatsExplorationTutorial(final Activity activity,final LinearLayoutCompat hueLayout)
{
    PreferencesManager manager = new PreferencesManager(activity);

    if (!manager.isdisplayed(SE_ROOMS_TAB))
    {
        ChatroomsExplorationActivity.touchesBlocked = true;
    }

    if (mCategoryConfig == null)
    {
        setCategoryConfig(activity);
    }

    ArrayList<View> seTxtView = new ArrayList<>();
    final ArrayList<View> soTxtView = new ArrayList<>();
    hueLayout.getChildAt(0).findViewsWithText(seTxtView,"SE",View.FIND_VIEWS_WITH_TEXT);
    hueLayout.getChildAt(1).findViewsWithText(soTxtView,"SO",View.FIND_VIEWS_WITH_TEXT);

    SpotlightView SErooms = new SpotlightView.Builder(activity)
            .target(seTxtView.get(0))
            .usageId(SE_ROOMS_TAB)
            .setConfiguration(mCategoryConfig)
            .headingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_heading))
            .subheadingTvText(activity.getResources().getString(R.string.CEA_SErooms_tab_tutorial_text))
            .show();

    final SpotlightView.Builder SOrooms = new SpotlightView.Builder(activity)
            .setConfiguration(mCategoryConfig)
            .headingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_heading))
            .subheadingTvText(activity.getResources().getString(R.string.CEA_SOrooms_tab_tutorial_text))
            .usageId(SO_ROOMS_TAB);

    SpotlightListener listener = new SpotlightListener()
    {
        @Override
        public void onUserClicked(String s)
        {
            switch (s)
            {
                case SE_ROOMS_TAB:
                    ChatroomsExplorationActivity.touchesBlocked = true;
                    SOrooms.target(soTxtView.get(0)).show();
                    break;
                case SO_ROOMS_TAB:
                    ChatroomsExplorationActivity.touchesBlocked = false;
                    break;
            }
        }

        @Override
        public void onFinishedDrawingSpotlight()
        {
            ChatroomsExplorationActivity.touchesBlocked = false;
        }

        @Override
        public void onStartedDrawingSpotlight()
        {
            ChatroomsExplorationActivity.touchesBlocked = false;
        }
    };

    SErooms.setListener(listener);
    SOrooms.setListener(listener);
}
项目:MaterialDesignDemo    文件:LinearLayoutCompatActivity.java   
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_linear_layout_compat);
    mLlc = (LinearLayoutCompat) findViewById(R.id.llc);
}
项目:MaterialDesignDemo    文件:LinearLayoutCompatActivity.java   
public void beginning(View view) {
    mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_BEGINNING);
}
项目:MaterialDesignDemo    文件:LinearLayoutCompatActivity.java   
public void middle(View view) {
    mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_MIDDLE);
}
项目:MaterialDesignDemo    文件:LinearLayoutCompatActivity.java   
public void end(View view) {
    mLlc.setShowDividers(LinearLayoutCompat.SHOW_DIVIDER_END);
}
项目:StretchView    文件:Rcvdecoration.java   
private int getItemLeftSpace(int itemPosition) {
    if (isFirstItem(itemPosition) && orientation == LinearLayoutCompat.HORIZONTAL) {
        return horizontalItemSpacingInPx;
    }
    return horizontalItemSpacingInPx >> 1;
}
项目:StretchView    文件:Rcvdecoration.java   
private int getItemRightSpace(int itemPosition,int childCount) {
    if (isLastItem(itemPosition,childCount) && orientation == LinearLayoutCompat.HORIZONTAL) {
        return horizontalItemSpacingInPx;
    }
    return horizontalItemSpacingInPx >> 1;
}
项目:Android-nRF-Beacon-for-Eddystone    文件:AllSlotInfoDialogFragment.java   
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity());
    alertDialogBuilder.setTitle("All Slot information");
    alertDialogBuilder.setMessage("Following slots have been configured in the beacon");

    final View alertDialogView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_all_slot_info,null);
    final LinearLayout slottitleContainer = (LinearLayout) alertDialogView.findViewById(R.id.slot_title_container);
    final LinearLayout slotInfoContainer = (LinearLayout) alertDialogView.findViewById(R.id.slot_info_container);
    LinearLayout.LayoutParams lParams = new LinearLayout.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
    for(int i = 0; i < mAllSlotInfo.size(); i++) {
        TextView slottitle = new TextView(getActivity());
        slottitle.setLayoutParams(lParams);
        slottitle.setText("Slot " + i + ":");
        slottitleContainer.addView(slottitle);

        TextView slotInfo = new TextView(getActivity());
        slotInfo.setLayoutParams(lParams);
        slotInfo.setText(mAllSlotInfo.get(i));
        slotInfoContainer.addView(slotInfo);

        if(i > 0){
            lParams.setMargins(0,0);
        }

    }

    final AlertDialog alertDialog = alertDialogBuilder.setView(alertDialogView).setPositiveButton(getString(R.string.ok),null).show();
    alertDialog.setCanceledOnTouchOutside(false);

    alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
                dismiss();
        }
    });



    return alertDialog;
}

android.support.v7.widget.LinearLayoutManager的实例源码

android.support.v7.widget.LinearLayoutManager的实例源码

项目:mobile-app-dev-book    文件:JournalFragment.java   
@Override
public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_journal_list,container,false);

    // Set the adapter
    if (view instanceof RecyclerView) {
        FirebaseDatabase dbRef = FirebaseDatabase.getInstance();
        FirebaseAuth auth = FirebaseAuth.getInstance();
        FirebaseUser user = auth.getCurrentUser();
        DatabaseReference userRef = dbRef.getReference(user.getUid());
        userRef.addChildEventListener (chEvListener);
        userRef.addValueEventListener(valEvListener);
        Context context = view.getContext();
        RecyclerView recyclerView = (RecyclerView) view;
        if (mColumnCount <= 1) {
            recyclerView.setLayoutManager(new linearlayoutmanager(context));
        } else {
            recyclerView.setLayoutManager(new GridLayoutManager(context,mColumnCount));
        }
        adapter = new JournalAdapter(allTrips,mListener);
        recyclerView.setAdapter(adapter);
    }
    return view;
}
项目:MeetMusic    文件:ThemeActivity.java   
private void init(){
    for (int i = 0 ;i < themeType.length;i++){
        ThemeInfo info = new ThemeInfo();
        info.setName(themeType[i]);
        info.setColor(colors[i]);
        info.setSelect((selectTheme == i) ? true : false);
        if (i == themeType.length-1){
            info.setBackground(R.color.nightBg);
        }else {
            info.setBackground(R.color.colorWhite);
        }
        themeInfoList.add(info);
    }
    recyclerView = (RecyclerView)findViewById(R.id.theme_rv);
    adapter = new ThemeAdapter();
    linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(this);
    linearlayoutmanager.setorientation(linearlayoutmanager.VERTICAL);
    recyclerView.setLayoutManager(linearlayoutmanager);
    recyclerView.setAdapter(adapter);

}
项目:GitHub    文件:MainFragment.java   
@Override
protected void initData() {
    List<Itemmodel> items = new ArrayList<>();
    fillData(items);

    adapter = new MainAdapter(items);
    adapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
    adapter.isFirstOnly(false);
    adapter.setonLoadMoreListener(this);

    refreshLayout.setColorSchemeColors(Color.RED,Color.BLUE,Color.GREEN);
    refreshLayout.setonRefreshListener(this);

    recyclerView.setLayoutManager(new linearlayoutmanager(context));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemdecoration(new DividerItemdecoration(context,linearlayoutmanager.VERTICAL));

    recyclerView.setAdapter(adapter);
}
项目:adapters-android    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    RecyclerView rcViewList = (RecyclerView) findViewById(R.id.rc_item);
    rcViewList.setAdapter(new ItemAdapter(generateFakeItems(),new OnItemClickListener() {
        @Override
        public void onItemClick(int position) {
            startActivity(new Intent(MainActivity.this,FragmentPagerActivity.class));
        }
    }));
    rcViewList.setLayoutManager(new linearlayoutmanager(this));
    rcViewList.addItemdecoration(new DividerItemdecoration(this,DividerItemdecoration.VERTICAL));
}
项目:Mix    文件:BackTopActivity.java   
private void initView(List<String> list) {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setdisplayHomeAsUpEnabled(true);

    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    recyclerView.setHasFixedSize(true);
    linearlayoutmanager = new linearlayoutmanager(this);
    linearlayoutmanager.setSmoothScrollbarEnabled(true);
    recyclerView.setLayoutManager(linearlayoutmanager);
    ListRecyclerAdapter adapter = new ListRecyclerAdapter(list);
    recyclerView.setAdapter(adapter);

    FAB = (FloatingActionButton) findViewById(R.id.fab);
    FAB.setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            linearlayoutmanager.scrollToPosition(0);
            hideFAB();
        }
    });
}
项目:BilibiliClient    文件:VideoIntroductionFragment.java   
private void setVideoRelated() {

    List<VideoDetailsInfo.DataBean.RelatesBean> relates = mVideoDetailsInfo.getRelates();
    if (relates == null) {
      mVideoRelatedLayout.setVisibility(View.GONE);
      return;
    }
    VideoRelatedAdapter mVideoRelatedAdapter = new VideoRelatedAdapter(mRecyclerView,relates);
    mRecyclerView.setHasFixedSize(false);
    mRecyclerView.setnestedScrollingEnabled(false);
    mRecyclerView.setLayoutManager(
        new linearlayoutmanager(getActivity(),linearlayoutmanager.VERTICAL,true));
    mRecyclerView.setAdapter(mVideoRelatedAdapter);
    mVideoRelatedAdapter.setonItemClickListener(
        (position,holder) -> VideoDetailsActivity.launch(getActivity(),relates.get(position).getAid(),relates.get(position).getPic()));
  }
项目:vlayout    文件:OnePlusNLayoutHelper.java   
@Override
public int computealignOffset(int offset,boolean isLayoutEnd,boolean useAnchor,LayoutManagerHelper helper) {
    //Log.d(TAG,//    "range " + getRange() + " offset " + offset + " isLayoutEnd " + isLayoutEnd + " useAnchor " + useAnchor
    //        + " helper " + this.hashCode());
    final boolean layoutInVertical = helper.getorientation() == linearlayoutmanager.VERTICAL;

    if (useAnchor) {
        return 0;
    }
    if (isLayoutEnd) {
        if (offset == getItemCount() - 1) {
            return layoutInVertical ? mMarginBottom + mPaddingBottom : mMarginRight + mPaddingRight;
        }
    } else {
        if (offset == 0) {
            return layoutInVertical ? -mMarginTop - mPaddingTop : -mMarginLeft - mPaddingLeft;
        }
    }
    return 0;
}
项目:RLibrary    文件:RecyclerViewPager.java   
/**
 * 计算每个Item的宽度
 */
public int getItemWidth() {
    final LayoutManager layoutManager = getLayoutManager();
    int itemWidth = 0;
    if (layoutManager instanceof GridLayoutManager) {
        final GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
        final int spanCount = gridLayoutManager.getSpanCount();
        if (gridLayoutManager.getorientation() == linearlayoutmanager.HORIZONTAL) {
            itemWidth = getRawWidth() / (mItemCount / spanCount);
        } else {
            itemWidth = getRawWidth() / spanCount;
        }

    } else if (layoutManager instanceof linearlayoutmanager) {
        final linearlayoutmanager linearlayoutmanager = (linearlayoutmanager) layoutManager;
        if (linearlayoutmanager.getorientation() == linearlayoutmanager.HORIZONTAL) {
            itemWidth = getRawWidth() / mItemCount;
        } else {
            itemWidth = getRawWidth();
        }
    }

    return itemWidth;
}
项目:SuperNatives    文件:HeroesListActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    AndroidInjection.inject(this);
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this,R.layout.activity_heroes_list);
    context = this;

    linearlayoutmanager linearlayoutmanager = new linearlayoutmanager(context,false);
    DividerItemdecoration dividerItemdecoration = new DividerItemdecoration(context,linearlayoutmanager.getorientation());
    binding.rvHeroes.setLayoutManager(linearlayoutmanager);
    binding.rvHeroes.addItemdecoration(dividerItemdecoration);
    binding.rvHeroes.setAdapter(heroesAdapter);
    binding.fastScroll.setRecyclerView(binding.rvHeroes);

    heroesAdapter.setonClickListener(position -> presenter.onSuperHeroClicked(position));

    binding.btnTryAgain.setonClickListener(v -> presenter.getSuperHeroes());

    binding.btnTryAgain.performClick();
}
项目:Remindy    文件:TaskDetailActivity.java   
private void setUpRecyclerView() {

        if(mTask.getAttachments().size() > 0) {
            mAttachmentsSubtitle.setVisibility(View.VISIBLE);

            mLayoutManager = new linearlayoutmanager(this,false);
            mAdapter = new AttachmentAdapter(this,mTask.getAttachments(),true);
            mAdapter.setAttachmentDataUpdatedListener(new AttachmentAdapter.AttachmentDataUpdatedListener() {
                @Override
                public void onAttachmentDataUpdated() {
                    mTaskDataUpdated = true;
                }
            });
            DividerItemdecoration itemdecoration = new DividerItemdecoration(this,mLayoutManager.getorientation());
            itemdecoration.setDrawable(ContextCompat.getDrawable(this,R.drawable.item_decoration_half_line));
            mRecyclerView.addItemdecoration(itemdecoration);
            mRecyclerView.setnestedScrollingEnabled(false);

            mRecyclerView.setLayoutManager(mLayoutManager);
            mRecyclerView.setAdapter(mAdapter);
        }
    }
项目:BounceView    文件:BounceMenu.java   
private BounceMenu(View view,int resId,final MyAdapter myAdapter) {
    parentVG = findParentVG(view);

    rootView = LayoutInflater.from(view.getContext()).inflate(resId,null,false);
    recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);
    bounceView = (BounceView) rootView.findViewById(R.id.bounceview);

    recyclerView.setLayoutManager(new linearlayoutmanager(view.getContext()));
    bounceView.setAnimatorListener(new BounceView.BounceAnimatorListener() {
        @Override
        public void showContent() {
            recyclerView.setVisibility(View.VISIBLE);
            recyclerView.setAdapter(myAdapter);
            recyclerView.scheduleLayoutAnimation();
        }
    });
}
项目:Pilem    文件:MovieInfoFragment.java   
private void setUpInfo(View view) {
    RecyclerView rvInfo = (RecyclerView) view.findViewById(R.id.rv_movie_detail_info);
    ArrayList<ItemInfo> infoItems = new ArrayList<>();
    String overviewValStr = view.getResources().getString(R.string.lorem_ipsum_long);

    infoItems.add(new ItemInfo("Overview",overviewValStr));
    infoItems.add(new ItemInfo("Tagline","Divided We Fall"));
    infoItems.add(new ItemInfo("Status","Releases"));
    infoItems.add(new ItemInfo("Budget","250.000.000"));
    infoItems.add(new ItemInfo("Revenue","1.153.304.495"));
    infoItems.add(new ItemInfo("Homepage","http://marvel.com/captainamericapremiere"));

    RecyclerAdapter infoAdapter = new RecyclerAdapter<ItemInfo,MovieInfoViewHolder>(
            R.layout.item_movie_info,ItemInfo.class,infoItems,MovieInfoViewHolder.class) {
        @Override
        protected void bindView(MovieInfoViewHolder holder,ItemInfo model,int position) {
            holder.getLabel().setText(model.getLabel());
            holder.getValue().setText(model.getValue());
        }
    };

    rvInfo.setLayoutManager(new linearlayoutmanager(view.getContext()));
    rvInfo.setAdapter(infoAdapter);
    rvInfo.addItemdecoration(new MovieInfoViewHolder.Itemdecoration());
}
项目:RunMap    文件:V2MainFragment.java   
@Override
public void onScrollStateChanged(RecyclerView recyclerView,int newState) {
    super.onScrollStateChanged(recyclerView,newState);
    RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
    if (layoutManager instanceof linearlayoutmanager) {
        linearlayoutmanager linearManager = (linearlayoutmanager) layoutManager;
        int firstItemPosition = linearManager.findFirstVisibleItemPosition();
        if(firstItemPosition == 0 || mContentlistadapter.getItemCount() == 0){
            mRefreshLayout.setEnabled(true);
            CFLog.e("V2MainFragment","arrive top");
        }
        else{
            mRefreshLayout.setEnabled(false);
        }
    }
}
项目:GCSApp    文件:YearDelegate.java   
public void setData(ArrayList<FinancingInfo> data,boolean isRefresh) {
    if (isRefresh){
        mData.clear();
    }
    mData.addAll(data);
    if (null == adapter) {
        manager = new linearlayoutmanager(getActivity());
        mRec.addItemdecoration(new DividerGridItemdecoration(getActivity()));
        adapter = new Yearadapter(mData,getActivity());
        mRec.setAdapter(adapter);
        mRec.setLayoutManager(manager);
    } else {
        adapter.notifyDataSetChanged();

    }
}
项目:Guanajoven    文件:PromocionFragment.java   
@Nullable
@Override
public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_promociones,false);
    rvPromociones = (RecyclerView) view.findViewById(R.id.rv_promociones);
    textViewEmptyPromociones = (TextView) view.findViewById(R.id.textview_empty_promociones);

    linearlayoutmanager llm = new linearlayoutmanager(getContext());
    adapter = new RVPromocionAdapter(getContext(),empresa.getPromociones(),empresa);

    rvPromociones.setLayoutManager(llm);
    rvPromociones.setAdapter(adapter);

    if (empresa.getPromociones().isEmpty()) {
        textViewEmptyPromociones.setVisibility(View.VISIBLE);
    }

    return view;
}
项目:Expert-Android-Programming    文件:FollowingFragment.java   
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    this.context = getActivity();

    list = new ArrayList<>();
    recyclerViewAdapter = new FriendAdapter(getActivity(),list);
   /* recyclerViewAdapter.setClickListener(new FriendAdapter.ClickListener() {
        @Override
        public void onItemClickListener(View v,int pos) {
            gotoDetailsActivity();
        }

        @Override
        public void onFriendListener(int pos,boolean isFollowing) {

        }
    });*/

    recyclerView.setLayoutManager(new linearlayoutmanager(getActivity()));
    recyclerView.setAdapter(recyclerViewAdapter);

    getFollowing();
}
项目:SimpleBible    文件:BookSelectionFragment.java   
@Override
public void update(Observable observable,Object o) {
    mBooks.clear();
    if (o instanceof IBookProvider && ((IBookProvider)o).getBooks() != null) {
        mBooks.addAll(((IBookProvider)o).getBooks());
        mAdapter.notifyDataSetChanged();

        if (CurrentSelected.getBook() != null) {
            for (IBook book : mBooks) {
                if (book.getId().equalsIgnoreCase(CurrentSelected.getBook().getId())) {
                    ((linearlayoutmanager)mRecyclerView.getLayoutManager()).scrollToPositionWithOffset(mBooks.indexOf(book),mRecyclerView.getHeight()/2);
                }
            }
        }
    }
}
项目:Aequorea    文件:TagActivity.java   
@Override
protected void initView() {
    ButterKnife.bind(this);

    mToolbar.setNavigationIcon(R.drawable.icon_ab_back_material);
    mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onBackpressed();
        }
    });
    mToolbar.setTitle(mModel.getTitle());
    mCoordinatorLayout.setPadding(0,displayUtils.getStatusBarHeight(getResources()),0);

    mAdapter = new SimpleArticlelistadapter(this,null);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setLayoutManager(new linearlayoutmanager(this));
    mRecyclerView.addOnScrollListener(mScrollListener);

    setStatusBarStyle();
}
项目:GitHub    文件:RecyclerViewActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recycler_view);
    mRecyclerView = (RecyclerView) findViewById(R.id.rv_pop);
    mRecyclerView.setLayoutManager(new linearlayoutmanager(this,false));
    List<String> list = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        list.add("");
    }
    mPopAdapter = new RecyclerPopAdapter();
    mPopAdapter.setNewData(list);
    mRecyclerView.setAdapter(mPopAdapter);
    initPop();
    initEvents();
}
项目:QMUI_Android    文件:QDSnapHelperFragment.java   
private void showBottomSheetList() {
    new QMUIBottomSheet.BottomListSheetBuilder(getActivity())
            .addItem("水平方向")
            .addItem("垂直方向")
            .setonSheetItemClickListener(new QMUIBottomSheet.BottomListSheetBuilder.OnSheetItemClickListener() {
                @Override
                public void onClick(QMUIBottomSheet dialog,View itemView,int position,String tag) {
                    dialog.dismiss();
                    switch (position) {
                        case 0:
                            mPagerLayoutManager.setorientation(linearlayoutmanager.HORIZONTAL);
                            break;
                        case 1:
                            mPagerLayoutManager.setorientation(linearlayoutmanager.VERTICAL);
                            break;
                        default:
                            break;
                    }
                }
            })
            .build()
            .show();
}
项目:GracefulMovies    文件:OpenLicenseActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_open_license);
    ButterKnife.bind(this);

    initializetoolbar();

    String[] libs = getResources().getStringArray(R.array.libraries);
    String[] licenses = getResources().getStringArray(R.array.licenses);
    List<OpenModel> list = new ArrayList<>();
    OpenModel openModel;
    for (int i = 0; i < libs.length; i++) {
        openModel = new OpenModel();
        openModel.setName(libs[i]);
        openModel.setLicense(licenses[i]);
        list.add(openModel);
    }
    mRecyclerView.setLayoutManager(new linearlayoutmanager(this));
    mRecyclerView.setAdapter(new Licenselistadapter(list));
}
项目:GitHub    文件:CardViewRecyclerActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.card_view_recycler_layout);
    top_bar_linear_back=(LinearLayout)this.findViewById(R.id.top_bar_linear_back);
    top_bar_linear_back.setonClickListener(new CustomOnClickListener());
    top_bar_title=(TextView)this.findViewById(R.id.top_bar_title);
    top_bar_title.setText("CardView结合RecyclerView使用实例");

    recycler_cardview=(RecyclerView)this.findViewById(R.id.recycler_cardview);
    linearlayoutmanager linearlayoutmanager=new linearlayoutmanager(this);
    linearlayoutmanager.setorientation(OrientationHelper.VERTICAL);
    recycler_cardview.setLayoutManager(linearlayoutmanager);
    recycler_cardview.setAdapter(new CardViewAdapter(this));


}
项目:gdgApp    文件:HomeSection.java   
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    recyclerView.setHasFixedSize(true);
    linearlayoutmanager manager = new linearlayoutmanager(getContext());
    manager.setorientation(linearlayoutmanager.HORIZONTAL);
    recyclerView.setLayoutManager(manager);
    recyclerView.setAdapter(adapter);
    UpdateMessages();
    UpdateEvents();
    //noinspection ConstantConditions
    typeface = Typeface.createFromAsset(getActivity().getAssets(),Constants.PathConstants.PRODUCT_SANS_FONT);

    notificationTitle.setTypeface(typeface);
    notificationMessage.setTypeface(typeface);
    notificationAuthorTime.setTypeface(typeface);
}
项目:tubik    文件:PopularFragment.java   
@Override
public View onCreateView(LayoutInflater inflater,Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_popular_grid,false);
    Context context = view.getContext();

    RecyclerView gridTracksView = (RecyclerView) view.findViewById(R.id.gridLastFMTopTracks);

    mTracksAdapter = new TrackAdapter(getContext(),mListener);
    gridTracksView.setLayoutManager(new GridLayoutManager(context,mColumnCount,linearlayoutmanager.HORIZONTAL,false));
    gridTracksView.setAdapter(mTracksAdapter);

    RecyclerView gridAlbumsView = (RecyclerView) view.findViewById(R.id.gridTopAlbums);

    mAlbumsAdapter = new AlbumAdapter(getContext(),mListener);
    gridAlbumsView.setLayoutManager(new GridLayoutManager(context,false));
    gridAlbumsView.setAdapter(mAlbumsAdapter);

    return view;
}
项目:OpenEyesReading-android    文件:NewsActivity.java   
private int calculateRecyclerViewFirstPosition() {
    RecyclerView.LayoutManager manager = mRecyclerView.getLayoutManager();
    if (manager instanceof StaggeredGridLayoutManager) {
        if (mVisiblePositions == null)
            mVisiblePositions = new int[((StaggeredGridLayoutManager) manager).getSpanCount()];
        ((StaggeredGridLayoutManager) manager).findLastCompletelyVisibleItemPositions(mVisiblePositions);
        int max = -1;
        for (int pos : mVisiblePositions) {
            max = Math.max(max,pos);
        }
        return max;
    } else if (manager instanceof GridLayoutManager) {
        return ((GridLayoutManager) manager).findFirstCompletelyVisibleItemPosition();
    } else {
        return ((linearlayoutmanager) manager).findLastCompletelyVisibleItemPosition();
    }
}
项目:recyclerview-android    文件:CursorDatasourceExampleActivity.java   
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_cursor_datasource_example);

    mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinator);

    mAdapter = new CallsAdapter();

    mRecyclerView = (RecyclerView) findViewById(android.R.id.list);
    mRecyclerView.setLayoutManager(new linearlayoutmanager(this));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addItemdecoration(new DividerItemdecoration(this,DividerItemdecoration.VERTICAL));
    mRecyclerView.setAdapter(mAdapter);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (ContextCompat.checkSelfPermission(this,CALL_LOG_PERMISSION) == PackageManager.PERMISSION_GRANTED) {
            onCallLogPermissionGranted();
        } else {
            ActivityCompat.requestPermissions(this,CALL_LOG_PERMISSIONS,REQUEST_CODE_CALL_LOG_PERMISSION);
        }
    } else {
        onCallLogPermissionGranted();
    }
}
项目:Phoenix-for-VK    文件:SelectSchoolsDialog.java   
@Override
public View onCreateView(@NonNull LayoutInflater inflater,@Nullable Bundle savedInstanceState) {
    getDialog().getwindow().requestFeature(Window.FEATURE_NO_TITLE);

    View root = inflater.inflate(R.layout.dialog_country_or_city_select,false);

    EditText input = root.findViewById(R.id.input);
    input.setText(filter);
    input.addTextChangedListener(new TextWatcherAdapter() {
        @Override
        public void afterTextChanged(Editable s) {
            filter = s.toString();
            mHandler.removeCallbacks(runSearchRunnable);
            mHandler.postDelayed(runSearchRunnable,RUN_SEACRH_DELAY);
        }
    });

    mRecyclerView = root.findViewById(R.id.list);
    mRecyclerView.setLayoutManager(new linearlayoutmanager(getActivity(),false));

    return root;
}
项目:black-mirror    文件:NewsWidgetView.java   
private void init() {
    inflate(getContext(),R.layout.view_news_widget,this);
    this.polsatNewsRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_polsat_news);
    this.tvnNewsRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_tvn_news);
    this.polsatNewsTitle = (TextView) findViewById(R.id.polsat_text);
    this.tvnNewsTitle = (TextView) findViewById(R.id.tvn_text);
    this.polsatNewsAdapter = new NewsRecyclerAdapter(getContext());
    this.tvnNewsAdapter = new NewsRecyclerAdapter(getContext());
    tvnNewsRecyclerView.setLayoutManager(new Scrollinglinearlayoutmanager(getContext(),false,5000));
    tvnNewsRecyclerView.setAdapter(tvnNewsAdapter);
    polsatNewsRecyclerView.setAdapter(polsatNewsAdapter);
    polsatNewsRecyclerView.setLayoutManager(new Scrollinglinearlayoutmanager(getContext(),11000));
    this.setVisibility(GONE);
}
项目:Gesture    文件:ItemTouchListener.java   
private int chooseDropTarget(RecyclerView rv,int dragPosition,int curY) {
    linearlayoutmanager layoutManager = ((linearlayoutmanager) rv.getLayoutManager());
    int firstVisiblePosition = layoutManager.findFirstVisibleItemPosition();

    if (mView.getY() < 0 && firstVisiblePosition == 0) {
        return firstVisiblePosition;
    }

    float referenceUp = mView.getY() - mView.getTranslationY();
    if ((referenceUp > curY) && mView.getTranslationY() < 0) {
        if (referenceUp - curY > mView.getHeight()) {
            return dragPosition - 2;
        }
        if (referenceUp - curY < mView.getHeight() && referenceUp - curY > 0) {
            return dragPosition - 1;
        }
    }
    float referenceDown = mView.getY() - mView.getTranslationY() + mView.getHeight();
    if ((referenceDown < curY) && mView.getTranslationY() > 0) {
        if (curY - referenceDown > mView.getHeight()) {
            return dragPosition + 2;
        }
        if (curY - referenceDown < mView.getHeight() && curY - referenceDown > 0) {
            return dragPosition + 1;
        }
    }

    return -1;
}
项目:aurora    文件:RecyclerSnapHelper.java   
@Override
public int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager,int veLocityX,int veLocityY) {
    int targetPos = super.findTargetSnapPosition(layoutManager,veLocityX,veLocityY);
    this.position = targetPos;
    final View currentView = findSnapView(layoutManager);
    if (targetPos != RecyclerView.NO_POSITION && currentView != null) {
        int currentPos = layoutManager.getPosition(currentView);
        int first = ((linearlayoutmanager) layoutManager).findFirstVisibleItemPosition();
        int last = ((linearlayoutmanager) layoutManager).findLastVisibleItemPosition();
        currentPos = targetPos < currentPos ? last : (targetPos > currentPos ? first : currentPos);
        targetPos = targetPos < currentPos ? currentPos - 1 : (targetPos > currentPos ? currentPos + 1 : currentPos);
    }
    return targetPos;
}
项目:android-dev-challenge    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    /*
     * Using findViewById,we get a reference to our RecyclerView from xml. This allows us to
     * do things like set the adapter of the RecyclerView and toggle the visibility.
     */
    mNumbersList = (RecyclerView) findViewById(R.id.rv_numbers);

    /*
     * A linearlayoutmanager is responsible for measuring and positioning item views within a
     * RecyclerView into a linear list. This means that it can produce either a horizontal or
     * vertical list depending on which parameter you pass in to the linearlayoutmanager
     * constructor. By default,if you don't specify an orientation,you get a vertical list.
     * In our case,we want a vertical list,so we don't need to pass in an orientation flag to
     * the linearlayoutmanager constructor.
     *
     * There are other LayoutManagers available to display your data in uniform grids,* staggered grids,and more! See the developer documentation for more details.
     */
    linearlayoutmanager layoutManager = new linearlayoutmanager(this);
    mNumbersList.setLayoutManager(layoutManager);

    /*
     * Use this setting to improve performance if you kNow that changes in content do not
     * change the child layout size in the RecyclerView
     */
    mNumbersList.setHasFixedSize(true);

    /*
     * The GreenAdapter is responsible for displaying each item in the list.
     */
    mAdapter = new GreenAdapter(NUM_LIST_ITEMS);
    mNumbersList.setAdapter(mAdapter);
}
项目:XFrame    文件:Dividerdecoration.java   
/**
 * 返回条目之间的间隔,例如我们想仿照ListView一样添加分割线,那么就需要设置outRect的下边距。
 * @param outRect
 * @param view
 * @param parent
 * @param state
 */
@Override
public void getItemOffsets(Rect outRect,View view,RecyclerView parent,RecyclerView.State state) {
    int position = parent.getChildAdapterPosition(view);
    int orientation = 0;
    int headerCount = 0,footerCount = 0;
    if (parent.getAdapter() instanceof XRecyclerViewAdapter){
        headerCount = ((XRecyclerViewAdapter) parent.getAdapter()).getHeaderCount();
        footerCount = ((XRecyclerViewAdapter) parent.getAdapter()).getFooterCount();
    }

    RecyclerView.LayoutManager layoutManager = parent.getLayoutManager();
    if (layoutManager instanceof StaggeredGridLayoutManager){
        orientation = ((StaggeredGridLayoutManager) layoutManager).getorientation();
    }else if (layoutManager instanceof GridLayoutManager){
        orientation = ((GridLayoutManager) layoutManager).getorientation();
    }else if (layoutManager instanceof linearlayoutmanager){
        orientation = ((linearlayoutmanager) layoutManager).getorientation();
    }

    if (position>=headerCount&&position<parent.getAdapter().getItemCount()-footerCount||mDrawheaderfooter){
        if (orientation == OrientationHelper.VERTICAL){
            outRect.bottom = mHeight;
        }else {
            outRect.right = mHeight;
        }
    }
}
项目:NoChat    文件:MainActivity.java   
private void setupChatAdapter() {
    chatAdapter = new ChatAdapter();
    linearlayoutmanager manager = new linearlayoutmanager(this);
    manager.setStackFromEnd(true);
    rvChat.setLayoutManager(manager);
    rvChat.setAdapter(chatAdapter);
}
项目:Cash    文件:frmvendaItens.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.frm_venda_itens);

    ivenda = getIntent().getExtras().getInt("venda");

    RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.rvItens);
    mRecyclerView.setLayoutManager(new linearlayoutmanager(frmvendaItens.this));
    mRecyclerView.addItemdecoration(new SpacesItemdecoration(Funcoes.SPACE_BETWEEN_ITEMS));

    mAdapter = new adpvendaItens(frmvendaItens.this,mRecyclerView,ivenda);
    mRecyclerView.setAdapter(mAdapter);

    ImageButton btnAdd = (ImageButton) findViewById(R.id.btnAdd);
    btnAdd.setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Intent intent = new Intent(frmvendaItens.this,frmManutencaovendaItens.class);
            intent.putExtra("Operacao","I");
            intent.putExtra("venda",ivenda);
            startActivity(intent);
        }
    });

}
项目:CXJPadProject    文件:CombinationActivity.java   
public void initSkuDetailBRAdapter() {
    skuDetailBRAdapter = new BRAdapter<CombinateQuoteInfo.SKUDetail>(this,R.layout.item_combination_product,combiSkuList) {
        @Override
        protected void convert(RvHolder holder,CombinateQuoteInfo.SKUDetail skuDetail,int position) {
            holder.setText(R.id.tv_proCtgName,skuDetail.getSkuCtgName());
            holder.setText(R.id.tv_proNo,skuDetail.getSkuNo());
            holder.setText(R.id.tv_proName,skuDetail.getSkuName());
            holder.setText(R.id.tv_proPrice,skuDetail.getStdPrice());
            holder.setText(R.id.tv_proQuantity,skuDetail.getSkuQuantity());
        }
    };

    yrvCombPro.setLayoutManager(new linearlayoutmanager(this));
    yrvCombPro.setAdapter(skuDetailBRAdapter);
}
项目:Tribe    文件:LifeFragment.java   
private void initRecyclerView() {
    mData = new ArrayList<>();
    mAdapter = new LifeAdapter(getContext(),mData,getActivity());
    RecyclerView.LayoutManager layoutManager = new linearlayoutmanager(getContext(),false);
    mLifeRecyclerView.setLayoutManager(layoutManager);
    mLifeRecyclerView.setAdapter(mAdapter);
}
项目:GitHub    文件:FastAdapterDialog.java   
/**
 * Start the dialog and display it on screen.  The window is placed in the
 * application layer and opaque.  Note that you should not override this
 * method to do initialization when the dialog is shown,instead implement
 * that in {@link #onStart}.
 */
public void show() {
    if (mRecyclerView.getLayoutManager() == null) {
        mRecyclerView.setLayoutManager(new linearlayoutmanager(getContext()));
    }
    if (mFastItemAdapter == null && mRecyclerView.getAdapter() == null) {
        mFastItemAdapter = new FastItemAdapter<>();
        mRecyclerView.setAdapter(mFastItemAdapter);
    }
    super.show();
}
项目:Pigeon    文件:ToolsFragment.java   
@Override
public void initData() {
    query = new BmobQuery<>();
    boolean isCache = query.hasCachedResult(Tools.class);

    if(isCache){
        query.setCachePolicy(BmobQuery.CachePolicy.CACHE_ELSE_NETWORK);    // 如果有缓存的话,则设置策略为CACHE_ELSE_NETWORK
    }else{
        query.setCachePolicy(BmobQuery.CachePolicy.NETWORK_ELSE_CACHE);    // 如果没有缓存的话,则设置策略为NETWORK_ELSE_CACHE
    }

    query.setMaxCacheAge(TimeUnit.DAYS.toMillis(3));//此表示缓存一天
    query.setLimit(10);
    query.findobjects(new FindListener<Tools>() {
        @Override
        public void done(List<Tools> list,BmobException e) {
            if (e == null) {
                if (list.size() != 0) {
                    toolsAdapter = new ToolsAdapter(getContext(),list);
                    mRvTools.setLayoutManager(new linearlayoutmanager(getContext(),false));
                    mRvTools.setAdapter(toolsAdapter);

                }
            }
        }
    });


}
项目:Nearby    文件:AllInOneInquiryVitalListCustomAdapter.java   
@Override
public void onScrolled(RecyclerView recyclerView,int dx,int dy) {
    super.onScrolled(recyclerView,dx,dy);

    final linearlayoutmanager linearlayoutmanager = (linearlayoutmanager) recyclerView.getLayoutManager();

    totalItemCount = linearlayoutmanager.getItemCount();
    lastVisibleItem = linearlayoutmanager.findLastVisibleItemPosition();
    if (!loading && totalItemCount <= (lastVisibleItem + visibleThreshold)) {
        // End has been reached
        // Do something
        loading = true;
        if (onLoadMoreListener != null) {
            onLoadMoreListener.onLoadMore();
        }
    }
    // 여기까지 무한 스크롤

    if (scrolleddistance > HIDE_THRESHOLD && controlsVisible) {
        onHide();
        controlsVisible = false;
        scrolleddistance = 0;
    } else if (scrolleddistance < -HIDE_THRESHOLD && !controlsVisible) {
        onShow();
        controlsVisible = true;
        scrolleddistance = 0;
    }

    if((controlsVisible && dy>0) || (!controlsVisible && dy<0)) {
        scrolleddistance += dy;
    }
    // 여기까지 툴바 숨기기
}

关于com.facebook.litho.widget.LinearLayoutInfo的实例源码facebook源代码的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于android.support.design.widget.CoordinatorLayout.LayoutParams的实例源码、android.support.v7.widget.LinearLayoutCompat.LayoutParams的实例源码、android.support.v7.widget.LinearLayoutCompat的实例源码、android.support.v7.widget.LinearLayoutManager的实例源码等相关知识的信息别忘了在本站进行查找喔。

本文标签: