Update Version 0.2.4

This commit is contained in:
David 2013-05-26 20:28:11 +02:00
parent 59c2143506
commit 903eb060ed
35 changed files with 170 additions and 43 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.luhmer.owncloudnewsreader"
android:versionCode="5"
android:versionName="0.2.3" >
android:versionCode="6"
android:versionName="0.2.4" >
<uses-sdk
android:minSdkVersion="14"

View file

@ -2,7 +2,7 @@
/*
* This file is auto-generated. DO NOT MODIFY.
* Original file: C:\\Users\\David\\Documents\\GitHub\\ownCloud-News-Reader-Android-App\\src\\com\\android\\vending\\billing\\IInAppBillingService.aidl
* Original file: C:\\Users\\David\\Documents\\GitHub\\News-Android-App\\src\\com\\android\\vending\\billing\\IInAppBillingService.aidl
*/
package com.android.vending.billing;
/**

View file

@ -1,61 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
android:orientation="vertical" >
<CheckBox
android:id="@+id/cb_lv_item_starred"
android:layout_width="40dp"
android:layout_height="40dp"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
android:clickable="false"
android:focusable="false"
android:button="@drawable/checkbox_background_empty"
android:background="@drawable/checkbox_background" />
<!--
android:background="@drawable/checkbox_background"
android:button="@drawable/checkbox"
-->
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:orientation="vertical" >
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/listview_row_margin_left"
android:layout_marginRight="@dimen/listview_row_margin_right"
android:layout_marginTop="@dimen/listview_row_margin_top"
android:orientation="horizontal" >
<TextView
android:id="@+id/tv_subscription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:layout_gravity="left"
android:singleLine="true"
android:text="Hi"
android:layout_weight="1"
android:textSize="13sp" />
<TextView
android:id="@+id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tv_item_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="2"
android:textSize="16sp"
android:textStyle="bold" />
android:layout_gravity="right"
android:text="Hi"
android:singleLine="true"
android:textSize="13sp" />
</LinearLayout>
<CheckBox
android:id="@+id/cb_lv_item_read"
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:clickable="false"
android:focusable="false" />
android:layout_marginLeft="@dimen/listview_row_margin_left"
android:layout_marginRight="@dimen/listview_row_margin_right"
android:layout_marginBottom="@dimen/listview_row_margin_bottom"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1" >
<TextView
android:id="@+id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="2"
android:textSize="16sp"
android:text="Hi"
android:textStyle="bold" />
<TextView
android:id="@+id/body"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="4"
android:text="Hi"
android:textSize="14sp"
android:autoLink="none" />
<!-- android:gravity="center_vertical" -->
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="right" >
<CheckBox
android:id="@+id/cb_lv_item_starred"
android:layout_width="40dp"
android:layout_height="40dp"
android:gravity="center_vertical|center_horizontal"
android:layout_gravity="center_vertical|center_horizontal"
android:clickable="false"
android:focusable="false"
android:button="@drawable/checkbox_background_empty"
android:background="@drawable/checkbox_background" />
<CheckBox
android:id="@+id/cb_lv_item_read"
android:layout_marginLeft="3dp"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:clickable="false"
android:focusable="false" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

View file

@ -25,4 +25,10 @@
android:showAsAction="never"
android:title="@string/action_sendSourceCode"/>
<item
android:id="@+id/action_ShareItem"
android:showAsAction="always"
android:icon="@android:drawable/ic_menu_share"
android:title="@string/action_Share" />
</menu>

View file

@ -4,4 +4,9 @@
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="listview_row_margin_left">10dp</dimen>
<dimen name="listview_row_margin_right">10dp</dimen>
<dimen name="listview_row_margin_top">5dp</dimen>
<dimen name="listview_row_margin_bottom">5dp</dimen>
</resources>

View file

@ -27,6 +27,7 @@
<string name="action_starred">Starred</string>
<string name="action_openInBrowser">Open in Browser</string>
<string name="action_sendSourceCode">Send item to Developer</string>
<string name="action_Share">Share</string>
</resources>

View file

@ -237,6 +237,14 @@ public class NewsDetailActivity extends FragmentActivity {
Toast.makeText(NewsDetailActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
break;
case R.id.action_ShareItem:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("text/plain");
share.putExtra(Intent.EXTRA_SUBJECT, rssFiles.get(currentPosition).getTitle());
share.putExtra(Intent.EXTRA_TEXT, rssFiles.get(currentPosition).getLink());
startActivity(Intent.createChooser(share, "Share Item"));
break;
}
return super.onOptionsItemSelected(item);
}

View file

@ -4,6 +4,10 @@ import android.content.Context;
import android.database.Cursor;
import android.support.v4.widget.CursorAdapter;
import android.text.Html;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@ -14,19 +18,27 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
import de.luhmer.owncloudnewsreader.R;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.helper.URLSpanNoUnderline;
import de.luhmer.owncloudnewsreader.reader.FeedItemTags;
import de.luhmer.owncloudnewsreader.reader.IReader;
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
import de.luhmer.owncloudnewsreader.reader.GoogleReaderApi.GoogleReaderMethods;
import de.luhmer.owncloudnewsreader.reader.owncloud.OwnCloud_Reader;
import java.text.SimpleDateFormat;
import java.util.Date;
public class NewsListCursorAdapter extends CursorAdapter {
DatabaseConnection dbConn;
IReader _Reader;
SimpleDateFormat simpleDateFormat;
final int LengthBody = 500;
@SuppressWarnings("deprecation")
public NewsListCursorAdapter(Context context, Cursor c) {
super(context, c);
super(context, c);
simpleDateFormat = new SimpleDateFormat("EEE, d. MMM HH:mm:ss");
_Reader = new OwnCloud_Reader();
dbConn = new DatabaseConnection(context);
@ -38,8 +50,22 @@ public class NewsListCursorAdapter extends CursorAdapter {
final String idItem = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_RSSITEM_ID));
TextView textViewSummary = (TextView) view.findViewById(R.id.summary);
textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))));
textViewSummary.setText(Html.fromHtml(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_TITLE))));
TextView textViewItemDate = (TextView) view.findViewById(R.id.tv_item_date);
long pubDate = cursor.getLong(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_PUBDATE));
textViewItemDate.setText(simpleDateFormat.format(new Date(pubDate)));
TextView textViewItemBody = (TextView) view.findViewById(R.id.body);
String body = cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_BODY));
if(body.length() > LengthBody)
body = body.substring(0, LengthBody);
SpannableString bodyString = new SpannableString(Html.fromHtml(body));
ForegroundColorSpan fcs = new ForegroundColorSpan(context.getResources().getColor(android.R.color.secondary_text_dark));
bodyString.setSpan(fcs, 0, bodyString.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
textViewItemBody.setText(bodyString);
TextView textViewTitle = (TextView) view.findViewById(R.id.tv_subscription);
textViewTitle.setText(dbConn.getTitleOfSubscriptionByID(cursor.getString(cursor.getColumnIndex(DatabaseConnection.RSS_ITEM_SUBSCRIPTION_ID))));
textViewSummary.setTag(cursor.getString(0));
@ -141,5 +167,4 @@ public class NewsListCursorAdapter extends CursorAdapter {
Log.d("FINISHED PERFORM TAG STARRED ", "" + task_result);
}
};
}

View file

@ -0,0 +1,34 @@
package de.luhmer.owncloudnewsreader.helper;
import android.text.Spannable;
import android.text.TextPaint;
import android.text.style.URLSpan;
import android.widget.TextView;
/**
* Created by David on 26.05.13.
*/
public class URLSpanNoUnderline extends URLSpan {
public URLSpanNoUnderline(String url) {
super(url);
}
@Override public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setUnderlineText(false);
}
public static void stripUnderlines(TextView textView) {
Spannable s = (Spannable)textView.getText();
URLSpan[] spans = s.getSpans(0, s.length(), URLSpan.class);
for (URLSpan span: spans) {
int start = s.getSpanStart(span);
int end = s.getSpanEnd(span);
s.removeSpan(span);
span = new URLSpanNoUnderline(span.getURL());
s.setSpan(span, start, end, 0);
}
textView.setText(s);
}
}