New Language support - Error messages improved
This commit is contained in:
parent
6003834dae
commit
db015bd327
11 changed files with 58 additions and 76 deletions
Binary file not shown.
|
@ -74,7 +74,7 @@
|
|||
android:maxLines="1"
|
||||
android:selectAllOnFocus="true"
|
||||
android:singleLine="true"
|
||||
android:title="@string/pref_title_owncloudRootPath"
|
||||
android:title="@string/pref_default_owncloudRootPath"
|
||||
style="@style/LoginDialogEditTextStyle" />
|
||||
|
||||
<CheckBox
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
android:icon="@drawable/ic_menu_refresh"
|
||||
android:showAsAction="always" />
|
||||
|
||||
<item android:id="@+id/menu_StartImageCaching"
|
||||
android:title="@string/menu_StartImageCaching"
|
||||
android:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_markAllAsRead"
|
||||
android:showAsAction="never"
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<resources>
|
||||
<!--<string name="non_sorted_articles">Nicht zugeordnete Artikel</string>-->
|
||||
<!--EMAIL-->
|
||||
<!--Action Bar Items-->
|
||||
<!--Strings related to login-->
|
||||
<!--<string name="pref_title_owncloudRootPath">ownCloud root address</string>-->
|
||||
<!--<string name="pref_default_username">admin</string>-->
|
||||
<!--Strings related to Settings-->
|
||||
<!--General settings-->
|
||||
<!--<string name="pref_title_social_recommendations">Enable social recommendations</string>
|
||||
<string name="pref_description_social_recommendations">Recommendations for people to contact based on your message history</string>-->
|
||||
<!--Settings for Display-->
|
||||
<!--Login Dialog-->
|
||||
<!--Data & Sync-->
|
||||
<!--Max INT size-->
|
||||
<!--<string name="pref_title_sync_frequency">Sync frequency</string>
|
||||
|
||||
<string-array name="pref_sync_frequency_titles">
|
||||
<item>15 minutes</item>
|
||||
<item>30 minutes</item>
|
||||
<item>1 hour</item>
|
||||
<item>3 hours</item>
|
||||
<item>6 hours</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
<string-array name="pref_sync_frequency_values">
|
||||
<item>15</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
<item>180</item>
|
||||
<item>360</item>
|
||||
<item>-1</item>
|
||||
</string-array>-->
|
||||
<!--<string name="pref_title_system_sync_settings">System sync settings</string>-->
|
||||
<!--Example settings for Notifications-->
|
||||
<!--<string name="pref_header_notifications">Notifications</string>
|
||||
<string name="pref_title_new_message_notifications">New message notifications</string>
|
||||
<string name="pref_title_ringtone">Ringtone</string>
|
||||
<string name="pref_ringtone_silent">Silent</string>
|
||||
<string name="pref_title_vibrate">Vibrate</string>-->
|
||||
</resources>
|
|
@ -19,6 +19,7 @@
|
|||
<string name="menu_update">Refresh</string>
|
||||
|
||||
<string name="menu_markAllAsRead">Mark all as read</string>
|
||||
<string name="menu_StartImageCaching">Start Image offline caching</string>
|
||||
|
||||
|
||||
|
||||
|
@ -106,7 +107,7 @@
|
|||
<!-- Login Dialog -->
|
||||
<string name="login_dialog_title_error">Error</string>
|
||||
<string name="login_dialog_text_something_went_wrong">Something went wrong :(</string>
|
||||
<string name="login_dialog_text_not_compatible">This App version is not compatible with you ownCloud News App. Please update the news app and the appframework.</string>
|
||||
<string name="login_dialog_text_not_compatible">This App version is not compatible with your ownCloud News App. Please update the news app and the appframework.</string>
|
||||
|
||||
<string name="login_dialog_title_security_warning">Security Warning</string>
|
||||
<string name="login_dialog_text_security_warning">You\'re not using https. An attacker could intercept your traffic and gain access to some sensitive data (e.g. your password). So it\'s strongly recommend to use https!</string>
|
||||
|
|
|
@ -418,16 +418,13 @@ public class LoginDialogFragment extends SherlockDialogFragment {
|
|||
editor.commit();
|
||||
|
||||
LoginDialogFragment.this.getDialog().cancel();
|
||||
} else if((versionCode > 0) || (versionCode == -1 && exception_message.equals("Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject"))) {
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), getString(R.string.login_dialog_text_not_compatible), getActivity());
|
||||
} else if(versionCode == -1) {
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), exception_message, getActivity());
|
||||
//mPasswordView.setError(getString(R.string.error_incorrect_password));
|
||||
//mPasswordView.requestFocus();
|
||||
}else if(versionCode > 0) {
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), getString(R.string.login_dialog_text_not_compatible), getActivity());
|
||||
//mPasswordView.setError(getString(R.string.error_incorrect_password));
|
||||
//mPasswordView.requestFocus();
|
||||
}
|
||||
else if(versionCode == 0){
|
||||
} else if(versionCode == 0){
|
||||
ShowAlertDialog(getString(R.string.login_dialog_title_error), getString(R.string.login_dialog_text_something_went_wrong), getActivity());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.handmark.pulltorefresh.library.PullToRefreshExpandableListView;
|
|||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
|
||||
import de.luhmer.owncloudnewsreader.reader.IReader;
|
||||
import de.luhmer.owncloudnewsreader.services.DownloadImagesService;
|
||||
|
||||
/**
|
||||
* An activity representing a list of NewsReader. This activity has different
|
||||
|
@ -293,6 +294,18 @@ public class NewsReaderListActivity extends SherlockFragmentActivity implements
|
|||
ndf.UpdateCursor();
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.menu_StartImageCaching:
|
||||
DatabaseConnection dbConn = new DatabaseConnection(this);
|
||||
try {
|
||||
long highestItemId = dbConn.getLowestItemIdUnread();
|
||||
Intent service = new Intent(this, DownloadImagesService.class);
|
||||
service.putExtra(DownloadImagesService.LAST_ITEM_ID, highestItemId);
|
||||
startService(service);
|
||||
} finally {
|
||||
dbConn.closeDatabase();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,6 @@ import android.annotation.TargetApi;
|
|||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -24,8 +21,6 @@ import android.preference.PreferenceActivity;
|
|||
import android.preference.PreferenceCategory;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.preference.RingtonePreference;
|
||||
import android.text.TextUtils;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.ThemeChooser;
|
||||
|
@ -201,7 +196,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
.setSummary(index >= 0 ? listPreference.getEntries()[index]
|
||||
: null);
|
||||
|
||||
} else if (preference instanceof RingtonePreference) {
|
||||
} /*else if (preference instanceof RingtonePreference) {
|
||||
// For ringtone preferences, look up the correct display value
|
||||
// using RingtoneManager.
|
||||
if (TextUtils.isEmpty(stringValue)) {
|
||||
|
@ -224,7 +219,7 @@ public class SettingsActivity extends PreferenceActivity {
|
|||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
} */ else {
|
||||
String key = preference.getKey();
|
||||
// For all other preferences, set the summary to the value's
|
||||
// simple string representation.
|
||||
|
|
|
@ -184,6 +184,12 @@ public class DatabaseConnection {
|
|||
return getLongValueBySQL(buildSQL);
|
||||
}
|
||||
|
||||
public long getLowestItemIdUnread()
|
||||
{
|
||||
String buildSQL = "SELECT MIN(" + RSS_ITEM_RSSITEM_ID + ") FROM " + RSS_ITEM_TABLE + " WHERE " + RSS_ITEM_READ_TEMP + " != 1";
|
||||
return getLongValueBySQL(buildSQL);
|
||||
}
|
||||
|
||||
public long getHighestItemId()
|
||||
{
|
||||
String buildSQL = "SELECT MAX(" + RSS_ITEM_RSSITEM_ID + ") FROM " + RSS_ITEM_TABLE;
|
||||
|
|
|
@ -14,7 +14,7 @@ public class AsyncTask_GetFeeds extends AsyncTask<Object, Void, Exception> imple
|
|||
private Activity context;
|
||||
private int task_id;
|
||||
private OnAsyncTaskCompletedListener[] listener;
|
||||
private String highestItemIdBeforeSync;
|
||||
private long highestItemIdBeforeSync;
|
||||
|
||||
public AsyncTask_GetFeeds(final int task_id, final Activity context, final OnAsyncTaskCompletedListener[] listener) {
|
||||
super();
|
||||
|
@ -64,7 +64,7 @@ public class AsyncTask_GetFeeds extends AsyncTask<Object, Void, Exception> imple
|
|||
int requestCount = 0;
|
||||
int maxSyncSize = Integer.parseInt(OwnCloudReaderMethods.maxSizePerSync);
|
||||
|
||||
highestItemIdBeforeSync = String.valueOf(dbConn.getHighestItemId());
|
||||
highestItemIdBeforeSync = dbConn.getHighestItemId();
|
||||
|
||||
if(lastModified == 0)
|
||||
{
|
||||
|
|
|
@ -2,13 +2,8 @@ package de.luhmer.owncloudnewsreader.services;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler.GetImageAsyncTask;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.IntentService;
|
||||
import android.app.Notification;
|
||||
|
@ -17,30 +12,44 @@ import android.app.PendingIntent;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
||||
import de.luhmer.owncloudnewsreader.R;
|
||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnection;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageDownloadFinished;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler;
|
||||
import de.luhmer.owncloudnewsreader.helper.ImageHandler.GetImageAsyncTask;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
||||
public class DownloadImagesService extends IntentService {
|
||||
|
||||
private static final int NOTIFICATION_ID = 1;
|
||||
public static final String LAST_ITEM_ID = "LAST_ITEM_ID";
|
||||
private static Random random;
|
||||
|
||||
private int NOTIFICATION_ID = 1;
|
||||
private NotificationManager notificationManager;
|
||||
private NotificationCompat.Builder NotificationDownloadImages;
|
||||
private int count;
|
||||
private int maxCount;
|
||||
public static final String LAST_ITEM_ID = "LAST_ITEM_ID";
|
||||
|
||||
|
||||
public DownloadImagesService() {
|
||||
super(null);
|
||||
count = 0;
|
||||
maxCount = 0;
|
||||
super(null);
|
||||
initService();
|
||||
}
|
||||
|
||||
public DownloadImagesService(String name) {
|
||||
super(name);
|
||||
initService();
|
||||
}
|
||||
|
||||
private void initService()
|
||||
{
|
||||
count = 0;
|
||||
maxCount = 0;
|
||||
if(random == null)
|
||||
random = new Random();
|
||||
NOTIFICATION_ID = random.nextInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,10 +69,9 @@ public class DownloadImagesService extends IntentService {
|
|||
super.onDestroy();
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
@Override
|
||||
protected void onHandleIntent(Intent intent) {
|
||||
String lastId = intent.getStringExtra(LAST_ITEM_ID);
|
||||
String lastId = String.valueOf(intent.getLongExtra(LAST_ITEM_ID, 0));
|
||||
DatabaseConnection dbConn = new DatabaseConnection(this);
|
||||
Cursor cursor = dbConn.getAllItemsWithIdHigher(lastId);
|
||||
List<String> links = new ArrayList<String>();
|
||||
|
@ -97,7 +105,8 @@ public class DownloadImagesService extends IntentService {
|
|||
Notification notify = NotificationDownloadImages.build();
|
||||
|
||||
//Hide the notification after its selected
|
||||
notify.flags |= Notification.FLAG_AUTO_CANCEL;
|
||||
//notify.flags |= Notification.FLAG_AUTO_CANCEL;
|
||||
notify.flags |= Notification.FLAG_NO_CLEAR;
|
||||
|
||||
if(maxCount > 0)
|
||||
notificationManager.notify(NOTIFICATION_ID, notify);
|
||||
|
@ -108,7 +117,6 @@ public class DownloadImagesService extends IntentService {
|
|||
|
||||
ImageDownloadFinished imgDownloadFinished = new ImageDownloadFinished() {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||
@Override
|
||||
public void DownloadFinished(int AsynkTaskId, String fileCachePath) {
|
||||
count++;
|
||||
|
|
Loading…
Reference in a new issue