Skip to content

Commit 9e2a46d

Browse files
committed
修正了一些bug
1 parent 89254ea commit 9e2a46d

9 files changed

Lines changed: 109 additions & 93 deletions

File tree

app/src/main/java/net/coding/program/WebActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ public void onReceivedTitle(WebView view, String title) {
108108
settings.setUseWideViewPort(true);
109109
settings.setLoadWithOverviewMode(true);
110110
webView.setWebViewClient(new CustomWebViewClient(this));
111+
String useAgent = MyAsyncHttpClient.getMapHeaders().get("User-Agent");
112+
webView.getSettings().setUserAgentString(useAgent);
111113
webView.loadUrl(url, MyAsyncHttpClient.getMapHeaders());
112114
}
113115

app/src/main/java/net/coding/program/common/enter/EnterEmojiLayout.java

Lines changed: 67 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ public class EnterEmojiLayout extends EnterLayout {
183183
"coding_emoji_43",
184184
}};
185185
protected final View rootView;
186+
protected int rootViewHigh = 0;
187+
protected ViewGroup mInputBox;//文本输入框所在的布局容器
188+
protected RippleBackground voiceLayout;
189+
protected InputType mInputType;
190+
protected boolean isSoftKeyBoard = false;
186191
PageChangeListener pageChange = new PageChangeListener();
187192
private CheckBox checkBoxEmoji;
188193
private View emojiKeyboardLayout;
@@ -193,20 +198,63 @@ public class EnterEmojiLayout extends EnterLayout {
193198
private View selectMonkey;
194199
private MyImageGetter myImageGetter;
195200
private Activity mActivity;
196-
protected int rootViewHigh = 0;
197-
protected ViewGroup mInputBox;//文本输入框所在的布局容器
198-
protected RippleBackground voiceLayout;
199201
private boolean firstLayout = true;
200202
private int contentViewHeight;
201203
private WindowManager mWindowManager;
202204
private WindowManager.LayoutParams mWindowLp;
203205
private ImageView mWindowView;
204206
private int statusBarHeight;
205-
protected InputType mInputType;
206207
private FrameLayout mPanelLayout;
208+
private View.OnClickListener checkBoxEmojiOnClicked = new View.OnClickListener() {
209+
@Override
210+
public void onClick(View v) {
211+
content.requestFocus();
212+
if (checkBoxEmoji.isChecked()) {
213+
rootViewHigh = rootView.getHeight();
207214

208-
protected boolean isSoftKeyBoard = false;
215+
final int bottomHigh = Global.dpToPx(100); // 底部虚拟按键高度,nexus5是73dp,以防万一,所以设大一点
216+
int rootParentHigh = rootView.getRootView().getHeight();
217+
//rootParentHigh - rootViewHigh > bottomHigh
218+
if (isSoftKeyBoard) {
219+
// 说明键盘已经弹出来了,等键盘消失后再设置 emoji keyboard 可见
220+
if (commonEnterRoot != null) {
221+
toggleInputTypeWithCloseSoftkeyboard(InputType.Emoji);
222+
} else {
223+
//兼容没有使用common_enter_emoji的输入控件
224+
Global.popSoftkeyboard(mActivity, content, false);
225+
mInputType = InputType.Emoji;
226+
}
209227

228+
// 魅族手机的 rootView 无论输入法是否弹出高度都是不变的,只好搞个延时做这个事
229+
rootView.postDelayed(new Runnable() {
230+
@Override
231+
public void run() {
232+
rootView.setLayoutParams(rootView.getLayoutParams());
233+
}
234+
}, 50);
235+
236+
} else {
237+
if (commonEnterRoot != null) {
238+
toggleNoTextInput(InputType.Emoji);
239+
} else {
240+
//兼容没有使用common_enter_emoji的输入控件
241+
emojiKeyboardLayout.setVisibility(View.VISIBLE);
242+
}
243+
244+
rootViewHigh = 0;
245+
}
246+
} else {
247+
if (commonEnterRoot != null) {
248+
toggleSoftkeyboardWithCloseNoTextInput(InputType.Emoji);
249+
} else {
250+
//兼容没有使用common_enter_emoji的输入控件
251+
Global.popSoftkeyboard(mActivity, content, true);
252+
emojiKeyboardLayout.setVisibility(View.GONE);
253+
}
254+
255+
}
256+
}
257+
};
210258

211259
public EnterEmojiLayout(final FragmentActivity activity, View.OnClickListener sendTextOnClick, Type type, EmojiType emojiType) {
212260
super(activity, sendTextOnClick, type);
@@ -257,16 +305,13 @@ public void onGlobalLayout() {
257305
if(mInputType!=null){
258306
switch (mInputType){
259307
case Text:
260-
voiceLayout.setVisibility(View.GONE);
261-
emojiKeyboardLayout.setVisibility(View.GONE);
308+
setInputStyle(View.GONE, View.GONE);
262309
break;
263310
case Voice:
264-
voiceLayout.setVisibility(View.VISIBLE);
265-
emojiKeyboardLayout.setVisibility(View.GONE);
311+
setInputStyle(View.GONE, View.VISIBLE);
266312
break;
267313
case Emoji:
268-
emojiKeyboardLayout.setVisibility(View.VISIBLE);
269-
voiceLayout.setVisibility(View.GONE);
314+
setInputStyle(View.VISIBLE, View.GONE);
270315
break;
271316
}
272317
}
@@ -342,9 +387,19 @@ public boolean onTouch(View v, MotionEvent event) {
342387
return false;
343388
}
344389
});
390+
}
345391

392+
public EnterEmojiLayout(FragmentActivity activity, View.OnClickListener sendTextOnClick) {
393+
this(activity, sendTextOnClick, Type.Default, EmojiType.Default);
394+
}
346395

347-
396+
private void setInputStyle(int emojiKeyboard, int voiceKeyboard) {
397+
if (emojiKeyboardLayout != null) {
398+
emojiKeyboardLayout.setVisibility(emojiKeyboard);
399+
}
400+
if (voiceLayout != null) {
401+
voiceLayout.setVisibility(voiceKeyboard);
402+
}
348403
}
349404

350405
private void dropTempWindow(){
@@ -407,8 +462,6 @@ private void moveTempWindow(int y){
407462
mWindowManager.updateViewLayout(mWindowView, mWindowLp);
408463
}
409464

410-
411-
412465
protected int getContentViewHeight(Activity activity){
413466
Rect rect = new Rect();
414467
Window window = activity.getWindow();
@@ -419,57 +472,6 @@ protected int getContentViewHeight(Activity activity){
419472
return rect.bottom - rect.top;
420473
}
421474

422-
423-
private View.OnClickListener checkBoxEmojiOnClicked = new View.OnClickListener() {
424-
@Override
425-
public void onClick(View v) {
426-
content.requestFocus();
427-
if (checkBoxEmoji.isChecked()) {
428-
rootViewHigh = rootView.getHeight();
429-
430-
final int bottomHigh = Global.dpToPx(100); // 底部虚拟按键高度,nexus5是73dp,以防万一,所以设大一点
431-
int rootParentHigh = rootView.getRootView().getHeight();
432-
//rootParentHigh - rootViewHigh > bottomHigh
433-
if (isSoftKeyBoard) {
434-
// 说明键盘已经弹出来了,等键盘消失后再设置 emoji keyboard 可见
435-
if(commonEnterRoot!=null){
436-
toggleInputTypeWithCloseSoftkeyboard(InputType.Emoji);
437-
}else{
438-
//兼容没有使用common_enter_emoji的输入控件
439-
Global.popSoftkeyboard(mActivity, content, false);
440-
}
441-
442-
// 魅族手机的 rootView 无论输入法是否弹出高度都是不变的,只好搞个延时做这个事
443-
rootView.postDelayed(new Runnable() {
444-
@Override
445-
public void run() {
446-
rootView.setLayoutParams(rootView.getLayoutParams());
447-
}
448-
}, 50);
449-
450-
} else {
451-
if(commonEnterRoot!=null){
452-
toggleNoTextInput(InputType.Emoji);
453-
}else{
454-
//兼容没有使用common_enter_emoji的输入控件
455-
emojiKeyboardLayout.setVisibility(View.VISIBLE);
456-
}
457-
458-
rootViewHigh = 0;
459-
}
460-
} else {
461-
if(commonEnterRoot!=null){
462-
toggleSoftkeyboardWithCloseNoTextInput(InputType.Emoji);
463-
}else{
464-
//兼容没有使用common_enter_emoji的输入控件
465-
Global.popSoftkeyboard(mActivity, content, true);
466-
emojiKeyboardLayout.setVisibility(View.GONE);
467-
}
468-
469-
}
470-
}
471-
};
472-
473475
private View getCurrentNoTextInput(){
474476
if(mInputType!=null && mInputType!= InputType.Text){
475477
switch (mInputType){
@@ -559,7 +561,6 @@ public void onAnimationEnd(Animator animation) {
559561
animEnterLayoutStatusChanaged(true);
560562
}
561563
}
562-
563564
}
564565

565566
@Override
@@ -571,8 +572,6 @@ public void animEnterLayoutStatusChanaged(boolean isOpen) {
571572
}
572573
}
573574

574-
575-
576575
@Override
577576
protected void onEnterLayoutDropDown(int bottom) {
578577
super.onEnterLayoutDropDown(bottom);
@@ -583,15 +582,6 @@ protected void onEnterLayoutPopUp(int bottom) {
583582
super.onEnterLayoutPopUp(bottom);
584583
}
585584

586-
587-
588-
589-
590-
591-
public EnterEmojiLayout(FragmentActivity activity, View.OnClickListener sendTextOnClick) {
592-
this(activity, sendTextOnClick, Type.Default, EmojiType.Default);
593-
}
594-
595585
public boolean isEnterPanelShowing() {
596586
return mEnterLayoutStatus && (emojiKeyboardLayout.getVisibility() == View.VISIBLE || voiceLayout.getVisibility() == View.VISIBLE);
597587
}

app/src/main/java/net/coding/program/message/NotifyListActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
8787
holder.title.setMovementMethod(LongClickLinkMovementMethod.getInstance());
8888
holder.time = (TextView) convertView.findViewById(R.id.time);
8989
holder.root = convertView;
90+
holder.badge = convertView.findViewById(R.id.badge);
9091

9192

9293
} else {
@@ -162,6 +163,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
162163

163164
holder.title.setText(Global.changeHyperlinkColor(title));
164165
holder.title.setTextColor(data.isUnRead() ? 0xff222222 : 0xff999999);
166+
holder.badge.setVisibility(data.isUnRead() ? View.VISIBLE : View.INVISIBLE);
165167

166168
if (position == (mData.size() - 1)) {
167169
loadMore();
@@ -264,6 +266,7 @@ private static class ViewHolder {
264266
public TextView title;
265267
public TextView time;
266268
public View root;
269+
public View badge;
267270
}
268271

269272
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ public int getIid() {
9797
return iid;
9898
}
9999

100+
public int getId() {
101+
return id;
102+
}
103+
100104
public ActionAuthor getActionAuthor() {
101105
return action_author;
102106
}

app/src/main/java/net/coding/program/project/SearchProjectActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.androidannotations.annotations.ViewById;
1717

1818
import java.util.ArrayList;
19+
import java.util.Iterator;
1920

2021
@EActivity(R.layout.activity_search_project)
2122
public class SearchProjectActivity extends BackActivity {
@@ -75,6 +76,14 @@ public boolean onQueryTextChange(String s) {
7576
});
7677

7778
mData = AccountInfo.loadProjects(this);
79+
if (type == ProjectFragment.Type.Pick) {
80+
for (Iterator<ProjectObject> iterator = mData.iterator(); iterator.hasNext(); ) {
81+
if (iterator.next().isPublic()) {
82+
iterator.remove();
83+
}
84+
}
85+
}
86+
7887
searchFragment = ProjectListFragment_.builder().type(type).mData(mSearchData).build();
7988
getSupportFragmentManager().beginTransaction()
8089
.add(R.id.container, searchFragment)

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ public void onClick(DialogInterface dialog, int which) {
142142
} else {
143143

144144
AlertDialog.Builder builder = new AlertDialog.Builder(this);
145+
String[] itemTitles = {"修改备注"};
146+
if (mData.get(pos).owner.isMe()) {
147+
itemTitles = new String[]{"修改备注", "删除"};
148+
}
145149
builder
146-
.setItems(new String[]{"修改备注", "删除"}, new DialogInterface.OnClickListener() {
150+
.setItems(itemTitles, new DialogInterface.OnClickListener() {
147151
public void onClick(DialogInterface dialog, int which) {
148152
AttachmentFileHistoryObject itemData = mData.get(pos);
149153
if (which == 0) {

app/src/main/java/net/coding/program/project/detail/merge/MergeFileDetailActivity.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,26 +65,19 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
6565
String host = uri.getHost();
6666
switch (host) {
6767
case "line_note": {
68-
final LineNoteBase lineNote = new LineNoteBase(uri);
68+
final LineNoteBase lineNote = new LineNoteBase(uri, mMerge.getId());
6969
showDialog("line " + lineNote.line, "添加评论", new DialogInterface.OnClickListener() {
7070
@Override
7171
public void onClick(DialogInterface dialog, int which) {
72-
// String url = "https://coding.net/api/user/ease/project/CodingTest/git/line_notes";
73-
// RequestParams params = lineNote.getPostParam("ccccc test");
74-
// postNetwork(url, params, TAG_LINE_NOTE_CREATE);
75-
76-
77-
// CommentActivity.CommentParam param = createParam(name);
7872
LineNoteParam param = createParam(lineNote, "");
7973
CommentActivity_.intent(MergeFileDetailActivity.this).mParam(param).startForResult(RESULT_COMMENT);
80-
8174
}
8275
});
8376
break;
8477
}
8578

8679
case "note": {
87-
final LineNote lineNote = new LineNote(uri);
80+
final LineNote lineNote = new LineNote(uri, mMerge.getId());
8881
if (lineNote.isMe()) {
8982
showDialog("line note", "删除评论", new DialogInterface.OnClickListener() {
9083
@Override
@@ -265,15 +258,16 @@ public static class LineNoteBase implements Serializable {
265258
public String position;
266259
public String line;
267260
public String anchor;
268-
public String noteable_id = "24212";
261+
public String noteable_id;// = "24212";
269262

270-
public LineNoteBase(Uri uri) {
263+
public LineNoteBase(Uri uri, int noteableId) {
271264
commitId = uri.getQueryParameter("commitId");
272265
noteable_type = uri.getQueryParameter("noteable_type");
273266
path = uri.getQueryParameter("path");
274267
position = uri.getQueryParameter("position");
275268
line = uri.getQueryParameter("line");
276269
anchor = uri.getQueryParameter("anchor");
270+
noteable_id = String.valueOf(noteableId);
277271
}
278272

279273
public RequestParams getPostParam(String content) {
@@ -295,8 +289,8 @@ public static class LineNote extends LineNoteBase implements Serializable {
295289
public String line_note_commentclicked_line_note_id;
296290
public String clicked_user_name; // 其实是 global key
297291

298-
public LineNote(Uri uri) {
299-
super(uri);
292+
public LineNote(Uri uri, int noteableId) {
293+
super(uri, noteableId);
300294
line_note_commentclicked_line_note_id = uri.getQueryParameter("line_note_commentclicked_line_note_id");
301295
clicked_user_name = uri.getQueryParameter("clicked_user_name");
302296
}

app/src/main/java/net/coding/program/project/detail/merge/MergeListFragment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public void onClick(View v) {
4747

4848
@AfterViews
4949
protected final void initMergeListFragment() {
50+
disableRefreshing();
5051
mUrlMerge = mProjectObject.getHttpMerge(mType == TYPE_OPEN);
5152
mMergeAdapter = new MergeAdapter(new ArrayList<Merge>(), this, getImageLoad());
5253
listView.setAdapter(mMergeAdapter);

app/src/main/res/layout/fragment_notify_list_item_at.xml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@
44
android:layout_height="match_parent"
55
tools:context="net.coding.program.message.NotifyListActivity">
66

7+
<com.readystatesoftware.viewbadger.BadgeView
8+
android:id="@+id/badge"
9+
android:layout_width="9dp"
10+
android:layout_height="9dp"
11+
android:layout_marginLeft="@dimen/padding_12"
12+
android:layout_marginRight="@dimen/padding_12"
13+
android:layout_marginTop="25dp"
14+
android:background="@drawable/ic_notify"
15+
android:gravity="center"
16+
android:visibility="invisible" />
717

818
<ImageView
919
android:id="@+id/icon"
1020
android:layout_width="wrap_content"
1121
android:layout_height="wrap_content"
12-
android:paddingLeft="12dp"
13-
android:paddingRight="6dp"
22+
android:layout_marginRight="@dimen/padding_12"
1423
android:paddingTop="15dp"
1524
android:src="@drawable/ic_notify_at" />
1625

0 commit comments

Comments
 (0)