Package Com.sunway.works.applycash;
Import java.util.ArrayList;
Import Java.util.Calendar;
Import Java.util.HashMap;
Import java.util.List;
Import Java.util.Map;
Import COM.SUNWAY.WORKS.R;
Import com.sunway.works.applycash.ApplyCashListActivity;
Import com.sunway.works.cost.apply.EditExpenseActivity;
Import com.sunway.works.cost.apply.ExpenseAuditActivity;
Import com.sunway.works.entitys.ApplyCashEntity;
Import com.sunway.works.entitys.IousEntity;
Import Com.sunway.works.network.HttpService;
Import Com.sunway.works.network.HttpServiceImpl;
Import Android.os.Bundle;
Import Android.os.Handler;
Import Android.os.Message;
Import Android.annotation.SuppressLint;
Import android.app.Activity;
Import Android.app.DatePickerDialog;
Import Android.app.Dialog;
Import Android.app.Service;
Import Android.app.ActionBar.LayoutParams;
Import Android.content.Context;
Import android.content.Intent;
Import Android.util.Log;
Import android.view.Gravity;
Import Android.view.LayoutInflater;
Import Android.view.Menu;
Import Android.view.View;
Import Android.view.ViewGroup;
Import Android.view.Window;
Import Android.view.View.OnClickListener;
Import Android.view.inputmethod.InputMethodManager;
Import Android.view.WindowManager;
Import Android.widget.AbsListView;
Import Android.widget.AbsListView.OnScrollListener;
Import Android.widget.AdapterView.OnItemClickListener;
Import Android.widget.AdapterView;
Import Android.widget.BaseAdapter;
Import Android.widget.Button;
Import Android.widget.DatePicker;
Import Android.widget.EditText;
Import Android.widget.LinearLayout;
Import Android.widget.ListView;
Import Android.widget.PopupWindow;
Import Android.widget.ProgressBar;
Import Android.widget.SimpleAdapter;
Import Android.widget.Spinner;
Import Android.widget.TextView;
Import Android.widget.Toast;
public class Editonecashactivity extends Activity implements
Onscrolllistener {
Private ListView ListView;
Private context context;
Private View Top_title;
Private TextView Tvtitle;
Private Popupwindow Popupwindow;
Private view view;
Private View bar1;
Private View bar2;
Private Spinner Sp_depart;
Private EditText Ed_iounnub;
Private EditText Ed_purpose;
Private EditText Ed_date_from;
Private EditText Ed_date_over;
Private Button Btn_date_from;
Private Button Btn_date_over;
Private EditText ed_iousum;
Private Spinner sp_checkstate;
Private EditText Ed_borrower;
Private Button btn_query;
Private Handler Handler;
private static final int date_dialog_id = 1;
private static final int show_datapick = 0;
private int myear;
private int mmonth;
private int mday;
Private Deletecashlistadapter adapter;
Private list<applycashentity> Listdata = new arraylist<applycashentity> ();
Private Inputmethodmanager IMM;
Private Button Btn_left;
Private Button btn_right;
Private list<applycashentity> Loaddatas; Loading data
private Choosecheckmanadapter adapters; Adapter
Private linearlayout loadinglayout;//Bottom load layout
Private Map<integer, boolean> ischeckedmap = new Hashmap<integer, boolean> ();
Private Boolean over;//Infer whether the data is all loaded
Private thread mthread;//Load thread
private int UNB = 1;
Set Layout Display Properties
Private Android.widget.LinearLayout.LayoutParams mlayoutparams = new Linearlayout.layoutparams (
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
Set layout display target maximization properties
Private Android.widget.LinearLayout.LayoutParams fflayoutparams = new Linearlayout.layoutparams (
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.FILL_PARENT);
Private ProgressBar ProgressBar;
Private Popupwindow window;
Private Intent Intent;
Private ListView List2;
Handler Mhandler = new Handler () {
public void Handlemessage (Android.os.Message msg) {
Switch (msg.what) {
Case 1://Infer If the data is all loaded
if (!over) {
Adapter.notifydatasetchanged ();
} else {
Listview.removefooterview (loadinglayout);
Toast.maketext (Context, "Data onboarding complete", Toast.length_short)
. Show ();
}
Break
Case 2:
Adapter.notifydatasetchanged ();
Break
}
};
};
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
This.requestwindowfeature (Window.feature_no_title);
Setcontentview (r.layout.activity_data_list);
context = Getapplicationcontext ();
Handler = new Handler ();
Initialize Bottom load View
LinearLayout layout = new LinearLayout (context);
Layout.setorientation (linearlayout.horizontal);
ProgressBar = new ProgressBar (context);
Progressbar.setpadding (0, 0, 15, 0);
Layout.addview (ProgressBar, mlayoutparams);
TextView TextView = new TextView (context);
Textview.settext ("Gta5-in ...");
Textview.setgravity (gravity.center_vertical);
Layout.addview (TextView, fflayoutparams);
Loadinglayout = new LinearLayout (context);
Loadinglayout.addview (layout, mlayoutparams);
Loadinglayout.setgravity (Gravity.center);
Initializing the ListView and setting events
Initview ();
Getlistener ();
}
private void Getlistener () {
Btn_left.setonclicklistener (New Onclicklistener () {
@Override
public void OnClick (View v) {
TODO auto-generated Method Stub
Finish ();
}
});
}
private void Initview () {
TODO auto-generated Method Stub
Top_title = This.findviewbyid (R.id.top_title);
Tvtitle = (TextView) Top_title.findviewbyid (r.id.tvtitle);
Btn_left = (Button) Top_title.findviewbyid (r.id.btn_title_left);
Btn_right = (Button) Top_title.findviewbyid (r.id.btn_title_right);
ListView = (ListView) Findviewbyid (R.id.data_enterlist);
Listview.addfooterview (loadinglayout);
The Listview.addfooterview () method must be used before its setadapter () method. or an error.
adapter = new Deletecashlistadapter (Editonecashactivity.this,
Listdata, True);
Listview.setadapter (adapter);
Listview.setonscrolllistener (Editonecashactivity.this);
over = false;
}
@Override
public void Onscroll (Abslistview view, int firstvisibleitem,
int visibleitemcount, int totalitemcount) {
if (firstvisibleitem + visibleitemcount = = Totalitemcount) {
if (Mthread = = NULL | |!mthread.isalive ()) {
Mthread = new Thread () {
public void Run () {
Read data from the Web This is my own data to read from the server, individuals need to write their own Internet access to read data
Httpservice service = new Httpserviceimpl ();
String i = (Ten * (unb-1) + 1) + ""; I is the subscript, deciding which data to start reading, 10 represents the number of each read data
Loaddatas = Service.getapplycashlist (param1, i);
Assuming that the loading data is not empty, the loaded data is added to the existing Mdata data. Otherwise the data is loaded in a completely
if (Loaddatas! = null && loaddatas.size () > 0) {
Listdata.addall (Loaddatas);
Loaddatas.clear ();
} else {
UNB = unb-1;
over = true;
}
unb++;
Mhandler.sendemptymessage (1);//Update UI
};
};
Mthread.start ();
}
}
}
@Override
public void onscrollstatechanged (Abslistview view, int scrollstate) {
TODO auto-generated Method Stub
}
}
Android ListView slide load data that data is fetched by the server