Search in sources :

Example 1 with GetProfileFormDescriptionTask

use of org.edx.mobile.user.GetProfileFormDescriptionTask in project edx-app-android by edx.

the class EditUserProfileFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRetainInstance(true);
    setHasOptionsMenu(true);
    EventBus.getDefault().register(this);
    final Activity activity = getActivity();
    final TaskMessageCallback mCallback = activity instanceof TaskMessageCallback ? (TaskMessageCallback) activity : null;
    getAccountCall = userService.getAccount(username);
    getAccountCall.enqueue(new AccountDataUpdatedCallback(activity, username, // Disable default loading indicator, we have our own
    null, mCallback, CallTrigger.LOADING_CACHED));
    getProfileFormDescriptionTask = new GetProfileFormDescriptionTask(activity) {

        @Override
        protected void onSuccess(@NonNull FormDescription formDescription) throws Exception {
            EditUserProfileFragment.this.formDescription = formDescription;
            if (null != viewHolder) {
                setData(account, formDescription);
            }
        }
    };
    getProfileFormDescriptionTask.setTaskProcessCallback(null);
    getProfileFormDescriptionTask.execute();
}
Also used : AccountDataUpdatedCallback(org.edx.mobile.user.UserAPI.AccountDataUpdatedCallback) Activity(android.app.Activity) GetProfileFormDescriptionTask(org.edx.mobile.user.GetProfileFormDescriptionTask) FormDescription(org.edx.mobile.user.FormDescription) InvalidLocaleException(org.edx.mobile.util.InvalidLocaleException) TaskMessageCallback(org.edx.mobile.view.common.TaskMessageCallback)

Aggregations

Activity (android.app.Activity)1 FormDescription (org.edx.mobile.user.FormDescription)1 GetProfileFormDescriptionTask (org.edx.mobile.user.GetProfileFormDescriptionTask)1 AccountDataUpdatedCallback (org.edx.mobile.user.UserAPI.AccountDataUpdatedCallback)1 InvalidLocaleException (org.edx.mobile.util.InvalidLocaleException)1 TaskMessageCallback (org.edx.mobile.view.common.TaskMessageCallback)1