diff options
author | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-04-21 21:00:51 +0200 |
---|---|---|
committer | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-04-21 21:00:51 +0200 |
commit | ff8db54385e6bb91fa9e09c3823906ce40a45484 (patch) | |
tree | 6916274c9b35ddadc25a113b7df0f39d27ffc6c5 /app | |
parent | 7829ddc94e8ddeb3f7e307205c07439e0f322dcd (diff) | |
download | AntennaPod-ff8db54385e6bb91fa9e09c3823906ce40a45484.zip |
Add copy to clipboard
Diffstat (limited to 'app')
-rw-r--r-- | app/build.gradle | 1 | ||||
-rw-r--r-- | app/proguard.cfg | 3 | ||||
-rw-r--r-- | app/src/main/assets/LICENSE_ANDROID_ICONIFY.txt | 18 | ||||
-rw-r--r-- | app/src/main/assets/about.html | 3 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java | 31 |
5 files changed, 55 insertions, 1 deletions
diff --git a/app/build.gradle b/app/build.gradle index 6afde434b..7591a414d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,6 +19,7 @@ dependencies { compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' compile 'com.squareup.okio:okio:1.2.0' compile 'de.greenrobot:eventbus:2.4.0' + compile 'com.joanzapata.android:android-iconify:1.0.9' compile project(':core') compile project(':library:drag-sort-listview') } diff --git a/app/proguard.cfg b/app/proguard.cfg index c0f1796ea..1345a709c 100644 --- a/app/proguard.cfg +++ b/app/proguard.cfg @@ -84,3 +84,6 @@ -keepclassmembers class ** { public void onEvent*(**); } + +# android-iconify +-keep class com.joanzapata.** { *; } diff --git a/app/src/main/assets/LICENSE_ANDROID_ICONIFY.txt b/app/src/main/assets/LICENSE_ANDROID_ICONIFY.txt new file mode 100644 index 000000000..85a6c0cf2 --- /dev/null +++ b/app/src/main/assets/LICENSE_ANDROID_ICONIFY.txt @@ -0,0 +1,18 @@ +Copyright 2013 Joan Zapata + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +It uses FontAwesome font, licensed under OFL 1.1, which is compatible +with this library's license. + + http://scripts.sil.org/cms/scripts/render_download.php?format=file&media_id=OFL_plaintext&filename=OFL.txt diff --git a/app/src/main/assets/about.html b/app/src/main/assets/about.html index f1a1fdf44..af7297564 100644 --- a/app/src/main/assets/about.html +++ b/app/src/main/assets/about.html @@ -80,5 +80,8 @@ by Google, licensed under an Attribution-ShareAlike 4.0 International license <a <h2>EventBus <a href="https://github.com/greenrobot/EventBus">(Link>)</a></h2> by greenrobot, licensed under the Apache 2.0 license <a href="LICENSE_EVENTBUS.txt">(View)</a> +<h2>Iconify <a href="https://github.com/JoanZapata/android-iconify">(Link>)</a></h2> +by Joan Zapata, licensed under the Apache 2.0 license <a href="LICENSE_ANDROID_ICONIFY.txt">(View)</a> + </body> </html> diff --git a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java index 2ec558046..24b684752 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/FeedInfoActivity.java @@ -1,5 +1,7 @@ package de.danoeh.antennapod.activity; +import android.content.ClipData; +import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; @@ -9,12 +11,15 @@ import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; +import android.widget.Toast; +import com.joanzapata.android.iconify.Iconify; import com.squareup.picasso.Picasso; import de.danoeh.antennapod.R; @@ -48,6 +53,27 @@ public class FeedInfoActivity extends ActionBarActivity { private EditText etxtPassword; private CheckBox cbxAutoDownload; + private final View.OnClickListener copyUrlToClipboard = new View.OnClickListener() { + @Override + public void onClick(View v) { + if(feed != null && feed.getDownload_url() != null) { + String url = feed.getDownload_url(); + if (android.os.Build.VERSION.SDK_INT >= 11) { + ClipData clipData = ClipData.newPlainText(url, url); + android.content.ClipboardManager cm = (android.content.ClipboardManager) FeedInfoActivity.this + .getSystemService(Context.CLIPBOARD_SERVICE); + cm.setPrimaryClip(clipData); + } else { + android.text.ClipboardManager cm = (android.text.ClipboardManager) FeedInfoActivity.this + .getSystemService(Context.CLIPBOARD_SERVICE); + cm.setText(url); + } + Toast t = Toast.makeText(FeedInfoActivity.this, R.string.copied_url_msg, Toast.LENGTH_SHORT); + t.show(); + } + } + }; + @Override protected void onCreate(Bundle savedInstanceState) { setTheme(UserPreferences.getTheme()); @@ -66,6 +92,8 @@ public class FeedInfoActivity extends ActionBarActivity { etxtUsername = (EditText) findViewById(R.id.etxtUsername); etxtPassword = (EditText) findViewById(R.id.etxtPassword); + txtvUrl.setOnClickListener(copyUrlToClipboard); + AsyncTask<Long, Void, Feed> loadTask = new AsyncTask<Long, Void, Feed>() { @Override @@ -100,7 +128,8 @@ public class FeedInfoActivity extends ActionBarActivity { txtvLanguage.setText(LangUtils .getLanguageString(feed.getLanguage())); } - txtvUrl.setText(feed.getDownload_url()); + txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}"); + Iconify.addIcons(txtvUrl); cbxAutoDownload.setEnabled(UserPreferences.isEnableAutodownload()); cbxAutoDownload.setChecked(feed.getPreferences().getAutoDownload()); |