use of android.view.animation.LayoutAnimationController in project Manhua by ag2s20150909.
the class SearchActivity method showList.
private void showList(final SearchResult data) {
SearchAdapter adapter = new SearchAdapter(this, data);
lv.setLayoutAnimation(new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_animation), 0.5f));
lv.setAdapter(adapter);
Toast.makeText(getApplicationContext(), "共有" + (data.results.size()) + "条结果", Toast.LENGTH_LONG).show();
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> p1, View p2, int p3, long p4) {
try {
BookShelf.addBook(data.results.get(p3));
Intent i = new Intent(getApplicationContext(), ListActivity.class);
i.putExtra("url", data.results.get(p3).link);
i.putExtra("book", data.results.get(p3));
// Toast.makeText(getApplicationContext(), data.get(p3).get("link"), 1).show();
startActivity(i);
} catch (Exception e) {
mHander.obtainMessage(0, e.getMessage()).sendToTarget();
}
}
});
}
use of android.view.animation.LayoutAnimationController in project Manhua by ag2s20150909.
the class HomeActivity method showList.
private void showList(final SearchResult data) {
SearchAdapter adapter = new SearchAdapter(this, data);
lv.setLayoutAnimation(new LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.list_animation), 0.5f));
lv.setAdapter(adapter);
Toast.makeText(getApplicationContext(), "共有" + (data.results.size()) + "条结果", Toast.LENGTH_LONG).show();
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> p1, View p2, int p3, long p4) {
try {
BookShelf.addBook(data.results.get(p3));
Intent i = new Intent(getApplicationContext(), ListActivity.class);
i.putExtra("url", data.results.get(p3).link);
i.putExtra("book", data.results.get(p3));
// Toast.makeText(getApplicationContext(), data.get(p3).get("link"), 1).show();
startActivity(i);
} catch (Exception e) {
mHander.obtainMessage(0, e.getMessage()).sendToTarget();
}
}
});
}
use of android.view.animation.LayoutAnimationController in project KL2 by jweihao.
the class LayoutAnimationActivity method onViewClicked.
@OnClick(R.id.button_addview)
public void onViewClicked() {
// 设置过渡动画
ScaleAnimation sa = new ScaleAnimation(0, 1, 0, 1);
sa.setDuration(2000);
// 设置布局动画的显示属性
LayoutAnimationController lac = new LayoutAnimationController(sa, 0.5F);
lac.setOrder(LayoutAnimationController.ORDER_NORMAL);
// 为ViewGroup设置布局动画
mLaLl.setLayoutAnimation(lac);
mLaLl.setOrientation(LinearLayout.VERTICAL);
TextView textView = new TextView(this);
textView.setTextSize(18);
textView.setGravity(Gravity.CENTER);
textView.setText("梅长苏");
textView.setTextColor(Color.BLACK);
ImageView imageView = new ImageView(this);
imageView.setImageResource(R.mipmap.meichangsu);
int screenWidthPx = ScreenUtil.getScreenWidthPx(this);
// 下面必须使用LinearLayout,如果使用ViewGroup的LayoutParams,则会报空指针异常。
// 方式一:
// LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
// screenWidthPx, LinearLayout.LayoutParams.WRAP_CONTENT);
// 方式二:使用MarginLayoutParams可以适用LinearLayout和RelativeLayout布局。
// 设置图片的宽度和长度
ViewGroup.MarginLayoutParams layoutParams = new ViewGroup.MarginLayoutParams(screenWidthPx, LinearLayout.LayoutParams.WRAP_CONTENT);
imageView.setLayoutParams(layoutParams);
imageView.setAdjustViewBounds(true);
imageView.setMaxWidth(screenWidthPx);
imageView.setMaxHeight(screenWidthPx);
mLaLl.addView(imageView);
mLaLl.addView(textView);
}
use of android.view.animation.LayoutAnimationController in project android_packages_apps_Dialer by LineageOS.
the class OldSpeedDialFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Trace.beginSection(TAG + " onCreateView");
mParentView = inflater.inflate(R.layout.speed_dial_fragment, container, false);
mListView = (PhoneFavoriteListView) mParentView.findViewById(R.id.contact_tile_list);
mListView.setOnItemClickListener(this);
mListView.setVerticalScrollBarEnabled(false);
mListView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT);
mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY);
mListView.getDragDropController().addOnDragDropListener(mContactTileAdapter);
final ImageView dragShadowOverlay = (ImageView) getActivity().findViewById(R.id.contact_tile_drag_shadow_overlay);
mListView.setDragShadowOverlay(dragShadowOverlay);
mEmptyView = (EmptyContentView) mParentView.findViewById(R.id.empty_list_view);
mEmptyView.setImage(R.drawable.empty_speed_dial);
mEmptyView.setActionClickedListener(this);
mContactTileFrame = mParentView.findViewById(R.id.contact_tile_frame);
final LayoutAnimationController controller = new LayoutAnimationController(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in));
controller.setDelay(0);
mListView.setLayoutAnimation(controller);
mListView.setAdapter(mContactTileAdapter);
mListView.setOnScrollListener(mScrollListener);
mListView.setFastScrollEnabled(false);
mListView.setFastScrollAlwaysVisible(false);
// prevent content changes of the list from firing accessibility events.
mListView.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_NONE);
ContentChangedFilter.addToParent(mListView);
Trace.endSection();
return mParentView;
}
use of android.view.animation.LayoutAnimationController in project MyJapanese by 54wall.
the class LayoutAnimationHelper method applyAnimation.
public void applyAnimation(RecyclerView recyclerView) {
LayoutAnimationController controller = new LayoutAnimationController(getAnimationSetFromLeft());
controller.setDelay(0.1f);
controller.setOrder(LayoutAnimationController.ORDER_NORMAL);
recyclerView.setLayoutAnimation(controller);
recyclerView.getAdapter().notifyDataSetChanged();
recyclerView.scheduleLayoutAnimation();
}
Aggregations