use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class MainFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ATE.apply(this, ATEUtil.getATEKey(getActivity()));
ButterKnife.bind(this, view);
if (Build.VERSION.SDK_INT < 21 && view.findViewById(R.id.status_bar) != null) {
view.findViewById(R.id.status_bar).setVisibility(View.GONE);
int statusBarHeight = DensityUtil.getStatusBarHeight(getContext());
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setPadding(0, statusBarHeight, 0, 0);
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
params.setScrollFlags(0);
toolbar.setLayoutParams(params);
}
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
switch(action) {
case Constants.NAVIGATE_ALLSONG:
ab.setTitle(R.string.library);
break;
case Constants.NAVIGATE_PLAYLIST_RECENTADD:
ab.setTitle(R.string.recent_add);
break;
case Constants.NAVIGATE_PLAYLIST_RECENTPLAY:
ab.setTitle(R.string.recent_play);
break;
case Constants.NAVIGATE_PLAYLIST_FAVOURATE:
ab.setTitle(R.string.favourate);
break;
}
tabLayout.setupWithViewPager(viewPager);
if (viewPager != null) {
setupViewPager(viewPager);
viewPager.setOffscreenPageLimit(2);
viewPager.setCurrentItem(mPreferences.getStartPageIndex());
}
}
use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class PlayRankingFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ATE.apply(this, ATEUtil.getATEKey(getActivity()));
if (Build.VERSION.SDK_INT < 21 && view.findViewById(R.id.status_bar) != null) {
view.findViewById(R.id.status_bar).setVisibility(View.GONE);
if (Build.VERSION.SDK_INT >= 19) {
int statusBarHeight = DensityUtil.getStatusBarHeight(getContext());
view.findViewById(R.id.toolbar).setPadding(0, statusBarHeight, 0, 0);
}
}
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(R.string.play_ranking);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(mAdapter);
mPresenter.subscribe();
subscribeMetaChangedEvent();
}
use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class FolderSongsFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
ATE.apply(this, ATEUtil.getATEKey(getActivity()));
if (Build.VERSION.SDK_INT < 21 && view.findViewById(R.id.status_bar) != null) {
view.findViewById(R.id.status_bar).setVisibility(View.GONE);
if (Build.VERSION.SDK_INT >= 19) {
int statusBarHeight = DensityUtil.getStatusBarHeight(getContext());
view.findViewById(R.id.toolbar).setPadding(0, statusBarHeight, 0, 0);
}
}
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
final ActionBar ab = ((AppCompatActivity) getActivity()).getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
ab.setTitle(R.string.folders);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(mAdapter);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST, true));
mPresenter.loadSongs(path);
subscribeMetaChangedEvent();
}
use of android.support.v7.app.AppCompatActivity in project ListenerMusicPlayer by hefuyicoder.
the class FolderSongsFragment method onCreate.
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
injectDependences();
mPresenter.attachView(this);
if (getArguments() != null) {
path = getArguments().getString(Constants.FOLDER_PATH);
}
mAdapter = new SongsListAdapter((AppCompatActivity) getActivity(), null, Constants.NAVIGATE_ALLSONG, true);
}
use of android.support.v7.app.AppCompatActivity in project Android-ObservableScrollView by ksoichiro.
the class FragmentActionBarControlListViewFragment method onUpOrCancelMotionEvent.
@Override
public void onUpOrCancelMotionEvent(ScrollState scrollState) {
AppCompatActivity activity = (AppCompatActivity) getActivity();
if (activity == null) {
return;
}
ActionBar ab = activity.getSupportActionBar();
if (ab == null) {
return;
}
if (scrollState == ScrollState.UP) {
if (ab.isShowing()) {
ab.hide();
}
} else if (scrollState == ScrollState.DOWN) {
if (!ab.isShowing()) {
ab.show();
}
}
}
Aggregations