From 59a46f701d1b7c7920923eac9cb72f9e5a1ba8a2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 25 Dec 2011 14:59:59 +0300 Subject: [PATCH 1/8] implement setting labels for selected article --- AndroidManifest.xml | 4 +- res/menu/main_menu.xml | 6 +++ res/values/strings.xml | 1 + src/org/fox/ttrss/Label.java | 9 ++++ src/org/fox/ttrss/MainActivity.java | 80 +++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 src/org/fox/ttrss/Label.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index f43a4921..04528cb3 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="45" + android:versionName="0.3.12" > diff --git a/res/menu/main_menu.xml b/res/menu/main_menu.xml index f8865d90..cc9f474e 100644 --- a/res/menu/main_menu.xml +++ b/res/menu/main_menu.xml @@ -112,6 +112,12 @@ android:id="@+id/catchup_above" android:icon="@drawable/ic_menu_tick" android:title="@string/article_mark_read_above"/> + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 9a7adf46..27eea636 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -114,4 +114,5 @@ Cache images Download images to sdcard. This might significantly increase time it takes to go offline. Downloading images (%1$d)... + Set labels \ No newline at end of file diff --git a/src/org/fox/ttrss/Label.java b/src/org/fox/ttrss/Label.java new file mode 100644 index 00000000..eccc1e66 --- /dev/null +++ b/src/org/fox/ttrss/Label.java @@ -0,0 +1,9 @@ +package org.fox.ttrss; + +public class Label { + int id; + String caption; + String fg_color; + String bg_color; + boolean checked; +} diff --git a/src/org/fox/ttrss/MainActivity.java b/src/org/fox/ttrss/MainActivity.java index e89b6adc..932445cb 100644 --- a/src/org/fox/ttrss/MainActivity.java +++ b/src/org/fox/ttrss/MainActivity.java @@ -1,5 +1,7 @@ package org.fox.ttrss; +import java.lang.reflect.Type; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Timer; @@ -13,6 +15,8 @@ import android.app.Dialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.DialogInterface; +import android.content.DialogInterface.OnClickListener; +import android.content.DialogInterface.OnMultiChoiceClickListener; import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; @@ -40,8 +44,10 @@ import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; +import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.google.gson.reflect.TypeToken; public class MainActivity extends FragmentActivity implements OnlineServices { private final String TAG = this.getClass().getSimpleName(); @@ -1024,6 +1030,78 @@ public class MainActivity extends FragmentActivity implements OnlineServices { * * 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>() {}.getType(); + final List