-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from naeemark/develop
Develop
- Loading branch information
Showing
55 changed files
with
1,470 additions
and
350 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
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/tline/android/app/view/BaseFragmentView.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,14 @@ | ||
package com.tline.android.app.view; | ||
|
||
/** | ||
* Created by Naeem(naeemark@gmail.com) | ||
* On 30/11/2017. | ||
* For TLine | ||
*/ | ||
|
||
public interface BaseFragmentView { | ||
|
||
void showLoading(); | ||
|
||
void hideLoading(); | ||
} |
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
4 changes: 2 additions & 2 deletions
4
...line/injection/TimelineViewComponent.java → ...vity/injection/TimelineViewComponent.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
33 changes: 33 additions & 0 deletions
33
.../main/java/com/tline/android/features/timeline/activity/injection/TimelineViewModule.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,33 @@ | ||
package com.tline.android.features.timeline.activity.injection; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
import com.tline.android.app.presenter.loader.PresenterFactory; | ||
import com.tline.android.features.timeline.activity.interactor.TimelineInteractor; | ||
import com.tline.android.features.timeline.activity.interactor.impl.TimelineInteractorImpl; | ||
import com.tline.android.features.timeline.activity.presenter.TimelinePresenter; | ||
import com.tline.android.features.timeline.activity.presenter.impl.TimelinePresenterImpl; | ||
import com.tline.android.utils.LocaleHelper; | ||
import com.tline.android.utils.PreferencesUtils; | ||
|
||
import dagger.Module; | ||
import dagger.Provides; | ||
|
||
@Module | ||
public final class TimelineViewModule { | ||
@Provides | ||
public TimelineInteractor provideInteractor(PreferencesUtils preferencesUtils, LocaleHelper localeHelper) { | ||
return new TimelineInteractorImpl(preferencesUtils, localeHelper); | ||
} | ||
|
||
@Provides | ||
public PresenterFactory<TimelinePresenter> providePresenterFactory(@NonNull final TimelineInteractor interactor) { | ||
return new PresenterFactory<TimelinePresenter>() { | ||
@NonNull | ||
@Override | ||
public TimelinePresenter create() { | ||
return new TimelinePresenterImpl(interactor); | ||
} | ||
}; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...main/java/com/tline/android/features/timeline/activity/interactor/TimelineInteractor.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,16 @@ | ||
package com.tline.android.features.timeline.activity.interactor; | ||
|
||
import android.app.Activity; | ||
|
||
import com.tline.android.app.interactor.BaseInteractor; | ||
|
||
public interface TimelineInteractor extends BaseInteractor { | ||
|
||
void saveSelectedTabIndex(int selectedTabIndex); | ||
|
||
int retrieveSelectedTabIndex(); | ||
|
||
void switchAppLocale(Activity activity); | ||
|
||
void invalidatePreference(); | ||
} |
45 changes: 45 additions & 0 deletions
45
.../com/tline/android/features/timeline/activity/interactor/impl/TimelineInteractorImpl.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,45 @@ | ||
package com.tline.android.features.timeline.activity.interactor.impl; | ||
|
||
import android.app.Activity; | ||
|
||
import javax.inject.Inject; | ||
|
||
import com.tline.android.app.interactor.impl.BaseInteractorImpl; | ||
import com.tline.android.features.timeline.activity.interactor.TimelineInteractor; | ||
import com.tline.android.utils.LocaleHelper; | ||
import com.tline.android.utils.PreferencesUtils; | ||
|
||
public final class TimelineInteractorImpl extends BaseInteractorImpl implements TimelineInteractor { | ||
|
||
private final PreferencesUtils mPreferencesUtils; | ||
private final LocaleHelper mLocaleHelper; | ||
|
||
@Inject | ||
public TimelineInteractorImpl(PreferencesUtils preferencesUtils, LocaleHelper localeHelper) { | ||
|
||
mPreferencesUtils = preferencesUtils; | ||
mLocaleHelper = localeHelper; | ||
} | ||
|
||
@Override | ||
public void saveSelectedTabIndex(int selectedTabIndex) { | ||
|
||
mPreferencesUtils.putInt(PreferencesUtils.PrefKeys.SELECTED_TAB_INDEX.name(), selectedTabIndex); | ||
} | ||
|
||
@Override | ||
public int retrieveSelectedTabIndex() { | ||
int index = mPreferencesUtils.getInt(PreferencesUtils.PrefKeys.SELECTED_TAB_INDEX.name()); | ||
return (index <= 0) ? 0 : index; | ||
} | ||
|
||
@Override | ||
public void switchAppLocale(Activity activity) { | ||
mLocaleHelper.switchLocale(activity); | ||
} | ||
|
||
@Override | ||
public void invalidatePreference() { | ||
mPreferencesUtils.clear(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...c/main/java/com/tline/android/features/timeline/activity/presenter/TimelinePresenter.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,15 @@ | ||
package com.tline.android.features.timeline.activity.presenter; | ||
|
||
import android.app.Activity; | ||
|
||
import com.tline.android.app.presenter.BasePresenter; | ||
import com.tline.android.features.timeline.activity.view.TimelineView; | ||
|
||
public interface TimelinePresenter extends BasePresenter<TimelineView> { | ||
|
||
void saveSelectedTabIndex(int selectedTabIndex); | ||
|
||
void logout(); | ||
|
||
void switchAppLocale(Activity activity); | ||
} |
63 changes: 63 additions & 0 deletions
63
...va/com/tline/android/features/timeline/activity/presenter/impl/TimelinePresenterImpl.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,63 @@ | ||
package com.tline.android.features.timeline.activity.presenter.impl; | ||
|
||
import android.app.Activity; | ||
import android.support.annotation.NonNull; | ||
|
||
import com.tline.android.app.presenter.impl.BasePresenterImpl; | ||
import com.tline.android.features.timeline.activity.presenter.TimelinePresenter; | ||
import com.tline.android.features.timeline.activity.view.TimelineView; | ||
import com.tline.android.features.timeline.activity.interactor.TimelineInteractor; | ||
|
||
import javax.inject.Inject; | ||
|
||
public final class TimelinePresenterImpl extends BasePresenterImpl<TimelineView> implements TimelinePresenter { | ||
/** | ||
* The interactor | ||
*/ | ||
@NonNull | ||
private final TimelineInteractor mInteractor; | ||
|
||
// The view is available using the mView variable | ||
|
||
@Inject | ||
public TimelinePresenterImpl(@NonNull TimelineInteractor interactor) { | ||
mInteractor = interactor; | ||
} | ||
|
||
@Override | ||
public void onStart(boolean viewCreated) { | ||
super.onStart(viewCreated); | ||
|
||
if (viewCreated) { | ||
initTimeline(); | ||
} | ||
} | ||
|
||
@Override | ||
public void saveSelectedTabIndex(int selectedTabIndex) { | ||
mInteractor.saveSelectedTabIndex(selectedTabIndex); | ||
} | ||
|
||
@Override | ||
public void logout() { | ||
assert mView != null; | ||
mView.logoutTwitter(); | ||
mInteractor.invalidatePreference(); | ||
mView.launchLoginActivity(); | ||
} | ||
|
||
@Override | ||
public void switchAppLocale(Activity activity) { | ||
mInteractor.switchAppLocale(activity); | ||
} | ||
|
||
|
||
private void initTimeline() { | ||
|
||
assert mView != null; | ||
mView.setSelectedNavItemId(mInteractor.retrieveSelectedTabIndex()); | ||
mView.showInitialFragment(); | ||
} | ||
|
||
|
||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/tline/android/features/timeline/activity/view/TimelineView.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,15 @@ | ||
package com.tline.android.features.timeline.activity.view; | ||
|
||
import android.support.annotation.UiThread; | ||
|
||
import com.tline.android.app.view.BaseView; | ||
|
||
@UiThread | ||
public interface TimelineView extends BaseView { | ||
|
||
void showInitialFragment(); | ||
|
||
void setSelectedNavItemId(int mSelectedNavItemId); | ||
|
||
void launchLoginActivity(); | ||
} |
Oops, something went wrong.