-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMainMVP.java
More file actions
81 lines (74 loc) · 2.44 KB
/
MainMVP.java
File metadata and controls
81 lines (74 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.tinmegali.mvp_tutorial;
import com.tinmegali.mvp_tutorial.modelos.Note;
/**
* ---------------------------------------------------
* Created by Tin Megali on 26/02/16.
* Project: MVP_Tutorial
* ---------------------------------------------------
* <a href="http://www.tinmegali.com">tinmegali.com</a>
* <a href="http://www.github.com/tinmegali>github</a>
*
* Aggregates all communication operations between MVP pattern layer:
* Model, View and Presenter
*
*
* Interface MVP guarda-chuva, contém todos as operações necessárias
* para funcionamento do padrão
*/
public interface MainMVP {
/**
* View mandatory methods. Available to Presenter
* Presenter -> View
*
* Métodos obrigatórios em View, disponíveis para Presenter
* Presenter -> View
*/
interface RequiredViewOps {
void showToast(String msg);
void showAlert(String msg);
// any other ops
// qualquer outra operação na UI
}
/**
* Operations offered from Presenter to View
* View -> Presenter
* operações oferecidas ao layer View para comunicação com Presenter
* View -> Presenter
*/
interface PresenterOps{
void onConfigurationChanged(RequiredViewOps view);
void onDestroy(boolean isChangingConfig);
void newNote(String textoNota);
void deleteNote(Note note);
// any other ops to be called from View
// qualquer outra operação a ser chamada pelo View
}
/**
* Operations offered from Presenter to Model
* Model -> Presenter
*
* operações oferecidas pelo layer Presenter para comunicações com Model
* Model -> Presenter
*/
interface RequiredPresenterOps {
void onNoteInserted(Note novaNote);
void onNoteRemoved(Note noteRemovida);
void onError(String errorMsg);
// Any other returning operation Model -> Presenter
// qualquer operação de retorno Model -> Presenter
}
/**
* Model operations offered to Presenter
* Presenter -> Model
*
* operações oferecidos pelo layer Model para comunicações com Presenter
* Presenter -> Model
*/
interface ModelOps {
void insertNote(Note note);
void removeNote(Note note);
void onDestroy();
// Any other data operation
// Qualquer operação referente à dados a ser chamado pelo Presenter
}
}