Skip to content

Commit

Permalink
修复因为重命名而引起的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kale committed Apr 9, 2016
1 parent 8f7d1c5 commit 5f01d8d
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 21 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ repositories {
compile 'com.github.tianzhijiexian:UiBlock:[Latest release](https://github.com/tianzhijiexian/UIBlock/releases)'

## 准备工作
在项目中的BaseActivity(如果没有请自行建立),让它实现`UIBlockActivity`接口:
在项目中的BaseActivity(如果没有请自行建立),让它实现`UiBlockActivity`接口:

```JAVA
public class BaseActivity extends AppCompatActivity implements UIBlockActivity {
public class BaseActivity extends AppCompatActivity implements UiBlockActivity {

private UiBlockManager mUiBlockManager;

Expand Down Expand Up @@ -114,7 +114,7 @@ public class BaseActivity extends AppCompatActivity implements UIBlockActivity {

1.建立UiBlock:
```JAVA
public class TextUIBlock extends UiBlock{
public class TextUiBlock extends UiBlock{

@Override
public int getLayoutResId() {
Expand All @@ -135,7 +135,7 @@ public class TextUIBlock extends UiBlock{
}
```
2.挂载到Activity上:
在activity中,通过`getUiBlockManager().add(R.id.share_linearlayout, new TextUIBlock())`把UiBlock绑定到activity上。
在activity中,通过`getUiBlockManager().add(R.id.share_linearlayout, new TextUiBlock())`把UiBlock绑定到activity上。

**2. 复用UI区块**

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/kale/ui/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import android.support.v7.app.AppCompatActivity;

import kale.ui.uiblock.UiBlockManager;
import kale.ui.uiblock.iface.UIBlockActivity;
import kale.ui.uiblock.iface.UiBlockActivity;

/**
* @author Kale
* @date 2016/4/8
*/
public class BaseActivity extends AppCompatActivity implements UIBlockActivity {
public class BaseActivity extends AppCompatActivity implements UiBlockActivity {

private UiBlockManager mUiBlockManager;

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/kale/ui/DemoActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import kale.ui.block.DemoVpUiBlock;
import kale.ui.uiblock.UiBlock;
import kale.ui.uiblock.adapter.CommonUiBlockPagerAdapter;
import kale.ui.uiblock.adapter.UIBlockPagerAdapter;
import kale.ui.uiblock.adapter.UiBlockPagerAdapter;

public class DemoActivity extends BaseActivity {

Expand Down Expand Up @@ -69,7 +69,7 @@ public void onTheBottomBtnClick() {

private PagerAdapter getAdapter(boolean b) {
if (b) {
return new UIBlockPagerAdapter(getUiBlockManager()) {
return new UiBlockPagerAdapter(getUiBlockManager()) {

@Override
public Object getItemType(int position) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import android.view.View;

import kale.ui.uiblock.iface.Lifecycle;
import kale.ui.uiblock.iface.UIBlockActivity;
import kale.ui.uiblock.iface.UiBlockActivity;
import lombok.Getter;
import lombok.Setter;

Expand Down Expand Up @@ -73,7 +73,7 @@ protected View resetRootView(View oldRootView, Activity activity) {
}

public UiBlockManager getUiBlockManager() {
return ((UIBlockActivity) activity).getUiBlockManager();
return ((UiBlockActivity) activity).getUiBlockManager();
}

public void onVisibleToUser(boolean isVisible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @date 2015/11/27
* 如果在viewpager中的UIBlock有数据源,那么可以用这个做处理
*/
public abstract class CommonUiBlockPagerAdapter<T> extends UIBlockPagerAdapter {
public abstract class CommonUiBlockPagerAdapter<T> extends UiBlockPagerAdapter {

@Setter @Getter
private List<T> data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
* @date 2015/11/21
* 这个类不关心缓存,仅仅做一般的操作。比如得到view,返回view
*/
public abstract class UIBlockPagerAdapter extends BasePagerAdapter<UiBlock> {
public abstract class UiBlockPagerAdapter extends BasePagerAdapter<UiBlock> {

private final UiBlockManager mManager;

private boolean mIsLazy = false;

public UIBlockPagerAdapter(UiBlockManager manager) {
public UiBlockPagerAdapter(UiBlockManager manager) {
this(manager, false);
}

public UIBlockPagerAdapter(UiBlockManager manager, boolean isLazy) {
public UiBlockPagerAdapter(UiBlockManager manager, boolean isLazy) {
super();
mManager = manager;
mIsLazy = isLazy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import android.os.Bundle;

import kale.ui.uiblock.UiBlockManager;
import kale.ui.uiblock.iface.UIBlockActivity;
import kale.ui.uiblock.iface.UiBlockActivity;

/**
* @author Kale
Expand All @@ -18,13 +18,13 @@
@Aspect
public class UiBlockActivityAspect {

@Pointcut("execution(* kale.ui.uiblock.iface.UIBlockActivity..on*(..))")
@Pointcut("execution(* kale.ui.uiblock.iface.UiBlockActivity..on*(..))")
public void onXXX() {
}

@After("onXXX()")
public void callManagerMethods(JoinPoint point) {
UIBlockActivity activity = (UIBlockActivity) point.getThis();
UiBlockActivity activity = (UiBlockActivity) point.getThis();
UiBlockManager manager = activity.getUiBlockManager();
if (manager == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import kale.ui.uiblock.UiBlockManager;

/**
* @author kale
* @date 2015/10/8
* @author Kale
* @date 2016/4/9
*/
public interface UIBlockActivity extends Lifecycle {
public interface UiBlockActivity extends Lifecycle{

UiBlockManager getUiBlockManager();

}

0 comments on commit 5f01d8d

Please sign in to comment.