Search in sources :

Example 1 with Favorite

use of com.instructure.canvasapi2.models.Favorite in project instructure-android by instructure.

the class HelpActivity method setupListeners.

private void setupListeners() {
    mSearchGuides.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // Search guides
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(Const.CANVAS_USER_GUIDES));
            startActivity(intent);
        }
    });
    mReportProblem.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ZendeskDialogStyled dialog = new ZendeskDialogStyled();
            // set the cached user so the dialog can use the cached user's email address
            User user = new User();
            user.setPrimaryEmail(mEmailAddress);
            ApiPrefs.setUser(user);
            dialog.setArguments(ZendeskDialogStyled.createBundle(false, true));
            dialog.show(getSupportFragmentManager(), ZendeskDialogStyled.TAG);
        }
    });
    mRequestFeature.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // let the user open their favorite mail client
            Intent intent = populateMailIntent(getString(R.string.featureSubject), getString(R.string.understandRequest), false);
            startActivity(Intent.createChooser(intent, getString(R.string.sendMail)));
        }
    });
    mShowLove.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Utils.goToAppStore(AppType.PARENT, HelpActivity.this);
        }
    });
    mOpenSource.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            startActivity(new Intent(HelpActivity.this, OssLicensesMenuActivity.class));
        }
    });
}
Also used : ZendeskDialogStyled(com.instructure.loginapi.login.api.zendesk.utilities.ZendeskDialogStyled) User(com.instructure.canvasapi2.models.User) Intent(android.content.Intent) View(android.view.View)

Example 2 with Favorite

use of com.instructure.canvasapi2.models.Favorite in project instructure-android by instructure.

the class CourseManager_Test method removeCourseFromFavorites.

public static void removeCourseFromFavorites(long courseId, StatusCallback<Favorite> callback) {
    // TODO:
    Response response = new Response.Builder().request(new Request.Builder().url("https://test.com").build()).code(200).message("favorite" + " " + courseId).protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "favorite".getBytes())).addHeader("content-type", "application/json").build();
    Favorite favorite = new Favorite();
    retrofit2.Response<Favorite> response1 = retrofit2.Response.success(favorite, response);
    callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
Also used : GradingPeriodResponse(com.instructure.canvasapi2.models.GradingPeriodResponse) Response(okhttp3.Response) Favorite(com.instructure.canvasapi2.models.Favorite) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) Request(okhttp3.Request)

Example 3 with Favorite

use of com.instructure.canvasapi2.models.Favorite in project instructure-android by instructure.

the class CourseManager method addCourseToFavorites.

public static void addCourseToFavorites(long courseId, StatusCallback<Favorite> callback, boolean forceNetwork) {
    if (isTesting() || mTesting) {
        CourseManager_Test.addCourseToFavorites(courseId, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
        CourseAPI.addCourseToFavorites(courseId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 4 with Favorite

use of com.instructure.canvasapi2.models.Favorite in project instructure-android by instructure.

the class CourseManager method removeCourseFromFavorites.

public static void removeCourseFromFavorites(long courseId, StatusCallback<Favorite> callback, boolean forceNetwork) {
    if (isTesting() || mTesting) {
        CourseManager_Test.removeCourseFromFavorites(courseId, callback);
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).withForceReadFromNetwork(forceNetwork).build();
        CourseAPI.removeCourseFromFavorites(courseId, adapter, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 5 with Favorite

use of com.instructure.canvasapi2.models.Favorite in project instructure-android by instructure.

the class GroupManager method addGroupToFavorites.

public static void addGroupToFavorites(long groupId, StatusCallback<Favorite> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        final RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
        final RestBuilder adapter = new RestBuilder(callback);
        GroupAPI.addGroupToFavorites(adapter, callback, params, groupId);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)4 RestParams (com.instructure.canvasapi2.builders.RestParams)4 Favorite (com.instructure.canvasapi2.models.Favorite)2 GradingPeriodResponse (com.instructure.canvasapi2.models.GradingPeriodResponse)2 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)2 Request (okhttp3.Request)2 Response (okhttp3.Response)2 Intent (android.content.Intent)1 View (android.view.View)1 User (com.instructure.canvasapi2.models.User)1 ZendeskDialogStyled (com.instructure.loginapi.login.api.zendesk.utilities.ZendeskDialogStyled)1