Search in sources :

Example 11 with ListView

use of android.widget.ListView in project AnimationEasingFunctions by daimajia.

the class MyActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my);
    mEasingList = (ListView) findViewById(R.id.easing_list);
    mAdapter = new EasingAdapter(this);
    mEasingList.setAdapter(mAdapter);
    mTarget = findViewById(R.id.target);
    mHistory = (DrawView) findViewById(R.id.history);
    mEasingList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            mHistory.clear();
            Skill s = (Skill) view.getTag();
            AnimatorSet set = new AnimatorSet();
            mTarget.setTranslationX(0);
            mTarget.setTranslationY(0);
            set.playTogether(Glider.glide(s, 1200, ObjectAnimator.ofFloat(mTarget, "translationY", 0, dipToPixels(MyActivity.this, -(160 - 3))), new BaseEasingMethod.EasingListener() {

                @Override
                public void on(float time, float value, float start, float end, float duration) {
                    mHistory.drawPoint(time, duration, value - dipToPixels(MyActivity.this, 60));
                }
            }));
            set.setDuration(1200);
            set.start();
        }
    });
}
Also used : BaseEasingMethod(com.daimajia.easing.BaseEasingMethod) AnimatorSet(android.animation.AnimatorSet) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) Skill(com.daimajia.easing.Skill) AdapterView(android.widget.AdapterView)

Example 12 with ListView

use of android.widget.ListView in project TextureViewDemo by dalinaum.

the class ListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    final Demo[] demos = { new Demo("Camera", CameraActivity.class), new Demo("GL Triangle", GLTriangleActivity.class), new Demo("Canvas", CanvasActivity.class), new Demo("Canvas2", Canvas2Activity.class), new Demo("Demo repository", null) };
    super.onCreate(savedInstanceState);
    final ListView listView = new ListView(this);
    listView.setAdapter(new ArrayAdapter<Demo>(this, R.layout.list, R.id.activity_name, demos) {

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            final LinearLayout view = (LinearLayout) super.getView(position, convertView, parent);
            final Demo demo = getItem(position);
            final TextView activityClass = (TextView) view.findViewById(R.id.activity_class);
            if (demo.classType != null) {
                activityClass.setText(demo.classType.toString());
            } else {
                activityClass.setText("");
            }
            return view;
        }
    });
    listView.setClickable(true);
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            final Demo demo = (Demo) parent.getAdapter().getItem(position);
            final Intent intent;
            if (demo.classType != null) {
                intent = new Intent(ListActivity.this, demo.classType);
            } else {
                final String url = "https://github.com/dalinaum/textureviewdemo";
                intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse(url));
            }
            startActivity(intent);
        }
    });
    setContentView(listView);
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ViewGroup(android.view.ViewGroup) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 13 with ListView

use of android.widget.ListView in project UltimateAndroid by cymcsg.

the class SuperListview method initAbsListView.

@Override
protected void initAbsListView(View v) {
    View listView = v.findViewById(android.R.id.list);
    if (listView instanceof ListView)
        mList = (ListView) listView;
    else
        throw new IllegalArgumentException("SuperListView works with a List!");
    if (mList != null) {
        mList.setClipToPadding(mClipToPadding);
        //getList().setDivider(mDivider);
        getList().setDividerHeight((int) mDividerHeight);
        mList.setOnScrollListener(this);
        if (mSelector != 0)
            mList.setSelector(mSelector);
        if (mPadding != -1.0f) {
            mList.setPadding(mPadding, mPadding, mPadding, mPadding);
        } else {
            mList.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
        }
        if (mScrollbarStyle != -1)
            mList.setScrollBarStyle(mScrollbarStyle);
    }
}
Also used : ListView(android.widget.ListView) View(android.view.View) ListView(android.widget.ListView)

Example 14 with ListView

use of android.widget.ListView in project MaterialList by dexafree.

the class ListCardProvider method render.

@Override
public void render(@NonNull final View view, @NonNull final Card card) {
    super.render(view, card);
    if (getAdapter() != null) {
        final ListView listView = (ListView) view.findViewById(R.id.listView);
        listView.setScrollbarFadingEnabled(true);
        listView.setOnTouchListener(new View.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                // That the gesture detection is correct
                return false;
            }
        });
        listView.setAdapter(getAdapter());
        listView.getAdapter().registerDataSetObserver(new DataSetObserver() {

            @Override
            public void onChanged() {
                super.onChanged();
                calculateListHeight(listView);
            }
        });
        listView.setOnItemClickListener(getOnItemClickListener());
        calculateListHeight(listView);
    }
}
Also used : ListView(android.widget.ListView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) DataSetObserver(android.database.DataSetObserver) MotionEvent(android.view.MotionEvent)

Example 15 with ListView

use of android.widget.ListView in project V2HOT by djyde.

the class ContentActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(false);
    }
    setContentView(R.layout.activity_content);
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
    ImageLoader.getInstance().init(config);
    Intent intent = getIntent();
    String id = intent.getStringExtra("id");
    String content = intent.getStringExtra("content");
    String username = intent.getStringExtra("username");
    title = intent.getStringExtra("title");
    url = intent.getStringExtra("url");
    final RepliesAdapter repliesAdapter = new RepliesAdapter(this, username);
    ListView repliesView = (ListView) findViewById(R.id.replies);
    View headerView = getLayoutInflater().inflate(R.layout.topic_header, repliesView, false);
    ((TextView) headerView.findViewById(R.id.header_title)).setText(title);
    ((TextView) headerView.findViewById(R.id.header_content)).setText(content);
    ((TextView) headerView.findViewById(R.id.header_username)).setText(username);
    repliesView.addHeaderView(headerView);
    repliesView.setAdapter(repliesAdapter);
    RequestQueue queue = Volley.newRequestQueue(ContentActivity.this);
    //获取回复
    queue.add(new GsonRequest<ReplyList>(Request.Method.GET, "https://www.v2ex.com/api/replies/show.json?topic_id=" + id, ReplyList.class, new Response.Listener<ReplyList>() {

        @Override
        public void onResponse(ReplyList response) {
            repliesAdapter.addAll(response);
            repliesAdapter.notifyDataSetChanged();
        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
            Toast.makeText(ContentActivity.this, "请检查网络", Toast.LENGTH_LONG).show();
        }
    }));
}
Also used : VolleyError(com.android.volley.VolleyError) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView) ListView(android.widget.ListView) RequestQueue(com.android.volley.RequestQueue) TextView(android.widget.TextView) ReplyList(com.v2ex.api.ReplyList) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) ActionBar(android.support.v7.app.ActionBar)

Aggregations

ListView (android.widget.ListView)1104 View (android.view.View)714 AdapterView (android.widget.AdapterView)425 TextView (android.widget.TextView)371 ImageView (android.widget.ImageView)163 Intent (android.content.Intent)144 AbsListView (android.widget.AbsListView)134 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)93 ArrayAdapter (android.widget.ArrayAdapter)93 ArrayList (java.util.ArrayList)80 ViewGroup (android.view.ViewGroup)70 ListAdapter (android.widget.ListAdapter)70 OnClickListener (android.view.View.OnClickListener)65 LayoutInflater (android.view.LayoutInflater)59 Bundle (android.os.Bundle)57 Button (android.widget.Button)55 LinearLayout (android.widget.LinearLayout)47 SuppressLint (android.annotation.SuppressLint)34 DialogInterface (android.content.DialogInterface)32 ScrollView (android.widget.ScrollView)31