Blendle gastcollege
Jolanda Verhoef
Android Developer @ Blendle
Joep van der Heijden
Frontend Developer @ Blendle
Wat gaan we doen?
- Blendle
- Design Patterns
- Dependency Injection
- MVP
- ReactJS basics
- Van data naar HTML
- Data wijzigt, nieuwe render
- Animatie
MVP
It's all about intentions
Presenter
View
public interface LoginView extends MvpView {
void showLoginLoading();
void loginSucceeded();
void loginFailed();
}
public class LoginPresenter implements MvpPresenter<LoginView> {
public void cancel() {}
public void forgotPassword() {}
public void login(String username, String password) {}
}
Complex Example
Dependency Injection
met Dagger 2
In software engineering, dependency injection
is a software design pattern that implements
inversion of control for resolving dependencies.
Dependency injection means giving an object
its instance variables. Really. That's it.
~ Wikipedia
DataManager mDataManager;
Analytics mAnalytics;
Session mSessionl
KioskService mKioskService;
public KioskPresenter(DataManager dataManager,
Analytics analytics, Session session,
KioskService kioskService) {
mDataManager = dataManager;
mAnalytics = analytics;
mSession = session;
mKioskService = kioskService;
}
@Inject DataManager mDataManager;
@Inject Analytics mAnalytics;
@Inject Session mSession;
@Inject KioskService mKioskService;
public KioskPresenter(Context context) {
MyApp.get(context).getSessionComponent().inject(this);
}
@Module
public class SessionModule {
@Provides
public OkHttpClient provideHttpClient() {
return new OkHttpClient();
}
@Provides
public DataManager provideDataManager(client) {
return new DataManager(client);
}
DataManager mDataManager;
Analytics mAnalytics;
Session mSessionl
KioskService mKioskService;
public KioskPresenter(Context context) {
mDataManager = DataManager.getInstance();
mAnalytics = new Analytics(context);
mSession = Session.retrieveSession();
mKioskService = new KioskService(context);
}
Gastcollege HU
By Jolanda Verhoef
Gastcollege HU
- 1,075