Search in sources :

Example 1 with AudientApplication

use of com.xinshang.audient.AudientApplication in project Audient by komamj.

the class MainActivity method onPermissonGranted.

@Override
protected void onPermissonGranted() {
    setSupportActionBar(mToolbar);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    mDrawerLayout.addDrawerListener(toggle);
    toggle.syncState();
    mNavigationView.setNavigationItemSelectedListener(this);
    View headerView = mNavigationView.getHeaderView(0);
    mName = headerView.findViewById(R.id.tv_user_name);
    mUserImage = headerView.findViewById(R.id.iv_user);
    mBlurImage = headerView.findViewById(R.id.iv_blur);
    // inject presenter layer
    DaggerMainComponent.builder().audientRepositoryComponent(((AudientApplication) getApplication()).getRepositoryComponent()).mainPresenterModule(new MainPresenterModule(this)).build().inject(this);
    List<Fragment> fragments = new ArrayList<>();
    fragments.add(MineFragment.newInstance());
    fragments.add(PlaylistFragment.newInstance());
    fragments.add(TopListFragment.newInstance());
    AudientAdapter audientAdapter = new AudientAdapter(getSupportFragmentManager(), fragments, mPageTitles);
    mViewPager.setAdapter(audientAdapter);
    mViewPager.setCurrentItem(1);
    mViewPager.setOffscreenPageLimit(2);
    mTabLayout.setupWithViewPager(mViewPager);
}
Also used : ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) ArrayList(java.util.ArrayList) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) PlaylistFragment(com.xinshang.audient.playlist.PlaylistFragment) TopListFragment(com.xinshang.audient.toplist.TopListFragment) FeedbackDialogFragment(com.xinshang.audient.feedback.FeedbackDialogFragment) Fragment(android.support.v4.app.Fragment) MineFragment(com.xinshang.audient.mine.MineFragment) AudientApplication(com.xinshang.audient.AudientApplication)

Example 2 with AudientApplication

use of com.xinshang.audient.AudientApplication in project Audient by komamj.

the class MyFavoritesActivity method onPermissonGranted.

@Override
protected void onPermissonGranted() {
    mToolbar.setTitle(R.string.add_to_favorites);
    setSupportActionBar(mToolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    Audient audient = getIntent().getParcelableExtra(Constants.KEY_AUDIENT);
    MyFavoritesFragment fragment = (MyFavoritesFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
    if (fragment == null) {
        fragment = MyFavoritesFragment.newInstance(audient);
        getSupportFragmentManager().beginTransaction().add(R.id.content_main, fragment).commit();
    }
    // inject presenter
    DaggerMyFavoritesPresenterComponent.builder().audientRepositoryComponent(((AudientApplication) getApplication()).getRepositoryComponent()).myFavoritesPresenterModule(new MyFavoritesPresenterModule(fragment)).build().inject(this);
}
Also used : Audient(com.xinshang.audient.model.entities.Audient) AudientApplication(com.xinshang.audient.AudientApplication)

Example 3 with AudientApplication

use of com.xinshang.audient.AudientApplication in project Audient by komamj.

the class FavoriteDetailActivity method onPermissonGranted.

@Override
protected void onPermissonGranted() {
    Favorite favorite = getIntent().getParcelableExtra(Constants.KEY_FAVORITE);
    mToolbar.setTitle(favorite.favoriteName);
    setSupportActionBar(mToolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_back);
    }
    GlideApp.with(this).asBitmap().transition(new BitmapTransitionOptions()).placeholder(R.drawable.ic_album).load(favorite.coverImageUrl).into(mAlbum);
    mFab.setImageResource(R.drawable.ic_unfavorite);
    FavoriteDetailFragment fragment = (FavoriteDetailFragment) getSupportFragmentManager().findFragmentById(R.id.content_main);
    if (fragment == null) {
        fragment = FavoriteDetailFragment.newInstance(favorite);
        getSupportFragmentManager().beginTransaction().add(R.id.content_main, fragment).commit();
    }
    DaggerFavoriteDetailComponent.builder().audientRepositoryComponent(((AudientApplication) getApplication()).getRepositoryComponent()).favoriteDetailPresenterModule(new FavoriteDetailPresenterModule(fragment)).build().inject(this);
}
Also used : Favorite(com.xinshang.audient.model.entities.Favorite) BitmapTransitionOptions(com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions) AudientApplication(com.xinshang.audient.AudientApplication)

Aggregations

AudientApplication (com.xinshang.audient.AudientApplication)3 NavigationView (android.support.design.widget.NavigationView)1 Fragment (android.support.v4.app.Fragment)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 BitmapTransitionOptions (com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions)1 FeedbackDialogFragment (com.xinshang.audient.feedback.FeedbackDialogFragment)1 MineFragment (com.xinshang.audient.mine.MineFragment)1 Audient (com.xinshang.audient.model.entities.Audient)1 Favorite (com.xinshang.audient.model.entities.Favorite)1 PlaylistFragment (com.xinshang.audient.playlist.PlaylistFragment)1 TopListFragment (com.xinshang.audient.toplist.TopListFragment)1 ArrayList (java.util.ArrayList)1