-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
iMeiji
committed
May 11, 2017
1 parent
e149282
commit 7590383
Showing
60 changed files
with
702 additions
and
1,779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
app/src/main/java/com/meiji/toutiao/module/base/BaseFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.meiji.toutiao.module.base; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import com.trello.rxlifecycle2.LifecycleTransformer; | ||
import com.trello.rxlifecycle2.components.support.RxFragment; | ||
|
||
/** | ||
* Created by Meiji on 2017/5/11. | ||
*/ | ||
|
||
public abstract class BaseFragment<T extends IBasePresenter> extends RxFragment implements IBaseView<T> { | ||
|
||
protected T presenter; | ||
|
||
/** | ||
* 绑定布局文件 | ||
* | ||
* @return 布局文件ID | ||
*/ | ||
protected abstract int attachLayoutId(); | ||
|
||
/** | ||
* 初始化视图控件 | ||
*/ | ||
protected abstract void initViews(View view); | ||
|
||
/** | ||
* 初始化数据 | ||
*/ | ||
protected abstract void initData(); | ||
|
||
/** | ||
* 初始化 Toolbar | ||
*/ | ||
protected void initToolBar(Toolbar toolbar, boolean homeAsUpEnabled, String title) { | ||
((BaseActivity) getActivity()).initToolBar(toolbar, homeAsUpEnabled, title); | ||
} | ||
|
||
@Override | ||
public void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setPresenter(presenter); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View view = inflater.inflate(attachLayoutId(), container, false); | ||
initViews(view); | ||
initData(); | ||
return view; | ||
} | ||
|
||
/** | ||
* 绑定生命周期 | ||
*/ | ||
@Override | ||
public <T> LifecycleTransformer<T> bindToLife() { | ||
return this.bindToLifecycle(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
app/src/main/java/com/meiji/toutiao/module/base/LazyLoadFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.