Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added user type selection activity and presenter
- Loading branch information
Showing
10 changed files
with
169 additions
and
48 deletions.
There are no files selected for viewing
31 changes: 0 additions & 31 deletions
31
app/src/main/java/foodrev/org/foodrev/domain/interactors/impl/SampleInteractorImpl.java
This file was deleted.
Oops, something went wrong.
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
17 changes: 17 additions & 0 deletions
17
app/src/main/java/foodrev/org/foodrev/presentation/presenters/UserTypePresenter.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,17 @@ | ||
package foodrev.org.foodrev.presentation.presenters; | ||
|
||
import foodrev.org.foodrev.presentation.presenters.base.BasePresenter; | ||
import foodrev.org.foodrev.presentation.ui.BaseView; | ||
|
||
/** | ||
* Created by darver on 5/15/17. | ||
*/ | ||
|
||
public interface UserTypePresenter extends BasePresenter<UserTypePresenter.View> { | ||
interface View extends BaseView { | ||
void goToCoordinatorMode(); | ||
void goToDriverMode(); | ||
} | ||
void coordinatorSelected(); | ||
void driverSelected(); | ||
} |
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
61 changes: 61 additions & 0 deletions
61
...src/main/java/foodrev/org/foodrev/presentation/presenters/impl/UserTypePresenterImpl.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,61 @@ | ||
package foodrev.org.foodrev.presentation.presenters.impl; | ||
|
||
import foodrev.org.foodrev.presentation.presenters.UserTypePresenter; | ||
|
||
/** | ||
* Created by darver on 5/15/17. | ||
*/ | ||
|
||
public class UserTypePresenterImpl implements UserTypePresenter { | ||
private UserTypePresenter.View mView; | ||
|
||
@Override | ||
public void attachView(View view) { | ||
mView = view; | ||
} | ||
|
||
@Override | ||
public void coordinatorSelected() { | ||
// Do some checking to see if the authenticated user is able to be coordinator | ||
|
||
mView.goToCoordinatorMode(); | ||
} | ||
|
||
@Override | ||
public void driverSelected() { | ||
// Look for driver associated with auth hash | ||
|
||
mView.goToDriverMode(); | ||
} | ||
|
||
@Override | ||
public void detachView() { | ||
mView = null; | ||
} | ||
|
||
@Override | ||
public void resume() { | ||
|
||
} | ||
|
||
@Override | ||
public void pause() { | ||
|
||
} | ||
|
||
@Override | ||
public void stop() { | ||
|
||
} | ||
|
||
@Override | ||
public void destroy() { | ||
|
||
} | ||
|
||
@Override | ||
public void onError(String message) { | ||
|
||
} | ||
|
||
} |
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
63 changes: 62 additions & 1 deletion
63
app/src/main/java/foodrev/org/foodrev/presentation/ui/activities/UserTypeActivity.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 |
---|---|---|
@@ -1,15 +1,76 @@ | ||
package foodrev.org.foodrev.presentation.ui.activities; | ||
|
||
import android.content.Intent; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
|
||
import foodrev.org.foodrev.R; | ||
import foodrev.org.foodrev.presentation.presenters.UserTypePresenter; | ||
import foodrev.org.foodrev.presentation.presenters.impl.UserTypePresenterImpl; | ||
import foodrev.org.foodrev.presentation.ui.activities.rapidprototype.DriverMode.DriverModeActivity; | ||
|
||
public class UserTypeActivity extends AppCompatActivity { | ||
public class UserTypeActivity extends AppCompatActivity implements UserTypePresenter.View, View.OnClickListener { | ||
private UserTypePresenter mPresenter; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_user_type); | ||
attachPresenter(); | ||
attachButtons(); | ||
} | ||
|
||
public void attachPresenter() { | ||
mPresenter = (UserTypePresenter) getLastCustomNonConfigurationInstance(); | ||
if (mPresenter == null) { | ||
mPresenter = new UserTypePresenterImpl(); | ||
} | ||
mPresenter.attachView(this); | ||
} | ||
|
||
|
||
|
||
private void attachButtons() { | ||
findViewById(R.id.select_type_coordinator_button).setOnClickListener(this); | ||
findViewById(R.id.select_type_driver_button).setOnClickListener(this); | ||
|
||
} | ||
|
||
@Override | ||
public void onClick(View view) { | ||
int buttonId = view.getId(); | ||
if (buttonId == R.id.select_type_coordinator_button) { | ||
mPresenter.coordinatorSelected(); | ||
} else if (buttonId == R.id.select_type_driver_button) { | ||
mPresenter.driverSelected(); | ||
} | ||
} | ||
|
||
@Override | ||
public void goToCoordinatorMode() { | ||
startActivity(new Intent(this, MainActivity.class)); | ||
// finish(); | ||
} | ||
|
||
@Override | ||
public void goToDriverMode() { | ||
startActivity(new Intent(this, DriverModeActivity.class)); | ||
// finish(); | ||
} | ||
|
||
@Override | ||
public void showProgressDialog() { | ||
|
||
} | ||
|
||
@Override | ||
public void hideProgressDialog() { | ||
|
||
} | ||
|
||
@Override | ||
public void showError(String message) { | ||
|
||
} | ||
} |
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