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();
}
});
}
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);
}
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);
}
}
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);
}
}
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();
}
}));
}
Aggregations