Merge branch 'master' of github.com:gothfox/Tiny-Tiny-RSS-for-Honeycomb

This commit is contained in:
Andrew Dolgov 2012-01-10 15:13:58 +04:00
commit 7f34760c3c
7 changed files with 227 additions and 13 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss" package="org.fox.ttrss"
android:versionCode="44" android:versionCode="46"
android:versionName="0.3.11" > android:versionName="0.3.13" >
<uses-sdk android:minSdkVersion="7" /> <uses-sdk android:minSdkVersion="7" />

View File

@ -112,6 +112,12 @@
android:id="@+id/catchup_above" android:id="@+id/catchup_above"
android:icon="@drawable/ic_menu_tick" android:icon="@drawable/ic_menu_tick"
android:title="@string/article_mark_read_above"/> android:title="@string/article_mark_read_above"/>
<item
android:id="@+id/set_labels"
android:icon="@drawable/ic_menu_marked"
android:title="@string/article_set_labels"/>
</group> </group>
</group> </group>
@ -127,7 +133,7 @@
android:id="@+id/login" android:id="@+id/login"
android:icon="@android:drawable/ic_menu_rotate" android:icon="@android:drawable/ic_menu_rotate"
android:showAsAction="ifRoom|withText" android:showAsAction="ifRoom|withText"
android:title="@string/login"/> android:title="@string/login_login"/>
</group> </group>
</menu> </menu>

118
res/values-de/strings.xml Normal file
View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="login_session_error">Anmeldung vom Server zurückgewiesen</string>
<string name="login_in_progress">Anmelden...</string>
<string name="login_failed">Anmeldung fehlgeschlagen...</string>
<string name="app_name">Tiny Tiny RSS</string>
<string name="login_need_configure">Bitte erst Einstellungen überprüfen.</string>
<string name="login_ready">Bereit zur Anmeldung</string>
<string name="login_login">Anmelden</string>
<string name="logout">Abmelden</string>
<string name="login">Benutzername</string>
<string name="debugging">Debugging</string>
<string name="password">Passwort</string>
<string name="default_url">http://example.domain/tt-rss/</string>
<string name="authentication">Anmeldung</string>
<string name="look_and_feel">Oberfläche</string>
<string name="pref_theme">Theme</string>
<string name="pref_theme_long">Ändert die Farbeinstellungen</string>
<string name="ttrss_url">Tiny Tiny RSS URL</string>
<string name="auto_login">automatisch Anmelden</string>
<string name="theme_dark">Dunkel</string>
<string name="preferences">Einstellungen</string>
<string name="theme_light">Hell</string>
<string name="connection">Verbindung</string>
<string name="headline_context_multiple">Ausgewählte Artikel</string>
<string name="http_authentication">HTTP Authentifizierung</string>
<string name="login_success">Anmeldung erfolgreich.</string>
<string name="no_unread_feeds">Keine ungelesenen Feeds</string>
<string name="no_unread_headlines">Keine ungelesenen Artikel</string>
<string name="loading_message">Lade, bitte warten...</string>
<string name="menu_unread_feeds">Zeige ungelesene Feeds</string>
<string name="menu_all_feeds">Zeige alle Feeds</string>
<string name="update_feeds">Feeds neu laden</string>
<string name="close_article">Artikel schließen</string>
<string name="share_article">Artikel teilen</string>
<string name="catchup">Gelesen markieren</string>
<string name="sort_feeds_by_unread">Sort feeds by unread count</string>
<string name="load_more_articles">Mehr laden</string>
<string name="show_all_articles">Alle Artikel anzeigen</string>
<string name="show_unread_articles">Show unread articles</string>
<string name="ssl_trust_any">Alle SSL Zertifikate akzeptieren</string>
<string name="category_browse_feeds">Feeds anzeigen</string>
<string name="category_browse_articles">Browse articles</string>
<string name="blank"></string>
<string name="transport_debugging">Log sent and received data</string>
<string name="article_toggle_marked">(Un)Star</string>
<string name="article_toggle_published">(Un)Publish</string>
<string name="headlines_select">Artikel auswählen</string>
<string name="headlines_select_dialog">Artikel auswählen</string>
<string name="headlines_select_all">Alle</string>
<string name="headlines_select_unread">Ungelesen</string>
<string name="headlines_select_none">Alle Abwählen</string>
<string name="selection_toggle_marked">(Un)Star</string>
<string name="selection_toggle_published">(Un)Publish</string>
<string name="selection_toggle_unread">(Un)Read</string>
<string name="selection_select_none">Alle abwählen</string>
<string name="context_selection_toggle_marked">(Un)Star</string>
<string name="context_selection_toggle_published">(Un)Publish</string>
<string name="context_selection_toggle_unread">(Un)Read</string>
<string name="article_set_unread">Set unread</string>
<string name="article_mark_read_above">Mark above read</string>
<string name="http_login_summary">Optional. Fill this if your tt-rss installation is protected by HTTP Basic authentication</string>
<string name="login_summary">Deine tt-rss Anmeldung. Nicht notwendig für single user mode</string>
<string name="enable_ads">Enable ads</string>
<string name="enable_ads_summary">Showing ads to you supports the project</string>
<string name="ttrss_url_summary">URLdeiner tt-rss Installation, Bsp.: http://site.com/tt-rss/</string>
<string name="download_feed_icons">Herunderladen der Feed-Symbole</string>
<string name="enable_cats">Anzeigen der Feedkategorien</string>
<string name="back_to_categories">Kategory schließen</string>
<string name="no_feeds_to_display">Keine Feeds zum anzeigen</string>
<string name="no_headlines_to_display">Keine Überschriften zum anzeigen.</string>
<string name="browse_cats_like_feeds">Browse categories like feeds</string>
<string name="browse_cats_like_feeds_summary">Kann im Kontexdtmenu jeder Kategorie angepasst werden.</string>
<string name="headlines_mark_as_read">Als gelesen markieren</string>
<string name="error_no_error">Kein Fehler</string>
<string name="error_unknown">Fehler: Unbekannter Fehler (siehe Log)</string>
<string name="error_http_unauthorized">Fehler: 401 Nicht Authorisiert</string>
<string name="error_http_forbidden">Fehler: 403 Zugriff verweigert</string>
<string name="error_http_not_found">Fehler: 404 Nicht gefunden</string>
<string name="error_http_server_error">Fehler: 500 Server Fehler</string>
<string name="error_http_other_error">Fehler: anderer HTTP Fehler (siehe Log)</string>
<string name="error_ssl_rejected">Fehler: SSL Zertifikat zurückgewiesen</string>
<string name="error_parse_error">Fehler: JSON parsen fehlgeschlagen</string>
<string name="error_io_error">Fehler: I/O Fehler (Server nicht erreichbar?)</string>
<string name="error_other_error">Fehler: Unbekannter Fehler (siehe Log)</string>
<string name="error_api_disabled">Fehler: API für diesen Benutzer abgeschlatet</string>
<string name="error_api_unknown">Fehler: unbekannter API Fehler (siehe Log)</string>
<string name="error_api_incorrect_usage">Fehler: falsche API Benutzung</string>
<string name="error_login_failed">Fehler: Benutzername und Passwort falsch</string>
<string name="error_invalid_api_url">Fehler: API URL ungültig</string>
<string name="combined_mode_summary">Zeigt Artikelinhalt in der gleichen Spalte statt in einer eigenen.</string>
<string name="combined_mode">Kombinierte Anzeige</string>
<string name="go_offline">Gehe Offline</string>
<string name="go_online">Gehe Online</string>
<string name="offline_downloading">Bereite Offlinemodus vor...</string>
<string name="offline_switch_error">Vorbereitung für Offlinemodus fehlgeschlagen (siehe Log)</string>
<string name="no_feeds">Keine Feeds zum Anzeigen</string>
<string name="no_headlines">Keine Artikel zum Anzeigen</string>
<string name="dialog_offline_prompt">Anmeldung fehlgeschlagen, Offlinedaten vorhanden. Möchten sie in den Offlinemodus wechseln?</string>
<string name="dialog_offline_success">Offlinemodus bereit</string>
<string name="dialog_offline_go">Offlinemodus</string>
<string name="dialog_cancel">Abbrechen</string>
<string name="syncing_offline_data">Synchronisiere Offlinedaten...</string>
<string name="dialog_offline_switch_prompt">Ungelesene Artikel herunterladen und in den Offlinemodus wechseln?</string>
<string name="notify_downloading_articles">Lade Artikel herunter (%1$d)...</string>
<string name="notify_downloading_init">Starte Download...</string>
<string name="notify_downloading_feeds">Feeds herunterladen...</string>
<string name="notify_uploading_sending_data">Sende Daten zum Server...</string>
<string name="notify_downloading_title">Bereite Offlinemodus vor...</string>
<string name="notify_uploading_title">Synchronisiere Offlinedaten...</string>
<string name="offline_sync_success">Synchronisierung der Offlinedaten erfolgreich abgeschlossen...</string>
<string name="offline_mode">Offlinemodus</string>
<string name="offline_image_cache_enabled">Bilder herunterladen</string>
<string name="offline_image_cache_enabled_summary">Herunterladen von Bildern. Dies kann die Zeit zum um inden Offlinemodus zu wechseln deutlich verlängern.</string>
<string name="notify_downloading_images">Bilder herunterladen (%1$d)...</string>
<string name="article_set_labels">Lables setzen</string>
</resources>

View File

@ -114,4 +114,5 @@
<string name="offline_image_cache_enabled">Cache images</string> <string name="offline_image_cache_enabled">Cache images</string>
<string name="offline_image_cache_enabled_summary">Download images to sdcard. This might significantly increase time it takes to go offline.</string> <string name="offline_image_cache_enabled_summary">Download images to sdcard. This might significantly increase time it takes to go offline.</string>
<string name="notify_downloading_images">Downloading images (%1$d)...</string> <string name="notify_downloading_images">Downloading images (%1$d)...</string>
<string name="article_set_labels">Set labels</string>
</resources> </resources>

View File

@ -0,0 +1,9 @@
package org.fox.ttrss;
public class Label {
int id;
String caption;
String fg_color;
String bg_color;
boolean checked;
}

View File

@ -1,5 +1,7 @@
package org.fox.ttrss; package org.fox.ttrss;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Timer; import java.util.Timer;
@ -13,6 +15,8 @@ import android.app.Dialog;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
@ -40,8 +44,10 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.google.gson.Gson;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
public class MainActivity extends FragmentActivity implements OnlineServices { public class MainActivity extends FragmentActivity implements OnlineServices {
private final String TAG = this.getClass().getSimpleName(); private final String TAG = this.getClass().getSimpleName();
@ -469,12 +475,12 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
int height = display.getHeight(); int height = display.getHeight();
if (height > width) { if (height > width) {
int tmp = height; int tmp = width;
width = tmp; width = height;
height = width; height = tmp;
} }
m_smallScreenMode = width < 960 || height < 720; m_smallScreenMode = m_compatMode || (width < 960 || height < 720);
setContentView(R.layout.main); setContentView(R.layout.main);
@ -1030,6 +1036,78 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
* *
* return true; * return true;
*/ */
case R.id.set_labels:
if (m_selectedArticle != null) {
ApiRequest req = new ApiRequest(getApplicationContext()) {
@Override
protected void onPostExecute(JsonElement result) {
if (result != null) {
Type listType = new TypeToken<List<Label>>() {}.getType();
final List<Label> labels = new Gson().fromJson(result, listType);
CharSequence[] items = new CharSequence[labels.size()];
final int[] itemIds = new int[labels.size()];
boolean[] checkedItems = new boolean[labels.size()];
for (int i = 0; i < labels.size(); i++) {
items[i] = labels.get(i).caption;
itemIds[i] = labels.get(i).id;
checkedItems[i] = labels.get(i).checked;
}
Dialog dialog = new Dialog(MainActivity.this);
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this)
.setTitle("Set labels")
.setMultiChoiceItems(items, checkedItems, new OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, final boolean isChecked) {
final int labelId = itemIds[which];
@SuppressWarnings("serial")
HashMap<String, String> map = new HashMap<String, String>() {
{
put("sid", m_sessionId);
put("op", "setArticleLabel");
put("label_id", String.valueOf(labelId));
put("article_ids", String.valueOf(m_selectedArticle.id));
if (isChecked) put("assign", "true");
}
};
ApiRequest req = new ApiRequest(m_context);
req.execute(map);
}
}).setPositiveButton("Close", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
dialog = builder.create();
dialog.show();
}
}
};
@SuppressWarnings("serial")
HashMap<String, String> map = new HashMap<String, String>() {
{
put("sid", m_sessionId);
put("op", "getLabels");
put("article_id", String.valueOf(m_selectedArticle.id));
}
};
req.execute(map);
}
return true;
default: default:
Log.d(TAG, Log.d(TAG,
"onOptionsItemSelected, unhandled id=" + item.getItemId()); "onOptionsItemSelected, unhandled id=" + item.getItemId());
@ -1046,7 +1124,7 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
intent.putExtra(Intent.EXTRA_TEXT, article.link); intent.putExtra(Intent.EXTRA_TEXT, article.link);
startActivity(Intent.createChooser(intent, startActivity(Intent.createChooser(intent,
getString(R.id.share_article))); getString(R.string.share_article)));
} }
} }
@ -1133,6 +1211,8 @@ public class MainActivity extends FragmentActivity implements OnlineServices {
getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticle != null); getActionBar().setDisplayHomeAsUpEnabled(m_selectedArticle != null);
} }
m_menu.findItem(R.id.set_labels).setEnabled(m_apiLevel >= 1);
} else { } else {
m_menu.setGroupVisible(R.id.menu_group_logged_in, false); m_menu.setGroupVisible(R.id.menu_group_logged_in, false);
m_menu.setGroupVisible(R.id.menu_group_logged_out, true); m_menu.setGroupVisible(R.id.menu_group_logged_out, true);

View File

@ -125,12 +125,12 @@ public class OfflineActivity extends FragmentActivity implements
int height = display.getHeight(); int height = display.getHeight();
if (height > width) { if (height > width) {
int tmp = height; int tmp = width;
width = tmp; width = height;
height = width; height = tmp;
} }
m_smallScreenMode = width < 960 || height < 720; m_smallScreenMode = m_compatMode || (width < 960 || height < 720);
setContentView(R.layout.main); setContentView(R.layout.main);