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
apply plugin: 'checkstyle' | |
dependencies { | |
checkstyle 'com.puppycrawl.tools:checkstyle:7.7' | |
} | |
def checkstyleConfigDir = "$project.rootDir/config"; | |
def reportsDir = "$project.buildDir/reports" | |
check.dependsOn 'checkstyle' |
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
dependencies { | |
compile 'com.github.amitkma:stitch-lib:1.0.1' | |
annotationProcessor 'com.github.amitkma:compiler:1.0.1' | |
} |
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
class ExampleClass { | |
public ExampleClass() { | |
} | |
@CallOnAnyThread | |
public Bitmap getBitmapFromURL(String src) { | |
try { | |
URL url = new URL(src); | |
HttpURLConnection connection = (HttpURLConnection) url.openConnection(); |
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
// If getting instance in other class. | |
ExampleClassStitch exampleClassStitch = ExampleClassStitch.stitch(new ExampleClass()); | |
// Or if getting instance in same class | |
ExampleClassStitch exampleClassStitch = ExampleClassStitch.stitch(this);. |
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
exampleClassStitch.getBitmapFromURL("https://image.freepik.com/free-vector/android-boot-logo_634639.jpg"); |
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
/** | |
* Base presenter which act as a Presenter in Model-View-Presenter | |
* This interface will be extended by more specific interface which will be implemented | |
* in any class which want to act as a MVP presenter | |
*/ | |
public interface MvpPresenter { | |
} |
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
/** | |
* Base view which act as a View in Model-View-Presenter. | |
* This interface will be extended by more specific interface and which will be implemented | |
* in any class that want to act as a MVP view. | |
*/ | |
public interface MvpView<T extends MvpPresenter> { | |
void setPresenter(T presenter); | |
void showProgress(); |
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
public interface MainContract { | |
interface View extends MvpView<Presenter> { | |
void updateView(List<Note> items); | |
} | |
interface Presenter extends MvpPresenter{ | |
void addNote(String note); |
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
public interface NoteDetailsContract { | |
interface View extends MvpView<Presenter> { | |
void showNote(Note note); | |
} | |
interface Presenter extends MvpPresenter{ | |
void loadNoteById(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
public class MainActivity extends AppCompatActivity implements MainContract.View, View.OnClickListener { | |
// Contract Presenter | |
private MainContract.Presenter mPresenter; | |
...... | |
// Other fields | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
OlderNewer