Search in sources :

Example 11 with ActionBar

use of com.actionbarsherlock.app.ActionBar in project howabout-android by recomio.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    categoryStrings = getResources().getStringArray(R.array.category_list);
    musicPlaylistTitle = getResources().getString(R.string.title_activity_music_playlist);
    exit = getResources().getString(R.string.exit);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setDisplayShowTitleEnabled(false);
    // dropdown menu in actionBar.
    final SpinnerAdapter spinnerAdapter = ArrayAdapter.createFromResource(this, R.array.category_list, android.R.layout.simple_list_item_1);
    actionBar.setListNavigationCallbacks(spinnerAdapter, new HowaboutDropdownNavigationListener());
    // set framgents.
    adultCategoryWrapFragment = new AdultCategoryWrapFragment();
    Bundle adultCategoryWrapFragmentBundle = new Bundle();
    adultCategoryWrapFragmentBundle.putString("category", "adult");
    adultCategoryWrapFragment.setArguments(adultCategoryWrapFragmentBundle);
    musicCategoryWrapFragment = new MusicCategoryWrapFragment();
    Bundle musicCategoryWrapFragmentBundle = new Bundle();
    musicCategoryWrapFragmentBundle.putString("category", "music");
    musicCategoryWrapFragment.setArguments(musicCategoryWrapFragmentBundle);
    setAdsContainer(R.id.adView);
}
Also used : SpinnerAdapter(android.widget.SpinnerAdapter) MusicCategoryWrapFragment(io.recom.howabout.category.music.fragment.MusicCategoryWrapFragment) Bundle(android.os.Bundle) AdultCategoryWrapFragment(io.recom.howabout.category.adult.fragment.AdultCategoryWrapFragment) ActionBar(com.actionbarsherlock.app.ActionBar)

Example 12 with ActionBar

use of com.actionbarsherlock.app.ActionBar in project howabout-android by recomio.

the class ShowImageActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    Bundle bundle = getIntent().getExtras();
    pHash = bundle.getString("pHash");
    limit = bundle.getInt("limit");
    clusteredImagesRequest = new ClusteredImagesRequest(pHash, limit);
}
Also used : Bundle(android.os.Bundle) ClusteredImagesRequest(io.recom.howabout.category.adult.net.ClusteredImagesRequest) ActionBar(com.actionbarsherlock.app.ActionBar)

Example 13 with ActionBar

use of com.actionbarsherlock.app.ActionBar in project howabout-android by recomio.

the class MusicPlaylistActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    imageLoader = ImageLoader.getInstance();
    final ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    setAdsContainer(R.id.adView);
    HowaboutApplication application = (HowaboutApplication) getApplication();
    playlistAdapter = application.getPlaylistAdapter();
    if (MusicPlayerService.isLoading()) {
        loadingProgressBar.setVisibility(View.VISIBLE);
        playPauseToggleButton.setVisibility(View.GONE);
    } else {
        if (MusicPlayerService.isPlaying()) {
            playPauseToggleButton.setImageDrawable(pauseIcon);
        } else {
            playPauseToggleButton.setImageDrawable(playIcon);
        }
        loadingProgressBar.setVisibility(View.GONE);
        playPauseToggleButton.setVisibility(View.VISIBLE);
    }
    listView.setAdapter(playlistAdapter);
    playlistAdapter.registerDataSetObserver(new DataSetObserver() {

        @Override
        public void onChanged() {
            try {
                Track track = playlistAdapter.getCurrentItem();
                actionBar.setTitle(track.getTrackTitle());
                actionBar.setSubtitle(track.getArtistName());
                if (MusicPlayerService.isLoading()) {
                    loadingProgressBar.setVisibility(View.VISIBLE);
                    playPauseToggleButton.setVisibility(View.GONE);
                } else {
                    if (MusicPlayerService.isPlaying()) {
                        playPauseToggleButton.setImageDrawable(pauseIcon);
                    } else {
                        playPauseToggleButton.setImageDrawable(playIcon);
                    }
                    loadingProgressBar.setVisibility(View.GONE);
                    playPauseToggleButton.setVisibility(View.VISIBLE);
                }
                imageLoader.displayImage(track.getThumbnailUrl(), songImageView, new ImageLoadingListener() {

                    @Override
                    public void onLoadingStarted(String imageUri, View view) {
                    }

                    @Override
                    public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
                    }

                    @Override
                    public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                    }

                    @Override
                    public void onLoadingCancelled(String imageUri, View view) {
                    }
                });
                String lyrics = playlistAdapter.getCurrentLyrics();
                if (lyrics == null) {
                    lyricsScrollView.setVisibility(View.GONE);
                    lyricsTextView.setText("");
                } else {
                    lyricsScrollView.setVisibility(View.VISIBLE);
                    lyricsTextView.setText(lyrics);
                }
                listView.invalidate();
            } catch (Exception e) {
            }
        }

        @Override
        public void onInvalidated() {
        }
    });
    playlistAdapter.notifyDataSetChanged();
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            playlistAdapter.play(position);
            playlistAdapter.notifyDataSetChanged();
        }
    });
    listView.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            playlistAdapter.remove(position);
            return true;
        }
    });
    playPauseToggleButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            playlistAdapter.playPauseToggle();
            if (MusicPlayerService.isPlaying()) {
                playPauseToggleButton.setImageDrawable(pauseIcon);
            } else {
                playPauseToggleButton.setImageDrawable(playIcon);
            }
        }
    });
    prevButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            playlistAdapter.playPrev();
        }
    });
    nextButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            playlistAdapter.playNext();
        }
    });
    UpdateCurrentPositionTask updateCurrentPositionTask = new UpdateCurrentPositionTask();
    updateCurrentPositionTimer.scheduleAtFixedRate(updateCurrentPositionTask, 0, 1000);
}
Also used : ImageLoadingListener(com.nostra13.universalimageloader.core.assist.ImageLoadingListener) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) HowaboutApplication(io.recom.howabout.HowaboutApplication) DataSetObserver(android.database.DataSetObserver) ContentView(roboguice.inject.ContentView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) InjectView(roboguice.inject.InjectView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) ListView(android.widget.ListView) OnItemLongClickListener(android.widget.AdapterView.OnItemLongClickListener) Bitmap(android.graphics.Bitmap) OnClickListener(android.view.View.OnClickListener) ActionBar(com.actionbarsherlock.app.ActionBar) Track(io.recom.howabout.category.music.model.Track)

Example 14 with ActionBar

use of com.actionbarsherlock.app.ActionBar in project howabout-android by recomio.

the class RecommendedTrackListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Bundle bundle = getIntent().getExtras();
    trackId = bundle.getString("trackId");
    trackTitle = bundle.getString("trackTitle");
    artistName = bundle.getString("artistName");
    thumbnailUrl = bundle.getString("thumbnailUrl");
    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(trackTitle);
    actionBar.setSubtitle(artistName);
    recommendedTrackListFragment = new RecommendedTrackListFragment();
    Bundle recommendedTrackListFragmentBundle = new Bundle();
    recommendedTrackListFragmentBundle.putString("trackId", trackId);
    recommendedTrackListFragment.setArguments(recommendedTrackListFragmentBundle);
    getSupportFragmentManager().beginTransaction().replace(R.id.contentView, recommendedTrackListFragment, "music_recommend").commit();
}
Also used : Bundle(android.os.Bundle) RecommendedTrackListFragment(io.recom.howabout.category.music.fragment.RecommendedTrackListFragment) ActionBar(com.actionbarsherlock.app.ActionBar)

Example 15 with ActionBar

use of com.actionbarsherlock.app.ActionBar in project Wallpaper-Manager by Bencodes.

the class WallpaperFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    this.mNode = (NodeWallpaper) super.getArguments().getSerializable(BUNDLE_TAG);
    final ActionBar ab = ((SherlockFragmentActivity) super.getActivity()).getSupportActionBar();
    if (ab != null) {
        ab.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        ab.setDisplayHomeAsUpEnabled(true);
        ab.setDisplayShowHomeEnabled(false);
        ab.setDisplayShowTitleEnabled(true);
        final String title = super.getResources().getString(R.string.config_full_screen_wallpaper_title);
        if (title == null || title.length() <= 0) {
            ab.setTitle(mNode.name);
        } else {
            ab.setTitle(title);
        }
    }
    this.mPending = (ProgressBar) super.getView().findViewById(R.id.pending);
    this.mImageView = (PhotoView) mView.findViewById(R.id.wp_image);
    ImageLoader.getInstance().displayImage(mNode.url, mImageView, new ImageLoadingListener() {

        @Override
        public void onLoadingStarted() {
            mImageDrawableSet = false;
            mImageView.setVisibility(View.GONE);
            mPending.setVisibility(View.VISIBLE);
        }

        @Override
        public void onLoadingFailed(FailReason failReason) {
            mImageDrawableSet = false;
            Toast.makeText(getActivity(), "Image Failed To Load!", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onLoadingComplete(Bitmap bitmap) {
            mImageDrawableSet = true;
            mImageView.setVisibility(View.VISIBLE);
            mImageView.setImageBitmap(bitmap);
            mImageView.setZoomable(true);
            mPending.setVisibility(View.GONE);
            if (mApplyImageOnDisplay)
                applyImage();
            if (mSaveImageOnDisplay)
                exportImage();
        }

        @Override
        public void onLoadingCancelled() {
        }
    });
}
Also used : Bitmap(android.graphics.Bitmap) ImageLoadingListener(com.nostra13.universalimageloader.core.assist.ImageLoadingListener) SherlockFragmentActivity(com.actionbarsherlock.app.SherlockFragmentActivity) FailReason(com.nostra13.universalimageloader.core.assist.FailReason) ActionBar(com.actionbarsherlock.app.ActionBar)

Aggregations

ActionBar (com.actionbarsherlock.app.ActionBar)34 Bundle (android.os.Bundle)5 TextView (android.widget.TextView)5 SherlockFragmentActivity (com.actionbarsherlock.app.SherlockFragmentActivity)3 Bitmap (android.graphics.Bitmap)2 GradientDrawable (android.graphics.drawable.GradientDrawable)2 FragmentTransaction (android.support.v4.app.FragmentTransaction)2 View (android.view.View)2 AdapterView (android.widget.AdapterView)2 Button (android.widget.Button)2 ImageView (android.widget.ImageView)2 LinearLayout (android.widget.LinearLayout)2 OnNavigationListener (com.actionbarsherlock.app.ActionBar.OnNavigationListener)2 FailReason (com.nostra13.universalimageloader.core.assist.FailReason)2 ImageLoadingListener (com.nostra13.universalimageloader.core.assist.ImageLoadingListener)2 Activity (org.holoeverywhere.app.Activity)2 DataSetObserver (android.database.DataSetObserver)1 Fragment (android.support.v4.app.Fragment)1 ViewPager (android.support.v4.view.ViewPager)1 LayoutInflater (android.view.LayoutInflater)1