use of com.comcast.freeflow.core.AbsLayoutContainer.OnItemClickListener in project FreeFlow by Comcast.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.frameLayout);
final ImageAdapter adapter = new ImageAdapter();
container = new FreeFlowContainer(this);
DefaultLayoutAnimator anim = (DefaultLayoutAnimator) container.getLayoutAnimator();
anim.animateAllSetsSequentially = false;
anim.animateIndividualCellsSequentially = false;
container.requestFocus();
hLayout = new HLayout();
hLayout.setLayoutParams(new HLayout.LayoutParams(100, 150, 600));
vLayout = new VLayout();
vLayout.setLayoutParams(new VLayout.LayoutParams(100, 600, 150));
vGridLayout = new VGridLayout();
vGridLayout.setLayoutParams(new VGridLayout.LayoutParams(200, 200, 600, 100));
hGridLayout = new HGridLayout();
hGridLayout.setLayoutParams(new HGridLayout.LayoutParams(200, 200, 100, 600));
layouts = new FreeFlowLayout[] { vLayout, hLayout, vGridLayout, hGridLayout };
container.setAdapter(adapter);
container.setLayout(layouts[currentLayoutIndex]);
frameLayout.addView(container);
changeButton = ((Button) frameLayout.findViewById(R.id.transitionButton));
changeButton.setText("Layout");
changeButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
currentLayoutIndex++;
if (currentLayoutIndex == layouts.length) {
currentLayoutIndex = 0;
}
container.setLayout(layouts[currentLayoutIndex]);
}
});
jumpButton = (Button) findViewById(R.id.jumpButton);
jumpButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
int section = (int) (adapter.getNumberOfSections() * Math.random());
int index = (int) (adapter.getSection(section).getDataCount() * Math.random());
String s = "section = " + section + ", index = " + index;
Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
container.scrollToItem(section, index, false);
}
});
jumpButtonAnim = (Button) findViewById(R.id.jumpButtonAnim);
jumpButtonAnim.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
int section = (int) (adapter.getNumberOfSections() * Math.random());
int index = (int) (adapter.getSection(section).getDataCount() * Math.random());
String s = "section = " + section + ", index = " + index;
Toast.makeText(MainActivity.this, s, Toast.LENGTH_SHORT).show();
container.scrollToItem(section, index, true);
}
});
container.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AbsLayoutContainer parent, FreeFlowItem proxy) {
Log.d("Test", "container item: " + proxy.itemSection + " / " + proxy.itemIndex);
}
});
changeButton.bringToFront();
jumpButton.bringToFront();
jumpButtonAnim.bringToFront();
}
use of com.comcast.freeflow.core.AbsLayoutContainer.OnItemClickListener in project FreeFlow by Comcast.
the class ArtbookActivity method onDataLoaded.
public void onDataLoaded(DribbbleFeed feed) {
Log.d(TAG, "photo: " + feed.getShots().get(0).getImage_teaser_url());
adapter.update(feed);
container.dataInvalidated();
container.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AbsLayoutContainer parent, FreeFlowItem proxy) {
}
});
container.addScrollListener(new OnScrollListener() {
@Override
public void onScroll(FreeFlowContainer container) {
Log.d(TAG, "scroll percent " + container.getScrollPercentY());
}
});
}
Aggregations