添加了肖志敏的功能

my
Administrator 5 years ago
parent bfe8acad30
commit 282a28978a

@ -11,13 +11,13 @@ import android.widget.ListView;
import java.util.ArrayList;
import hunnu.sj.raise_money.donate_record.Record;
import hunnu.sj.raise_money.donate_record.RecordAdapter;
import hunnu.sj.raise_money.record.Record;
import hunnu.sj.raise_money.donate_record.DonateRecordAdapter;
public class BrowseRecordActivity extends AppCompatActivity {
private ArrayList<Record> records = new ArrayList<>();
private ListView lv_record;
private RecordAdapter recordAdapter;
private DonateRecordAdapter recordAdapter;
private String username;
private Handler mhandler = new Handler(){
@Override
@ -34,7 +34,7 @@ public class BrowseRecordActivity extends AppCompatActivity {
setContentView(R.layout.activity_browse_record);
Intent intent = getIntent();
username = intent.getStringExtra("username");
recordAdapter = new RecordAdapter(this,records);
recordAdapter = new DonateRecordAdapter(this,records);
lv_record = findViewById(R.id.lv_browse_denate_record);
lv_record.setAdapter(recordAdapter);
new BrowseRecordThread().start();

@ -10,7 +10,7 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import hunnu.sj.raise_money.donate_record.Record;
import hunnu.sj.raise_money.record.Record;
import hunnu.sj.raise_money.news.News;
import hunnu.sj.raise_money.R;
import hunnu.sj.raise_money.User;

@ -5,7 +5,7 @@ import android.content.Context;
import java.util.ArrayList;
import hunnu.sj.raise_money.DataBase.UserService;
import hunnu.sj.raise_money.donate_record.Record;
import hunnu.sj.raise_money.record.Record;
import hunnu.sj.raise_money.news.News;
public class InfoUtils {

@ -110,10 +110,10 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
//new UploadThread().start();
lv_news = findViewById(R.id.list);
lv_news.setAdapter(newsAdapter);
//lv_news.setOnItemClickListener(this);
lv_news.setOnItemClickListener(this);
News news = new News();
news.setTitle("火箭发射成功");
news.setDes("地方上的房贷首付读书首付第三方的手房贷首付第三方的手负担");
//news.setTitle("火箭发射成功");
// news.setDes("地方上的房贷首付读书首付第三方的手房贷首付第三方的手负担");
news.setHead_icon(ContextCompat.getDrawable(this, R.drawable.ic_launcher_background));
list.add(news);
new UploadThread().start();
@ -134,10 +134,11 @@ public class MainActivity extends AppCompatActivity implements AdapterView.OnIte
@Override//点击条目时调用该方法parent指listviewposition指条目位置
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
News news = (News)parent.getItemAtPosition(position);
String url = "www.baidu.com";
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
String title=news.getTitle();
String des=news.getDes();
Intent intent = new Intent(this,NewsContentActivity.class);
intent.putExtra("news_title",title);
intent.putExtra("news_des",des);
startActivity(intent);
}

@ -9,11 +9,12 @@ import android.widget.TextView;
import java.util.ArrayList;
import hunnu.sj.raise_money.R;
import hunnu.sj.raise_money.record.Record;
public class RecordAdapter extends BaseAdapter {
public class DonateRecordAdapter extends BaseAdapter {
private ArrayList<Record> recordlist;
private Context context;
public RecordAdapter(Context context,ArrayList<Record> recordlist) {
public DonateRecordAdapter(Context context, ArrayList<Record> recordlist) {
this.context = context;
this.recordlist = recordlist;

@ -0,0 +1,52 @@
package hunnu.sj.raise_money.donated_record;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import hunnu.sj.raise_money.R;
import hunnu.sj.raise_money.record.Record;
public class DonatedRecordAdapter extends BaseAdapter {
private ArrayList<Record> recordlist;
private Context context;
public DonatedRecordAdapter(Context context, ArrayList<Record> recordlist) {
this.context = context;
this.recordlist = recordlist;
}
@Override
public int getCount() {
return recordlist.size();
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public Object getItem(int position) {
return recordlist.get(position);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
if(convertView != null){
view = convertView;
}else{
view = View.inflate(context, R.layout.donate_record_item,null);
}
Record record = recordlist.get(position);
TextView record_vw = view.findViewById(R.id.record_descri);
String descri = "用户"+record.getUsername()+"于"+record.getTime()+"捐赠了"+record.getDonatemon()+"元";
record_vw.setText(descri);
return view;
}
}

@ -1,4 +1,4 @@
package hunnu.sj.raise_money.donate_record;
package hunnu.sj.raise_money.record;
public class Record {
private long id = 0;

@ -1,26 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/visibility_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="invisible" >
android:visibility="invisible">
<TextView
android:id="@+id/news_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="61dp"
android:gravity="center"
android:padding="10dp"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="161dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/ph1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
tools:srcCompat="@tools:sample/avatars" />
<ImageView
android:id="@+id/ph2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
tools:srcCompat="@tools:sample/avatars" />
<ImageView
android:id="@+id/ph3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
tools:srcCompat="@tools:sample/avatars" />
</LinearLayout>
<TextView
android:id="@+id/news_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="457dp"
android:layout_weight="1"
android:padding="15dp"
android:scrollbars="vertical"
android:textSize="18sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="75dp"
android:text="捐助信息" />
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="75dp"
android:text="捐助" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>

@ -3,9 +3,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/news_title_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
android:layout_height="match_parent"></ListView>
</LinearLayout>
Loading…
Cancel
Save