• 大小: 2.27MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-29
  • 语言: Java
  • 标签:

资源简介

Android仿墨迹天气应用源码,代码规范,供大家学习参考。

资源截图

代码片段和文件信息

package com.way.apapter;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.onscrollListener;
import android.widget.baseAdapter;
import android.widget.SectionIndexer;
import android.widget.TextView;

import com.way.bean.City;
import com.way.plistview.PinnedHeaderListView;
import com.way.plistview.PinnedHeaderListView.PinnedHeaderAdapter;
import com.way.weather.R;

public class CityAdapter extends baseAdapter implements SectionIndexer
PinnedHeaderAdapter onscrollListener {
// 首字母集
private List mCities;
private Map> mMap;
private List mSections;
private List mPositions;
private LayoutInflater inflater;

public CityAdapter(Context context List cities
Map> map List sections
List positions) {
// TODO Auto-generated constructor stub
inflater = LayoutInflater.from(context);
mCities = cities;
mMap = map;
mSections = sections;
mPositions = positions;
}

@Override
public int getCount() {
// TODO Auto-generated method stub
return mCities.size();
}

@Override
public City getItem(int position) {
// TODO Auto-generated method stub
int section = getSectionForPosition(position);
return mMap.get(mSections.get(section)).get(
position - getPositionForSection(section));
}

@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}

@Override
public View getView(int position View convertView ViewGroup parent) {
// TODO Auto-generated method stub
int section = getSectionForPosition(position);
if (convertView == null) {
convertView = inflater.inflate(R.layout.select_city_item null);
}
TextView group = (TextView) convertView.findViewById(R.id.group_title);
TextView city = (TextView) convertView.findViewById(R.id.column_title);
if (getPositionForSection(section) == position) {
group.setVisibility(View.VISIBLE);
group.setText(mSections.get(section));
} else {
group.setVisibility(View.GONE);
}
City item = mMap.get(mSections.get(section)).get(
position - getPositionForSection(section));
city.setText(item.getCity());
return convertView;
}

@Override
public void onscrollStateChanged(AbsListView view int scrollState) {
// TODO Auto-generated method stub

}

@Override
public void onscroll(AbsListView view int firstVisibleItem
int visibleItemCount int totalItemCount) {
// TODO Auto-generated method stub
if (view instanceof PinnedHeaderListView) {
((PinnedHeaderListView) view).configureHeaderView(firstVisibleItem);
}

}

@Override
public int getPinnedHeaderState(int position) {
int realPosition = position;
if (realPosition < 0 || position >= getCount()) {
return PINNED_HEADER_GONE;
}
int section = getSe

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-07-26 23:17  Weather\
     文件        4078  2013-07-26 22:33  Weather\AndroidManifest.xml
     目录           0  2013-07-26 23:17  Weather\assets\
     文件      125952  2013-06-28 15:36  Weather\assets\city.db
     目录           0  2013-07-26 23:17  Weather\libs\
     文件      393154  2013-06-25 17:48  Weather\libs\android-support-v4.jar
     目录           0  2013-07-26 23:17  Weather\libs\armeabi\
     文件       40319  2013-06-27 17:07  Weather\libs\armeabi\liblocSDK3.so
     文件      190418  2013-06-19 16:33  Weather\libs\gson-2.2.4.jar
     文件      100410  2013-06-27 17:07  Weather\libs\locSDK_3.3.jar
     文件      188920  2012-10-18 11:06  Weather\libs\pinyin4j-2.5.0.jar
     目录           0  2013-07-26 23:17  Weather\res\
     目录           0  2013-07-26 23:17  Weather\res\anim\
     文件         289  2013-06-26 17:21  Weather\res\anim\base_loading_large_anim.xml
     文件         289  2013-06-26 16:47  Weather\res\anim\base_loading_small_anim.xml
     文件         277  2013-07-04 09:40  Weather\res\anim\title_update_anim.xml
     目录           0  2013-07-26 23:17  Weather\res\drawable\
     目录           0  2013-07-26 23:17  Weather\res\drawable-hdpi\
     文件         146  2013-06-27 18:28  Weather\res\drawable-hdpi\ab_solid_custom_blue_inverse_holo.9.png
     文件          95  2013-06-21 11:40  Weather\res\drawable-hdpi\actionbar_btn_pressed.9.png
     文件        3024  2011-07-21 12:52  Weather\res\drawable-hdpi\alert.png
     文件        1318  2013-06-25 19:11  Weather\res\drawable-hdpi\base_action_bar_back_divider.jpg
     文件         409  2013-06-25 19:19  Weather\res\drawable-hdpi\base_action_bar_back_normal.png
     文件          95  2013-06-25 19:11  Weather\res\drawable-hdpi\base_action_bar_icon_background_pressed.9.png
     文件         118  2013-06-25 17:51  Weather\res\drawable-hdpi\base_list_divider_drawable.png
     文件         103  2013-06-25 18:05  Weather\res\drawable-hdpi\base_list_scrollbar_handle.9.png
     文件         122  2013-06-25 18:05  Weather\res\drawable-hdpi\base_list_selector_disabled.9.png
     文件         146  2013-06-25 18:05  Weather\res\drawable-hdpi\base_list_selector_pressed.9.png
     文件        1915  2013-06-25 18:02  Weather\res\drawable-hdpi\base_loading_large_icon.png
     文件         847  2013-06-25 18:01  Weather\res\drawable-hdpi\base_loading_small_icon.png
     文件         291  2013-06-25 17:59  Weather\res\drawable-hdpi\base_search_edittext_bg.9.png
............此处省略206个文件信息

评论

共有 条评论