Search in sources :

Example 61 with OnClickListener

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);
        }
    });
}
Also used : Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) View(android.view.View)

Example 62 with OnClickListener

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();
}
Also used : MediaRouteSelector(android.support.v7.media.MediaRouteSelector) ColorDrawable(android.graphics.drawable.ColorDrawable) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) View(android.view.View) ActionBar(android.support.v7.app.ActionBar)

Example 63 with OnClickListener

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());
        }
    });
}
Also used : OnClickListener(android.view.View.OnClickListener) View(android.view.View)

Example 64 with OnClickListener

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();
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) ListView(android.widget.ListView) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) LiveSdkSampleApplication(com.microsoft.live.sample.LiveSdkSampleApplication) LinearLayout(android.widget.LinearLayout)

Example 65 with OnClickListener

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();
}
Also used : Visitor(com.microsoft.live.sample.skydrive.SkyDriveObject.Visitor) ListView(android.widget.ListView) Button(android.widget.Button) LiveSdkSampleApplication(com.microsoft.live.sample.LiveSdkSampleApplication) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) Bundle(android.os.Bundle) Intent(android.content.Intent) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) VideoView(android.widget.VideoView) OnClickListener(android.view.View.OnClickListener) LinearLayout(android.widget.LinearLayout) FilePicker(com.microsoft.live.sample.util.FilePicker)

Aggregations

OnClickListener (android.view.View.OnClickListener)794 View (android.view.View)792 TextView (android.widget.TextView)492 Button (android.widget.Button)265 ImageView (android.widget.ImageView)256 Intent (android.content.Intent)183 ListView (android.widget.ListView)112 AdapterView (android.widget.AdapterView)91 ScrollView (android.widget.ScrollView)52 LinearLayout (android.widget.LinearLayout)49 Bundle (android.os.Bundle)43 LayoutInflater (android.view.LayoutInflater)35 ViewGroup (android.view.ViewGroup)30 ArrayList (java.util.ArrayList)30 BindView (butterknife.BindView)29 KeyEvent (android.view.KeyEvent)28 EditText (android.widget.EditText)28 DialogInterface (android.content.DialogInterface)27 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)25 FragmentManager (android.support.v4.app.FragmentManager)23