Search in sources :

Example 1 with HummingbirdApi

use of tr.bcxip.hummingbird.api.HummingbirdApi in project Hummingbird-for-Android by xiprox.

the class FavoriteAnimeFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = getActivity();
    api = new HummingbirdApi(context);
    prefMan = new PrefManager(context);
    try {
        parent = (ProfileFragment) getFragmentManager().findFragmentByTag(ProfileFragment.FRAGMENT_TAG_PROFILE);
    } catch (Exception e) {
    /* empty */
    }
}
Also used : HummingbirdApi(tr.bcxip.hummingbird.api.HummingbirdApi) PrefManager(tr.bcxip.hummingbird.managers.PrefManager)

Example 2 with HummingbirdApi

use of tr.bcxip.hummingbird.api.HummingbirdApi in project Hummingbird-for-Android by xiprox.

the class TimelineFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = getActivity();
    api = new HummingbirdApi(context);
    prefMan = new PrefManager(context);
}
Also used : HummingbirdApi(tr.bcxip.hummingbird.api.HummingbirdApi) PrefManager(tr.bcxip.hummingbird.managers.PrefManager)

Example 3 with HummingbirdApi

use of tr.bcxip.hummingbird.api.HummingbirdApi in project Hummingbird-for-Android by xiprox.

the class UserInfoFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = getActivity();
    api = new HummingbirdApi(context);
    prefMan = new PrefManager(context);
    setHasOptionsMenu(true);
}
Also used : HummingbirdApi(tr.bcxip.hummingbird.api.HummingbirdApi) PrefManager(tr.bcxip.hummingbird.managers.PrefManager)

Example 4 with HummingbirdApi

use of tr.bcxip.hummingbird.api.HummingbirdApi in project Hummingbird-for-Android by xiprox.

the class AnimeDetailsActivity method onCreate.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    Transition sharedElem = TransitionInflater.from(this).inflateTransition(R.transition.move_scale_transition);
    getWindow().setSharedElementEnterTransition(sharedElem);
    getWindow().setSharedElementExitTransition(sharedElem);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_anime_details);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    mActionBar = getSupportActionBar();
    api = new HummingbirdApi(this);
    prefMan = new PrefManager(this);
    mActionBar.setDisplayHomeAsUpEnabled(true);
    anime = (Anime) getIntent().getSerializableExtra(ARG_ANIME_OBJ);
    ANIME_ID = getIntent().getStringExtra(ARG_ID);
    if (savedInstanceState != null) {
        Anime savedAnime = (Anime) savedInstanceState.getSerializable(STATE_ANIME);
        if (savedAnime != null)
            anime = savedAnime;
        LibraryEntry savedLibraryEntry = (LibraryEntry) savedInstanceState.getSerializable(STATE_LIBRARY_ENTRY);
        if (savedLibraryEntry != null)
            libraryEntry = savedLibraryEntry;
    }
    mActionBarBackgroundDrawable = new ColorDrawable(darkMutedColor != 0 ? darkMutedColor : getResources().getColor(R.color.neutral_darker));
    mActionBarBackgroundDrawable.setAlpha(0);
    toolbar.setBackgroundDrawable(mActionBarBackgroundDrawable);
    mActionButton = (FloatingActionButton) findViewById(R.id.fab);
    mQuickReturnView = toolbar;
    mPlaceholderView = findViewById(R.id.placeholder);
    mObservableScrollView = (ObservableScrollView) findViewById(R.id.anime_details_scroll_view);
    mObservableScrollView.setCallbacks(this);
    mObservableScrollView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            onScrollChanged(mObservableScrollView.getScrollY());
            mMaxScrollY = mObservableScrollView.computeVerticalScrollRange() - mObservableScrollView.getHeight();
            mQuickReturnHeight = mQuickReturnView.getHeight();
            int headerHeight = mHeaderImage.getHeight();
            if (!firstGlobalLayoutPerformed && headerHeight != 0) {
                updateHeaderHeight(headerHeight);
                firstGlobalLayoutPerformed = true;
            }
        }
    });
    mContentsHolder = (LinearLayout) findViewById(R.id.anime_details_content_holder);
    mInfoHolder = (FrameLayout) findViewById(R.id.anime_details_info_holder);
    mMoreInfoHolder = (LinearLayout) findViewById(R.id.anime_details_more_info_holder);
    mLibraryInfoHolder = (LinearLayout) findViewById(R.id.anime_details_library_info_holder);
    mHeaderHolder = (FrameLayout) findViewById(R.id.anime_details_header_holder);
    mHeaderImage = (ImageView) findViewById(R.id.anime_details_header);
    mCoverHolder = (FrameLayout) findViewById(R.id.anime_details_cover_image_holder);
    mCoverImage = (ImageView) findViewById(R.id.anime_details_cover_image);
    mTitle = (TextView) findViewById(R.id.anime_details_title);
    mType = (TextView) findViewById(R.id.anime_details_type);
    mGenre = (TextView) findViewById(R.id.anime_details_genres);
    mEpisodeCount = (TextView) findViewById(R.id.anime_details_episode_count);
    mEpisodeLength = (TextView) findViewById(R.id.anime_details_episode_duration);
    mAgeRating = (TextView) findViewById(R.id.anime_details_age_rating);
    mAired = (TextView) findViewById(R.id.anime_details_aired);
    mCommunityRating = (TextView) findViewById(R.id.anime_details_community_rating);
    mSynopsisHolder = (LinearLayout) findViewById(R.id.anime_details_synopsis_holder);
    mSynopsis = (TextView) findViewById(R.id.anime_details_synopsis);
    mMoreSimilarAnime = (LinearLayout) findViewById(R.id.anime_details_more_similar_anime);
    mLibraryProgressBar = (ProgressBar) findViewById(R.id.anime_details_library_progress_bar);
    mStatusSpinner = (Spinner) findViewById(R.id.anime_details_status_spinner);
    mEpisodesHolder = (LinearLayout) findViewById(R.id.anime_details_library_episodes_holder);
    mEpisodes = (TextView) findViewById(R.id.anime_details_library_episodes);
    mRewatching = (SwitchCompat) findViewById(R.id.anime_details_library_rewatching);
    mRewatchedTimesHolder = (LinearLayout) findViewById(R.id.anime_details_library_rewatched_holder);
    mRewatchedTimes = (TextView) findViewById(R.id.anime_details_library_rewatched);
    mPrivate = (SwitchCompat) findViewById(R.id.anime_details_library_private);
    mRatingBar = (RatingBar) findViewById(R.id.anime_details_library_rating_advanced);
    mSimpleRatingView = (SimpleRatingView) findViewById(R.id.anime_details_library_rating_simple);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ViewOutlineProvider infoOutlineProvider = new ViewOutlineProvider() {

            @Override
            public void getOutline(View view, Outline outline) {
                outline.setRect(0, Utils.dpToPx(AnimeDetailsActivity.this, getResources().getDimension(R.dimen.offset_details_info_card)), view.getWidth(), view.getHeight());
            }
        };
        mInfoHolder.setOutlineProvider(infoOutlineProvider);
    }
    if (anime != null) {
        displayAnimeInfo();
        if (libraryEntry == null)
            new LibraryEntryTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        else
            displayLibraryElements();
    } else
        new AnimeInfoTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, true);
}
Also used : LibraryEntry(tr.bcxip.hummingbird.api.objects.LibraryEntry) HummingbirdApi(tr.bcxip.hummingbird.api.HummingbirdApi) Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) ImageView(android.widget.ImageView) ObservableScrollView(tr.bcxip.hummingbird.widget.ObservableScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) SimpleRatingView(tr.xip.widget.simpleratingview.SimpleRatingView) TextView(android.widget.TextView) PrefManager(tr.bcxip.hummingbird.managers.PrefManager) Anime(tr.bcxip.hummingbird.api.objects.Anime) ColorDrawable(android.graphics.drawable.ColorDrawable) Transition(android.transition.Transition) ViewTreeObserver(android.view.ViewTreeObserver) TargetApi(android.annotation.TargetApi)

Example 5 with HummingbirdApi

use of tr.bcxip.hummingbird.api.HummingbirdApi in project Hummingbird-for-Android by xiprox.

the class AnimeSearchActivity method onCreate.

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    overridePendingTransition(R.anim.fade_in_quick, R.anim.nothing);
    setContentView(R.layout.activity_anime_search);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        getWindow().setStatusBarColor(getResources().getColor(R.color.apptheme_white_status_bar));
    api = new HummingbirdApi(this);
    mResultsRecycler = (RecyclerView) findViewById(R.id.search_results);
    mErrorText = (TextView) findViewById(R.id.search_error_text);
    mFlipper = (ViewFlipper) findViewById(R.id.search_flipper);
    mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
    mLayoutManager = new LinearLayoutManager(this);
    mResultsRecycler.setLayoutManager(mLayoutManager);
    mResultsRecycler.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL_LIST));
    SearchView searchView = (SearchView) findViewById(R.id.search_view);
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            searchFromScratch(query);
            return false;
        }

        @Override
        public boolean onQueryTextChange(String query) {
            searchInCurrentDataSet(query);
            return false;
        }
    });
}
Also used : SearchView(android.support.v7.widget.SearchView) HummingbirdApi(tr.bcxip.hummingbird.api.HummingbirdApi) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) TargetApi(android.annotation.TargetApi)

Aggregations

HummingbirdApi (tr.bcxip.hummingbird.api.HummingbirdApi)9 PrefManager (tr.bcxip.hummingbird.managers.PrefManager)8 TargetApi (android.annotation.TargetApi)2 View (android.view.View)2 TextView (android.widget.TextView)2 SharedPreferences (android.content.SharedPreferences)1 Outline (android.graphics.Outline)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 SearchView (android.support.v7.widget.SearchView)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 Transition (android.transition.Transition)1 ViewOutlineProvider (android.view.ViewOutlineProvider)1 ViewTreeObserver (android.view.ViewTreeObserver)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 Anime (tr.bcxip.hummingbird.api.objects.Anime)1 LibraryEntry (tr.bcxip.hummingbird.api.objects.LibraryEntry)1 ObservableScrollView (tr.bcxip.hummingbird.widget.ObservableScrollView)1