diff --git a/src/org/fox/ttrss/CommonActivity.java b/src/org/fox/ttrss/CommonActivity.java index 92d8b2a3..f6aa339a 100644 --- a/src/org/fox/ttrss/CommonActivity.java +++ b/src/org/fox/ttrss/CommonActivity.java @@ -7,6 +7,7 @@ import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.util.Log; +import android.widget.Toast; public class CommonActivity extends FragmentActivity { private final String TAG = this.getClass().getSimpleName(); @@ -72,5 +73,19 @@ public class CommonActivity extends FragmentActivity { public int getOrientation() { return getWindowManager().getDefaultDisplay().getOrientation(); } - + + public void copyToClipboard(String str) { + if (android.os.Build.VERSION.SDK_INT < 11) { + @SuppressWarnings("deprecation") + android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); + clipboard.setText(str); + } else { + android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); + clipboard.setText(str); + } + + Toast toast = Toast.makeText(this, R.string.text_copied_to_clipboard, Toast.LENGTH_SHORT); + toast.show(); + } + } diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index 91ae5de3..8f6d55f4 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -2245,21 +2245,6 @@ public class MainActivity extends CommonActivity implements OnlineServices { initMainMenu(); } - @Override - public void copyToClipboard(String str) { - if (android.os.Build.VERSION.SDK_INT < 11) { - @SuppressWarnings("deprecation") - android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); - clipboard.setText(str); - } else { - android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); - clipboard.setText(str); - } - - Toast toast = Toast.makeText(MainActivity.this, R.string.text_copied_to_clipboard, Toast.LENGTH_SHORT); - toast.show(); - } - @Override public void restart() { Intent refresh = new Intent(MainActivity.this, MainActivity.class); diff --git a/src/org/fox/ttrss/offline/OfflineActivity.java b/src/org/fox/ttrss/offline/OfflineActivity.java index 9b8d2061..8f2a3413 100644 --- a/src/org/fox/ttrss/offline/OfflineActivity.java +++ b/src/org/fox/ttrss/offline/OfflineActivity.java @@ -1041,19 +1041,8 @@ public class OfflineActivity extends CommonActivity implements } if (article != null) { - if (android.os.Build.VERSION.SDK_INT < 11) { - @SuppressWarnings("deprecation") - android.text.ClipboardManager clipboard = (android.text.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); - clipboard.setText(article.getString(article.getColumnIndex("link"))); - } else { - android.content.ClipboardManager clipboard = (android.content.ClipboardManager) getSystemService(CLIPBOARD_SERVICE); - clipboard.setText(article.getString(article.getColumnIndex("link"))); - } - + copyToClipboard(article.getString(article.getColumnIndex("link"))); article.close(); - - Toast toast = Toast.makeText(OfflineActivity.this, R.string.text_copied_to_clipboard, Toast.LENGTH_SHORT); - toast.show(); } } return true;