mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-02-05 21:13:45 +01:00
Improved error handling in gpodder.net directory
This commit is contained in:
parent
a716e4bbc0
commit
4a2a25a551
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
@ -21,14 +21,25 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_gravity="center"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminateOnly="true"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/txtvError"
|
||||
android:layout_gravity="center"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone"
|
||||
android:textAlignment="center"
|
||||
android:layout_margin="16dp"
|
||||
android:textSize="@dimen/text_size_small"/>
|
||||
</FrameLayout>
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/butRetry"
|
||||
android:text="@string/retry_label"
|
||||
android:layout_margin="16dp"
|
||||
android:visibility="gone"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_below="@id/txtvError"/>
|
||||
</RelativeLayout>
|
@ -51,6 +51,7 @@
|
||||
<string name="image_of_prefix">Image of:\u0020</string>
|
||||
<string name="save_username_password_label">Save username and password</string>
|
||||
<string name="close_label">Close</string>
|
||||
<string name="retry_label">Retry</string>
|
||||
|
||||
|
||||
<!-- 'Add Feed' Activity labels -->
|
||||
|
@ -256,6 +256,7 @@ public abstract class OnlineFeedViewActivity extends ActionBarActivity {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,10 +9,7 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.*;
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.DefaultOnlineFeedViewActivity;
|
||||
@ -33,6 +30,7 @@ public abstract class PodcastListFragment extends Fragment {
|
||||
private GridView gridView;
|
||||
private ProgressBar progressBar;
|
||||
private TextView txtvError;
|
||||
private Button butRetry;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
@ -42,6 +40,7 @@ public abstract class PodcastListFragment extends Fragment {
|
||||
gridView = (GridView) root.findViewById(R.id.gridView);
|
||||
progressBar = (ProgressBar) root.findViewById(R.id.progressBar);
|
||||
txtvError = (TextView) root.findViewById(R.id.txtvError);
|
||||
butRetry = (Button) root.findViewById(R.id.butRetry);
|
||||
|
||||
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
@ -49,6 +48,12 @@ public abstract class PodcastListFragment extends Fragment {
|
||||
onPodcastSelected((GpodnetPodcast) gridView.getAdapter().getItem(position));
|
||||
}
|
||||
});
|
||||
butRetry.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
loadData();
|
||||
}
|
||||
});
|
||||
|
||||
loadData();
|
||||
return root;
|
||||
@ -96,10 +101,15 @@ public abstract class PodcastListFragment extends Fragment {
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
gridView.setVisibility(View.VISIBLE);
|
||||
txtvError.setVisibility(View.GONE);
|
||||
butRetry.setVisibility(View.GONE);
|
||||
} else if (context != null) {
|
||||
gridView.setVisibility(View.GONE);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
txtvError.setText(getString(R.string.error_msg_prefix) + exception.getMessage());
|
||||
txtvError.setVisibility(View.VISIBLE);
|
||||
butRetry.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,6 +118,8 @@ public abstract class PodcastListFragment extends Fragment {
|
||||
super.onPreExecute();
|
||||
gridView.setVisibility(View.GONE);
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
txtvError.setVisibility(View.GONE);
|
||||
butRetry.setVisibility(View.GONE);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package de.danoeh.antennapod.fragment.gpodnet;
|
||||
|
||||
import android.R;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
@ -74,15 +73,14 @@ public class TagListFragment extends ListFragment {
|
||||
for (GpodnetTag tag : gpodnetTags) {
|
||||
tagNames.add(tag.getName());
|
||||
}
|
||||
setListAdapter(new ArrayAdapter<String>(context, R.layout.simple_list_item_1, tagNames));
|
||||
setListShown(true);
|
||||
setListAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, tagNames));
|
||||
} else if (exception != null) {
|
||||
TextView txtvError = new TextView(getActivity());
|
||||
txtvError.setText(exception.getMessage());
|
||||
getListView().setEmptyView(txtvError);
|
||||
} else {
|
||||
setListShown(true);
|
||||
}
|
||||
setListShown(true);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user