仿饿了么+点餐动画效果

移动开发
高仿饿了么安卓客户端,有相关方面需求的同学可以参考参考,不喜勿喷。。。

源码简介

高仿饿了么安卓客户端,有相关方面需求的同学可以参考参考,不喜勿喷。。。
源码截图

源码片段:

  1. package com.example.ele_me.activity; 
  2.   
  3. import android.annotation.TargetApi; 
  4. import android.app.Activity; 
  5. import android.content.Intent; 
  6. import android.os.Build; 
  7. import android.os.Bundle; 
  8. import android.support.v4.widget.SlidingPaneLayout; 
  9. import android.view.View; 
  10. import android.view.Window; 
  11. import android.view.View.OnClickListener; 
  12. import android.widget.AdapterView; 
  13. import android.widget.ImageView; 
  14. import android.widget.LinearLayout; 
  15. import android.widget.TextView; 
  16. import android.widget.Toast; 
  17.   
  18. import com.example.ele_me.R; 
  19. import com.example.ele_me.adapter.RestaurantDetailAdapter; 
  20. import com.example.ele_me.util.InjectView; 
  21. import com.example.ele_me.util.Injector; 
  22. import com.example.ele_me.widget.stickylistheaders.StickyListHeadersListView; 
  23.   
  24.   
  25. public class RestaurantDetailActivity extends Activity implements 
  26.         AdapterView.OnItemClickListener, 
  27.         StickyListHeadersListView.OnHeaderClickListener, 
  28.         StickyListHeadersListView.OnStickyHeaderOffsetChangedListener, 
  29.         StickyListHeadersListView.OnStickyHeaderChangedListener { 
  30.   
  31.     private RestaurantDetailAdapter mAdapter; 
  32.     private boolean fadeHeader = true
  33.     @InjectView(R.id.linear_above_toHome) 
  34.     private LinearLayout above_toHome; 
  35.     @InjectView(R.id.tv_common_above_head) 
  36.     private TextView above_tittle; 
  37.     @InjectView(R.id.iv_head_left) 
  38.     private ImageView head_left; 
  39.     @InjectView(R.id.tv_common_above_head) 
  40.     private TextView head_tittle; 
  41.     @InjectView(R.id.food_list_shipping_fee) 
  42.     private TextView order_cart; 
  43.       
  44.     private String restaurant_name; 
  45.       
  46.   
  47.       
  48.       
  49.   
  50.     private StickyListHeadersListView stickyList; 
  51.   
  52.     @Override 
  53.     public void onCreate(Bundle savedInstanceState) { 
  54.         super.onCreate(savedInstanceState); 
  55.         requestWindowFeature(Window.FEATURE_NO_TITLE); 
  56.         setContentView(R.layout.restaurant_detail_main); 
  57.         Injector.get(this).inject();//init views 
  58.         Intent intent = getIntent(); 
  59.         restaurant_name = intent.getStringExtra("name"); 
  60.         initView(); 
  61.         setListener(); 
  62.           
  63.     } 
  64.   
  65.     private void initView() { 
  66.         above_tittle.setText(restaurant_name); 
  67.         head_left.setImageResource(R.drawable.abc_ic_ab_back_holo_dark); 
  68.           
  69.     } 
  70.       
  71.     private void setListener() { 
  72.         // TODO Auto-generated method stub 
  73.         above_toHome.setOnClickListener(new OnClickListener() { 
  74.             public void onClick(View v) { 
  75.                 finish(); 
  76.                   
  77.             } 
  78.         }); 
  79.           
  80.         mAdapter = new RestaurantDetailAdapter(this,order_cart); 
  81.   
  82.         stickyList = (StickyListHeadersListView) findViewById(R.id.list_restaurant_detail); 
  83.         stickyList.setOnItemClickListener(this); 
  84.         stickyList.setOnHeaderClickListener(this); 
  85.         stickyList.setOnStickyHeaderChangedListener(this); 
  86.         stickyList.setOnStickyHeaderOffsetChangedListener(this); 
  87.         stickyList.addHeaderView(getLayoutInflater().inflate( 
  88.                 R.layout.restaurant_list_header, null)); 
  89. //      stickyList.addFooterView(getLayoutInflater().inflate( 
  90. //              R.layout.restaurant_list_footer, null)); 
  91.         stickyList.setDrawingListUnderStickyHeader(true); 
  92.         stickyList.setAreHeadersSticky(true); 
  93.         stickyList.setAdapter(mAdapter); 
  94.   
  95. //      stickyList.setStickyHeaderTopOffset(-20); 
  96.           
  97.     } 
  98.   
  99.     public void onItemClick(AdapterView<!--?--> parent, View view, int position, 
  100.             long id) { 
  101.         Toast.makeText(this"Item " + position + " clicked!"
  102.                 Toast.LENGTH_SHORT).show(); 
  103.     } 
  104.   
  105.     @Override 
  106.     public void onHeaderClick(StickyListHeadersListView l, View header, 
  107.             int itemPosition, long headerId, boolean currentlySticky) { 
  108.         Toast.makeText(this
  109.                 "Header " + headerId + " currentlySticky ? " + currentlySticky, 
  110.                 Toast.LENGTH_SHORT).show(); 
  111.     } 
  112.   
  113.     @Override 
  114.     @TargetApi(Build.VERSION_CODES.HONEYCOMB) 
  115.     public void onStickyHeaderOffsetChanged(StickyListHeadersListView l, 
  116.             View header, int offset) { 
  117.         if (fadeHeader 
  118.                 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { 
  119.             header.setAlpha(1 - (offset / (float) header.getMeasuredHeight())); 
  120.         } 
  121.     } 
  122.   
  123.     @Override 
  124.     @TargetApi(Build.VERSION_CODES.HONEYCOMB) 
  125.     public void onStickyHeaderChanged(StickyListHeadersListView l, View header, 
  126.             int itemPosition, long headerId) { 
  127.         header.setAlpha(1); 
  128.     } 
  129.   

源码链接http://down.51cto.com/data/2013977

 

 

责任编辑:chenqingxiang 来源: 网络整理
相关推荐

2017-07-21 14:48:47

AI物流O2O

2016-08-26 22:36:18

大数据

2017-12-05 15:03:45

人工智能饿了么大数据

2018-01-03 09:57:19

异地双活数据库

2015-07-21 15:22:20

点赞仿知乎按钮动画

2015-08-03 10:08:36

公司变卖

2015-08-03 09:08:41

公司卖掉发工资

2024-07-15 09:08:51

2024-11-27 08:53:06

2017-10-27 15:44:24

饿了么张龙前端基础设施

2018-11-29 09:36:56

大数据调度系统

2020-07-06 08:40:36

阿里饿了么思考

2016-04-01 18:25:21

中国科技网

2019-01-04 16:11:50

2018-08-17 09:14:43

饿了么容器演进

2017-06-12 09:13:02

饿了么技术运营运维

2018-04-11 09:36:27

演进SLA实时计算

2017-12-22 09:21:02

API架构实践

2015-08-06 17:49:18

容联咻咻验证码

2019-02-26 09:39:46

数据库高可用架构
点赞
收藏

51CTO技术栈公众号