- [Data Structures] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#data-structures)
- [Linked Lists] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#linked-lists)
- [Trees] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#trees)
- [Binary Trees] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#binary-trees)
- [Binary Search Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#binary-search-tree)
- [Red-Black Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#red-black-tree)
- [AVL Tree] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#avl-tree)
- [Tries] (https://gist.github.com/lawloretienne/6f7d7d92f72986f5ebd60f226d9044ee#tries)
This file contains hidden or 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
testLoginError() | |
testLoginSuccess() | |
testLoginWithoutStudentNameAndPassword() |
This file contains hidden or 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
inline fun<reified T:Activity>Context.startActivity() { | |
val intent = Intent(this, T:: class.java) | |
startActivity(intent) | |
} | |
startActivity<DetailActivity>() |
This file contains hidden or 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
## Note : | |
We will use MVP as default architecture cause it's easy to implement comparing to MVVM. | |
Instead we will implement some features with MVVM architecture. | |
## Why we need an Architecture ? | |
1. The Android API is tightly coupled. | |
2. Make the app easy to test (the must important part). | |
3. Make the app modular. | |
4. Make app change/fix easy. |
This file contains hidden or 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
# Package by features | |
The directory structure is the very first thing encountered by a programmer when browsing source code. Everything flows from it. Everything depends on it. It is clearly one of the most important aspects of your source code. | |
### Gains and Benefits | |
* By looking at the structure you can already tell what the app is all about (figure 1); | |
* Higher modularity; | |
* Easier code navigation; | |
* Higher level of abstraction; |
This file contains hidden or 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
mkdir alpha | |
cd alpha | |
mkdir data | |
printf 'a' > data/letter.txt | |
git init | |
git add data/letter.txt | |
printf '1234' > data/number.txt | |
git add data | |
printf '1' > data/number.txt | |
git add data |
This file contains hidden or 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
@Override | |
public void onError(Throwable e) { | |
getMvpView().hideProgressIndicator(); | |
if (e instanceof IOException || e instanceof HttpException) { | |
mDataManager.getProfiles().subscribe(new Action1<List<Profile>>() { | |
@Override | |
public void call(List<Profile> profiles) { | |
renderProfilesUi(profiles); |
This file contains hidden or 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
@Override | |
protected void onDestroy() { | |
super.onDestroy(); | |
if (mSubscription != null) mSubscription.unsubscribe(); | |
} |
This file contains hidden or 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 Observable<List<Profile>> reloadProfiles() { | |
return mJobAppApiService.getAllProfiles().subscribeOn(Schedulers.io()) | |
.concatMap(new Func1<List<Profile>, Observable<List<Profile>>>() { | |
@Override | |
public Observable<List<Profile>> call(List<Profile> profiles) { | |
return mRealmProfileRepo.setProfiles(profiles); | |
} | |
}); | |
} |
This file contains hidden or 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
//BasePresenter.java | |
public interface BasePresenter<V extends BaseView> { | |
/** | |
* Set or attach the view to this presenter | |
*/ | |
public void attachView(V view); | |
/** | |
* Will be called if the view has been destroyed. Typically this method will |