我正在编写一个类文件,其中包含一个列表视图,显示每个特定人员的状态。
现在,无论我在此页面中所做的任何更改,都应反映在相应显示列表用户的第一页上。我正在使用碎片。有人可以帮助我吗?
private class ListViewSummaryAdapter extends BaseAdapter {
Context con;
SummaryModel sumModel;
LayoutInflater inflater;
CircularImageView image;
ImageLoader imageLoader;
DisplayImageOptions options;
TextView accidentType, status;
LinearLayout root;
public ListViewSummaryAdapter(Context context, SummaryModel summaryModel) {
con = context;
sumModel = summaryModel;
if (con != null) {
inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration
.createDefault(getActivity()));
}
@Override
public int getCount() {
return sumModel.getDetails().size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View v = inflater.inflate(R.layout.fragment_summarylistinner, parent, false);
image = (CircularImageView) v.findViewById(R.id.cV_summary_profileImage);
accidentType = (TextView) v.findViewById(R.id.tV_summary_accident);
status = (TextView) v.findViewById(R.id.tV_summary_status);
root = (LinearLayout) v.findViewById(R.id.lL_summary_root);
options = new DisplayImageOptions.Builder().cacheInMemory(true)
.cacheOnDisk(true)
.considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565)
.build();
if (sumModel.getDetails().size() != 0) {
// Toast.makeText(getActivity(), "" + homModel.getpost().get(position).getAttachments().get(position).getImages().getThumbnail().getUrl(), Toast.LENGTH_SHORT).show();
imageLoader.displayImage((sumModel.getDetails().get(position).getUser_details().getUser_profilePic()), image, options,
new SimpleImageLoadingListener() {
Animation rotation;
@Override
public void onLoadingStarted(String imageUri, View view) {
rotation = AnimationUtils.loadAnimation(getActivity(),
R.anim.clockwise_rotation);
rotation.setRepeatCount(Animation.INFINITE);
// image.startAnimation(rotation);
}
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
image.clearAnimation();
image.setScaleType(ImageView.ScaleType.FIT_XY);
}
}, new ImageLoadingProgressListener() {
@Override
public void onProgressUpdate(String imageUri, View view,
int current, int total) {
}
});
}
root.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putString("UserName", sumModel.getDetails().get(position).getUser_details().getUser_firstName() + " " + sumModel.getDetails().get(position).getUser_details().getUser_lastName());
bundle.putString("UserLocation", sumModel.getDetails().get(position).getUser_details().getUser_location());
bundle.putString("UserReport", sumModel.getDetails().get(position).getReport_at());
bundle.putString("UserLatitude", sumModel.getDetails().get(position).getUser_details().getUser_latitude());
bundle.putString("UserLongitude", sumModel.getDetails().get(position).getUser_details().getUser_longitude());
bundle.putString("UserStatus", sumModel.getDetails().get(position).getStatus());
addFragment(new InnerSummaryFragment(), true, FragmentTransaction.TRANSIT_NONE, "SummaryInner", bundle);
}
});
if (sumModel.getDetails().get(position).getStatus().equals("0")) {
if(SaveSharedPreference.getClosestatus(getActivity()).equals("YES"))
{
status.setText("Status : Closed");
}
else
status.setText("Status : Open");
}
else if (sumModel.getDetails().get(position).getStatus().equals("2")) {
status.setText("Status : Close");
}
return v;
}