Skip to content

Commit 31b2a32

Browse files
committed
补提交
1 parent 6b0ea11 commit 31b2a32

File tree

7 files changed

+126
-0
lines changed

7 files changed

+126
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.rae.cnblogs.activity;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.Nullable;
5+
import android.support.v4.app.Fragment;
6+
7+
import com.rae.cnblogs.R;
8+
9+
/**
10+
* 单个Fragment页面
11+
* Created by ChenRui on 2017/8/29 0029 22:59.
12+
*/
13+
public abstract class BaseFragmentActivity extends BaseActivity {
14+
15+
@Override
16+
protected void onCreate(@Nullable Bundle savedInstanceState) {
17+
super.onCreate(savedInstanceState);
18+
setContentView(getLayoutId());
19+
showHomeAsUp();
20+
getSupportFragmentManager()
21+
.beginTransaction()
22+
.add(R.id.content, newFragment())
23+
.commitNowAllowingStateLoss();
24+
25+
}
26+
27+
protected abstract Fragment newFragment();
28+
29+
public int getLayoutId() {
30+
return R.layout.activity_single_fragment;
31+
}
32+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.rae.cnblogs.activity;
2+
3+
import android.os.Bundle;
4+
import android.support.annotation.Nullable;
5+
import android.support.v4.app.Fragment;
6+
import android.view.View;
7+
8+
import com.rae.cnblogs.fragment.SearchFragment;
9+
10+
/**
11+
* 搜索界面
12+
* Created by ChenRui on 2017/8/29 0029 22:59.
13+
*/
14+
public class SearchActivity extends BaseFragmentActivity {
15+
16+
@Override
17+
protected void onCreate(@Nullable Bundle savedInstanceState) {
18+
super.onCreate(savedInstanceState);
19+
mToolBar.setVisibility(View.GONE);
20+
}
21+
22+
@Override
23+
protected Fragment newFragment() {
24+
return SearchFragment.newInstance();
25+
}
26+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.rae.cnblogs.model;
2+
3+
import android.support.v7.widget.RecyclerView;
4+
import android.view.View;
5+
6+
public class SimpleViewHolder extends RecyclerView.ViewHolder {
7+
8+
public SimpleViewHolder(View itemView) {
9+
super(itemView);
10+
}
11+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.rae.cnblogs.widget;
2+
3+
import android.content.Context;
4+
import android.util.AttributeSet;
5+
6+
import in.srain.cube.views.ptr.PtrClassicDefaultHeader;
7+
8+
public class HomeSearchHeader extends PtrClassicDefaultHeader {
9+
10+
public HomeSearchHeader(Context context) {
11+
super(context);
12+
}
13+
14+
public HomeSearchHeader(Context context, AttributeSet attrs) {
15+
super(context, attrs);
16+
}
17+
18+
public HomeSearchHeader(Context context, AttributeSet attrs, int defStyle) {
19+
super(context, attrs, defStyle);
20+
}
21+
22+
@Override
23+
protected void initViews(AttributeSet attrs) {
24+
super.initViews(attrs);
25+
// LayoutInflater.from(getContext()).inflate(R.layout.item_home_search, this, true);
26+
27+
}
28+
}
Loading
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?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:orientation="vertical">
6+
7+
<include layout="@layout/view_title"/>
8+
9+
<FrameLayout
10+
android:id="@+id/content"
11+
android:layout_width="match_parent"
12+
android:layout_height="match_parent"/>
13+
14+
</LinearLayout>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?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="wrap_content"
5+
android:background="@color/dividerColor"
6+
android:gravity="center"
7+
android:orientation="vertical"
8+
android:padding="12dp">
9+
10+
<TextView
11+
android:layout_width="wrap_content"
12+
android:layout_height="wrap_content"
13+
android:text="搜索"/>
14+
15+
</LinearLayout>

0 commit comments

Comments
 (0)