diff --git a/app/src/main/java/com/matto/model/MainLogic.java b/app/src/main/java/com/matto/model/MainLogic.java index c71cb74..bd22941 100644 --- a/app/src/main/java/com/matto/model/MainLogic.java +++ b/app/src/main/java/com/matto/model/MainLogic.java @@ -12,4 +12,5 @@ public interface MainLogic extends MvpLogic { void switchNavigation(int id); + } diff --git a/app/src/main/java/com/matto/model/MainLogicImpl.java b/app/src/main/java/com/matto/model/MainLogicImpl.java index 8687156..3369dda 100644 --- a/app/src/main/java/com/matto/model/MainLogicImpl.java +++ b/app/src/main/java/com/matto/model/MainLogicImpl.java @@ -1,6 +1,7 @@ package com.matto.model; import com.matto.R; +import com.matto.ui.view.MainView; /** * author meikoz on 2016/4/19. diff --git a/app/src/main/java/com/matto/ui/activity/MainActivity.java b/app/src/main/java/com/matto/ui/activity/MainActivity.java index 9d2c158..339b36a 100644 --- a/app/src/main/java/com/matto/ui/activity/MainActivity.java +++ b/app/src/main/java/com/matto/ui/activity/MainActivity.java @@ -3,6 +3,7 @@ import android.app.Activity; import android.content.Intent; +import android.support.v4.app.Fragment; import android.view.View; import com.common.model.control.LogicProxy; @@ -10,7 +11,6 @@ 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; @@ -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(); }