本文整理汇总了Java中org.researchstack.backbone.ui.ViewTaskActivity类的典型用法代码示例。如果您正苦于以下问题:Java ViewTaskActivity类的具体用法?Java ViewTaskActivity怎么用?Java ViewTaskActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ViewTaskActivity类属于org.researchstack.backbone.ui包,在下文中一共展示了ViewTaskActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CHANGE_EMAIL && resultCode == RESULT_OK) {
TaskResult taskResult = (TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT);
StepResult stepResult = taskResult.getStepResult(OnboardingTask.SignUpStepIdentifier);
String newEmail = (String) stepResult.getResultForIdentifier(SignUpTask.ID_EMAIL);
String newPassword = (String) stepResult.getResultForIdentifier(SignUpTask.ID_PASSWORD);
// need to overwrite the values in the intent since they will be re-read in onDataReady
Intent intent = getIntent();
intent.putExtra(EXTRA_EMAIL, newEmail);
intent.putExtra(EXTRA_PASSWORD, newPassword);
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例2: onActivityResult
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
// if(requestCode == REQUEST_CONSENT && resultCode == RESULT_OK)
// {
// processConsentResult((TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT));
// }
// else
if(requestCode == REQUEST_YADL_FULL && resultCode == RESULT_OK) {
Log.i(LOG_TAG, "YADL FULL FINISHED");
processYADLFullResult((TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT));
}
else if(requestCode == REQUEST_YADL_SPOT && resultCode == RESULT_OK) {
Log.i(LOG_TAG, "YADL SPOT FINISHED");
}
else if(requestCode == REQUEST_PAM && resultCode == RESULT_OK) {
Log.i(LOG_TAG, "PAM FINISHED");
processPAMResult((TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT));
}
else if(requestCode == REQUEST_PAM_MULTIPLE && resultCode == RESULT_OK) {
Log.i(LOG_TAG, "PAM MULTIPLE FINISHED");
processPAMMultipleResult((TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT));
}
else if(requestCode == REQUEST_MEDL_FULL && resultCode == RESULT_OK) {
Log.i(LOG_TAG, "MEDL FULL FINISHED");
processMEDLFullResult((TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT));
}
else if(requestCode == REQUEST_MEDL_SPOT && resultCode == RESULT_OK) {
Log.i(LOG_TAG, "MEDL SPOT FINISHED");
}
}
示例3: launchYADLFull
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
private void launchYADLFull()
{
Log.i(LOG_TAG, "Launching YADL Full Assessment");
OrderedTask task = YADLFullAssessmentTask.create(YADL_FULL_ASSESSMENT, getResources().getString(R.string.yadl_json), this);
// Create an activity using the task and set a delegate.
Intent intent = ViewTaskActivity.newIntent(this, task);
startActivityForResult(intent, REQUEST_YADL_FULL);
}
示例4: launchMEDLFull
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
private void launchMEDLFull()
{
Log.i(LOG_TAG, "Launching MEDL Full Assessment");
OrderedTask task = MEDLFullAssessmentTask.create(MEDL_FULL_ASSESSMENT, getResources().getString(R.string.medl_json), this);
// Create an activity using the task and set a delegate.
Intent intent = ViewTaskActivity.newIntent(this, task);
startActivityForResult(intent, REQUEST_MEDL_FULL);
}
示例5: launchPAM
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
private void launchPAM()
{
Log.i(LOG_TAG, "Launching PAM");
OrderedTask task = PAMTask.create(PAM_ASSESSMENT, this);
// Create an activity using the task and set a delegate.
Intent intent = ViewTaskActivity.newIntent(this, task);
startActivityForResult(intent, REQUEST_PAM);
}
示例6: launchPAMMultiple
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
private void launchPAMMultiple()
{
Log.i(LOG_TAG, "Launching PAMMultiple");
PAMMultipleSelectionStep step = PAMMultipleSelectionStep.create(PAM_MULTIPLE_ASSESSMENT, this);
InstructionStep instructionStep = new InstructionStep("instruction", "PAM Multiple Completed", "Thanks for completing the PAM multiple step");
OrderedTask task = new OrderedTask(PAM_MULTIPLE_ASSESSMENT, step, instructionStep);
// Create an activity using the task and set a delegate.
Intent intent = ViewTaskActivity.newIntent(this, task);
startActivityForResult(intent, REQUEST_PAM_MULTIPLE);
}
示例7: launchText
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
private void launchText()
{
Log.i(LOG_TAG, "Launching PAMMultiple");
// public CTFTextVSRAssessmentStep(
// String identifier,
// String title,
// AnswerFormat answerFormat,
// RSXMultipleImageSelectionSurveyOptions options
// )
String title = "Below is a list of behaviors that people may have trouble controlling. Please select UP TO 4 of the ones that you have the most trouble controlling.";
Choice choice1 = new Choice("choice1", "choice1");
Choice choice2 = new Choice("choice2", "choice2");
AnswerFormat answerFormat = new ChoiceAnswerFormat(
AnswerFormat.ChoiceAnswerStyle.MultipleChoice,
new Choice("Eating\nunhealthy\nfood", "choice1"),
new Choice("Hair pulling /\nskin picking", "choice2"));
RSXMultipleImageSelectionSurveyOptions options = new RSXMultipleImageSelectionSurveyOptions();
options.setItemMinSpacing(32 * 2);
options.setItemsPerRow(2);
options.setSomethingSelectedButtonColor(ThemeUtils.getAccentColor(this));
options.setNothingSelectedButtonColor(ThemeUtils.getAccentColor(this));
options.setItemCellSelectedColor(ThemeUtils.getAccentColor(this));
CTFTextVSRAssessmentStep step = new CTFTextVSRAssessmentStep(PAM_MULTIPLE_ASSESSMENT, title, answerFormat, options);
// PAMMultipleSelectionStep step = PAMMultipleSelectionStep.create(PAM_MULTIPLE_ASSESSMENT, this);
OrderedTask task = new OrderedTask(PAM_MULTIPLE_ASSESSMENT, step);
// Create an activity using the task and set a delegate.
Intent intent = ViewTaskActivity.newIntent(this, task);
startActivityForResult(intent, REQUEST_PAM_MULTIPLE);
}
示例8: onActivityResult
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if(requestCode == REQUEST_FEEDBACK && resultCode == RESULT_OK)
{
TaskResult result = (TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT);
((MoleMapperDataProvider) DataProvider.getInstance()).uploadFeedback(this, result);
Toast.makeText(MoleLearnActivity.this, R.string.thanks_feedback, Toast.LENGTH_SHORT)
.show();
}
else
{
super.onActivityResult(requestCode, resultCode, data);
}
}
示例9: startMoleRemovalSurvey
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
private void startMoleRemovalSurvey(Mole mole)
{
InstructionStep firstStep = new InstructionStep("sitePhoto",
getString(R.string.biopsy_step_title),
getString(R.string.biopsy_step_text));
InstructionStep thankYouStep = new InstructionStep("thankYou",
getString(R.string.rss_thank_you),
getString(R.string.biopsy_thank_you_text));
// not great, but we need to pass the mole id into the task, using it as the identifier
OrderedTask task = new OrderedTask(String.valueOf(mole.id), firstStep, thankYouStep);
startActivityForResult(ViewTaskActivity.newIntent(BodyZoneActivity.this, task),
REQUEST_MOLE_REMOVAL);
}
示例10: setUpAdapter
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
private void setUpAdapter() {
unsubscribe();
recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(),
DividerItemDecoration.VERTICAL_LIST,
0,
false));
Observable.create(subscriber -> {
SchedulesAndTasksModel model = DataProvider.getInstance()
.loadTasksAndSchedules(getActivity());
subscriber.onNext(model);
})
.compose(ObservableUtils.applyDefault())
.map(o -> (SchedulesAndTasksModel) o)
.subscribe(model -> {
adapter = new TaskAdapter(model);
recyclerView.setAdapter(adapter);
subscription = adapter.getPublishSubject().subscribe(task -> {
Task newTask = DataProvider.getInstance().loadTask(getContext(), task);
if (newTask == null) {
Toast.makeText(getActivity(),
R.string.rss_local_error_load_task,
Toast.LENGTH_SHORT).show();
return;
}
startActivityForResult(ViewTaskActivity.newIntent(getContext(), newTask),
REQUEST_TASK);
});
});
}
示例11: onActivityResult
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_TASK) {
LogExt.d(getClass(), "Received task result from task activity");
TaskResult taskResult = (TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT);
StorageAccess.getInstance().getAppDatabase().saveTaskResult(taskResult);
DataProvider.getInstance().uploadTaskResult(getActivity(), taskResult);
setUpAdapter();
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例12: changeEmail
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
private void changeEmail() {
Step signUpStep = new Step(OnboardingTask.SignUpStepIdentifier);
signUpStep.setStepTitle(R.string.rss_sign_up);
signUpStep.setStepLayoutClass(SignUpStepLayout.class);
signUpStep.setTitle(getString(R.string.rss_change_email));
Intent intent = new Intent(this, ViewTaskActivity.class);
intent.putExtra(ViewTaskActivity.EXTRA_TASK, new OrderedTask(CHANGE_EMAIL_ID, signUpStep));
startActivityForResult(intent, REQUEST_CHANGE_EMAIL);
}
示例13: onActivityResult
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_CODE_INITIAL_TASK) {
if (resultCode == RESULT_OK) {
TaskResult taskResult = (TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT);
StorageAccess.getInstance().getAppDatabase().saveTaskResult(taskResult);
DataProvider.getInstance().processInitialTaskResult(this, taskResult);
} else {
failedToFinishInitialTask = true;
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
示例14: onDataReady
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
@Override
public void onDataReady() {
super.onDataReady();
// Check if we need to run initial Task
if (!failedToFinishInitialTask) {
Observable.defer(() -> {
UiThreadContext.assertBackgroundThread();
if (!DataProvider.getInstance().isSignedIn(MainActivity.this)) {
LogExt.d(getClass(), "User not signed in, skipping initial survey");
return Observable.empty();
}
TaskResult result = StorageAccess.getInstance()
.getAppDatabase()
.loadLatestTaskResult(TaskProvider.TASK_ID_INITIAL);
return Observable.just(result == null);
}).compose(ObservableUtils.applyDefault()).subscribe(needsInitialSurvey -> {
if (needsInitialSurvey) {
Task task = TaskProvider.getInstance().get(TaskProvider.TASK_ID_INITIAL);
if (task == null) {
LogExt.d(getClass(), "No initial survey provided in TaskProvider");
return;
}
Intent intent = ViewTaskActivity.newIntent(this, task);
startActivityForResult(intent, MainActivity.REQUEST_CODE_INITIAL_TASK);
}
});
}
}
示例15: onActivityResult
import org.researchstack.backbone.ui.ViewTaskActivity; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == OnboardingActivity.REQUEST_CODE_SIGN_IN && resultCode == RESULT_OK) {
TaskResult result = (TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT);
String email = (String) result.getStepResult(OnboardingTask.SignInStepIdentifier)
.getResultForIdentifier(SignInTask.ID_EMAIL);
String password = (String) result.getStepResult(OnboardingTask.SignInStepIdentifier)
.getResultForIdentifier(SignInTask.ID_PASSWORD);
if (email != null && password != null) {
Intent intent = new Intent(this, EmailVerificationActivity.class);
intent.putExtra(EmailVerificationActivity.EXTRA_EMAIL, email);
intent.putExtra(EmailVerificationActivity.EXTRA_PASSWORD, password);
startActivity(intent);
}
} else if (requestCode == SignUpEligibleStepLayout.CONSENT_REQUEST && resultCode == RESULT_OK) {
TaskResult consentResult = (TaskResult) data.getSerializableExtra(ViewTaskActivity.EXTRA_TASK_RESULT);
Observable.fromCallable(() -> {
// Upload consent object
DataProvider.getInstance().uploadConsent(this, consentResult);
return null;
}).compose(ObservableUtils.applyDefault()).subscribe();
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}