当前位置: 首页>>代码示例>>Java>>正文


Java CoverFlow类代码示例

本文整理汇总了Java中me.crosswall.lib.coverflow.CoverFlow的典型用法代码示例。如果您正苦于以下问题:Java CoverFlow类的具体用法?Java CoverFlow怎么用?Java CoverFlow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CoverFlow类属于me.crosswall.lib.coverflow包,在下文中一共展示了CoverFlow类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import me.crosswall.lib.coverflow.CoverFlow; //导入依赖的package包/类
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_normal);

  PagerContainer pagerContainer = (PagerContainer) findViewById(R.id.pager_container);
  pagerContainer.setOverlapEnabled(true);

  final ViewPager viewPager = pagerContainer.getViewPager();
  MyFragmentPagerAdapter pagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager());
  viewPager.setOffscreenPageLimit(pagerAdapter.getCount());
  viewPager.setAdapter(pagerAdapter);

  new CoverFlow.Builder().with(viewPager)
      .scale(0.3f)
      .pagerMargin(getResources().getDimensionPixelSize(R.dimen.overlap_pager_margin))
      .spaceSize(0f)
      .build();

  //Manually setting the first View to be elevated
  viewPager.post(new Runnable() {
    @Override public void run() {
      Fragment fragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, 0);
      ViewCompat.setElevation(fragment.getView(), 8.0f);
    }
  });
}
 
开发者ID:crosswall,项目名称:Android-Coverflow,代码行数:27,代码来源:OverlapActivity.java

示例2: onBind

import me.crosswall.lib.coverflow.CoverFlow; //导入依赖的package包/类
@Override
public void onBind(DiscoverModel model) {
    CarouselAdapter adapter = new CarouselAdapter(context, model.getList());

    //Dimensions
    final int carouselHeight = orientation == Configuration.ORIENTATION_PORTRAIT
            ? (int)(screenDimensions.y * 0.37)
            : (int)(screenDimensions.y * 0.61);

    FrameLayout.LayoutParams carouselParams = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, carouselHeight);

    pager.setLayoutParams(carouselParams);

    pager.setAdapter(adapter);
    pager.setClipChildren(false);
    pager.setOffscreenPageLimit(15);
    pager.setCurrentItem(1);

    new CoverFlow.Builder()
            .with(pager)
            .pagerMargin(0)
            .spaceSize(10)
            .scale(0.13f)
            .build();

    indicator.initViewPager(pager);
}
 
开发者ID:tgbMedia,项目名称:Android-app,代码行数:29,代码来源:DiscoverAdapter.java

示例3: onCreate

import me.crosswall.lib.coverflow.CoverFlow; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_normal2);

    PagerContainer mContainer = (PagerContainer) findViewById(R.id.pager_container);

    final ViewPager pager = mContainer.getViewPager();

    PagerAdapter adapter = new MyPagerAdapter();
    pager.setAdapter(adapter);

    pager.setOffscreenPageLimit(adapter.getCount());

    pager.setClipChildren(false);

    mContainer.setPageItemClickListener(new PageItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            Toast.makeText(Normal2Activity.this,"position:" + position,Toast.LENGTH_SHORT).show();
        }
    });


    boolean showRotate = getIntent().getBooleanExtra("showRotate",true);

    if(showRotate){
        new CoverFlow.Builder()
                .with(pager)
                .scale(0.3f)
                .pagerMargin(0f)
                .spaceSize(0f)
                .rotationY(25f)
                .build();
    }
    
}
 
开发者ID:crosswall,项目名称:Android-Coverflow,代码行数:38,代码来源:Normal2Activity.java

示例4: onCreate

import me.crosswall.lib.coverflow.CoverFlow; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_normal);
    PagerContainer container = (PagerContainer) findViewById(R.id.pager_container);
    ViewPager pager = container.getViewPager();
    pager.setAdapter(new MyPagerAdapter());
    pager.setClipChildren(false);
   //
    pager.setOffscreenPageLimit(15);

    container.setPageItemClickListener(new PageItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            Toast.makeText(NormalActivity.this,"position:" + position,Toast.LENGTH_SHORT).show();
        }
    });

    boolean showTransformer = getIntent().getBooleanExtra("showTransformer",false);


    if(showTransformer){

            new CoverFlow.Builder()
                    .with(pager)
                    .scale(0.3f)
                    .pagerMargin(getResources().getDimensionPixelSize(R.dimen.pager_margin))
                    .spaceSize(0f)
                    .build();

    }else{
        pager.setPageMargin(30);
    }
}
 
开发者ID:crosswall,项目名称:Android-Coverflow,代码行数:35,代码来源:NormalActivity.java

示例5: onCreateView

import me.crosswall.lib.coverflow.CoverFlow; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState){
    final View ret = inflater.inflate(R.layout.layout_coverflow, parent, false);
    pagerContainer = (PagerContainer) ret.findViewById(R.id.pager_container);
    pager = (ViewPager) ret.findViewById(R.id.view_pager);
    pagerAdapter = new CoverflowPagerAdapter();
    pager.setAdapter(pagerAdapter);
    pager.setOffscreenPageLimit(3);
    flow = new CoverFlow.Builder()
            .with(pager)
            .pagerMargin(0)
            .scale(0.05f)
            .spaceSize(0f)
            .rotationY(30f)
            .build();
    pagerContainer.setOverlapEnabled(true);
    pager.post(new Runnable() {
        @Override public void run() {
            View view = (View) pager.getAdapter().instantiateItem(pager, 0);
            ViewCompat.setElevation(view, 8.0f);
        }
    });
    ret.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            int height = pagerContainer.getHeight();
            if (height <= 0 || resized) {
                return;
            }
            ViewGroup.LayoutParams lp = pager.getLayoutParams();
            int margin = getResources().getDimensionPixelSize(R.dimen.cover_flow_margin);
            lp.height = height - margin * 2;
            lp.width = lp.height;
            pager.setLayoutParams(lp);
            pagerAdapter.resized = true;
            pagerContainer.invalidate();
            pagerAdapter.notifyDataSetChanged();
            pager.post(new Runnable() {
                @Override
                public void run() {
                    pager.setCurrentItem(pagerAdapter.getCount() / 2);
                }
            });
            resized = true;

            if (pagerAdapter.getCount() == 0) {
                emptyView.setVisibility(View.VISIBLE);
                pagerContainer.setVisibility(View.GONE);
            } else {
                emptyView.setVisibility(View.GONE);
                pagerContainer.setVisibility(View.VISIBLE);
            }
        }
    });
    emptyView = ret.findViewById(R.id.id_empty_view);

    return ret;
}
 
开发者ID:SpongeBobSun,项目名称:Prodigal,代码行数:59,代码来源:CoverflowFragment.java


注:本文中的me.crosswall.lib.coverflow.CoverFlow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。