use of com.facebook.share.widget.ShareButton 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();
}
});
}
Aggregations