Skip to content

Commit 4ccd11b

Browse files
committed
首页搜索ICON
1 parent 564df67 commit 4ccd11b

File tree

9 files changed

+98
-78
lines changed

9 files changed

+98
-78
lines changed

app/src/debug/res/AndroidManifest.xml renamed to app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<activity
2727
android:name=".activity.LauncherActivity"
2828
android:theme="@style/AppTheme.NoActionBar.FullScreen"
29-
tools:node="remove"/>
29+
tools:node="replace"/>
3030

3131
<!--主界面-->
3232
<activity

app/src/main/AndroidManifest.xml

Lines changed: 28 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -24,50 +24,34 @@
2424
<activity
2525
android:name=".activity.LauncherActivity"
2626
android:theme="@style/AppTheme.NoActionBar.FullScreen">
27-
<intent-filter>
28-
<action android:name="android.intent.action.MAIN"/>
27+
<intent-filter>
28+
<action android:name="android.intent.action.MAIN"/>
2929

30-
<category android:name="android.intent.category.LAUNCHER"/>
31-
</intent-filter>
30+
<category android:name="android.intent.category.LAUNCHER"/>
31+
</intent-filter>
3232
</activity>
3333

3434
<!--主界面-->
3535
<activity
36-
android:name=".activity.MainActivity"
37-
android:theme="@style/AppTheme.Dark">
38-
<!-- <intent-filter>
39-
<action android:name="android.intent.action.MAIN"/>
40-
41-
<category android:name="android.intent.category.LAUNCHER"/>
42-
</intent-filter>-->
43-
</activity>
36+
android:name=".activity.MainActivity"/>
4437

4538
<activity
4639
android:name=".activity.TestActivity"
4740
android:label="博客园测试"
48-
android:theme="@style/AppTheme.Dark">
49-
<!-- <intent-filter>
50-
<action android:name="android.intent.action.MAIN"/>
51-
<category android:name="android.intent.category.LAUNCHER"/>
52-
</intent-filter>-->
53-
</activity>
41+
android:theme="@style/AppTheme.Dark"/>
5442

5543
<!--博文-->
5644
<activity
57-
android:name=".activity.BlogContentActivity"
58-
/>
45+
android:name=".activity.BlogContentActivity"/>
5946

6047
<!--登录-->
6148
<activity
6249
android:name=".activity.LoginActivity"
63-
android:launchMode="singleTop"
64-
/>
65-
50+
android:launchMode="singleTop"/>
6651

6752
<!--网页登录-->
6853
<activity
69-
android:name=".activity.WebLoginActivity"
70-
/>
54+
android:name=".activity.WebLoginActivity"/>
7155

7256
<!--网页-->
7357
<activity
@@ -80,82 +64,67 @@
8064

8165
<!--博主-->
8266
<activity
83-
android:name=".activity.BloggerActivity"
84-
/>
67+
android:name=".activity.BloggerActivity"/>
8568
<!--关注、粉丝-->
8669
<activity
87-
android:name=".activity.FriendsActivity"
88-
/>
70+
android:name=".activity.FriendsActivity"/>
8971
<!--分类管理-->
9072
<activity
9173
android:name=".activity.CategoryActivity"
9274
android:label="@string/title_category"
93-
android:launchMode="singleTop"
94-
/>
75+
android:launchMode="singleTop"/>
9576

9677
<activity
9778
android:name=".activity.FavoritesActivity"
9879
android:label="@string/my_favorites"
99-
android:launchMode="singleTop"
100-
/>
80+
android:launchMode="singleTop"/>
10181

10282
<activity
10383
android:name=".activity.SettingActivity"
10484
android:label="@string/setting"
105-
android:launchMode="singleTop"
106-
/>
85+
android:launchMode="singleTop"/>
10786

10887
<activity
10988
android:name=".activity.FeedbackActivity"
11089
android:label="@string/feedback"
11190
android:launchMode="singleTop"
112-
11391
android:windowSoftInputMode="stateVisible"/>
11492

11593
<activity
11694
android:name=".activity.SearchActivity"
117-
11895
android:windowSoftInputMode="stateVisible"/>
11996

12097
<activity
12198
android:name=".activity.SystemMessageActivity"
122-
android:label="@string/system_message"
123-
/>
99+
android:label="@string/system_message"/>
124100

125101
<activity
126102
android:name=".activity.FontSettingActivity"
127-
android:label="@string/font_setting"
128-
/>
103+
android:label="@string/font_setting"/>
129104

130105
<activity
131106
android:name=".activity.CommentActivity"
132-
android:label="@string/label_comment"
133-
/>
107+
android:label="@string/label_comment"/>
134108

135109
<activity
136110
android:name=".activity.PostMomentActivity"
137-
android:label="@string/label_post_moment"
138-
/>
111+
android:label="@string/label_post_moment"/>
139112
<activity
140113
android:name=".activity.ImageSelectionActivity"
141-
android:label="@string/label_image_selection"
142-
>
114+
android:label="@string/label_image_selection">
143115

144116
</activity>
145117
<activity
146118
android:name=".activity.MomentDetailActivity"
147-
android:label="@string/label_moment_detail"
148-
/>
119+
android:label="@string/label_moment_detail"/>
149120

150121
<activity
151122
android:name=".activity.MomentAtMeActivity"
152-
android:label="@string/label_moment_at_me"
153-
/>
123+
android:label="@string/label_moment_at_me"/>
154124

155125
<activity
156126
android:name=".activity.MomentMessageActivity"
157-
android:label="@string/label_moment_message"
158-
/>
127+
android:label="@string/label_moment_message"/>
159128

160129
<service
161130
android:name=".service.CnblogsService"
@@ -239,12 +208,12 @@
239208
android:enabled="true"
240209
android:exported="false"/>
241210

242-
<!-- <meta-data
243-
android:name="UMENG_APPKEY"
244-
android:value="${UMENG_APPKEY}"/>-->
245-
<!-- <meta-data
246-
android:name="UMENG_CHANNEL"
247-
android:value="${UMENG_CHANNEL}"/>-->
211+
<!-- <meta-data
212+
android:name="UMENG_APPKEY"
213+
android:value="${UMENG_APPKEY}"/>-->
214+
<!-- <meta-data
215+
android:name="UMENG_CHANNEL"
216+
android:value="${UMENG_CHANNEL}"/>-->
248217

249218

250219
</application>

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import com.rae.cnblogs.sdk.bean.UserInfoBean;
1414
import com.rae.cnblogs.sdk.db.DbFactory;
1515
import com.rae.swift.session.SessionManager;
16-
import com.squareup.leakcanary.LeakCanary;
1716
import com.tencent.bugly.Bugly;
1817
import com.tencent.tinker.loader.app.TinkerApplication;
1918
import com.tencent.tinker.loader.shareutil.ShareConstants;
@@ -40,9 +39,9 @@ public void onCreate() {
4039

4140
// 级别较高的初始化操作
4241
if (BuildConfig.DEBUG) {
43-
if (!LeakCanary.isInAnalyzerProcess(this)) {
44-
LeakCanary.install(this);
45-
}
42+
// if (!LeakCanary.isInAnalyzerProcess(this)) {
43+
// LeakCanary.install(this);
44+
// }
4645
} else {
4746
// 正式环境
4847
Bugly.init(getApplication(), BuildConfig.BUGLY_APP_ID, false);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public class MainActivity extends BaseActivity {
6666
protected void onCreate(Bundle savedInstanceState) {
6767
super.onCreate(savedInstanceState);
6868
setContentView(R.layout.activity_main);
69-
AppUI.toastInCenter(this, "渠道:" + getChannel());
7069
// if (!BuildConfig.DEBUG) {
7170
// // 跳启动页
7271
// startActivity(new Intent(this, LauncherActivity.class));

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

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
import android.app.Activity;
44
import android.content.Intent;
55
import android.os.Bundle;
6+
import android.support.annotation.NonNull;
67
import android.support.annotation.Nullable;
8+
import android.support.design.widget.AppBarLayout;
9+
import android.support.design.widget.CoordinatorLayout;
710
import android.support.design.widget.DesignTabLayout;
811
import android.support.v4.view.ViewPager;
12+
import android.util.Log;
13+
import android.view.MotionEvent;
914
import android.view.View;
15+
import android.view.animation.Animation;
16+
import android.view.animation.AnimationUtils;
1017
import android.widget.TextView;
1118

1219
import com.rae.cnblogs.AppRoute;
13-
import com.rae.cnblogs.AppUI;
1420
import com.rae.cnblogs.R;
1521
import com.rae.cnblogs.adapter.BlogListAdapter;
1622
import com.rae.cnblogs.message.TabEvent;
@@ -35,7 +41,7 @@ public class HomeFragment extends BaseFragment implements IHomePresenter.IHomeVi
3541

3642
private BlogListAdapter mAdapter;
3743
private IHomePresenter mHomePresenter;
38-
private List<CategoryBean> mCategoryBeanList;
44+
// private List<CategoryBean> mCategoryBeanList;
3945
private int mPosition;
4046

4147
public static HomeFragment newInstance() {
@@ -50,6 +56,9 @@ public static HomeFragment newInstance() {
5056
@BindView(R.id.tv_search)
5157
TextView mSearchView;
5258

59+
@BindView(R.id.coordinator_layout)
60+
CoordinatorLayout mCoordinatorLayout;
61+
5362
@Override
5463
protected int getLayoutId() {
5564
return R.layout.fm_home;
@@ -75,15 +84,48 @@ public void onDestroy() {
7584
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
7685
super.onActivityCreated(savedInstanceState);
7786
mHomePresenter.start();
87+
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) mViewPager.getLayoutParams();
88+
lp.setBehavior(new AppBarLayout.ScrollingViewBehavior() {
89+
@Override
90+
public boolean onInterceptTouchEvent(CoordinatorLayout parent, View child, MotionEvent ev) {
91+
Log.d("rae-layout", "onInterceptTouchEvent" + ev);
92+
return super.onInterceptTouchEvent(parent, child, ev);
93+
}
94+
95+
@Override
96+
public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
97+
Log.d("rae-layout", "layoutDependsOn:" + dependency);
98+
return super.layoutDependsOn(parent, child, dependency);
99+
}
100+
101+
@Override
102+
public boolean onDependentViewChanged(CoordinatorLayout parent, View child, View dependency) {
103+
Log.d("rae-layout", "onDependentViewChanged:" + dependency);
104+
return super.onDependentViewChanged(parent, child, dependency);
105+
}
106+
107+
@Override
108+
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type) {
109+
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type);
110+
Log.d("rae-layout", "onNestedScroll:" + type);
111+
}
112+
113+
@Override
114+
public boolean onNestedFling(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View target, float velocityX, float velocityY, boolean consumed) {
115+
Log.d("rae-layout", "onNestedFling:" + velocityY);
116+
return super.onNestedFling(coordinatorLayout, child, target, velocityX, velocityY, consumed);
117+
}
118+
119+
@Override
120+
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull View child, @NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
121+
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
122+
Log.d("rae-layout", "onNestedScroll:" + target);
123+
}
124+
});
78125
}
79126

80-
81127
@OnClick(R.id.img_edit_category)
82128
public void onCategoryClick(View view) {
83-
if (mCategoryBeanList == null || mCategoryBeanList.size() <= 0) {
84-
AppUI.failed(getContext(), "请等待分类加载完成");
85-
return;
86-
}
87129
AppRoute.jumpToCategoryForResult(getActivity());
88130
}
89131

@@ -95,7 +137,7 @@ public void onLoadCategory(List<CategoryBean> data) {
95137
return;
96138
}
97139

98-
mCategoryBeanList = data;
140+
// mCategoryBeanList = data;
99141
int count = mAdapter == null ? 0 : mAdapter.getCount();
100142

101143
if (mAdapter == null) {
@@ -130,6 +172,9 @@ public void onTabReselected(DesignTabLayout.Tab tab) {
130172

131173
@Override
132174
public void onLoadHotSearchData(String keyword) {
175+
Animation anim = AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_in);
176+
anim.setDuration(800);
177+
mSearchView.startAnimation(anim);
133178
mSearchView.setText(keyword);
134179
}
135180

app/src/main/java/com/rae/cnblogs/widget/RaeRecyclerView.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ public boolean isOnTop() {
125125
return false;
126126
}
127127

128+
@Override
129+
public boolean fling(int velocityX, int velocityY) {
130+
Log.i("rae", "滑动状态改变:fling " + velocityY);
131+
return super.fling(velocityX, velocityY);
132+
}
133+
128134
@Override
129135
public void onScrollStateChanged(int state) {
130136
super.onScrollStateChanged(state);
Loading

app/src/main/res/drawable/bg_nav_search.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
33
<item>
44
<shape>
5-
<corners android:radius="12dp"/>
5+
<corners android:radius="56dp"/>
66
<solid android:color="@color/default_background"/>
77
</shape>
88
</item>

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<android.support.design.widget.CoordinatorLayout
3+
android:id="@+id/coordinator_layout"
34
xmlns:android="http://schemas.android.com/apk/res/android"
45
xmlns:app="http://schemas.android.com/apk/res-auto"
56
android:layout_width="match_parent"
@@ -42,24 +43,25 @@
4243
android:layout_marginRight="12dp"
4344
android:layout_weight="1"
4445
android:background="@drawable/bg_nav_search"
45-
android:paddingBottom="2dp"
46+
android:paddingBottom="5dp"
4647
android:paddingLeft="6dp"
4748
android:paddingRight="6dp"
48-
android:paddingTop="2dp">
49+
android:paddingTop="5dp">
4950

5051
<TextView
5152
android:id="@+id/tv_search"
5253
android:layout_width="wrap_content"
5354
android:layout_height="wrap_content"
5455
android:layout_gravity="center"
55-
android:drawableLeft="@drawable/ic_search"
56+
android:drawableLeft="@drawable/ic_nav_home_search"
5657
android:drawablePadding="4dp"
5758
android:ellipsize="end"
5859
android:gravity="center"
5960
android:singleLine="true"
6061
android:text="@string/search_hint"
6162
android:textColor="@color/ph3"
62-
android:textSize="14sp"/>
63+
android:textSize="14sp"
64+
android:textStyle="bold"/>
6365

6466
</FrameLayout>
6567

0 commit comments

Comments
 (0)