Merge pull request #763 from mfietz/feature/show_feed_url

Show URL in feed info
This commit is contained in:
Martin Fietz 2015-04-22 09:34:39 +02:00
commit 75d9c6ec7b
7 changed files with 158 additions and 73 deletions

View File

@ -6,6 +6,7 @@ repositories {
dependencies {
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:gridlayout-v7:21.0.3'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile('org.shredzone.flattr4j:flattr4j-core:2.12') {
exclude group: 'org.json', module: 'json'
@ -18,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')
}

View File

@ -84,3 +84,6 @@
-keepclassmembers class ** {
public void onEvent*(**);
}
# android-iconify
-keep class com.joanzapata.** { *; }

View File

@ -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

View File

@ -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>

View File

@ -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,15 +11,17 @@ 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.BuildConfig;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.dialog.DownloadRequestErrorDialogCreator;
import de.danoeh.antennapod.core.feed.Feed;
@ -44,10 +48,32 @@ public class FeedInfoActivity extends ActionBarActivity {
private TextView txtvDescription;
private TextView txtvLanguage;
private TextView txtvAuthor;
private TextView txtvUrl;
private EditText etxtUsername;
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());
@ -61,10 +87,13 @@ public class FeedInfoActivity extends ActionBarActivity {
txtvDescription = (TextView) findViewById(R.id.txtvDescription);
txtvLanguage = (TextView) findViewById(R.id.txtvLanguage);
txtvAuthor = (TextView) findViewById(R.id.txtvAuthor);
txtvUrl = (TextView) findViewById(R.id.txtvUrl);
cbxAutoDownload = (CheckBox) findViewById(R.id.cbxAutoDownload);
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
@ -76,10 +105,9 @@ public class FeedInfoActivity extends ActionBarActivity {
protected void onPostExecute(Feed result) {
if (result != null) {
feed = result;
if (BuildConfig.DEBUG)
Log.d(TAG, "Language is " + feed.getLanguage());
if (BuildConfig.DEBUG)
Log.d(TAG, "Author is " + feed.getAuthor());
Log.d(TAG, "Language is " + feed.getLanguage());
Log.d(TAG, "Author is " + feed.getAuthor());
Log.d(TAG, "URL is " + feed.getDownload_url());
imgvCover.post(new Runnable() {
@Override
@ -92,7 +120,7 @@ public class FeedInfoActivity extends ActionBarActivity {
});
txtvTitle.setText(feed.getTitle());
txtvDescription.setText(feed.getDescription());
txtvDescription.setText(feed.getDescription().trim());
if (feed.getAuthor() != null) {
txtvAuthor.setText(feed.getAuthor());
}
@ -100,6 +128,8 @@ public class FeedInfoActivity extends ActionBarActivity {
txtvLanguage.setText(LangUtils
.getLanguageString(feed.getLanguage()));
}
txtvUrl.setText(feed.getDownload_url() + " {fa-paperclip}");
Iconify.addIcons(txtvUrl);
cbxAutoDownload.setEnabled(UserPreferences.isEnableAutodownload());
cbxAutoDownload.setChecked(feed.getPreferences().getAutoDownload());

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -11,7 +12,10 @@
android:focusableInTouchMode="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
android:gravity="center_vertical"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp">
<ImageView
android:id="@+id/imgvCover"
@ -20,26 +24,26 @@
android:layout_height="70dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="4dp"
tools:src="@drawable/ic_stat_antenna_default"
tools:background="@android:color/holo_green_dark" />
tools:background="@android:color/holo_green_dark"/>
<TextView
android:id="@+id/txtvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_margin="4dp"
android:layout_marginLeft="8dp"
android:layout_toRightOf="@id/imgvCover"
style="@style/AntennaPod.TextView.Heading"
tools:text="Feed title"
tools:background="@android:color/holo_green_dark" />
tools:background="@android:color/holo_green_dark"/>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/imgvCover"
android:layout_marginTop="8dp"
android:background="@color/bright_blue"/>
</RelativeLayout>
@ -47,99 +51,120 @@
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
android:layout_weight="1"
android:scrollbarStyle="outsideInset"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingBottom="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
<android.support.v7.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp">
<View
android:id="@+id/center_divider"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_centerHorizontal="true"/>
android:layout_marginTop="8dp"
app:columnCount="2"
app:rowCount="3">
<TextView
android:id="@+id/lblAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_margin="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_row="0"
app:layout_column="0"
android:lines="1"
android:text="@string/author_label"
android:textColor="?android:attr/textColorPrimary"
tools:background="@android:color/holo_red_light" />
tools:background="@android:color/holo_red_light"/>
<TextView
android:id="@+id/txtvAuthor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_margin="8dp"
android:layout_toRightOf="@id/center_divider"
app:layout_row="0"
app:layout_column="1"
tools:text="Daniel Oeh"
tools:background="@android:color/holo_green_dark" />
tools:background="@android:color/holo_green_dark"/>
<TextView
android:id="@+id/lblLanguage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/txtvAuthor"
android:layout_margin="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_row="1"
app:layout_column="0"
android:lines="1"
android:text="@string/language_label"
android:textColor="?android:attr/textColorPrimary"
tools:background="@android:color/holo_red_light" />
tools:background="@android:color/holo_red_light"/>
<TextView
android:id="@+id/txtvLanguage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/txtvAuthor"
android:layout_margin="8dp"
android:layout_toRightOf="@id/center_divider"
app:layout_row="1"
app:layout_column="1"
tools:text="English"
tools:background="@android:color/holo_green_dark" />
</RelativeLayout>
tools:background="@android:color/holo_green_dark"/>
<TextView
android:id="@+id/lblUrl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_row="2"
app:layout_column="0"
android:lines="1"
android:text="@string/url_label"
android:textColor="?android:attr/textColorPrimary"
tools:background="@android:color/holo_red_light"/>
<TextView
android:id="@+id/txtvUrl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_row="2"
app:layout_column="1"
tools:text="http://www.example.com/feed"
tools:background="@android:color/holo_green_dark"/>
</android.support.v7.widget.GridLayout>
<TextView
android:id="@+id/txtvSettings"
style="@style/AntennaPod.TextView.Heading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text="@string/podcast_settings_label"
android:layout_marginLeft="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="24dp"/>
android:layout_marginTop="8dp"/>
<CheckBox
android:id="@+id/cbxAutoDownload"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginTop="8dp"
android:text="@string/auto_download_label"
android:enabled="false"
android:textColor="?android:attr/textColorPrimary"
tools:background="@android:color/holo_red_light" />
tools:background="@android:color/holo_red_light"
android:checked="false"/>
<TextView
android:id="@+id/txtvAuthentication"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginTop="8dp"
android:text="@string/authentication_label"
android:textSize="@dimen/text_size_medium"
android:textColor="?android:attr/textColorPrimary"
android:layout_marginLeft="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="24dp"/>
android:textColor="?android:attr/textColorPrimary"/>
<TextView
android:id="@+id/txtvAuthenticationDescr"
@ -148,71 +173,74 @@
android:textColor="?android:attr/textColorPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"/>
android:layout_marginTop="8dp"/>
<LinearLayout
android:layout_width="match_parent"
<android.support.v7.widget.GridLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp">
android:layout_marginTop="8dp"
app:columnCount="2"
app:rowCount="3"
android:layout_gravity="center_horizontal">
<TextView
android:id="@+id/txtvUsername"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_row="0"
app:layout_column="0"
android:text="@string/username_label"
android:textColor="?android:attr/textColorPrimary"/>
<EditText
android:id="@+id/etxtUsername"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_width="140sp"
android:layout_height="wrap_content"
app:layout_row="0"
app:layout_column="1"
android:hint="@string/username_label"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp">
<TextView
android:id="@+id/txtvPassword"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_row="1"
app:layout_column="0"
android:text="@string/password_label"
android:textColor="?android:attr/textColorPrimary"/>
<EditText
android:id="@+id/etxtPassword"
android:layout_width="0dp"
android:layout_weight="2"
android:layout_width="140sp"
android:layout_height="wrap_content"
app:layout_row="1"
app:layout_column="1"
android:hint="@string/password_label"
android:inputType="textPassword"/>
</LinearLayout>
</android.support.v7.widget.GridLayout>
<TextView
style="@style/AntennaPod.TextView.Heading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="24dp"
android:layout_marginTop="8dp"
android:text="@string/description_label"/>
<TextView
android:id="@+id/txtvDescription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:layout_marginTop="8dp"
android:text="@string/design_time_lorem_ipsum"
tools:background="@android:color/holo_green_dark" />
tools:background="@android:color/holo_green_dark"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -48,6 +48,7 @@
<string name="cancel_label">Cancel</string>
<string name="author_label">Author</string>
<string name="language_label">Language</string>
<string name="url_label">URL</string>
<string name="podcast_settings_label">Settings</string>
<string name="cover_label">Picture</string>
<string name="error_label">Error</string>