diff --git a/OwncloudNewsReader.iml b/News-Android-App.iml
similarity index 52%
rename from OwncloudNewsReader.iml
rename to News-Android-App.iml
index 2b249312..8460bff5 100644
--- a/OwncloudNewsReader.iml
+++ b/News-Android-App.iml
@@ -2,14 +2,7 @@
-
-
- MANIFEST_FILE_PATH
- RESOURCES_DIR_PATH
- ASSETS_DIR_PATH
- NATIVE_LIBS_DIR_PATH
-
-
+
@@ -18,10 +11,14 @@
-
+
-
-
+
+
+
+
+
+
diff --git a/build.gradle b/build.gradle
index 2fa22689..3b6e7e63 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,20 +3,21 @@ buildscript {
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:0.4'
+ classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
dependencies {
+ compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
- buildToolsVersion "17"
+ buildToolsVersion "17.0.0"
defaultConfig {
- minSdkVersion 14
+ minSdkVersion 7
targetSdkVersion 17
}
sourceSets {
@@ -30,6 +31,6 @@ android {
assets.srcDirs = ['assets']
}
- instrumentTest.setRoot('tests')
+ //instrumentTest.setRoot('tests')
}
}
diff --git a/project.properties b/project.properties
index 5084d43a..07cac057 100644
--- a/project.properties
+++ b/project.properties
@@ -12,5 +12,8 @@
# Project target.
target=android-17
-android.library.reference.1=../../workspace_juno/actionbarsherlock
+android.library.reference.1=../ActionBarSherlock/actionbarsherlock
android.library.reference.2=../Android-PullToRefresh/library
+android.library.reference.3=../AppRater/AppRater
+android.library.reference.4=../changeloglib/ChangeLogLibrary/src/main
+android.library.reference.5=../MessageBar
diff --git a/res/layout/dialog_version_info.xml b/res/layout/dialog_version_info.xml
index 63d7dfa4..80a81a0c 100644
--- a/res/layout/dialog_version_info.xml
+++ b/res/layout/dialog_version_info.xml
@@ -1,3 +1,4 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/values-ach/strings.xml b/res/values-ach/strings.xml
deleted file mode 100644
index b244edf1..00000000
--- a/res/values-ach/strings.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/values-en@pirate/strings.xml b/res/values-en@pirate/strings.xml
deleted file mode 100644
index b6a54137..00000000
--- a/res/values-en@pirate/strings.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
- Secret Code
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/values-fr/strings_activity_settings.xml b/res/values-fr/strings_activity_settings.xml
deleted file mode 100644
index 200f4d31..00000000
--- a/res/values-fr/strings_activity_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- synchroniser automatiquement avec le démarrage du programme
-
-
\ No newline at end of file
diff --git a/res/values-nqo/strings.xml b/res/values-nqo/strings.xml
deleted file mode 100644
index b244edf1..00000000
--- a/res/values-nqo/strings.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/res/values-ru/strings_activity_settings.xml b/res/values-ru/strings_activity_settings.xml
deleted file mode 100644
index 10e8b28b..00000000
--- a/res/values-ru/strings_activity_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- автоматической синхронизации c начала программы
-
-
\ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 5e669456..61984dda 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -1,6 +1,7 @@
- #525252
+
+ #383d43
#F0F0F0
#292929
diff --git a/src/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java b/src/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
index 6caf1078..5dc2d79e 100644
--- a/src/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
+++ b/src/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java
@@ -43,6 +43,8 @@ import com.actionbarsherlock.view.MenuItem;
import com.handmark.pulltorefresh.library.BlockingExpandableListView;
import com.handmark.pulltorefresh.library.PullToRefreshExpandableListView;
+import org.codechimp.apprater.AppRater;
+
import de.luhmer.owncloudnewsreader.LoginDialogFragment.LoginSuccessfullListener;
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.authentication.AccountGeneral;
@@ -54,12 +56,7 @@ import de.luhmer.owncloudnewsreader.services.IOwnCloudSyncService;
/**
* An activity representing a list of NewsReader. This activity has different
- * presentations for handset and tablet-size devices. On handsets, the activity
- * presents a list of items, which when touched, lead to a
- * {@link NewsReaderDetailActivity} representing item details. On tablets, the
- * activity presents the list of items and item details side-by-side using two
- * vertical panes.
- *
+ * presentations for handset and tablet-size devices.
* The activity makes heavy use of fragments. The list of items is a
* {@link NewsReaderListFragment} and the item details (if present) is a
* {@link NewsReaderDetailFragment}.
@@ -212,7 +209,10 @@ public class NewsReaderListActivity extends MenuUtilsSherlockFragmentActivity im
startDetailFHolder = new StartDetailFragmentHolder(SubscriptionExpandableListAdapter.ALL_UNREAD_ITEMS, true, null);
StartDetailFragmentNow();
}
-
+
+ AppRater.app_launched(this);
+ //AppRater.rateNow(this);
+
//onTopItemClicked(SubscriptionExpandableListAdapter.ALL_UNREAD_ITEMS, true, null);
}
@@ -539,7 +539,7 @@ public class NewsReaderListActivity extends MenuUtilsSherlockFragmentActivity im
//getSupportMenuInflater().inflate(R.menu.news_reader, menu);
- super.onCreateOptionsMenu(menu, getSupportMenuInflater(), true, this);
+ super.onCreateOptionsMenu(menu, getSupportMenuInflater(), this);
UpdateButtonSyncLayout();
diff --git a/src/de/luhmer/owncloudnewsreader/NewsReaderListFragment.java b/src/de/luhmer/owncloudnewsreader/NewsReaderListFragment.java
index e8d9c6cb..3dfd514c 100644
--- a/src/de/luhmer/owncloudnewsreader/NewsReaderListFragment.java
+++ b/src/de/luhmer/owncloudnewsreader/NewsReaderListFragment.java
@@ -21,9 +21,6 @@
package de.luhmer.owncloudnewsreader;
-import org.apache.http.client.HttpResponseException;
-import org.apache.http.conn.HttpHostConnectException;
-
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
@@ -37,6 +34,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
+import android.os.Parcelable;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.util.Log;
@@ -55,6 +53,12 @@ import com.handmark.pulltorefresh.library.BlockingExpandableListView;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshExpandableListView;
+import com.michaelflisar.messagebar.MessageBar;
+import com.michaelflisar.messagebar.messages.BaseMessage;
+import com.michaelflisar.messagebar.messages.TextMessage;
+
+import org.apache.http.client.HttpResponseException;
+import org.apache.http.conn.HttpHostConnectException;
import de.luhmer.owncloudnewsreader.Constants.SYNC_TYPES;
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
@@ -148,20 +152,23 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
case SYNC_TYPE__FEEDS:
break;
case SYNC_TYPE__ITEMS:
-
+
Log.d(TAG, "finished sync");
refresh = new Handler(Looper.getMainLooper());
refresh.post(new Runnable() {
- public void run() {
- lvAdapter.ReloadAdapter();
-
- NewsReaderListActivity nlActivity = (NewsReaderListActivity) getActivity();
- if (nlActivity != null)
- nlActivity.UpdateItemList();
+ public void run() {
+ lvAdapter.ReloadAdapter();
+ NewsReaderListActivity nlActivity = (NewsReaderListActivity) getActivity();
+ if (nlActivity != null)
+ nlActivity.UpdateItemList();
+
+ MessageBar messageBar = new MessageBar(getActivity(), true);
+ TextMessage textMessage = new TextMessage("New Messages available", "Reload", R.drawable.ic_menu_refresh);
+ textMessage.setClickListener(mListener);
+ messageBar.show(textMessage);
}
});
-
- break;
+ break;
}
}
@@ -231,7 +238,9 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
//public static String password;
//AsyncUpdateFinished asyncUpdateFinished;
ServiceConnection mConnection = null;
-
+
+ private BaseMessage.OnMessageClickListener mListener = null;
+
/**
* Mandatory empty constructor for the fragment manager to instantiate the
* fragment (e.g. upon screen orientation changes).
@@ -265,6 +274,24 @@ public class NewsReaderListFragment extends SherlockFragment implements OnCreate
//if(_Reader == null)
// _Reader = new OwnCloud_Reader();
+
+ mListener = new BaseMessage.OnMessageClickListener()
+ {
+ @Override
+ public void onButton2Click(Parcelable data)
+ {
+ }
+
+ @Override
+ public void onButton1Click(Parcelable data)
+ {
+ //Toast.makeText(getActivity(), "button 1 pressed", 3000).show();
+ NewsReaderDetailFragment ndf = ((NewsReaderDetailFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.content_frame));
+ if(ndf != null)
+ ndf.UpdateCursor();
+ }
+ };
+
}
catch(Exception ex)
{
diff --git a/src/de/luhmer/owncloudnewsreader/VersionInfoDialogFragment.java b/src/de/luhmer/owncloudnewsreader/VersionInfoDialogFragment.java
index 01d9c86f..5e132ab7 100644
--- a/src/de/luhmer/owncloudnewsreader/VersionInfoDialogFragment.java
+++ b/src/de/luhmer/owncloudnewsreader/VersionInfoDialogFragment.java
@@ -21,21 +21,17 @@
package de.luhmer.owncloudnewsreader;
-import java.io.InputStream;
-
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.Dialog;
-import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager.LayoutParams;
-import android.webkit.WebSettings;
-import android.webkit.WebView;
+import android.widget.TextView;
import com.actionbarsherlock.app.SherlockDialogFragment;
@@ -44,9 +40,7 @@ import com.actionbarsherlock.app.SherlockDialogFragment;
* well.
*/
public class VersionInfoDialogFragment extends SherlockDialogFragment {
-
- private static String web_template = null;
-
+
@SuppressLint("SetJavaScriptEnabled")
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@@ -54,36 +48,22 @@ public class VersionInfoDialogFragment extends SherlockDialogFragment {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dialog_version_info, null);
- builder.setView(view)
- /*
- // Add action buttons
- .setPositiveButton(R.string.action_sign_in_short, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- //attemptLogin();
- }
- })
- .setNegativeButton(R.string.action_cancel, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- LoginDialogFragment.this.getDialog().cancel();
- }
- })*/
- .setTitle(getString(R.string.menu_About_Changelog));
-
-
- init_webTemplate(getActivity());
- WebView webView = (WebView) view;
- WebSettings webSettings = webView.getSettings();
- webSettings.setJavaScriptEnabled(true);
- webView.loadDataWithBaseURL("", web_template, "text/html", "UTF-8", "");
-
+ builder.setView(view).setTitle(getString(R.string.menu_About_Changelog));
+
+ try {
+ PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
+ String version = pInfo.versionName;
+ ((TextView)view.findViewById(R.id.tv_androidAppVersion)).setText("You're using Version " + version);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
return builder.create();
}
-
+
/* (non-Javadoc)
* @see android.support.v4.app.DialogFragment#onStart()
*/
- @SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.FROYO)
@Override
public void onStart() {
@@ -98,29 +78,4 @@ public class VersionInfoDialogFragment extends SherlockDialogFragment {
super.onStart();
}
-
- private void init_webTemplate(Context context)
- {
- if(web_template == null)
- {
- InputStream input = null;
- try {
- //Activity act = getActivity();
- input = context.getAssets().open("version_changelog_web_template.html");
- int size = input.available();
- byte[] buffer = new byte[size];
- input.read(buffer);
- input.close();
-
- // byte buffer into a string
- web_template = new String(buffer);
-
- PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
- String version = pInfo.versionName;
- web_template = web_template.replace("X_VERSION", version);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
}
diff --git a/src/de/luhmer/owncloudnewsreader/helper/AutoResizeTextView.java b/src/de/luhmer/owncloudnewsreader/helper/AutoResizeTextView.java
new file mode 100644
index 00000000..8aa0de92
--- /dev/null
+++ b/src/de/luhmer/owncloudnewsreader/helper/AutoResizeTextView.java
@@ -0,0 +1,310 @@
+package de.luhmer.owncloudnewsreader.helper;
+
+/**
+ * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ * Version 2, December 2004
+ *
+ * Copyright (C) 2004 Sam Hocevar
+ *
+ * Everyone is permitted to copy and distribute verbatim or modified
+ * copies of this license document, and changing it is allowed as long
+ * as the name is changed.
+ *
+ * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+ *
+ * 0. You just DO WHAT THE FUCK YOU WANT TO.
+ */
+
+import android.content.Context;
+import android.text.Layout.Alignment;
+import android.text.StaticLayout;
+import android.text.TextPaint;
+import android.util.AttributeSet;
+import android.util.TypedValue;
+import android.widget.TextView;
+
+/**
+ * Text view that auto adjusts text size to fit within the view.
+ * If the text size equals the minimum text size and still does not
+ * fit, append with an ellipsis.
+ *
+ * @author Chase Colburn
+ * @since Apr 4, 2011
+ */
+public class AutoResizeTextView extends TextView {
+
+ // Minimum text size for this text view
+ public static final float MIN_TEXT_SIZE = 20;
+
+ // Interface for resize notifications
+ public interface OnTextResizeListener {
+ public void onTextResize(TextView textView, float oldSize, float newSize);
+ }
+
+ // Our ellipse string
+ private static final String mEllipsis = "...";
+
+ // Registered resize listener
+ private OnTextResizeListener mTextResizeListener;
+
+ // Flag for text and/or size changes to force a resize
+ private boolean mNeedsResize = false;
+
+ // Text size that is set from code. This acts as a starting point for resizing
+ private float mTextSize;
+
+ // Temporary upper bounds on the starting text size
+ private float mMaxTextSize = 0;
+
+ // Lower bounds for text size
+ private float mMinTextSize = MIN_TEXT_SIZE;
+
+ // Text view line spacing multiplier
+ private float mSpacingMult = 1.0f;
+
+ // Text view additional line spacing
+ private float mSpacingAdd = 0.0f;
+
+ // Add ellipsis to text that overflows at the smallest text size
+ private boolean mAddEllipsis = true;
+
+ // Default constructor override
+ public AutoResizeTextView(Context context) {
+ this(context, null);
+ }
+
+ // Default constructor when inflating from XML file
+ public AutoResizeTextView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ // Default constructor override
+ public AutoResizeTextView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ mTextSize = getTextSize();
+ }
+
+ /**
+ * When text changes, set the force resize flag to true and reset the text size.
+ */
+ @Override
+ protected void onTextChanged(final CharSequence text, final int start, final int before, final int after) {
+ mNeedsResize = true;
+ // Since this view may be reused, it is good to reset the text size
+ resetTextSize();
+ }
+
+ /**
+ * If the text view size changed, set the force resize flag to true
+ */
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ if (w != oldw || h != oldh) {
+ mNeedsResize = true;
+ }
+ }
+
+ /**
+ * Register listener to receive resize notifications
+ * @param listener
+ */
+ public void setOnResizeListener(OnTextResizeListener listener) {
+ mTextResizeListener = listener;
+ }
+
+ /**
+ * Override the set text size to update our internal reference values
+ */
+ @Override
+ public void setTextSize(float size) {
+ super.setTextSize(size);
+ mTextSize = getTextSize();
+ }
+
+ /**
+ * Override the set text size to update our internal reference values
+ */
+ @Override
+ public void setTextSize(int unit, float size) {
+ super.setTextSize(unit, size);
+ mTextSize = getTextSize();
+ }
+
+ /**
+ * Override the set line spacing to update our internal reference values
+ */
+ @Override
+ public void setLineSpacing(float add, float mult) {
+ super.setLineSpacing(add, mult);
+ mSpacingMult = mult;
+ mSpacingAdd = add;
+ }
+
+ /**
+ * Set the upper text size limit and invalidate the view
+ * @param maxTextSize
+ */
+ public void setMaxTextSize(float maxTextSize) {
+ mMaxTextSize = maxTextSize;
+ requestLayout();
+ invalidate();
+ }
+
+ /**
+ * Return upper text size limit
+ * @return
+ */
+ public float getMaxTextSize() {
+ return mMaxTextSize;
+ }
+
+ /**
+ * Set the lower text size limit and invalidate the view
+ * @param minTextSize
+ */
+ public void setMinTextSize(float minTextSize) {
+ mMinTextSize = minTextSize;
+ requestLayout();
+ invalidate();
+ }
+
+ /**
+ * Return lower text size limit
+ * @return
+ */
+ public float getMinTextSize() {
+ return mMinTextSize;
+ }
+
+ /**
+ * Set flag to add ellipsis to text that overflows at the smallest text size
+ * @param addEllipsis
+ */
+ public void setAddEllipsis(boolean addEllipsis) {
+ mAddEllipsis = addEllipsis;
+ }
+
+ /**
+ * Return flag to add ellipsis to text that overflows at the smallest text size
+ * @return
+ */
+ public boolean getAddEllipsis() {
+ return mAddEllipsis;
+ }
+
+ /**
+ * Reset the text to the original size
+ */
+ public void resetTextSize() {
+ if(mTextSize > 0) {
+ super.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize);
+ mMaxTextSize = mTextSize;
+ }
+ }
+
+ /**
+ * Resize text after measuring
+ */
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ if(changed || mNeedsResize) {
+ int widthLimit = (right - left) - getCompoundPaddingLeft() - getCompoundPaddingRight();
+ int heightLimit = (bottom - top) - getCompoundPaddingBottom() - getCompoundPaddingTop();
+ resizeText(widthLimit, heightLimit);
+ }
+ super.onLayout(changed, left, top, right, bottom);
+ }
+
+
+ /**
+ * Resize the text size with default width and height
+ */
+ public void resizeText() {
+ int heightLimit = getHeight() - getPaddingBottom() - getPaddingTop();
+ int widthLimit = getWidth() - getPaddingLeft() - getPaddingRight();
+ resizeText(widthLimit, heightLimit);
+ }
+
+ /**
+ * Resize the text size with specified width and height
+ * @param width
+ * @param height
+ */
+ public void resizeText(int width, int height) {
+ CharSequence text = getText();
+ // Do not resize if the view does not have dimensions or there is no text
+ if(text == null || text.length() == 0 || height <= 0 || width <= 0 || mTextSize == 0) {
+ return;
+ }
+
+ // Get the text view's paint object
+ TextPaint textPaint = getPaint();
+
+ // Store the current text size
+ float oldTextSize = textPaint.getTextSize();
+ // If there is a max text size set, use the lesser of that and the default text size
+ float targetTextSize = mMaxTextSize > 0 ? Math.min(mTextSize, mMaxTextSize) : mTextSize;
+
+ // Get the required text height
+ int textHeight = getTextHeight(text, textPaint, width, targetTextSize);
+
+ // Until we either fit within our text view or we had reached our min text size, incrementally try smaller sizes
+ while(textHeight > height && targetTextSize > mMinTextSize) {
+ targetTextSize = Math.max(targetTextSize - 2, mMinTextSize);
+ textHeight = getTextHeight(text, textPaint, width, targetTextSize);
+ }
+
+ // If we had reached our minimum text size and still don't fit, append an ellipsis
+ if(mAddEllipsis && targetTextSize == mMinTextSize && textHeight > height) {
+ // Draw using a static layout
+ StaticLayout layout = new StaticLayout(text, textPaint, width, Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd, false);
+ // Check that we have a least one line of rendered text
+ if(layout.getLineCount() > 0) {
+ // Since the line at the specific vertical position would be cut off,
+ // we must trim up to the previous line
+ int lastLine = layout.getLineForVertical(height) - 1;
+ // If the text would not even fit on a single line, clear it
+ if(lastLine < 0) {
+ setText("");
+ }
+ // Otherwise, trim to the previous line and add an ellipsis
+ else {
+ int start = layout.getLineStart(lastLine);
+ int end = layout.getLineEnd(lastLine);
+ float lineWidth = layout.getLineWidth(lastLine);
+ float ellipseWidth = textPaint.measureText(mEllipsis);
+
+ // Trim characters off until we have enough room to draw the ellipsis
+ while(width < lineWidth + ellipseWidth) {
+ lineWidth = textPaint.measureText(text.subSequence(start, --end + 1).toString());
+ }
+ setText(text.subSequence(0, end) + mEllipsis);
+ }
+ }
+ }
+
+ // Some devices try to auto adjust line spacing, so force default line spacing
+ // and invalidate the layout as a side effect
+ textPaint.setTextSize(targetTextSize);
+ setLineSpacing(mSpacingAdd, mSpacingMult);
+
+ // Notify the listener if registered
+ if(mTextResizeListener != null) {
+ mTextResizeListener.onTextResize(this, oldTextSize, targetTextSize);
+ }
+
+ // Reset force resize flag
+ mNeedsResize = false;
+ }
+
+ // Set the text size of the text paint object and use a static layout to render text off screen before measuring
+ private int getTextHeight(CharSequence source, TextPaint paint, int width, float textSize) {
+ // Update the text paint object
+ paint.setTextSize(textSize);
+ // Measure using a static layout
+ StaticLayout layout = new StaticLayout(source, paint, width, Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd, true);
+ return layout.getHeight();
+ }
+
+}
diff --git a/src/de/luhmer/owncloudnewsreader/helper/MenuUtilsSherlockFragmentActivity.java b/src/de/luhmer/owncloudnewsreader/helper/MenuUtilsSherlockFragmentActivity.java
index d827bbe1..2a7ba624 100644
--- a/src/de/luhmer/owncloudnewsreader/helper/MenuUtilsSherlockFragmentActivity.java
+++ b/src/de/luhmer/owncloudnewsreader/helper/MenuUtilsSherlockFragmentActivity.java
@@ -22,8 +22,6 @@
package de.luhmer.owncloudnewsreader.helper;
import android.annotation.TargetApi;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
import android.os.Build;
import android.preference.PreferenceManager;
import android.support.v4.app.FragmentActivity;
@@ -41,7 +39,6 @@ import de.luhmer.owncloudnewsreader.NewsReaderDetailFragment;
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
import de.luhmer.owncloudnewsreader.R;
import de.luhmer.owncloudnewsreader.VersionInfoDialogFragment;
-import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
import de.luhmer.owncloudnewsreader.reader.IReader;
import de.luhmer.owncloudnewsreader.reader.OnAsyncTaskCompletedListener;
@@ -90,7 +87,7 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
}
- public static void onCreateOptionsMenu(Menu menu, MenuInflater inflater, boolean mTwoPane, FragmentActivity act) {
+ public static void onCreateOptionsMenu(Menu menu, MenuInflater inflater, FragmentActivity act) {
inflater.inflate(R.menu.news_reader, menu);
activity = act;
@@ -167,7 +164,8 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
}
private static void DownloadMoreItems()
- {
+ {
+ /*
DatabaseConnection dbConn = new DatabaseConnection(activity);
int count = dbConn.getCountFeedsForFolder(SubscriptionExpandableListAdapter.ALL_ITEMS, false);
if(count >= Constants.maxItemsCount)
@@ -187,8 +185,8 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
//Toast.makeText(activity, text, Toast.LENGTH_LONG).show();
}
else
- {
- String username = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getString("edt_username", "");
+ {*/
+ String username = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getString("edt_username", "");
String password = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()).getString("edt_password", "");
if(username != null) {
@@ -197,7 +195,7 @@ public class MenuUtilsSherlockFragmentActivity extends SherlockFragmentActivity
Toast.makeText(activity, activity.getString(R.string.toast_GettingMoreItems), Toast.LENGTH_SHORT).show();
}
- }
+ //}
}
static OnAsyncTaskCompletedListener onAsyncTaskGetVersionFinished = new OnAsyncTaskCompletedListener() {