Make a few improvements on the implementation of the 'copy to clipboard' button.
This commit is contained in:
parent
9c9a0c1221
commit
c0743f7a08
4 changed files with 5 additions and 9 deletions
|
@ -295,13 +295,13 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
|
|||
break;
|
||||
|
||||
case R.id.menu_share:
|
||||
String codeForClipboard = "sudoku://" + gameController.getCodeOfField();
|
||||
ShareBoardDialog shareDialog = new ShareBoardDialog();
|
||||
shareDialog.setDisplayCode("sudoku://" + gameController.getCodeOfField());
|
||||
shareDialog.setDisplayCode(codeForClipboard);
|
||||
shareDialog.setCopyClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// remember to include alternate code for older android versions
|
||||
String codeForClipboard = "sudoku://" + gameController.getCodeOfField();
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
|
||||
if (clipboard != null) {
|
||||
|
@ -310,8 +310,7 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
|
|||
Toast.makeText(GameActivity.this, R.string.copy_code_confirmation_toast,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
//remember to replace hardcoded string
|
||||
Toast.makeText(GameActivity.this, "Cannot access clipboard",
|
||||
Toast.makeText(GameActivity.this, R.string.copy_code_error_toast,
|
||||
Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
package org.secuso.privacyfriendlysudoku.ui.listener;
|
||||
|
||||
import org.secuso.privacyfriendlysudoku.ui.view.databinding.DialogFragmentShareBoardBinding;
|
||||
|
||||
/**
|
||||
* Created by Chris on 19.01.2016.
|
||||
*/
|
||||
public interface IShareDialogFragmentListener {
|
||||
public void onShareDialogPositiveClick(String input);
|
||||
public void onDialogNegativeClick();
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
<string name="menu_reset">Zurücksetzen</string>
|
||||
<string name="menu_share">Sudoku teilen</string>
|
||||
<string name="copy_code_confirmation_toast">In Zwischenablage gespeichert</string>
|
||||
<string name="copy_code_error_toast">Kein Zugriff auf Zwischenablage möglich</string>
|
||||
<string name="min_time">Beste Zeit:</string>
|
||||
<string name="number_of_games">Abgeschlossene Spiele:</string>
|
||||
<string name="number_of_hints">Benutzte Hinweise:</string>
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
<string name="reset_confirmation_confirm">Reset</string>
|
||||
<string name="share_confirmation_confirm">Share</string>
|
||||
<string name="copy_code_confirmation_toast">Copied to clipboard</string>
|
||||
<string name="copy_code_error_toast">Cannot access clipboard</string>
|
||||
|
||||
<!-- ### Welcome Dialog ### -->
|
||||
|
||||
|
|
Loading…
Reference in a new issue