use of android.view.View.OnClickListener in project robolectric by robolectric.
the class ShadowViewTest method shouldClickAndNotClick.
public void shouldClickAndNotClick() throws Exception {
assertThat(view.isClickable()).isFalse();
view.setClickable(true);
assertThat(view.isClickable()).isTrue();
view.setClickable(false);
assertThat(view.isClickable()).isFalse();
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
;
}
});
assertThat(view.isClickable()).isTrue();
}
use of android.view.View.OnClickListener 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 android.view.View.OnClickListener in project howabout-android by recomio.
the class MusicBottomBarFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_music_bottom_bar, container, false);
rootView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), MusicPlaylistActivity.class);
Bundle bundle = new Bundle();
intent.putExtras(bundle);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
}
});
imageView = (ImageView) rootView.findViewById(R.id.image);
trackTitle = (TextView) rootView.findViewById(R.id.trackTitle);
artistName = (TextView) rootView.findViewById(R.id.artistName);
isLoading = (ProgressBar) rootView.findViewById(R.id.isLoading);
isPlaying = (ImageView) rootView.findViewById(R.id.isPlaying);
isPlaying.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HowaboutApplication application = (HowaboutApplication) getActivity().getApplication();
MusicPlaylistAdapter playlistAdapter = application.getPlaylistAdapter();
playlistAdapter.playPauseToggle();
}
});
playlistObserver = new DataSetObserver() {
@Override
public void onChanged() {
updateTrack();
}
@Override
public void onInvalidated() {
updateTrack();
}
};
HowaboutApplication application = (HowaboutApplication) getActivity().getApplication();
MusicPlaylistAdapter playlistAdapter = application.getPlaylistAdapter();
playlistAdapter.registerDataSetObserver(playlistObserver);
return rootView;
}
use of android.view.View.OnClickListener in project cube-sdk by liaohuqiu.
the class TitleBaseFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup view = (ViewGroup) inflater.inflate(getFrameLayoutId(), null);
LinearLayout contentContainer = (LinearLayout) view.findViewById(R.id.cube_mints_content_frame_content);
mTitleHeaderBar = (TitleHeaderBar) view.findViewById(R.id.cube_mints_content_frame_title_header);
if (enableDefaultBack()) {
mTitleHeaderBar.setLeftOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
} else {
mTitleHeaderBar.getLeftViewContainer().setVisibility(View.INVISIBLE);
}
mContentContainer = contentContainer;
View contentView = createView(inflater, view, savedInstanceState);
contentView.setLayoutParams(new LinearLayout.LayoutParams(-1, -1));
contentContainer.addView(contentView);
return view;
}
use of android.view.View.OnClickListener in project coursera-android by aporter.
the class BoomUserActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.boom_user_layout);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
// Called when the user clicks on the Detonate Button
@Override
public void onClick(View v) {
// Create an implicit Intent using the Action String ACTION_BOOM
// Launch an Activity that can receive the Intent using Activity.startActivity()
startActivity(new Intent(ACTION_BOOM));
}
});
}
Aggregations