mirror of
https://github.com/moparisthebest/android-app
synced 2024-11-15 05:15:04 -05:00
improving article list: adding host label
This commit is contained in:
parent
d63d47c1f8
commit
440354e578
@ -1,18 +1,37 @@
|
||||
package fr.gaulupeau.apps.Poche;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public class Article {
|
||||
public String url;
|
||||
public String id;
|
||||
public String title;
|
||||
public String content;
|
||||
public String archive;
|
||||
|
||||
private URL m_url = null;
|
||||
|
||||
public Article(String url, String id, String title, String content, String archive) {
|
||||
super();
|
||||
this.url = url;
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.archive = archive;
|
||||
}
|
||||
super();
|
||||
this.url = url;
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.archive = archive;
|
||||
|
||||
try {
|
||||
this.m_url = new URL(url);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public String getHostOfUrl() {
|
||||
if (this.m_url != null) {
|
||||
return m_url.getHost();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -42,8 +42,10 @@ public class ReadingListAdapter extends BaseAdapter {
|
||||
convertView = inflater.inflate(R.layout.article_list, parent, false);
|
||||
}
|
||||
TextView tvTitle = (TextView) convertView.findViewById(R.id.listitem_titre);
|
||||
//Log.e("title", entry.title);
|
||||
TextView tvHost = (TextView) convertView.findViewById(R.id.listitem_textview_url);
|
||||
|
||||
tvTitle.setText(entry.title);
|
||||
tvHost.setText(entry.getHostOfUrl());
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
@ -1,14 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:padding="10sp"
|
||||
android:orientation="vertical" android:padding="8sp"
|
||||
android:layout_width="fill_parent" android:layout_height="fill_parent" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/listitem_titre"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20sp"
|
||||
android:typeface="serif" />
|
||||
<TextView
|
||||
android:id="@+id/listitem_titre"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@android:color/black"
|
||||
android:paddingBottom="4sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/listitem_textview_url"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp"
|
||||
android:singleLine="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user