Skip to content

Commit 554fed5

Browse files
committed
Merge branch 'v410' into merge410
2 parents f5d7d14 + 20fd117 commit 554fed5

28 files changed

+744
-157
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Android Studio 2.2.3,用gradle引用的许多第三方库,第一次加载会
2323
2424
##一些觉得有必要提一下的
2525
因为不想写一堆绑定函数,所以项目用了 [androidannotations](https://github.com/excilys/androidannotations),如果以前没用过最好先看看。
26-
显示图片用的[universal-image-loader](https://github.com/nostra13/Android-Universal-Image-Loader),网络库用的[android-async-http](https://github.com/loopj/android-async-http),因为登录以后保存的cookie都在[android-async-http](https://github.com/loopj/android-async-http),有些图片需要登录后的cookie才能取到(例如项目文档里面的图片),这种情况就会用先用[android-async-http](https://github.com/loopj/android-async-http)下载图片(AttachmentimagePagerFragment.java)。
26+
显示图片用的[universal-image-loader](https://github.com/nostra13/Android-Universal-Image-Loader),网络库用的[android-async-http](https://github.com/loopj/android-async-http),因为登录以后保存的cookie都在[android-async-http](https://github.com/loopj/android-async-http),有些图片需要登录后的cookie才能取到(例如项目文件里面的图片),这种情况就会用先用[android-async-http](https://github.com/loopj/android-async-http)下载图片(AttachmentimagePagerFragment.java)。
2727

2828
- Application用的是MyApp.java,用静态变量保存了用户信息,屏幕长宽等信息(理论上来说不是好的做法,但是这些基本都是只读的数据,而且并不大,所以就这么做了)。
2929

app/src/main/java/net/coding/program/common/adapter/SearchMergeAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
5757
CircleImageView personImg = ViewHolder.get(convertView, R.id.personImg);
5858
TextView txtMergeName = ViewHolder.get(convertView, R.id.txtMergeName);
5959
TextView txtMergeBranch = ViewHolder.get(convertView, R.id.txtMergeBranch);
60-
TextView txtContent = ViewHolder.get(convertView, R.id.txtContent);
60+
// TextView txtContent = ViewHolder.get(convertView, R.id.txtContent);
6161
TextView txtBottomName = ViewHolder.get(convertView, R.id.txtBottomName);
6262
TextView bottomTime = ViewHolder.get(convertView, R.id.bottomTime);
6363
TextView bottomStatus = ViewHolder.get(convertView, R.id.bottomStatus);
@@ -69,7 +69,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
6969
txtMergeName.setText(bean.getSrcBranch());
7070

7171
txtMergeBranch.setText(bean.getDesBranch());
72-
HoloUtils.setHoloText(txtContent, key, bean.getBody());
72+
// HoloUtils.setHoloText(txtContent, key, bean.getBody());
7373
txtBottomName.setText(bean.getTitleIId() + " " + bean.getAuthor().name);
7474
SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm");
7575
bottomTime.setText(format.format(bean.getCreated_at()));

app/src/main/java/net/coding/program/common/adapter/SearchReslutAdapter.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public View getView(int position, View convertView, ViewGroup parent) {
5656
holder = new ViewHolder();
5757
holder.nameTask = (TextView) convertView.findViewById(R.id.nameTask);
5858
holder.iconTask = (ImageView) convertView.findViewById(R.id.iconTask);
59-
holder.descTask = (TextView) convertView.findViewById(R.id.descTask);
6059
holder.bottomName = (TextView) convertView.findViewById(R.id.bottomName);
6160
holder.bottomTime = (TextView) convertView.findViewById(R.id.bottomTime);
6261
holder.bottomHeartCount = (TextView) convertView.findViewById(R.id.bottomHeartCount);
@@ -67,21 +66,18 @@ public View getView(int position, View convertView, ViewGroup parent) {
6766
holder = (ViewHolder) convertView.getTag();
6867
}
6968
TaskObject.SingleTask bean = mData.get(position);
70-
HoloUtils.setHoloText(holder.nameTask, key, bean.creator.name);
71-
HoloUtils.setHoloText(holder.descTask, key, bean.description);
72-
holder.bottomName.setText(bean.owner.name);
69+
HoloUtils.setHoloText(holder.nameTask, key, bean.content);
70+
holder.bottomName.setText(bean.creator.name);
7371
SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm");
7472
holder.bottomTime.setText(format.format(bean.created_at));
7573
holder.bottomCommentCount.setText(bean.comments + "");
7674
holder.bottomHeartCount.setText("");
77-
ImageLoader.getInstance().displayImage(bean.creator.avatar, holder.iconTask, ImageLoadTool.optionsImage);
75+
ImageLoader.getInstance().displayImage(bean.owner.avatar, holder.iconTask, ImageLoadTool.optionsImage);
7876
return convertView;
7977
}
8078

81-
8279
static class ViewHolder {
8380
TextView nameTask;
84-
TextView descTask;
8581
TextView bottomName;
8682
TextView bottomTime;
8783
TextView bottomCommentCount;

app/src/main/java/net/coding/program/common/adapter/SearchTopicAdapter.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.coding.program.common.adapter;
22

33
import android.content.Context;
4-
import android.text.Html;
54
import android.view.View;
65
import android.view.ViewGroup;
76
import android.widget.BaseAdapter;
@@ -33,7 +32,6 @@ public SearchTopicAdapter(List<TopicObject> mData, Context context, String key)
3332
this.mData = mData;
3433
this.context = context;
3534
this.key = key;
36-
3735
}
3836

3937
@Override
@@ -59,7 +57,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
5957
holder = new ViewHolder();
6058
holder.nameTask = (TextView) convertView.findViewById(R.id.nameTask);
6159
holder.iconTask = (ImageView) convertView.findViewById(R.id.iconTask);
62-
holder.descTask = (TextView) convertView.findViewById(R.id.descTask);
60+
// holder.descTask = (TextView) convertView.findViewById(R.id.descTask);
6361
holder.bottomName = (TextView) convertView.findViewById(R.id.bottomName);
6462
holder.bottomTime = (TextView) convertView.findViewById(R.id.bottomTime);
6563
holder.bottomHeartCount = (TextView) convertView.findViewById(R.id.bottomHeartCount);
@@ -71,7 +69,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
7169
}
7270
TopicObject bean = mData.get(position);
7371
HoloUtils.setHoloText(holder.nameTask, key, bean.title);
74-
HoloUtils.setHoloText(holder.descTask, key, Html.fromHtml(bean.content).toString());
72+
// HoloUtils.setHoloText(holder.descTask, key, Html.fromHtml(bean.content).toString());
7573
holder.bottomName.setText(bean.owner.name);
7674
SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm");
7775
holder.bottomTime.setText(format.format(bean.created_at));
@@ -127,7 +125,7 @@ public boolean isPublicProject() {
127125

128126
static class ViewHolder {
129127
TextView nameTask;
130-
TextView descTask;
128+
// TextView descTask;
131129
TextView bottomName;
132130
TextView bottomTime;
133131
TextView bottomCommentCount;

app/src/main/java/net/coding/program/maopao/MaopaoAddActivity.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,16 +405,23 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
405405
@Override
406406
public void onBackPressed() {
407407
if (message.getText().toString().isEmpty() && adapter.getCount() <= 1) {
408-
finish();
408+
finishAndHideKeyboard();
409409
} else {
410-
showDialog("冒泡", "保存为草稿?", (dialog, which) -> finish(),
410+
showDialog("冒泡", "保存为草稿?", (dialog, which) -> finishAndHideKeyboard(),
411411
(dialog, which) -> finishWithoutSave(),
412412
"保存",
413413
"不保存"
414414
);
415415
}
416416
}
417417

418+
private void finishAndHideKeyboard() {
419+
mEnterLayout.content.postDelayed(() -> {
420+
Global.popSoftkeyboard(MaopaoAddActivity.this, mEnterLayout.content, false);
421+
finish();
422+
}, 50);
423+
}
424+
418425
@OptionsItem
419426
void action_add() {
420427
showProgressBar(true, "正在发表冒泡...");
@@ -475,7 +482,7 @@ private void finishWithoutSave() {
475482
// 清空输入的数据,因为在onDestroy时如果检测到有数据会保存
476483
mEnterLayout.clearContent();
477484
mData.clear();
478-
finish();
485+
finishAndHideKeyboard();
479486
}
480487

481488
@Override

app/src/main/java/net/coding/program/model/AttachmentFileObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
/**
1414
* Created by yangzhen on 2014/10/25.
15-
* 项目文档中的文件
15+
* 项目文件中的文件
1616
*/
1717
public class AttachmentFileObject implements Serializable {
1818

app/src/main/java/net/coding/program/model/MergeObject.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import net.coding.program.common.Global;
88

9+
import org.json.JSONArray;
910
import org.json.JSONException;
1011
import org.json.JSONObject;
1112

@@ -85,6 +86,10 @@ public boolean isMergeTreate() {
8586
merge_status.equals(STYLE_REFUSE);
8687
}
8788

89+
public boolean isMergeCannel() {
90+
return merge_status.equals(STYLE_CANNEL);
91+
}
92+
8893
public void setCreated_at(long created_at) {
8994
this.created_at = created_at;
9095
}
@@ -133,7 +138,12 @@ public MergeObject(JSONObject json) throws JSONException {
133138
title = json.optString("title");
134139
iid = json.optInt("iid");
135140
author_id = json.optInt("author_id");
136-
body = json.optJSONArray("body").getString(0);
141+
JSONArray body = json.optJSONArray("body");
142+
if (body != null && body.length() > 0) {
143+
this.body = body.getString(0);
144+
} else {
145+
this.body = "";
146+
}
137147
merge_status = json.optString("merge_status");
138148
path = ProjectObject.translatePath(json.optString("path", ""));
139149
created_at = json.optLong("created_at");

app/src/main/java/net/coding/program/model/TaskObject.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,16 @@ public static class SingleTask implements Serializable {
192192
public String description = "";
193193

194194
public SingleTask(JSONObject json) throws JSONException {
195+
this(json, false);
196+
}
197+
198+
public SingleTask(JSONObject json, boolean useRaw) throws JSONException {
195199
comments = json.optInt("comments");
196-
content = Html.fromHtml(json.optString("content")).toString();
200+
this.content = json.optString("content", "");
201+
if (!useRaw) {
202+
this.content = Html.fromHtml(content).toString();
203+
}
204+
197205
created_at = json.optLong("created_at");
198206

199207
if (json.has("creator")) {

app/src/main/java/net/coding/program/project/detail/AttachmentsActivity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
import static net.coding.program.common.Global.HOST_API;
6666

6767
/**
68-
* 展示某一项目文档目录下面文件的Activity
68+
* 展示某一项目文件目录下面文件的Activity
6969
* 原本没有二级目录,这个Activity是只用来处理AttachmentFileObject的
7070
* 之后加了二级目录,那么有些实现方式就不太合适了
7171
* Created by yangzhen
@@ -299,8 +299,8 @@ public void onClick(View v) {
299299
/**
300300
* 弹出框
301301
*/
302-
private DialogUtil.BottomPopupWindow mAttachmentPopupWindow = null;//文档目录的底部弹出框
303-
private DialogUtil.BottomPopupWindow mAttachmentFilePopupWindow = null;//文档文件的底部弹出框
302+
private DialogUtil.BottomPopupWindow mAttachmentPopupWindow = null;//文件目录的底部弹出框
303+
private DialogUtil.BottomPopupWindow mAttachmentFilePopupWindow = null;//文件文件的底部弹出框
304304
private int selectedPosition;
305305
protected View.OnClickListener onMoreClickListener = new View.OnClickListener() {
306306
@Override
@@ -618,9 +618,9 @@ private void jumpToDetail(AttachmentFileObject data) {
618618

619619

620620
/**
621-
* 获取当前文档列表中的所有图片文档,提供给AttachmentsPicDetailActivity
621+
* 获取当前文件列表中的所有图片文件,提供给AttachmentsPicDetailActivity
622622
*
623-
* @return 当前文档列表中的所有图片文档
623+
* @return 当前文件列表中的所有图片文件
624624
*/
625625
private ArrayList<AttachmentFileObject> getPicFiles() {
626626
ArrayList<AttachmentFileObject> picFiles = new ArrayList<>();

app/src/main/java/net/coding/program/project/detail/AttachmentsDetailBaseActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import cz.msebera.android.httpclient.Header;
4141

4242
/**
43-
* 展示某一项目文档目录下面文件的BsseActivity
43+
* 展示某一项目文件目录下面文件的BsseActivity
4444
* Created by yangzhen
4545
*/
4646
@EActivity

0 commit comments

Comments
 (0)