Search in sources :

Example 1 with OrganizationService

use of com.meisolsson.githubsdk.service.organizations.OrganizationService in project gh4a by slapperwan.

the class UserFragment method loadOrganizationsIfUser.

private void loadOrganizationsIfUser(boolean force) {
    if (mUser.type() != UserType.User) {
        fillOrganizations(null);
        return;
    }
    final OrganizationService service = ServiceFactory.get(OrganizationService.class, force);
    ApiHelpers.PageIterator.toSingle(page -> mIsSelf ? service.getMyOrganizations(page) : service.getUserPublicOrganizations(mUser.login(), page)).compose(makeLoaderSingle(ID_LOADER_ORG_LIST, force)).subscribe(this::fillOrganizations, this::handleLoadFailure);
}
Also used : OrganizationService(com.meisolsson.githubsdk.service.organizations.OrganizationService)

Example 2 with OrganizationService

use of com.meisolsson.githubsdk.service.organizations.OrganizationService in project gh4a by slapperwan.

the class NewsFeedFactory method loadOrganizations.

private void loadOrganizations(boolean force) {
    final Gh4Application app = Gh4Application.get();
    final OrganizationService service = ServiceFactory.get(OrganizationService.class, force);
    mOrganizationSubscription = ApiHelpers.PageIterator.toSingle(page -> ApiHelpers.loginEquals(mUserLogin, app.getAuthLogin()) ? service.getMyOrganizations(page) : service.getUserPublicOrganizations(mUserLogin, page)).compose(mActivity.makeLoaderSingle(ID_LOADER_ORGS, force)).subscribe(result -> {
        mUserScopes = result.isEmpty() ? null : result;
        mActivity.supportInvalidateOptionsMenu();
    }, mActivity::handleLoadFailure);
}
Also used : OrganizationService(com.meisolsson.githubsdk.service.organizations.OrganizationService) Context(android.content.Context) ApiHelpers(com.gh4a.utils.ApiHelpers) OrganizationService(com.meisolsson.githubsdk.service.organizations.OrganizationService) LayoutInflater(android.view.LayoutInflater) Fragment(android.support.v4.app.Fragment) ImageView(android.widget.ImageView) StringRes(android.support.annotation.StringRes) PrivateEventListFragment(com.gh4a.fragment.PrivateEventListFragment) ViewGroup(android.view.ViewGroup) Spinner(android.widget.Spinner) Gravity(android.view.Gravity) User(com.meisolsson.githubsdk.model.User) List(java.util.List) Disposable(io.reactivex.disposables.Disposable) TextView(android.widget.TextView) BaseAdapter(android.widget.BaseAdapter) Gh4Application(com.gh4a.Gh4Application) AvatarHandler(com.gh4a.utils.AvatarHandler) Menu(android.view.Menu) R(com.gh4a.R) View(android.view.View) AdapterView(android.widget.AdapterView) ServiceFactory(com.gh4a.ServiceFactory) Gh4Application(com.gh4a.Gh4Application)

Aggregations

OrganizationService (com.meisolsson.githubsdk.service.organizations.OrganizationService)2 Context (android.content.Context)1 StringRes (android.support.annotation.StringRes)1 Fragment (android.support.v4.app.Fragment)1 Gravity (android.view.Gravity)1 LayoutInflater (android.view.LayoutInflater)1 Menu (android.view.Menu)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 AdapterView (android.widget.AdapterView)1 BaseAdapter (android.widget.BaseAdapter)1 ImageView (android.widget.ImageView)1 Spinner (android.widget.Spinner)1 TextView (android.widget.TextView)1 Gh4Application (com.gh4a.Gh4Application)1 R (com.gh4a.R)1 ServiceFactory (com.gh4a.ServiceFactory)1 PrivateEventListFragment (com.gh4a.fragment.PrivateEventListFragment)1 ApiHelpers (com.gh4a.utils.ApiHelpers)1 AvatarHandler (com.gh4a.utils.AvatarHandler)1