use of android.widget.AdapterView in project UltimateRecyclerView by cymcsg.
the class SwipeLayout method performAdapterViewItemLongClick.
private boolean performAdapterViewItemLongClick() {
if (getOpenStatus() != Status.Close)
return false;
ViewParent t = getParent();
if (t instanceof AdapterView) {
AdapterView view = (AdapterView) t;
int p = view.getPositionForView(SwipeLayout.this);
if (p == AdapterView.INVALID_POSITION)
return false;
long vId = view.getItemIdAtPosition(p);
boolean handled = false;
try {
Method m = AbsListView.class.getDeclaredMethod("performLongPress", View.class, int.class, long.class);
m.setAccessible(true);
handled = (boolean) m.invoke(view, SwipeLayout.this, p, vId);
} catch (Exception e) {
e.printStackTrace();
if (view.getOnItemLongClickListener() != null) {
handled = view.getOnItemLongClickListener().onItemLongClick(view, SwipeLayout.this, p, vId);
}
if (handled) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
}
}
return handled;
}
return false;
}
use of android.widget.AdapterView in project UltimateRecyclerView by cymcsg.
the class SwipeLayout method performAdapterViewItemClick.
private void performAdapterViewItemClick() {
if (getOpenStatus() != Status.Close)
return;
ViewParent t = getParent();
if (t instanceof AdapterView) {
AdapterView view = (AdapterView) t;
int p = view.getPositionForView(SwipeLayout.this);
if (p != AdapterView.INVALID_POSITION) {
view.performItemClick(view.getChildAt(p - view.getFirstVisiblePosition()), p, view.getAdapter().getItemId(p));
}
}
}
use of android.widget.AdapterView 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.AdapterView 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.AdapterView in project V2HOT by djyde.
the class TitleListActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_title_list);
final SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.pull);
final ArrayAdapter<Topic> topicsAdapter = new ArrayAdapter<Topic>(this, 0) {
private final LayoutInflater inflater = LayoutInflater.from(getContext());
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.topic_item, parent, false);
}
TextView title = (TextView) convertView.findViewById(R.id.title);
title.setText(getItem(position).title);
return convertView;
}
};
final ListView topicsView = (ListView) findViewById(R.id.topics);
topicsView.setAdapter(topicsAdapter);
topicsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Topic topic = topicsAdapter.getItem(position);
Intent intent = new Intent(TitleListActivity.this, ContentActivity.class);
intent.putExtra("id", topic.id);
intent.putExtra("title", topic.title);
intent.putExtra("username", topic.member.username);
intent.putExtra("url", topic.url);
intent.putExtra("content", topic.content);
startActivity(intent);
}
});
//创建volley请求队列
final RequestQueue queue = Volley.newRequestQueue(this);
//根据API获取热议主题
final GsonRequest<TopicList> request = new GsonRequest<TopicList>(Request.Method.GET, "https://www.v2ex.com/api/topics/hot.json", TopicList.class, new Response.Listener<TopicList>() {
@Override
public void onResponse(TopicList response) {
topicsAdapter.clear();
topicsAdapter.addAll(response);
topicsAdapter.notifyDataSetChanged();
swipeRefreshLayout.setRefreshing(false);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(TitleListActivity.this, "请检查网络", Toast.LENGTH_LONG).show();
}
});
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
queue.add(request);
}
});
queue.add(request);
swipeRefreshLayout.setRefreshing(true);
}
Aggregations