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