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);
}
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);
}
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);
}
Aggregations