From a0f7cc7c539e11a56f8f3e6d19583bd56bd843d7 Mon Sep 17 00:00:00 2001 From: zjlong Date: Tue, 19 Apr 2016 10:34:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E6=B7=BBmvp=20=E7=A4=BA=E4=BE=8B?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/matto/model/MainLogic.java | 1 + .../main/java/com/matto/model/MainLogicImpl.java | 1 + .../java/com/matto/ui/activity/MainActivity.java | 15 +++++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) 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(); }