Skip to content

Commit 755d7ae

Browse files
committed
UI细节优化;
启动页改为从首页启动;
1 parent 4c98c71 commit 755d7ae

24 files changed

+133
-61
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@
2929
android:name=".activity.LauncherActivity"
3030
android:screenOrientation="portrait"
3131
android:theme="@style/AppTheme.NoActionBar.FullScreen">
32-
<!-- <intent-filter>
33-
<action android:name="android.intent.action.MAIN"/>
32+
<!-- <intent-filter>
33+
<action android:name="android.intent.action.MAIN"/>
3434
35-
<category android:name="android.intent.category.LAUNCHER"/>
36-
</intent-filter>-->
35+
<category android:name="android.intent.category.LAUNCHER"/>
36+
</intent-filter>-->
3737
</activity>
3838

3939
<!--主界面-->
4040
<activity
4141
android:name=".activity.MainActivity"
4242
android:screenOrientation="portrait"
4343
android:theme="@style/AppTheme.Dark">
44-
<intent-filter>
45-
<action android:name="android.intent.action.MAIN"/>
44+
<intent-filter>
45+
<action android:name="android.intent.action.MAIN"/>
4646

47-
<category android:name="android.intent.category.LAUNCHER"/>
48-
</intent-filter>
47+
<category android:name="android.intent.category.LAUNCHER"/>
48+
</intent-filter>
4949
</activity>
5050

5151
<activity

app/src/main/java/com/rae/cnblogs/AppRoute.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ public static void jumpToWebNewTask(Context context, String url) {
141141
* 主界面
142142
*/
143143
public static void jumpToMain(Context context) {
144-
startActivity(context, MainActivity.class);
144+
Intent intent = new Intent(context, MainActivity.class);
145+
intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
146+
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
147+
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
148+
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
149+
context.startActivity(intent);
145150
}
146151

147152

app/src/main/java/com/rae/cnblogs/activity/BloggerActivity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.bumptech.glide.load.engine.GlideException;
1818
import com.bumptech.glide.request.RequestListener;
1919
import com.bumptech.glide.request.target.Target;
20+
import com.rae.cnblogs.AppMobclickAgent;
2021
import com.rae.cnblogs.AppRoute;
2122
import com.rae.cnblogs.AppUI;
2223
import com.rae.cnblogs.GlideApp;
@@ -216,6 +217,8 @@ public boolean onLoadFailed(@Nullable GlideException e, Object o, Target<Drawabl
216217
public boolean onResourceReady(Drawable drawable, Object o, Target<Drawable> target, DataSource dataSource, boolean b) {
217218
// 如果有封面图,则设置进去
218219
mBackgroundView.setContentDescription(coverUrl);
220+
// 统计
221+
AppMobclickAgent.onClickEvent(getContext(), "BloggerCover");
219222
return false;
220223
}
221224
})

app/src/main/java/com/rae/cnblogs/activity/LauncherActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,10 @@ public void onSkipClick() {
122122
mLauncherPresenter.stop();
123123
mCountDownTextView.stop();
124124
}
125+
126+
@Override
127+
public void finish() {
128+
super.finish();
129+
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
130+
}
125131
}

app/src/main/java/com/rae/cnblogs/activity/LoginActivity.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
9090
setContentView(com.rae.cnblogs.R.layout.activity_login);
9191
mLoginPresenter = CnblogsPresenterFactory.getLoginPresenter(this, this);
9292

93-
mBackView.setVisibility(View.INVISIBLE);
94-
mBackView.postDelayed(new Runnable() {
95-
@Override
96-
public void run() {
97-
mBackView.setVisibility(View.VISIBLE);
98-
RaeAnim.fadeIn(mBackView);
99-
}
100-
}, 300);
93+
mBackView.setVisibility(View.VISIBLE);
94+
RaeAnim.fadeIn(mBackView);
10195

10296
// mAccountTextWatcher = new AccountTextWatcher();
10397
// addAccountTextListener(mAccountTextWatcher);

app/src/main/java/com/rae/cnblogs/activity/MainActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ protected void onCreate(Bundle savedInstanceState) {
6868
AppStatusBar.setStatusbarToDark(this);
6969
super.onCreate(savedInstanceState);
7070
setContentView(R.layout.activity_main);
71+
// 跳启动页
72+
startActivity(new Intent(this, LauncherActivity.class));
73+
7174
EventBus.getDefault().register(this);
7275
mServiceConnection = new ServiceConnection() {
7376
@Override
@@ -262,5 +265,4 @@ public void onEvent(JobEvent event) {
262265
}
263266

264267

265-
266268
}

app/src/main/java/com/rae/cnblogs/activity/SwipeBackBaseActivity.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import me.imid.swipebacklayout.lib.Utils;
1414
import me.imid.swipebacklayout.lib.app.SwipeBackActivityBase;
1515
import me.imid.swipebacklayout.lib.app.SwipeBackActivityHelper;
16-
import skin.support.SkinCompatManager;
1716

1817
/**
1918
* 可以滑动返回的
@@ -23,6 +22,7 @@ public abstract class SwipeBackBaseActivity extends BaseActivity implements Swip
2322

2423
private SwipeBackActivityHelper mHelper;
2524

25+
// 是否为滑动返回
2626
private boolean mIsSwipeBack;
2727

2828

@@ -81,13 +81,20 @@ public void setSwipeBackEnable(boolean enable) {
8181
public void scrollToFinishActivity() {
8282
Utils.convertActivityToTranslucent(this);
8383
getSwipeBackLayout().scrollToFinishActivity();
84+
mIsSwipeBack = true;
85+
}
86+
87+
@Override
88+
public void onBackPressed() {
89+
super.onBackPressed();
90+
mIsSwipeBack = false;
8491
}
8592

8693
@Override
8794
public void finish() {
8895
super.finish();
89-
// if (!mIsSwipeBack) {
90-
overridePendingTransition(0, 0);
91-
// }
96+
if (mIsSwipeBack) {
97+
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
98+
}
9299
}
93100
}

app/src/main/java/com/rae/cnblogs/adapter/CategoriesOverallAdapter.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.os.Message;
55
import android.support.annotation.Nullable;
66
import android.support.v7.widget.RecyclerView;
7+
import android.view.View;
78

89
import com.rae.cnblogs.model.CategoriesOverallItem;
910

@@ -20,12 +21,20 @@ public class CategoriesOverallAdapter extends FlexibleAdapter<AbstractFlexibleIt
2021
private boolean mIsRemoveMode;
2122

2223
public interface CategoryDragListener {
23-
24-
2524
void onItemDrag();
2625
}
2726

27+
public interface OnDataSetFinishListener {
28+
/**
29+
* 更新完成
30+
*
31+
* @param lastView 最后一个View
32+
*/
33+
void onDataSetFinish(View lastView);
34+
}
35+
2836
private CategoryDragListener mCategoryDragListener;
37+
private OnDataSetFinishListener mOnDataSetFinishListener;
2938

3039
private Handler mHandler = new Handler(new Handler.Callback() {
3140
@Override
@@ -47,6 +56,10 @@ public void setCategoryDragListener(CategoryDragListener categoryDragListener) {
4756
mCategoryDragListener = categoryDragListener;
4857
}
4958

59+
public void setOnDataSetFinishListener(OnDataSetFinishListener onDataSetFinishListener) {
60+
mOnDataSetFinishListener = onDataSetFinishListener;
61+
}
62+
5063
/**
5164
* 移除模式切换
5265
*/
@@ -64,6 +77,11 @@ public void onBindViewHolder(RecyclerView.ViewHolder holder, int position, List
6477
// 切换模型
6578
CategoriesOverallItem.CategoriesViewHolder viewHolder = (CategoriesOverallItem.CategoriesViewHolder) holder;
6679
viewHolder.onRemoveMode(mIsRemoveMode, getItem(position).isDraggable());
80+
81+
// 最后一个,动态计算高度
82+
if (position == getItemCount() - 1 && mOnDataSetFinishListener != null) {
83+
mOnDataSetFinishListener.onDataSetFinish(holder.itemView);
84+
}
6785
}
6886

6987
@Override

app/src/main/java/com/rae/cnblogs/adapter/MomentAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void onBindViewHolder(SimpleViewHolder viewHolder, int position, MomentBe
130130
holder.thumbView.setVisibility(imageCount == 1 ? View.VISIBLE : View.GONE);
131131
if (imageCount == 1) {
132132
String url = m.getImageList().get(0);
133-
RaeImageLoader.displayHeaderImage(url, holder.thumbView);
133+
RaeImageLoader.displayImage(url, holder.thumbView);
134134
holder.thumbView.setOnClickListener(new ItemImageClickListener(url));
135135
}
136136

app/src/main/java/com/rae/cnblogs/adapter/MomentDetailAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private void onBindDetailInfoViewHolder(MomentHolder holder, MomentBean m) {
191191
holder.thumbView.setVisibility(imageCount == 1 ? View.VISIBLE : View.GONE);
192192
if (imageCount == 1) {
193193
String url = m.getImageList().get(0);
194-
RaeImageLoader.displayHeaderImage(url, holder.thumbView);
194+
RaeImageLoader.displayImage(url, holder.thumbView);
195195
holder.thumbView.setOnClickListener(new MomentAdapter.ItemImageClickListener(url));
196196
}
197197

app/src/main/java/com/rae/cnblogs/fragment/CategoriesFragment.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import android.os.Message;
77
import android.support.annotation.Nullable;
88
import android.support.v7.widget.RecyclerView;
9+
import android.util.Log;
910
import android.view.View;
1011
import android.view.animation.DecelerateInterpolator;
1112
import android.widget.TextView;
@@ -135,14 +136,32 @@ private void initializeRecyclerView() {
135136
.setAnimationDelay(70L);
136137
mCategoryRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view);
137138
mCategoryRecyclerView.setItemViewCacheSize(0); //Setting ViewCache to 0 (default=2) will animate mCategoryItems better while scrolling down+up with LinearLayout
138-
mCategoryRecyclerView.setLayoutManager(new SmoothScrollStaggeredLayoutManager(getActivity(), 4));
139+
mCategoryRecyclerView.setLayoutManager(new SmoothScrollStaggeredLayoutManager(getActivity(), 3));
139140
mCategoryRecyclerView.setAdapter(mCategoryAdapter);
140141
mCategoryRecyclerView.setHasFixedSize(true); //Size of RV will not change
141142
mCategoryAdapter.setLongPressDragEnabled(true) //Enable long press to drag items
142143
.setHandleDragEnabled(true) //Enable drag using handle view
143144
.setSwipeEnabled(true); //Enable swipe items
144145

145146
mCategoryAdapter.setCategoryDragListener(this);
147+
mCategoryAdapter.setOnDataSetFinishListener(new CategoriesOverallAdapter.OnDataSetFinishListener() {
148+
@Override
149+
public void onDataSetFinish(final View lastView) {
150+
lastView.post(new Runnable() {
151+
@Override
152+
public void run() {
153+
onViewLayoutFinish(lastView);
154+
}
155+
});
156+
}
157+
158+
private void onViewLayoutFinish(View lastView) {
159+
int[] location = new int[2];
160+
lastView.getLocationInWindow(location);
161+
int y = location[1];
162+
Log.i("rae", "高度:" + mCategoryRecyclerView.getLayoutManager().getHeight() + ";实际:" + mCategoryRecyclerView.getHeight());
163+
}
164+
});
146165

147166
mCategoryAdapter.addListener(new FlexibleAdapter.OnItemClickListener() {
148167
@Override
@@ -182,6 +201,8 @@ public void onItemLongClick(int i) {
182201
AppUI.toastInCenter(getContext(), item.getCategory().getName());
183202
}
184203
});
204+
205+
185206
}
186207

187208

@@ -195,7 +216,7 @@ private void initializeUnusedRecyclerView() {
195216

196217
mUnusedRecyclerView = (RecyclerView) getView().findViewById(R.id.recycler_view_unused);
197218
mUnusedRecyclerView.setItemViewCacheSize(0); //Setting ViewCache to 0 (default=2) will animate mCategoryItems better while scrolling down+up with LinearLayout
198-
mUnusedRecyclerView.setLayoutManager(new SmoothScrollStaggeredLayoutManager(getActivity(), 4));
219+
mUnusedRecyclerView.setLayoutManager(new SmoothScrollStaggeredLayoutManager(getActivity(), 3));
199220
mUnusedRecyclerView.setAdapter(mUnusedAdapter);
200221
mUnusedRecyclerView.setHasFixedSize(true); //Size of RV will not change
201222
mUnusedAdapter.setCategoryDragListener(this);
@@ -331,6 +352,9 @@ public void run() {
331352

332353
@Override
333354
public void onDestroy() {
355+
if (mCategoryAdapter != null) {
356+
mCategoryAdapter.setOnDataSetFinishListener(null);
357+
}
334358
mHandler.removeMessages(0);
335359
mHandler = null;
336360
super.onDestroy();
Binary file not shown.
Loading
Loading
Loading
Loading
Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent"
4-
android:layout_height="match_parent"
5-
android:background="@color/white"
6-
android:fitsSystemWindows="true"
7-
android:orientation="vertical"
8-
android:paddingTop="@dimen/default_padding_top">
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:background="@color/white"
6+
android:fitsSystemWindows="true"
7+
android:orientation="vertical"
8+
android:paddingTop="@dimen/default_padding_top">
99

10-
<include layout="@layout/view_title"/>
10+
<LinearLayout
11+
android:id="@+id/ll_toolbar"
12+
android:layout_width="match_parent"
13+
android:layout_height="wrap_content"
14+
android:orientation="vertical">
15+
16+
<include layout="@layout/view_title"/>
17+
18+
</LinearLayout>
1119

1220
<FrameLayout
1321
android:id="@+id/content"
1422
android:layout_width="match_parent"
15-
android:layout_height="match_parent">
23+
android:layout_height="match_parent"
24+
android:layout_below="@+id/ll_toolbar"
25+
android:layout_marginTop="-5dp">
1626

1727
</FrameLayout>
1828

19-
</LinearLayout>
29+
</RelativeLayout>

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
android:id="@+id/img_launcher_display"
1515
android:layout_width="match_parent"
1616
android:layout_height="match_parent"
17-
android:scaleType="centerCrop"/>
17+
android:scaleType="centerCrop"
18+
android:src="@drawable/launcher_background"/>
1819

1920
<TextView
2021
android:id="@+id/tv_launcher_name"
@@ -57,12 +58,12 @@
5758
<ImageView
5859
android:layout_width="wrap_content"
5960
android:layout_height="wrap_content"
60-
android:src="@drawable/ic_launcher_logo"/>
61+
android:src="@drawable/ic_logo_small"/>
6162

6263
<TextView
6364
android:layout_width="wrap_content"
6465
android:layout_height="wrap_content"
65-
android:layout_marginTop="18dp"
66+
android:layout_marginTop="12dp"
6667
android:text="@string/copyright"
6768
android:textColor="@color/ph3"
6869
android:textSize="7sp"/>

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
<LinearLayout
99
android:layout_width="match_parent"
10-
android:layout_height="0dp"
11-
android:layout_weight="1"
12-
android:background="@color/white"
10+
android:layout_height="wrap_content"
11+
android:minHeight="100dp"
1312
android:orientation="vertical">
1413

1514
<LinearLayout
@@ -25,7 +24,7 @@
2524
android:layout_height="wrap_content"
2625
android:layout_weight="1"
2726
android:text="长按拖动排序"
28-
android:textColor="@color/ph3"/>
27+
android:textColor="@color/ph2"/>
2928

3029
<TextView
3130
android:id="@+id/tv_remove_category"
@@ -49,16 +48,17 @@
4948
android:layout_width="match_parent"
5049
android:layout_height="0dp"
5150
android:layout_weight="1"
51+
android:minHeight="100dp"
5252
android:orientation="vertical"
53-
android:visibility="invisible">
53+
android:visibility="visible">
5454

5555
<TextView
5656
android:layout_width="wrap_content"
5757
android:layout_height="wrap_content"
5858
android:layout_marginLeft="18dp"
5959
android:layout_marginTop="12dp"
6060
android:text="点击添加更多栏目"
61-
android:textColor="@color/ph3"/>
61+
android:textColor="@color/ph2"/>
6262

6363
<android.support.v7.widget.RecyclerView
6464
android:id="@+id/recycler_view_unused"

0 commit comments

Comments
 (0)