本文整理汇总了Java中com.wirelesspienetwork.overview.model.OverviewAdapter类的典型用法代码示例。如果您正苦于以下问题:Java OverviewAdapter类的具体用法?Java OverviewAdapter怎么用?Java OverviewAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OverviewAdapter类属于com.wirelesspienetwork.overview.model包,在下文中一共展示了OverviewAdapter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setTaskStack
import com.wirelesspienetwork.overview.model.OverviewAdapter; //导入依赖的package包/类
/** Set/get the bsp root node */
public void setTaskStack(OverviewAdapter adapter) {
if (mStackView != null) {
removeView(mStackView);
}
mAdapter = adapter;
mStackView = new OverviewStackView(getContext(), adapter, mConfig);
LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
mStackView.setLayoutParams(params);
mStackView.setCallbacks(this);
mStackView.setAlpha(0);
mStackView.animate().alpha(1.f).setStartDelay(2000).setDuration(3500).start();
//所以说 OverviewStackView 才是重点
addView(mStackView);
}
示例2: OverviewStackView
import com.wirelesspienetwork.overview.model.OverviewAdapter; //导入依赖的package包/类
public OverviewStackView(Context context, OverviewAdapter adapter, OverviewConfiguration config) {
super(context);
mConfig = config;
mStack = adapter;
mStack.setCallbacks(this);
mViewPool = new ObjectPool<>(context, this);
mInflater = LayoutInflater.from(context);
mLayoutAlgorithm = new OverviewStackViewLayoutAlgorithm(mConfig);
mStackScroller = new OverviewStackViewScroller(context, mConfig, mLayoutAlgorithm);
mStackScroller.setCallbacks(this);
mTouchHandler = new OverviewStackViewTouchHandler(context, this, mConfig, mStackScroller);
}
示例3: onResume
import com.wirelesspienetwork.overview.model.OverviewAdapter; //导入依赖的package包/类
@Override
protected void onResume() {
super.onResume();
// Mark Recents as visible
mVisible = true;
ArrayList<Integer> models = new ArrayList<>();
for(int i = 0; i < 10; ++i)
{
Random random = new Random();
random.setSeed(i);
int color = Color.argb(255, random.nextInt(255), random.nextInt(255), random.nextInt(255));
models.add(color);
}
final OverviewAdapter stack = new OverviewAdapter<ViewHolder<View, Integer>, Integer>(models)
{
@Override
public ViewHolder onCreateViewHolder(Context context, ViewGroup parent) {
View v = View.inflate(context, R.layout.recents_dummy, null);
return new ViewHolder<View, Integer>(v);
}
@Override
public void onBindViewHolder(ViewHolder<View, Integer> viewHolder) {
viewHolder.itemView.setBackgroundColor(viewHolder.model);
}
};
mRecentsView.setTaskStack(stack);
// new Handler().postDelayed(new Runnable() {
// @Override
// public void run() {
// stack.notifyDataSetInserted(new Integer(1), 2);
// }
// },2000);
}
示例4: onCardAdded
import com.wirelesspienetwork.overview.model.OverviewAdapter; //导入依赖的package包/类
public void onCardAdded(OverviewAdapter stack, int position) {
requestSynchronizeStackViewsWithModel();
}
示例5: onCardRemoved
import com.wirelesspienetwork.overview.model.OverviewAdapter; //导入依赖的package包/类
public void onCardRemoved(OverviewAdapter stack, int removedTask) {
// Remove the view associated with this task, we can't rely on updateTransforms
// to work here because the task is no longer in the list
OverviewCard tv = getChildViewForIndex(removedTask);
ViewHolder holder = mViewHolderMap.get(tv);
// Notify the callback that we've removed the task and it can clean up after it
mCb.onCardDismissed(removedTask);
if (tv != null) {
holder.setPosition(-1);
mViewPool.returnObjectToPool(holder);
}
for (ViewHolder vh : mViewHolderMap.values())
{
if (vh.getPosition() > removedTask) {
vh.setPosition(vh.getPosition() - 1);
// No need to rebind, it's just an index change.
}
}
// Get the stack scroll of the task to anchor to (since we are removing something, the front
// most task will be our anchor task)
int anchorPosition = -1;
float prevAnchorTaskScroll = 0;
boolean pullStackForward = stack.getNumberOfItems() > 0;
if (pullStackForward) {
anchorPosition = stack.getNumberOfItems() - 1;
prevAnchorTaskScroll = mLayoutAlgorithm.getStackScrollForTask(anchorPosition);
}
// Update the min/max scroll and animate other task views into their new positions
updateMinMaxScroll(true);
// Offset the stack by as much as the anchor task would otherwise move back
if (pullStackForward) {
float anchorTaskScroll = mLayoutAlgorithm.getStackScrollForTask(anchorPosition);
mStackScroller.setStackScroll(mStackScroller.getStackScroll() + (anchorTaskScroll
- prevAnchorTaskScroll));
mStackScroller.boundScroll();
}
// Animate all the tasks into place
requestSynchronizeStackViewsWithModel(200);
// If there are no remaining tasks, then either unfilter the current stack, or just close
// the activity if there are no filtered stacks
if (mStack.getNumberOfItems() == 0) {
mCb.onAllCardsDismissed();
}
}