Skip to content

Commit

Permalink
增添mvp 示例代码”
Browse files Browse the repository at this point in the history
  • Loading branch information
zjlong committed Apr 19, 2016
1 parent cc5ab89 commit a0f7cc7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/matto/model/MainLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
public interface MainLogic extends MvpLogic<MainView> {

void switchNavigation(int id);

}
1 change: 1 addition & 0 deletions app/src/main/java/com/matto/model/MainLogicImpl.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.matto.model;

import com.matto.R;
import com.matto.ui.view.MainView;

/**
* author meikoz on 2016/4/19.
Expand Down
15 changes: 9 additions & 6 deletions app/src/main/java/com/matto/ui/activity/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.Fragment;
import android.view.View;

import com.common.model.control.LogicProxy;
import com.common.view.ui.BaseActivity;
import com.matto.R;
import com.matto.model.MainLogic;
import com.matto.ui.fragment.DiscoveryFragment;
import com.matto.ui.fragment.HomeFragment;
import com.matto.ui.fragment.ShowMeFragment;
import com.matto.ui.view.MainView;

Expand Down Expand Up @@ -42,20 +42,23 @@ protected void onInitView() {

@Override
public void switchHome() {
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout, new HomeFragment()).commit();
startFragment(new DiscoveryFragment());
}

@Override
public void switchDiscovery() {
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout, new DiscoveryFragment()).commit();
startFragment(new DiscoveryFragment());
}

@Override
public void switchShomeMe() {
startFragment(new ShowMeFragment());
}

void startFragment(Fragment fragment) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.frame_layout, new ShowMeFragment()).commit();
.replace(R.id.frame_layout, fragment)
.commit();
}


Expand Down

0 comments on commit a0f7cc7

Please sign in to comment.