Search in sources :

Example 1 with SendButton

use of com.facebook.share.widget.SendButton in project facebook-android-sdk by facebook.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    gameController = new GameController(this, getIntent());
    board = (GridView) findViewById(R.id.board);
    validNumbers = (GridView) findViewById(R.id.valid_numbers);
    gameController.setBoardView(board);
    gameController.setSelectionView(validNumbers);
    Button newGame = (Button) findViewById(R.id.new_board);
    newGame.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            gameController.newGame();
        }
    });
    Button clearBoard = (Button) findViewById(R.id.clear_board);
    clearBoard.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            gameController.clearBoard();
        }
    });
    final ShareButton share = (ShareButton) findViewById(R.id.share_button);
    share.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            share.setShareContent(getLinkContent());
        }
    });
    final SendButton send = (SendButton) findViewById(R.id.send_button);
    send.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            send.setShareContent(getLinkContent());
        }
    });
    Button copy = (Button) findViewById(R.id.copy_button);
    copy.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
            ClipData clip = ClipData.newUri(getContentResolver(), "Iconicus", gameController.getShareUri());
            clipboard.setPrimaryClip(clip);
            Toast.makeText(MainActivity.this, R.string.link_copied, Toast.LENGTH_SHORT).show();
        }
    });
}
Also used : ClipboardManager(android.content.ClipboardManager) SendButton(com.facebook.share.widget.SendButton) ShareButton(com.facebook.share.widget.ShareButton) Button(android.widget.Button) SendButton(com.facebook.share.widget.SendButton) GridView(android.widget.GridView) View(android.view.View) ShareButton(com.facebook.share.widget.ShareButton) ClipData(android.content.ClipData)

Aggregations

ClipData (android.content.ClipData)1 ClipboardManager (android.content.ClipboardManager)1 View (android.view.View)1 Button (android.widget.Button)1 GridView (android.widget.GridView)1 SendButton (com.facebook.share.widget.SendButton)1 ShareButton (com.facebook.share.widget.ShareButton)1