From 6b6107b2764003af19162e85d16a49a4bd42f930 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 3 Jun 2015 13:43:28 +0300 Subject: [PATCH] subscribe dialog: add a progressbar --- .../fox/ttrss/share/SubscribeActivity.java | 58 ++++++++++--------- .../src/main/res/layout/subscribe.xml | 11 +++- 2 files changed, 40 insertions(+), 29 deletions(-) mode change 100644 => 100755 org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java mode change 100644 => 100755 org.fox.ttrss/src/main/res/layout/subscribe.xml diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java old mode 100644 new mode 100755 index 69bc8a2e..9f79c194 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java @@ -1,5 +1,26 @@ package org.fox.ttrss.share; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.view.Window; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ProgressBar; +import android.widget.Spinner; + +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.reflect.TypeToken; + +import org.fox.ttrss.ApiRequest; +import org.fox.ttrss.R; +import org.fox.ttrss.types.FeedCategory; +import org.fox.ttrss.types.FeedCategoryList; + import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Collections; @@ -7,27 +28,6 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; -import org.fox.ttrss.ApiRequest; -import org.fox.ttrss.R; -import org.fox.ttrss.types.FeedCategory; -import org.fox.ttrss.types.FeedCategoryList; - -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.view.Window; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.EditText; -import android.widget.Spinner; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.reflect.TypeToken; - public class SubscribeActivity extends CommonShareActivity { private final String TAG = this.getClass().getSimpleName(); @@ -35,6 +35,7 @@ public class SubscribeActivity extends CommonShareActivity { private Button m_catButton; private CatListAdapter m_adapter; private FeedCategoryList m_cats = new FeedCategoryList(); + private ProgressBar m_progressBar; private static final int REQ_CATS = 1; private static final int REQ_POST = 2; @@ -87,7 +88,8 @@ public class SubscribeActivity extends CommonShareActivity { getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher); setSmallScreen(false); - + + m_progressBar = (ProgressBar) findViewById(R.id.subscribe_progress); Spinner catList = (Spinner) findViewById(R.id.category_spinner); if (m_cats.size() == 0) m_cats.add(new FeedCategory(0, "Uncategorized", 0)); @@ -138,7 +140,7 @@ public class SubscribeActivity extends CommonShareActivity { ApiRequest req = new ApiRequest(getApplicationContext()) { protected void onPostExecute(JsonElement result) { - setProgressBarIndeterminateVisibility(false); + m_progressBar.setVisibility(View.INVISIBLE); if (m_lastError != ApiError.NO_ERROR) { toast(getErrorMessage()); @@ -206,8 +208,8 @@ public class SubscribeActivity extends CommonShareActivity { } } }; - - setProgressBarIndeterminateVisibility(true); + + m_progressBar.setVisibility(View.VISIBLE); req.execute(map); } @@ -228,7 +230,7 @@ public class SubscribeActivity extends CommonShareActivity { private void updateCats() { ApiRequest req = new ApiRequest(getApplicationContext()) { protected void onPostExecute(JsonElement result) { - setProgressBarIndeterminateVisibility(false); + m_progressBar.setVisibility(View.INVISIBLE); if (m_lastError != ApiError.NO_ERROR) { toast(getErrorMessage()); @@ -266,8 +268,8 @@ public class SubscribeActivity extends CommonShareActivity { put("op", "getCategories"); } }; - - setProgressBarIndeterminateVisibility(true); + + m_progressBar.setVisibility(View.VISIBLE); req.execute(map); } diff --git a/org.fox.ttrss/src/main/res/layout/subscribe.xml b/org.fox.ttrss/src/main/res/layout/subscribe.xml old mode 100644 new mode 100755 index 71877606..2eb7141f --- a/org.fox.ttrss/src/main/res/layout/subscribe.xml +++ b/org.fox.ttrss/src/main/res/layout/subscribe.xml @@ -26,13 +26,22 @@ android:layout_alignParentRight="true" android:layout_below="@+id/feed_url" /> + + + android:layout_below="@+id/subscribe_progress" >