Search in sources :

Example 91 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project Douya by DreaminginCodeZH.

the class ItemCollectionFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    //activity.setTitle(getTitle());
    activity.setSupportActionBar(mToolbar);
    // As in https://developer.android.com/guide/topics/ui/controls/radiobutton.html .
    View.OnClickListener collectionStateButtonOnClickListener = new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (!((RadioButton) view).isChecked()) {
                return;
            }
            ItemCollectionState oldCollectionState = mCollectionState;
            switch(view.getId()) {
                case R.id.todo:
                    mCollectionState = ItemCollectionState.TODO;
                    break;
                case R.id.doing:
                    mCollectionState = ItemCollectionState.DOING;
                    break;
                case R.id.done:
                    mCollectionState = ItemCollectionState.DONE;
                    break;
            }
            if (mCollectionState != oldCollectionState) {
                onCollectionStateChanged();
            }
        }
    };
    mTodoButton.setOnClickListener(collectionStateButtonOnClickListener);
    mDoingButton.setOnClickListener(collectionStateButtonOnClickListener);
    mDoneButton.setOnClickListener(collectionStateButtonOnClickListener);
    mRatingBar.setOnRatingChangeListener(new MaterialRatingBar.OnRatingChangeListener() {

        @Override
        public void onRatingChanged(MaterialRatingBar ratingBar, float rating) {
            mRatingHintText.setText(DoubanUtils.getRatingHint((int) rating, mRatingHintText.getContext()));
        }
    });
}
Also used : MaterialRatingBar(me.zhanghai.android.materialratingbar.MaterialRatingBar) AppCompatActivity(android.support.v7.app.AppCompatActivity) BindView(butterknife.BindView) TextView(android.widget.TextView) View(android.view.View) ItemCollectionState(me.zhanghai.android.douya.network.api.info.frodo.ItemCollectionState)

Example 92 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project Douya by DreaminginCodeZH.

the class BroadcastListActivityFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setTitle(getTitle());
    activity.setSupportActionBar(mToolbar);
    TransitionUtils.setupTransitionOnActivityCreated(this);
    if (savedInstanceState == null) {
        FragmentUtils.add(BroadcastListFragment.newInstance(mUserIdOrUid, mTopic), this, R.id.broadcast_list_fragment);
    }
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity)

Example 93 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project Douya by DreaminginCodeZH.

the class HomeFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    mTabAdapter = new TabFragmentPagerAdapter(this);
    mTabAdapter.addTab(new TabFragmentPagerAdapter.FragmentCreator() {

        @Override
        public Fragment createFragment() {
            return HomeBroadcastListFragment.newInstance();
        }
    }, getString(R.string.home_broadcast));
    mTabAdapter.addTab(new TabFragmentPagerAdapter.FragmentCreator() {

        @Override
        public Fragment createFragment() {
            return NotYetImplementedFragment.newInstance();
        }
    }, getString(R.string.home_discover));
    mTabAdapter.addTab(new TabFragmentPagerAdapter.FragmentCreator() {

        @Override
        public Fragment createFragment() {
            return NotYetImplementedFragment.newInstance();
        }
    }, getString(R.string.home_online));
    mViewPager.setOffscreenPageLimit(mTabAdapter.getCount() - 1);
    mViewPager.setAdapter(mTabAdapter);
    mTabLayout.setupWithViewPager(mViewPager);
}
Also used : AppCompatActivity(android.support.v7.app.AppCompatActivity) TabFragmentPagerAdapter(me.zhanghai.android.douya.ui.TabFragmentPagerAdapter) Fragment(android.support.v4.app.Fragment) NotYetImplementedFragment(me.zhanghai.android.douya.ui.NotYetImplementedFragment) HomeBroadcastListFragment(me.zhanghai.android.douya.broadcast.ui.HomeBroadcastListFragment)

Example 94 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project Shuttle by timusus.

the class DetailFragment method onClick.

@Override
public void onClick(View v) {
    switch(v.getId()) {
        case R.id.fab:
            if (albumArtist != null) {
                MusicUtils.shuffleAll(getActivity(), albumArtist.getSongsObservable());
            } else if (album != null) {
                MusicUtils.shuffleAll(getActivity(), album.getSongsObservable());
            } else if (genre != null) {
                MusicUtils.shuffleAll(getActivity(), genre.getSongsObservable(getContext()));
            } else if (playlist != null) {
                MusicUtils.shuffleAll(getActivity(), playlist.getSongsObservable(getContext()));
            }
            break;
        case R.id.btn_overflow:
            final PopupMenu menu = new PopupMenu(getActivity(), v);
            if (album != null) {
                MenuUtils.addAlbumMenuOptions(getActivity(), menu);
                MenuUtils.addClickHandler((AppCompatActivity) getActivity(), menu, album);
                menu.getMenu().add(ALBUM_FRAGMENT_GROUP_ID, VIEW_INFO, Menu.NONE, R.string.info);
            } else if (albumArtist != null) {
                MenuUtils.addAlbumArtistMenuOptions(getActivity(), menu);
                MenuUtils.addClickHandler((AppCompatActivity) getActivity(), menu, albumArtist);
                menu.getMenu().add(ALBUM_FRAGMENT_GROUP_ID, VIEW_INFO, Menu.NONE, R.string.info);
            } else if (genre != null) {
            } else if (playlist != null) {
                MenuUtils.addPlaylistMenuOptions(menu, playlist);
                //Remove the delete menu option, since we're looking at the playlist we would delete.
                if (menu.getMenu().findItem(MusicUtils.PlaylistMenuOrder.DELETE_PLAYLIST) != null) {
                    menu.getMenu().removeItem(MusicUtils.PlaylistMenuOrder.DELETE_PLAYLIST);
                }
                MenuUtils.addClickHandler(getActivity(), menu, playlist, (materialDialog, dialogAction) -> {
                    //The user might have changed the playlist name
                    lineOne.setText(playlist.name);
                }, (materialDialog, dialogAction) -> {
                    //If the user clicked 'edit', they've probably set a new 'week' range. Restart the loader.
                    refreshAdapterItems();
                });
            }
            menu.show();
            break;
    }
}
Also used : ModalMultiSelectorCallback(com.bignerdranch.android.multiselector.ModalMultiSelectorCallback) R(com.simplecity.amp_library.R) Genre(com.simplecity.amp_library.model.Genre) Bundle(android.os.Bundle) SongView(com.simplecity.amp_library.ui.modelviews.SongView) CrashlyticsCore(com.crashlytics.android.core.CrashlyticsCore) PlaylistUtils(com.simplecity.amp_library.utils.PlaylistUtils) Uri(android.net.Uri) FrameLayout(android.widget.FrameLayout) ImageView(android.widget.ImageView) AndroidSchedulers(rx.android.schedulers.AndroidSchedulers) Random(java.util.Random) ItemAdapter(com.simplecity.amp_library.ui.adapters.ItemAdapter) ColorStateList(android.content.res.ColorStateList) Song(com.simplecity.amp_library.model.Song) Priority(com.bumptech.glide.Priority) RequestManager(com.bumptech.glide.RequestManager) HorizontalAlbumView(com.simplecity.amp_library.ui.modelviews.HorizontalAlbumView) MediaStore(android.provider.MediaStore) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) MenuUtils(com.simplecity.amp_library.utils.MenuUtils) Schedulers(rx.schedulers.Schedulers) View(android.view.View) DetailAdapter(com.simplecity.amp_library.ui.adapters.DetailAdapter) ResourceUtils(com.simplecity.amp_library.utils.ResourceUtils) ViewCompat(android.support.v4.view.ViewCompat) Transition(android.transition.Transition) PreferenceManager(android.preference.PreferenceManager) ItemTouchHelperCallback(com.simplecity.amp_library.ui.recyclerview.ItemTouchHelperCallback) FloatingActionButton(android.support.design.widget.FloatingActionButton) SortManager(com.simplecity.amp_library.utils.SortManager) ActionMode(android.support.v7.view.ActionMode) Playlist(com.simplecity.amp_library.model.Playlist) MainActivity(com.simplecity.amp_library.ui.activities.MainActivity) ObjectAnimator(android.animation.ObjectAnimator) IntentFilter(android.content.IntentFilter) PopupMenu(android.support.v7.widget.PopupMenu) SubMenu(android.view.SubMenu) BroadcastReceiver(android.content.BroadcastReceiver) AppCompatActivity(android.support.v7.app.AppCompatActivity) ViewGroup(android.view.ViewGroup) BaseAdaptableItem(com.simplecity.amp_library.ui.modelviews.BaseAdaptableItem) NonScrollImageButton(com.simplecity.amp_library.ui.views.NonScrollImageButton) Serializable(java.io.Serializable) MusicUtils(com.simplecity.amp_library.utils.MusicUtils) List(java.util.List) TextView(android.widget.TextView) PermissionUtils(com.simplecity.amp_library.utils.PermissionUtils) GlideUtils(com.simplecity.amp_library.glide.utils.GlideUtils) AdaptableItem(com.simplecity.amp_library.model.AdaptableItem) Subscription(rx.Subscription) Context(android.content.Context) Album(com.simplecity.amp_library.model.Album) Stream(com.annimon.stream.Stream) EmptyView(com.simplecity.amp_library.ui.modelviews.EmptyView) DrawableUtils(com.simplecity.amp_library.utils.DrawableUtils) Intent(android.content.Intent) StringUtils(com.simplecity.amp_library.utils.StringUtils) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) Observable(rx.Observable) ThemeUtils(com.simplecity.amp_library.utils.ThemeUtils) ColorUtils(com.simplecity.amp_library.utils.ColorUtils) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) DiskCacheStrategy(com.bumptech.glide.load.engine.DiskCacheStrategy) Menu(android.view.Menu) AnimatorSet(android.animation.AnimatorSet) WeakReference(java.lang.ref.WeakReference) ShuttleUtils(com.simplecity.amp_library.utils.ShuttleUtils) SharedElementCallback(android.support.v4.app.SharedElementCallback) AlwaysCrossFade(com.simplecity.amp_library.glide.utils.AlwaysCrossFade) ViewType(com.simplecity.amp_library.ui.modelviews.ViewType) Collectors(com.annimon.stream.Collectors) LayoutInflater(android.view.LayoutInflater) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DiscNumberView(com.simplecity.amp_library.ui.modelviews.DiscNumberView) DialogUtils(com.simplecity.amp_library.utils.DialogUtils) TimeUnit(java.util.concurrent.TimeUnit) CompositeSubscription(rx.subscriptions.CompositeSubscription) RecyclerView(android.support.v7.widget.RecyclerView) BlacklistHelper(com.simplecity.amp_library.sql.databases.BlacklistHelper) Glide(com.bumptech.glide.Glide) SharedPreferences(android.content.SharedPreferences) HorizontalRecyclerView(com.simplecity.amp_library.ui.modelviews.HorizontalRecyclerView) OvershootInterpolator(android.view.animation.OvershootInterpolator) MultiSelector(com.bignerdranch.android.multiselector.MultiSelector) ComparisonUtils(com.simplecity.amp_library.utils.ComparisonUtils) ViewTreeObserver(android.view.ViewTreeObserver) DataManager(com.simplecity.amp_library.utils.DataManager) AlbumArtist(com.simplecity.amp_library.model.AlbumArtist) Operators(com.simplecity.amp_library.utils.Operators) Collections(java.util.Collections) ContentUris(android.content.ContentUris) AppCompatActivity(android.support.v7.app.AppCompatActivity) PopupMenu(android.support.v7.widget.PopupMenu)

Example 95 with AppCompatActivity

use of android.support.v7.app.AppCompatActivity in project Shuttle by timusus.

the class SongFragment method onOverflowClick.

@Override
public void onOverflowClick(View v, int position, final Song song) {
    PopupMenu menu = new PopupMenu(SongFragment.this.getActivity(), v);
    MenuUtils.addSongMenuOptions(getActivity(), menu);
    MenuUtils.addClickHandler((AppCompatActivity) getActivity(), menu, song, item -> {
        switch(item.getItemId()) {
            case BLACKLIST:
                {
                    BlacklistHelper.addToBlacklist(song);
                    return true;
                }
        }
        return false;
    });
    menu.show();
}
Also used : PopupMenu(android.support.v7.widget.PopupMenu)

Aggregations

AppCompatActivity (android.support.v7.app.AppCompatActivity)85 View (android.view.View)36 ActionBar (android.support.v7.app.ActionBar)32 TextView (android.widget.TextView)22 RecyclerView (android.support.v7.widget.RecyclerView)18 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)16 ImageView (android.widget.ImageView)16 Toolbar (android.support.v7.widget.Toolbar)12 Fragment (android.support.v4.app.Fragment)8 PopupMenu (android.support.v7.widget.PopupMenu)8 Intent (android.content.Intent)6 FragmentTransaction (android.support.v4.app.FragmentTransaction)6 Transition (android.transition.Transition)6 MenuItem (android.view.MenuItem)6 TargetApi (android.annotation.TargetApi)5 Activity (android.app.Activity)4 ColorDrawable (android.graphics.drawable.ColorDrawable)4 FragmentManager (android.support.v4.app.FragmentManager)4 PopupMenu (android.widget.PopupMenu)4 BindView (butterknife.BindView)4