subscribe dialog: add a progressbar
This commit is contained in:
parent
3de302182c
commit
6b6107b276
58
org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java
Normal file → Executable file
58
org.fox.ttrss/src/main/java/org/fox/ttrss/share/SubscribeActivity.java
Normal file → Executable file
@ -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);
|
||||
}
|
||||
|
11
org.fox.ttrss/src/main/res/layout/subscribe.xml
Normal file → Executable file
11
org.fox.ttrss/src/main/res/layout/subscribe.xml
Normal file → Executable file
@ -26,13 +26,22 @@
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@+id/feed_url" />
|
||||
|
||||
<ProgressBar
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_below="@+id/category_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:visibility="invisible"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:id="@+id/subscribe_progress" />
|
||||
|
||||
<LinearLayout
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignLeft="@+id/category_spinner"
|
||||
android:layout_alignRight="@+id/category_spinner"
|
||||
android:layout_below="@+id/category_spinner" >
|
||||
android:layout_below="@+id/subscribe_progress" >
|
||||
|
||||
<Button
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
|
Loading…
Reference in New Issue
Block a user