Add copy to clipboard
This commit is contained in:
parent
7829ddc94e
commit
ff8db54385
|
@ -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')
|
||||
}
|
||||
|
|
|
@ -84,3 +84,6 @@
|
|||
-keepclassmembers class ** {
|
||||
public void onEvent*(**);
|
||||
}
|
||||
|
||||
# android-iconify
|
||||
-keep class com.joanzapata.** { *; }
|
||||
|
|
|
@ -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
|
|
@ -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>
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue