Search in sources :

Example 71 with AppCompatActivity

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());
    }
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) AppBarLayout(android.support.design.widget.AppBarLayout) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 72 with AppCompatActivity

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();
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ActionBar(android.support.v7.app.ActionBar)

Example 73 with AppCompatActivity

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();
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(io.hefuyi.listener.widget.DividerItemDecoration) ActionBar(android.support.v7.app.ActionBar)

Example 74 with AppCompatActivity

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);
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) SongsListAdapter(io.hefuyi.listener.ui.adapter.SongsListAdapter)

Example 75 with AppCompatActivity

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();
        }
    }
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) ActionBar(android.support.v7.app.ActionBar)

Aggregations

AppCompatActivity (android.support.v7.app.AppCompatActivity)99 View (android.view.View)43 ActionBar (android.support.v7.app.ActionBar)36 TextView (android.widget.TextView)28 RecyclerView (android.support.v7.widget.RecyclerView)21 ImageView (android.widget.ImageView)17 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)16 Toolbar (android.support.v7.widget.Toolbar)14 BindView (butterknife.BindView)11 Fragment (android.support.v4.app.Fragment)8 PopupMenu (android.support.v7.widget.PopupMenu)8 Transition (android.transition.Transition)7 MenuItem (android.view.MenuItem)7 Intent (android.content.Intent)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 TargetApi (android.annotation.TargetApi)5 Activity (android.app.Activity)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 Bundle (android.os.Bundle)4 FragmentManager (android.support.v4.app.FragmentManager)4