use of android.view.View.OnClickListener in project MediaRouter-Cast-Button-android by googlecast.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Display buttons to launch other activities for MediaRouter use cases
Button button = (Button) findViewById(R.id.media_router_discovery);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "MediaRouterDiscoveryActivity");
startActivity(MediaRouterDiscoveryActivity.class);
}
});
button = (Button) findViewById(R.id.media_router_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "MediaRouterButtonActivity");
startActivity(MediaRouterButtonActivity.class);
}
});
button = (Button) findViewById(R.id.media_router_action_bar_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "MediaRouterActionBarButtonActivity");
startActivity(MediaRouterActionBarButtonActivity.class);
}
});
button = (Button) findViewById(R.id.media_router_custom_dialog_button);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "MediaRouterCustomDialogActivity");
startActivity(MediaRouterCustomDialogActivity.class);
}
});
}
use of android.view.View.OnClickListener in project CastHelloText-android-v2 by googlecast.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
// When the user clicks on the button, use Android voice recognition to
// get text
Button voiceButton = (Button) findViewById(R.id.voiceButton);
voiceButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startVoiceRecognitionActivity();
}
});
// Configure Cast device discovery
mMediaRouter = MediaRouter.getInstance(getApplicationContext());
mMediaRouteSelector = new MediaRouteSelector.Builder().addControlCategory(CastMediaControlIntent.categoryForCast(getResources().getString(R.string.app_id))).build();
mMediaRouterCallback = new MyMediaRouterCallback();
}
use of android.view.View.OnClickListener in project otto by square.
the class LocationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.location_history);
findViewById(R.id.clear_location).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Tell everyone to clear their location history.
BusProvider.getInstance().post(new LocationClearEvent());
// Post new location event for the default location.
lastLatitude = DEFAULT_LAT;
lastLongitude = DEFAULT_LON;
BusProvider.getInstance().post(produceLocationEvent());
}
});
findViewById(R.id.move_location).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
lastLatitude += (RANDOM.nextFloat() * OFFSET * 2) - OFFSET;
lastLongitude += (RANDOM.nextFloat() * OFFSET * 2) - OFFSET;
BusProvider.getInstance().post(produceLocationEvent());
}
});
}
use of android.view.View.OnClickListener in project LiveSDK-for-Android by liveservices.
the class ContactsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_contacts);
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Contact contact = (Contact) parent.getItemAtPosition(position);
ViewContactDialog dialog = new ViewContactDialog(ContactsActivity.this, contact);
dialog.setOwnerActivity(ContactsActivity.this);
dialog.show();
}
});
LinearLayout layout = new LinearLayout(this);
Button newCalendarButton = new Button(this);
newCalendarButton.setText("New Contact");
newCalendarButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
CreateContactDialog dialog = new CreateContactDialog(ContactsActivity.this);
dialog.setOwnerActivity(ContactsActivity.this);
dialog.show();
}
});
layout.addView(newCalendarButton);
lv.addHeaderView(layout);
mAdapter = new ContactsListAdapter(this);
setListAdapter(mAdapter);
LiveSdkSampleApplication app = (LiveSdkSampleApplication) getApplication();
mClient = app.getConnectClient();
}
use of android.view.View.OnClickListener in project LiveSDK-for-Android by liveservices.
the class SkyDriveActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.skydrive);
mPrevFolderIds = new Stack<String>();
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
SkyDriveObject skyDriveObj = (SkyDriveObject) parent.getItemAtPosition(position);
skyDriveObj.accept(new Visitor() {
@Override
public void visit(SkyDriveAlbum album) {
mPrevFolderIds.push(mCurrentFolderId);
loadFolder(album.getId());
}
@Override
public void visit(SkyDrivePhoto photo) {
ViewPhotoDialog dialog = new ViewPhotoDialog(SkyDriveActivity.this, photo);
dialog.setOwnerActivity(SkyDriveActivity.this);
dialog.show();
}
@Override
public void visit(SkyDriveFolder folder) {
mPrevFolderIds.push(mCurrentFolderId);
loadFolder(folder.getId());
}
@Override
public void visit(SkyDriveFile file) {
Bundle b = new Bundle();
b.putString(JsonKeys.ID, file.getId());
b.putString(JsonKeys.NAME, file.getName());
showDialog(DIALOG_DOWNLOAD_ID, b);
}
@Override
public void visit(SkyDriveVideo video) {
PlayVideoDialog dialog = new PlayVideoDialog(SkyDriveActivity.this, video);
dialog.setOwnerActivity(SkyDriveActivity.this);
dialog.show();
}
@Override
public void visit(SkyDriveAudio audio) {
PlayAudioDialog audioDialog = new PlayAudioDialog(SkyDriveActivity.this, audio);
audioDialog.show();
}
});
}
});
LinearLayout layout = new LinearLayout(this);
Button newFolderButton = new Button(this);
newFolderButton.setText("New Folder");
newFolderButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
NewFolderDialog dialog = new NewFolderDialog(SkyDriveActivity.this);
dialog.setOwnerActivity(SkyDriveActivity.this);
dialog.show();
}
});
layout.addView(newFolderButton);
Button uploadFileButton = new Button(this);
uploadFileButton.setText("Upload File");
uploadFileButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(), FilePicker.class);
startActivityForResult(intent, FilePicker.PICK_FILE_REQUEST);
}
});
layout.addView(uploadFileButton);
lv.addHeaderView(layout);
mPhotoAdapter = new SkyDriveListAdapter(this);
setListAdapter(mPhotoAdapter);
LiveSdkSampleApplication app = (LiveSdkSampleApplication) getApplication();
mClient = app.getConnectClient();
}
Aggregations