Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jun 5, 2024. It is now read-only.

Commit a6361d1

Browse files
committed
微调
1 parent 5a3d159 commit a6361d1

File tree

8 files changed

+123
-28
lines changed

8 files changed

+123
-28
lines changed

‎module-discover/src/main/java/com/rae/cnblogs/discover/RaeBaseQuickAdapter.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.support.annotation.NonNull;
55
import android.support.annotation.Nullable;
66
import android.support.v4.content.ContextCompat;
7+
import android.view.View;
78
import android.view.ViewGroup;
89

910
import com.chad.library.adapter.base.BaseQuickAdapter;
@@ -32,13 +33,6 @@ public RaeBaseQuickAdapter(Context context, int layoutResId) {
3233
initView(context);
3334
}
3435

35-
@NonNull
36-
@Override
37-
public K onCreateViewHolder(ViewGroup parent, int viewType) {
38-
39-
return super.onCreateViewHolder(parent, viewType);
40-
}
41-
4236
protected void initView(Context context) {
4337
mPlaceholderView = new PlaceholderView(context);
4438
mPlaceholderView.setBackgroundColor(ContextCompat.getColor(context, R.color.background_divider));

‎module-discover/src/main/java/com/rae/cnblogs/discover/column/detail/AntUserColumnDetailAdapter.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.content.Context;
44
import android.support.annotation.Nullable;
5+
import android.view.ViewGroup;
56
import android.widget.ImageView;
67

78
import com.antcode.sdk.model.AntArticleInfo;
@@ -14,13 +15,34 @@
1415

1516
public class AntUserColumnDetailAdapter extends RaeBaseQuickAdapter<AntArticleInfo, BaseViewHolder> {
1617

18+
private int mViewType;
1719

20+
/**
21+
*/
1822
public AntUserColumnDetailAdapter(Context context, @Nullable List<AntArticleInfo> data) {
1923
super(context, R.layout.item_user_column_detail, data);
2024
}
2125

26+
public void setViewType(int type) {
27+
mViewType = type;
28+
}
29+
30+
public int getViewType() {
31+
return mViewType;
32+
}
33+
34+
@Override
35+
protected BaseViewHolder createBaseViewHolder(ViewGroup parent, int layoutResId) {
36+
layoutResId = mViewType == 1 ? R.layout.item_user_column_title : R.layout.item_user_column_detail;
37+
return super.createBaseViewHolder(parent, layoutResId);
38+
}
39+
2240
@Override
2341
protected void convert(BaseViewHolder helper, AntArticleInfo item) {
42+
if (mViewType == 1) {
43+
helper.setText(R.id.tv_title, item.getTitle());
44+
return;
45+
}
2446
AppImageLoader.display(item.getImageUrl(), (ImageView) helper.getView(R.id.img_cover));
2547
helper.setText(R.id.tv_title, item.getTitle());
2648
helper.setText(R.id.tv_summary, item.getSummary());

‎module-discover/src/main/java/com/rae/cnblogs/discover/ui/AntColumnActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5454
@OnClick(R2.id.img_question)
5555
public void onQuestionClick() {
5656
AppRoute.routeToAntColumnWeb(this, getString(R.string.url_antcode_about));
57-
// AppRoute.routeToAntColumnWeb(this, "http://192.168.1.112:8088/about");
57+
// AppRoute.routeToAntColumnWeb(this, "http://192.168.1.7:8080/about");
5858
}
5959

6060
class AntColumnAdapter extends FragmentPagerAdapter {

‎module-discover/src/main/java/com/rae/cnblogs/discover/ui/AntUserColumnDetailActivity.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
6464
setContentView(R.layout.activity_ant_user_column_detail);
6565
setTitle(" ");
6666
mPresenter = new AntUserColumnDetailPresenterImpl(this);
67-
mAdapter = new AntUserColumnDetailAdapter(this, null);
67+
mAdapter = new AntUserColumnDetailAdapter(this, null);
6868
mAdapter.setEnableLoadMore(true);
6969
mRecyclerView.setAdapter(mAdapter);
7070
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
@@ -176,13 +176,15 @@ public void onLoadColumnDetail(AntColumnInfo columnInfo) {
176176
TextView articleCountView = mHeaderView.findViewById(R.id.tv_article_count);
177177
mHeaderView.findViewById(R.id.fl_header).setOnClickListener(this);
178178
mHeaderView.findViewById(R.id.btn_unsubscribe).setOnClickListener(this);
179+
mHeaderView.findViewById(R.id.btn_mode).setOnClickListener(this);
179180

180181
AppImageLoader.display(columnInfo.getAvatar(), coverImageView);
181182
GlideApp.with(this)
182183
.load(columnInfo.getLogo())
183184
.apply(bitmapTransform(new BlurTransformation(25, 3)))
184185
.into(blurImageView);
185-
String articleNumText = getString(R.string.format_article_updated, columnInfo.getArticleNum());
186+
// String articleNumText = getString(R.string.format_article_updated, columnInfo.getArticleNum());
187+
String articleNumText = String.valueOf(columnInfo.getArticleNum());
186188
mTitleView.setText(columnInfo.getTitle());
187189
titleView.setText(columnInfo.getTitle());
188190
subtitleView.setText(columnInfo.getRecommendation());
@@ -240,12 +242,26 @@ public void onClick(View v) {
240242
if (v.getId() == R.id.fl_header && mColumnInfo != null)
241243
AppRoute.routeToAntColumnDetail(this, mColumnInfo.getId());
242244

245+
if (v.getId() == R.id.btn_mode) {
246+
onModeClick();
247+
}
248+
243249
// 取消订阅
244250
if (v.getId() == R.id.btn_unsubscribe) {
245251
onUnsubscribeClick();
246252
}
247253
}
248254

255+
/**
256+
* 模式切换
257+
*/
258+
private void onModeClick() {
259+
// int viewType = mAdapter.getViewType();
260+
// viewType = viewType == 1 ? 0 : 1;
261+
// mAdapter.setViewType(viewType);
262+
// mAdapter.notifyDataSetChanged();
263+
}
264+
249265
/**
250266
* 取消订阅
251267
*/

‎module-discover/src/main/res/layout/activity_ant_user_column_detail.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:layout_width="match_parent"
1111
android:layout_height="match_parent"
1212
android:layout_above="@id/ll_bottom"
13-
android:background="#F8F8F8"
13+
android:background="@color/background_divider"
1414
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
1515

1616

@@ -21,7 +21,8 @@
2121
android:layout_width="match_parent"
2222
android:layout_height="wrap_content"
2323
android:fitsSystemWindows="true"
24-
app:navigationIcon="@drawable/icon_back_white" >
24+
app:navigationIcon="@drawable/icon_back_white">
25+
2526
<TextView
2627
android:id="@+id/tv_title"
2728
android:layout_width="wrap_content"

‎module-discover/src/main/res/layout/item_user_column_detail.xml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
<?xml version="1.0" encoding="utf-8"?><!--<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"--><!--xmlns:app="http://schemas.android.com/apk/res-auto"--><!--android:layout_width="match_parent"--><!--android:layout_height="wrap_content"--><!--android:layout_marginStart="12dp"--><!--android:layout_marginTop="16dp"--><!--android:layout_marginEnd="12dp"--><!--android:orientation="vertical"--><!--app:cardBackgroundColor="@color/white"--><!--app:cardCornerRadius="4dp"--><!--app:cardElevation="12dp"--><!--app:contentPadding="20dp">-->
22

33
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
45
android:layout_width="match_parent"
56
android:layout_height="wrap_content"
6-
android:layout_marginTop="12dp"
7+
android:layout_marginTop="20dp"
78
android:background="@color/white"
89
android:orientation="vertical"
910
android:paddingStart="12dp"
10-
android:paddingTop="24dp"
11+
android:paddingTop="18dp"
1112
android:paddingEnd="12dp"
1213
android:paddingBottom="14dp">
1314

15+
<com.makeramen.roundedimageview.RoundedImageView
16+
android:id="@+id/img_cover"
17+
android:layout_width="match_parent"
18+
android:layout_height="180dp"
19+
android:scaleType="centerCrop"
20+
android:src="@drawable/default_placeholder_normal"
21+
app:riv_corner_radius="4dp" />
22+
1423
<TextView
1524
android:id="@+id/tv_title"
1625
android:layout_width="match_parent"
1726
android:layout_height="wrap_content"
27+
android:layout_marginTop="14dp"
1828
android:text="01 为什么在基于ASP.NET应用寄宿下配置的BaseAddress无效"
1929
android:textColor="@color/black"
2030
android:textSize="18sp" />
2131

22-
<ImageView
23-
android:id="@+id/img_cover"
24-
android:layout_width="match_parent"
25-
android:layout_height="160dp"
26-
android:layout_marginTop="14dp"
27-
android:scaleType="centerCrop"
28-
android:src="@drawable/default_placeholder_normal" />
2932

3033
<TextView
3134
android:id="@+id/tv_summary"
@@ -50,6 +53,8 @@
5053
android:layout_height="wrap_content"
5154
android:layout_marginTop="14dp"
5255
android:drawableEnd="@drawable/default_right_arrow"
56+
android:drawablePadding="12dp"
57+
android:gravity="start|center"
5358
android:lineSpacingMultiplier="1.2"
5459
android:text="阅读全文"
5560
android:textColor="@color/ph4"

‎module-discover/src/main/res/layout/item_user_column_detail_header.xml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,25 @@
127127
android:textColor="@color/white"
128128
android:textSize="12sp" />
129129

130+
<TextView
131+
android:id="@+id/tv_article_num"
132+
android:layout_width="wrap_content"
133+
android:layout_height="wrap_content"
134+
android:layout_marginStart="18dp"
135+
android:text="--"
136+
android:textColor="@color/white"
137+
android:textSize="18sp"
138+
android:textStyle="bold" />
139+
140+
<TextView
141+
android:layout_width="wrap_content"
142+
android:layout_height="wrap_content"
143+
android:layout_alignBaseline="@+id/tv_article_num"
144+
android:layout_marginStart="5dp"
145+
android:layout_toEndOf="@+id/tv_article_num"
146+
android:text=""
147+
android:textColor="@color/white"
148+
android:textSize="12sp" />
130149

131150
<TextView
132151
android:id="@+id/tv_sub_num"
@@ -144,9 +163,11 @@
144163
android:layout_alignBaseline="@+id/tv_article_num"
145164
android:layout_marginStart="5dp"
146165
android:layout_toEndOf="@+id/tv_article_num"
147-
android:text="人已学习"
166+
android:text="人学习"
148167
android:textColor="@color/white"
149168
android:textSize="12sp" />
169+
170+
150171
</LinearLayout>
151172

152173

@@ -158,16 +179,22 @@
158179
android:layout_width="match_parent"
159180
android:layout_height="wrap_content"
160181
android:layout_below="@+id/fl_header"
182+
android:background="@drawable/public_divider_while_primary"
161183
android:paddingStart="24dp"
162184
android:paddingEnd="24dp">
163185

164-
<TextView
165-
android:id="@+id/tv_article_num"
166-
android:layout_width="0dp"
186+
<Button
187+
android:id="@+id/btn_mode"
188+
android:layout_width="wrap_content"
167189
android:layout_height="wrap_content"
168-
android:layout_weight="1"
169-
android:text="已完结"
170-
android:textColor="#FF878C97" />
190+
android:background="@android:color/transparent"
191+
android:text="详细模式"
192+
android:textColor="#FFBBBBBB" />
193+
194+
<Space
195+
android:layout_width="0dp"
196+
android:layout_height="match_parent"
197+
android:layout_weight="1" />
171198

172199
<Button
173200
android:id="@+id/btn_unsubscribe"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?><!--<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"--><!--xmlns:app="http://schemas.android.com/apk/res-auto"--><!--android:layout_width="match_parent"--><!--android:layout_height="wrap_content"--><!--android:layout_marginStart="12dp"--><!--android:layout_marginTop="16dp"--><!--android:layout_marginEnd="12dp"--><!--android:orientation="vertical"--><!--app:cardBackgroundColor="@color/white"--><!--app:cardCornerRadius="4dp"--><!--app:cardElevation="12dp"--><!--app:contentPadding="20dp">-->
2+
3+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
android:layout_marginBottom="1dp"
7+
android:background="@color/white"
8+
android:orientation="vertical"
9+
android:paddingStart="24dp"
10+
android:paddingTop="18dp"
11+
android:paddingEnd="24dp"
12+
android:paddingBottom="18dp">
13+
14+
<TextView
15+
android:id="@+id/tv_title"
16+
android:layout_width="match_parent"
17+
android:layout_height="wrap_content"
18+
android:drawableEnd="@drawable/default_right_arrow"
19+
android:drawablePadding="12dp"
20+
android:drawableTint="@color/black"
21+
android:ellipsize="end"
22+
android:singleLine="true"
23+
android:text="01 为什么在基于ASP.NET应用寄宿下配置的BaseAddress无效"
24+
android:textColor="@color/ant_h1"
25+
android:textSize="15sp" />
26+
27+
28+
</LinearLayout>
29+
30+
<!--</android.support.v7.widget.CardView>-->

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /