forked from racofix/architecture-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
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
zjlong
committed
Apr 19, 2016
1 parent
5fda1ba
commit cc5ab89
Showing
19 changed files
with
275 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.matto.model; | ||
|
||
import com.common.model.annotation.Implement; | ||
import com.common.model.control.MvpLogic; | ||
import com.matto.ui.view.MainView; | ||
|
||
/** | ||
* author meikoz on 2016/4/19. | ||
* email [email protected] | ||
*/ | ||
@Implement(MainLogicImpl.class) | ||
public interface MainLogic extends MvpLogic<MainView> { | ||
|
||
void switchNavigation(int id); | ||
} |
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,35 @@ | ||
package com.matto.model; | ||
|
||
import com.matto.R; | ||
|
||
/** | ||
* author meikoz on 2016/4/19. | ||
* email [email protected] | ||
*/ | ||
public class MainLogicImpl implements MainLogic { | ||
|
||
MainView mMainView; | ||
|
||
@Override | ||
public void switchNavigation(int id) { | ||
|
||
switch (id) { | ||
case R.id.navigation_selection: | ||
mMainView.switchHome(); | ||
break; | ||
case R.id.navigation_discovery: | ||
mMainView.switchDiscovery(); | ||
break; | ||
case R.id.navigation_about: | ||
mMainView.switchShomeMe(); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
@Override | ||
public void attachView(MainView mvpView) { | ||
this.mMainView = mvpView; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,36 +1,37 @@ | ||
package com.matto.view.activity; | ||
package com.matto.ui.activity; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.EditText; | ||
|
||
import com.common.model.basic.ToastTip; | ||
import com.common.view.ui.BaseActivity; | ||
import com.common.view.widget.OnClickEvent; | ||
import com.matto.R; | ||
import com.common.model.control.LogicProxy; | ||
import com.matto.model.LoginLogic; | ||
import com.matto.ui.view.LoginView; | ||
|
||
import butterknife.Bind; | ||
import butterknife.OnClick; | ||
|
||
/** | ||
* author meikoz on 2016/4/13. | ||
* email [email protected] | ||
*/ | ||
public class LoginActivity extends BaseActivity implements LoginLogic.LoginView { | ||
public class LoginActivity extends BaseActivity implements LoginView { | ||
|
||
public static void start(Activity activity) { | ||
Intent intent = new Intent(activity, LoginActivity.class); | ||
activity.startActivity(intent); | ||
activity.finish(); | ||
} | ||
@Bind(R.id.edit_username) EditText mEditName; | ||
@Bind(R.id.edit_passwrod) EditText mEditPasswrod; | ||
@Bind(R.id.btn_login) Button mLogin; | ||
|
||
@Bind(R.id.edit_username) | ||
EditText mEditName; | ||
@Bind(R.id.edit_passwrod) | ||
EditText mEditPasswrod; | ||
|
||
LoginLogic mLoginLogic; | ||
public int i= 1; | ||
|
||
@Override | ||
protected int getLayoutResource() { | ||
|
@@ -40,27 +41,21 @@ protected int getLayoutResource() { | |
@Override | ||
protected void onInitView() { | ||
mLoginLogic = LogicProxy.getInstance().getBindViewProxy(LoginLogic.class, this); | ||
mLogin.setOnClickListener(new OnClickEvent() { | ||
@Override | ||
public void singleClick(View v) { | ||
Log.d("cs",i++ +""); | ||
// mLoginLogic.login("zhangsan", "123"); | ||
} | ||
}); | ||
} | ||
|
||
// @OnClick(R.id.btn_login) | ||
// void login() { | ||
// mLoginLogic.login("zhangsan", "123"); | ||
// } | ||
@OnClick(R.id.btn_login) | ||
void login() { | ||
mLoginLogic.login("zhangsan", "123"); | ||
} | ||
|
||
@Override | ||
public void onLoginSuccess() { | ||
Log.d("cs", "登录成功"); | ||
ToastTip.show("登录成功"); | ||
MainActivity.start(LoginActivity.this); | ||
} | ||
|
||
@Override | ||
public void onLoginFail() { | ||
Log.d("cs", "登录失败"); | ||
ToastTip.show("登录失败"); | ||
} | ||
} |
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,66 @@ | ||
package com.matto.ui.activity; | ||
|
||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
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; | ||
|
||
import butterknife.OnClick; | ||
|
||
|
||
public class MainActivity extends BaseActivity implements MainView { | ||
|
||
|
||
public static void start(Activity context) { | ||
Intent intent = new Intent(context, MainActivity.class); | ||
context.startActivity(intent); | ||
context.finish(); | ||
} | ||
|
||
MainLogic mainLogic; | ||
|
||
@Override | ||
protected int getLayoutResource() { | ||
return R.layout.activity_main; | ||
} | ||
|
||
@Override | ||
protected void onInitView() { | ||
if (mainLogic == null) | ||
mainLogic = LogicProxy.getInstance().getBindViewProxy(MainLogic.class, this); | ||
switchHome(); | ||
} | ||
|
||
@Override | ||
public void switchHome() { | ||
getSupportFragmentManager().beginTransaction() | ||
.replace(R.id.frame_layout, new HomeFragment()).commit(); | ||
} | ||
|
||
@Override | ||
public void switchDiscovery() { | ||
getSupportFragmentManager().beginTransaction() | ||
.replace(R.id.frame_layout, new DiscoveryFragment()).commit(); | ||
} | ||
|
||
@Override | ||
public void switchShomeMe() { | ||
getSupportFragmentManager().beginTransaction() | ||
.replace(R.id.frame_layout, new ShowMeFragment()).commit(); | ||
} | ||
|
||
|
||
@OnClick({R.id.navigation_selection, R.id.navigation_discovery, R.id.navigation_about}) | ||
void onClick(View view) { | ||
mainLogic.switchNavigation(view.getId()); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...m/matto/view/activity/SplashActivity.java → ...com/matto/ui/activity/SplashActivity.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
2 changes: 1 addition & 1 deletion
2
...a/com/matto/view/adapter/MainAdapter.java → ...ava/com/matto/ui/adapter/MainAdapter.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.matto.view.adapter; | ||
package com.matto.ui.adapter; | ||
|
||
import android.content.Context; | ||
|
||
|
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/matto/ui/fragment/DiscoveryFragment.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,20 @@ | ||
package com.matto.ui.fragment; | ||
|
||
import com.common.view.ui.BaseFragment; | ||
import com.matto.R; | ||
|
||
/** | ||
* author meikoz on 2016/4/19. | ||
* email [email protected] | ||
*/ | ||
public class DiscoveryFragment extends BaseFragment { | ||
@Override | ||
protected int getLayoutResource() { | ||
return R.layout.activity_login; | ||
} | ||
|
||
@Override | ||
protected void onInitData() { | ||
|
||
} | ||
} |
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,20 @@ | ||
package com.matto.ui.fragment; | ||
|
||
import com.common.view.ui.BaseFragment; | ||
import com.matto.R; | ||
|
||
/** | ||
* author meikoz on 2016/4/19. | ||
* email [email protected] | ||
*/ | ||
public class HomeFragment extends BaseFragment { | ||
@Override | ||
protected int getLayoutResource() { | ||
return R.layout.activity_spalsh; | ||
} | ||
|
||
@Override | ||
protected void onInitData() { | ||
|
||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/com/matto/ui/fragment/ShowMeFragment.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,20 @@ | ||
package com.matto.ui.fragment; | ||
|
||
import com.common.view.ui.BaseFragment; | ||
import com.matto.R; | ||
|
||
/** | ||
* author meikoz on 2016/4/19. | ||
* email [email protected] | ||
*/ | ||
public class ShowMeFragment extends BaseFragment { | ||
@Override | ||
protected int getLayoutResource() { | ||
return R.layout.activity_hosting; | ||
} | ||
|
||
@Override | ||
protected void onInitData() { | ||
|
||
} | ||
} |
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,11 @@ | ||
package com.matto.ui.view; | ||
|
||
/** | ||
* author meikoz on 2016/4/19. | ||
* email [email protected] | ||
*/ | ||
public interface LoginView { | ||
void onLoginSuccess(); | ||
|
||
void onLoginFail(); | ||
} |
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,13 @@ | ||
package com.matto.ui.view; | ||
|
||
/** | ||
* author meikoz on 2016/4/19. | ||
* email [email protected] | ||
*/ | ||
public interface MainView { | ||
void switchHome(); | ||
|
||
void switchDiscovery(); | ||
|
||
void switchShomeMe(); | ||
} |
Oops, something went wrong.