Search in sources :

Example 36 with LayoutAnimationController

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();
            }
        }
    });
}
Also used : SearchAdapter(cn.liuyin.manhua.adapter.SearchAdapter) LayoutAnimationController(android.view.animation.LayoutAnimationController) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 37 with LayoutAnimationController

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();
            }
        }
    });
}
Also used : SearchAdapter(cn.liuyin.manhua.adapter.SearchAdapter) LayoutAnimationController(android.view.animation.LayoutAnimationController) AdapterView(android.widget.AdapterView) Intent(android.content.Intent) HorizontalScrollView(android.widget.HorizontalScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 38 with LayoutAnimationController

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);
}
Also used : ViewGroup(android.view.ViewGroup) LayoutAnimationController(android.view.animation.LayoutAnimationController) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ScaleAnimation(android.view.animation.ScaleAnimation) OnClick(butterknife.OnClick)

Example 39 with LayoutAnimationController

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;
}
Also used : LayoutAnimationController(android.view.animation.LayoutAnimationController) ImageView(android.widget.ImageView)

Example 40 with LayoutAnimationController

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();
}
Also used : LayoutAnimationController(android.view.animation.LayoutAnimationController)

Aggregations

LayoutAnimationController (android.view.animation.LayoutAnimationController)42 ListView (android.widget.ListView)11 TranslateAnimation (android.view.animation.TranslateAnimation)10 Animation (android.view.animation.Animation)9 Paint (android.graphics.Paint)7 AlphaAnimation (android.view.animation.AlphaAnimation)7 AnimationSet (android.view.animation.AnimationSet)7 Cursor (android.database.Cursor)6 ListAdapter (android.widget.ListAdapter)6 SimpleCursorAdapter (android.widget.SimpleCursorAdapter)6 View (android.view.View)5 Intent (android.content.Intent)3 AdapterView (android.widget.AdapterView)3 ImageView (android.widget.ImageView)3 BaseActivity (com.instructure.androidpolling.app.activities.BaseActivity)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 ViewGroup (android.view.ViewGroup)2 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)2 SearchAdapter (cn.liuyin.manhua.adapter.SearchAdapter)2 SwipeDismissListViewTouchListener (com.instructure.androidpolling.app.util.SwipeDismissListViewTouchListener)2