今日是团队冲刺最后一天,各成员完成内容如下:
朴远东:“我的笔记”初稿完成,实现ListView遍历显示翼级点击后查看详细信息(无美化)
博客地址:https://www.cnblogs.com/20183711PYD/p/13030153.html
王兵兵:完善一下查看笔记的界面,代码如下:
1 package com.itheima.network.activity; 2 3 import android.content.Intent; 4 import android.graphics.Bitmap; 5 import android.os.Bundle; 6 import android.text.TextUtils; 7 import android.widget.ImageView; 8 import android.widget.TextView; 9 import android.widget.Toast; 10 11 import androidx.appcompat.app.AppCompatActivity; 12 13 import com.alibaba.fastjson.JSON; 14 import com.alibaba.fastjson.JSONObject; 15 import com.itheima.network.R; 16 import com.itheima.network.func_reference.BitmapUtils; 17 import com.zhy.http.okhttp.OkHttpUtils; 18 import com.zhy.http.okhttp.callback.BitmapCallback; 19 import com.zhy.http.okhttp.callback.StringCallback; 20 21 import butterknife.BindView; 22 import butterknife.ButterKnife; 23 import okhttp3.Call; 24 25 public class DetailNoteActivity extends AppCompatActivity { 26 27 @BindView(R.id.icon) 28 ImageView icon; 29 @BindView(R.id.writer_name) 30 TextView writerName; 31 @BindView(R.id.note_date) 32 TextView noteDate; 33 @BindView(R.id.title) 34 TextView title; 35 @BindView(R.id.content) 36 TextView content; 37 @BindView(R.id.image1) 38 ImageView image1; 39 @BindView(R.id.image2) 40 ImageView image2; 41 @BindView(R.id.image3) 42 ImageView image3; 43 @BindView(R.id.collect) 44 ImageView collect; 45 46 private final String root_path="http://192.168.5.29:8080/userfile/"; 47 48 @Override 49 protected void onCreate(Bundle savedInstanceState) { 50 super.onCreate(savedInstanceState); 51 setContentView(R.layout.detail_note_activity); 52 ButterKnife.bind(this); 53 collect.setImageResource(R.drawable.shoucang1); 54 init( ); 55 } 56 57 public void init() { 58 Intent intent = getIntent( ); 59 int note_id = intent.getIntExtra("note_id", 0); 60 String url = "http://192.168.5.29:8080/CloudNoteServlet/NoteServlet"; 61 OkHttpUtils 62 .get( ) 63 .url(url) 64 .addParams("method", "getSpecialNote") 65 .addParams("note_id", "" + note_id) 66 .build( ) 67 .execute(new StringCallback( ) { 68 @Override 69 public void onError(Call call, Exception e, int id) { 70 Toast.makeText(DetailNoteActivity.this, "get失败", Toast.LENGTH_SHORT).show( ); 71 } 72 73 @Override 74 public void onResponse(String response, int id) { 75 JSONObject json = (JSONObject) JSON.parse(response); 76 String user_icon = json.getString("user_icon"); 77 String user_name = json.getString("username"); 78 String date = json.getString("date"); 79 String note_title = json.getString("title"); 80 String course = json.getString("course"); 81 String txt_path = json.getString("txt_path"); 82 String image1_path = json.getString("image1_path"); 83 String image2_path = json.getString("image2_path"); 84 String image3_path = json.getString("image3_path"); 85 setBitmap(icon, root_path + user_icon, true); 86 writerName.setText(user_name); 87 noteDate.setText(date); 88 title.setText(note_title + " " + course); 89 if (!TextUtils.isEmpty(txt_path)) { 90 setContent(content, root_path + txt_path); 91 } 92 if (!TextUtils.isEmpty(image1_path)) { 93 setBitmap(image1, root_path + image1_path, false); 94 } 95 if (!TextUtils.isEmpty(image2_path)) { 96 setBitmap(image2, root_path + image2_path, false); 97 } 98 if (!TextUtils.isEmpty(image3_path)) { 99 setBitmap(image3, root_path + image3_path, false); 100 } 101 } 102 103 }); 104 } 105 106 private void setBitmap(ImageView iv, String path, boolean flag) { 107 OkHttpUtils 108 .get( ) 109 .url(path) 110 .build( ) 111 .execute(new BitmapCallback( ) { 112 @Override 113 public void onError(Call call, Exception e, int id) { 114 Toast.makeText(DetailNoteActivity.this, "网络异常" + id, Toast.LENGTH_SHORT).show( ); 115 } 116 117 @Override 118 public void onResponse(Bitmap response, int id) { 119 Bitmap bitmap = response; 120 if (flag) { 121 bitmap = BitmapUtils.zoom(response, 80, 80); 122 bitmap = BitmapUtils.circleBitmap(bitmap); 123 } 124 iv.setImageBitmap(bitmap); 125 } 126 }); 127 } 128 129 private void setContent(TextView tv, String path) { 130 OkHttpUtils 131 .get( ) 132 .url(path) 133 .build( ) 134 .execute(new StringCallback( ) { 135 136 @Override 137 public void onError(Call call, Exception e, int id) { 138 Toast.makeText(DetailNoteActivity.this, "网络异常" + id, Toast.LENGTH_SHORT).show( ); 139 } 140 141 @Override 142 public void onResponse(String response, int id) { 143 tv.setText(response); 144 } 145 }); 146 } 147 148 149 }
张宏伟:修改了app之间跳转的bug,函数间关系,代码如下:
1 protected void onCreate (Bundle savedInstanceStats) 2 { 3 super.onCreate(savedInstanceStats); 4 setContentView(R.layout.layout_advice); 5 edit_advice_txt=findViewById(R.id.advice_txt); 6 btn_advice_submit=findViewById(R.id.advice_submit); 7 btn_advice_qq=findViewById(R.id.advice_qq); 8 mProSpinner=(Spinner) findViewById(R.id.spinner_advice); 9 init(); 10 btn_advice_qq.setOnClickListener(new View.OnClickListener() { 11 @Override 12 public void onClick(View v) { 13 Toast tot=Toast.makeText(SpinnerActivity.this,"1",Toast.LENGTH_SHORT); 14 buttonOnClick(); 15 } 16 }); 17 } 18 public void buttonOnClick(){ 19 a="2506236179"; 20 if (checkApkExist(this, "com.tencent.mobileqq")){ 21 startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin="+a+"&version=1"))); 22 }else{ 23 Toast.makeText(this,"本机未安装QQ应用", Toast.LENGTH_SHORT).show(); 24 } 25 } 26 public boolean checkApkExist(Context context, String packageName) { 27 if (packageName == null || "".equals(packageName)) 28 return false; 29 try { 30 ApplicationInfo info = context.getPackageManager().getApplicationInfo(packageName, 31 PackageManager.GET_UNINSTALLED_PACKAGES); 32 return true; 33 } catch (PackageManager.NameNotFoundException e) { 34 return false; 35 } 36 }