mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2025-12-01 12:31:45 +00:00
Replaced 'miro' in filenames with 'miroguide'
This commit is contained in:
@ -184,13 +184,13 @@
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".activity.MiroSearchActivity" />
|
||||
</activity>
|
||||
<activity android:name=".activity.MiroSearchActivity" android:launchMode="singleTop" android:configChanges="keyboardHidden|orientation">
|
||||
<activity android:name=".activity.MiroGuideSearchActivity" android:launchMode="singleTop" android:configChanges="keyboardHidden|orientation">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.app.searchable"
|
||||
android:resource="@xml/miro_searchable" />
|
||||
android:resource="@xml/miroguide_searchable" />
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".activity.MiroSearchActivity" />
|
||||
|
||||
@ -13,8 +13,8 @@ import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroException;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroService;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroGuideException;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroGuideService;
|
||||
|
||||
/** Shows a list of available categories and offers a search button. */
|
||||
public class MiroGuideMainActivity extends SherlockListActivity {
|
||||
@ -29,7 +29,7 @@ public class MiroGuideMainActivity extends SherlockListActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.miro_categorylist);
|
||||
setContentView(R.layout.miroguide_categorylist);
|
||||
|
||||
txtvStatus = (TextView) findViewById(android.R.id.empty);
|
||||
}
|
||||
@ -63,7 +63,7 @@ public class MiroGuideMainActivity extends SherlockListActivity {
|
||||
AsyncTask<Void, Void, Void> listLoader = new AsyncTask<Void, Void, Void>() {
|
||||
|
||||
private String[] c;
|
||||
private MiroException exception;
|
||||
private MiroGuideException exception;
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
@ -85,10 +85,10 @@ public class MiroGuideMainActivity extends SherlockListActivity {
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
MiroService service = new MiroService();
|
||||
MiroGuideService service = new MiroGuideService();
|
||||
try {
|
||||
c = service.getCategories();
|
||||
} catch (MiroException e) {
|
||||
} catch (MiroGuideException e) {
|
||||
e.printStackTrace();
|
||||
exception = e;
|
||||
}
|
||||
|
||||
@ -12,19 +12,19 @@ import com.actionbarsherlock.view.MenuItem;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.fragment.MiroChannellistFragment;
|
||||
import de.danoeh.antennapod.fragment.MiroGuideChannellistFragment;
|
||||
|
||||
/** Displays results when a search for miroguide channels has been performed */
|
||||
public class MiroSearchActivity extends SherlockFragmentActivity {
|
||||
private static final String TAG = "MiroSearchActivity";
|
||||
public class MiroGuideSearchActivity extends SherlockFragmentActivity {
|
||||
private static final String TAG = "MiroGuideSearchActivity";
|
||||
|
||||
private MiroChannellistFragment listFragment;
|
||||
private MiroGuideChannellistFragment listFragment;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle arg0) {
|
||||
super.onCreate(arg0);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
setContentView(R.layout.mirosearch);
|
||||
setContentView(R.layout.miroguidesearch);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,7 +45,7 @@ public class MiroSearchActivity extends SherlockFragmentActivity {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Performing search");
|
||||
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
||||
listFragment = MiroChannellistFragment.newInstance("name", query,
|
||||
listFragment = MiroGuideChannellistFragment.newInstance("name", query,
|
||||
"name");
|
||||
ft.replace(R.id.channellistFragment, listFragment);
|
||||
ft.commit();
|
||||
@ -12,9 +12,9 @@ import android.widget.TextView;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.miroguide.model.MiroChannel;
|
||||
|
||||
public class MiroChannellistAdapter extends ArrayAdapter<MiroChannel> {
|
||||
public class MiroGuideChannelListAdapter extends ArrayAdapter<MiroChannel> {
|
||||
|
||||
public MiroChannellistAdapter(Context context, int textViewResourceId,
|
||||
public MiroGuideChannelListAdapter(Context context, int textViewResourceId,
|
||||
List<MiroChannel> objects) {
|
||||
super(context, textViewResourceId, objects);
|
||||
}
|
||||
@ -30,7 +30,7 @@ public class MiroChannellistAdapter extends ArrayAdapter<MiroChannel> {
|
||||
LayoutInflater inflater = (LayoutInflater) getContext()
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
||||
convertView = inflater.inflate(R.layout.miro_channellist_item, null);
|
||||
convertView = inflater.inflate(R.layout.miroguide_channellist_item, null);
|
||||
holder.title = (TextView) convertView.findViewById(R.id.txtvTitle);
|
||||
holder.cover = (ImageView) convertView
|
||||
.findViewById(R.id.imgvChannelimage);
|
||||
@ -19,29 +19,29 @@ import com.actionbarsherlock.app.SherlockListFragment;
|
||||
|
||||
import de.danoeh.antennapod.AppConfig;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.adapter.MiroChannellistAdapter;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroException;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroService;
|
||||
import de.danoeh.antennapod.adapter.MiroGuideChannelListAdapter;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroGuideException;
|
||||
import de.danoeh.antennapod.miroguide.con.MiroGuideService;
|
||||
import de.danoeh.antennapod.miroguide.model.MiroChannel;
|
||||
|
||||
/**
|
||||
* Displays a list of MiroChannel objects that were results of a certain
|
||||
* MiroService query. If the user reaches the bottom of the list, more entries
|
||||
* MiroGuideService query. If the user reaches the bottom of the list, more entries
|
||||
* will be loaded until all entries have been loaded or the maximum number of
|
||||
* channels has been reached.
|
||||
* */
|
||||
public class MiroChannellistFragment extends SherlockListFragment {
|
||||
private static final String TAG = "MiroChannellistFragment";
|
||||
public class MiroGuideChannellistFragment extends SherlockListFragment {
|
||||
private static final String TAG = "MiroGuideChannellistFragment";
|
||||
|
||||
private static final String ARG_FILTER = "filter";
|
||||
private static final String ARG_FILTER_VALUE = "filter_value";
|
||||
private static final String ARG_SORT = "sort";
|
||||
|
||||
private static final int MAX_CHANNELS = 200;
|
||||
private static final int CHANNELS_PER_QUERY = MiroService.DEFAULT_CHANNEL_LIMIT;
|
||||
private static final int CHANNELS_PER_QUERY = MiroGuideService.DEFAULT_CHANNEL_LIMIT;
|
||||
|
||||
private ArrayList<MiroChannel> channels;
|
||||
private MiroChannellistAdapter listAdapter;
|
||||
private MiroGuideChannelListAdapter listAdapter;
|
||||
private int offset;
|
||||
|
||||
private boolean isLoadingChannels;
|
||||
@ -65,7 +65,7 @@ public class MiroChannellistFragment extends SherlockListFragment {
|
||||
* @throws IllegalArgumentException
|
||||
* if filter, filterValue or sort is null
|
||||
* */
|
||||
public static MiroChannellistFragment newInstance(String filter,
|
||||
public static MiroGuideChannellistFragment newInstance(String filter,
|
||||
String filterValue, String sort) {
|
||||
if (filter == null) {
|
||||
throw new IllegalArgumentException("filter cannot be null");
|
||||
@ -76,7 +76,7 @@ public class MiroChannellistFragment extends SherlockListFragment {
|
||||
if (sort == null) {
|
||||
throw new IllegalArgumentException("sort cannot be null");
|
||||
}
|
||||
MiroChannellistFragment cf = new MiroChannellistFragment();
|
||||
MiroGuideChannellistFragment cf = new MiroGuideChannellistFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_FILTER, filter);
|
||||
args.putString(ARG_FILTER_VALUE, filterValue);
|
||||
@ -85,7 +85,7 @@ public class MiroChannellistFragment extends SherlockListFragment {
|
||||
return cf;
|
||||
}
|
||||
|
||||
private MiroChannellistFragment() {
|
||||
private MiroGuideChannellistFragment() {
|
||||
super();
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ public class MiroChannellistFragment extends SherlockListFragment {
|
||||
LayoutInflater inflater = (LayoutInflater) getActivity()
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
footer = inflater.inflate(R.layout.loading_footer, null);
|
||||
listAdapter = new MiroChannellistAdapter(getActivity(), 0, channels);
|
||||
listAdapter = new MiroGuideChannelListAdapter(getActivity(), 0, channels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -156,7 +156,7 @@ public class MiroChannellistFragment extends SherlockListFragment {
|
||||
if (!stopLoading) {
|
||||
isLoadingChannels = true;
|
||||
channelLoader = new AsyncTask<Void, Void, List<MiroChannel>>() {
|
||||
private MiroException exception;
|
||||
private MiroGuideException exception;
|
||||
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
@ -220,11 +220,11 @@ public class MiroChannellistFragment extends SherlockListFragment {
|
||||
protected List<MiroChannel> doInBackground(Void... params) {
|
||||
if (AppConfig.DEBUG)
|
||||
Log.d(TAG, "Background channel loader started");
|
||||
MiroService service = new MiroService();
|
||||
MiroGuideService service = new MiroGuideService();
|
||||
try {
|
||||
return service.getChannelList(filter, filterValue,
|
||||
sort, CHANNELS_PER_QUERY, offset);
|
||||
} catch (MiroException e) {
|
||||
} catch (MiroGuideException e) {
|
||||
exception = e;
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
package de.danoeh.antennapod.miroguide.con;
|
||||
|
||||
public class MiroException extends Exception {
|
||||
private static final long serialVersionUID = -8834656185748713194L;
|
||||
|
||||
public MiroException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MiroException(String arg0, Throwable arg1) {
|
||||
super(arg0, arg1);
|
||||
}
|
||||
|
||||
public MiroException(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
public MiroException(Throwable arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -17,7 +17,7 @@ import org.json.JSONObject;
|
||||
import android.net.Uri;
|
||||
|
||||
/** Executes HTTP requests and returns the results. */
|
||||
public class MiroConnector {
|
||||
public class MiroGuideConnector {
|
||||
private HttpClient httpClient;
|
||||
|
||||
private static final String HOST_URL = "https://www.miroguide.com/api/";
|
||||
@ -25,7 +25,7 @@ public class MiroConnector {
|
||||
private static final String PATH_LIST_CATEGORIES = "list_categories";
|
||||
private static final String PATH_GET_CHANNEL = "get_channel";
|
||||
|
||||
public MiroConnector() {
|
||||
public MiroGuideConnector() {
|
||||
httpClient = new DefaultHttpClient();
|
||||
}
|
||||
|
||||
@ -39,23 +39,23 @@ public class MiroConnector {
|
||||
return builder;
|
||||
}
|
||||
|
||||
public JSONArray getArrayResponse(Uri uri) throws MiroException {
|
||||
public JSONArray getArrayResponse(Uri uri) throws MiroGuideException {
|
||||
try {
|
||||
JSONArray result = new JSONArray(executeRequest(uri));
|
||||
return result;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
throw new MiroException();
|
||||
throw new MiroGuideException();
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject getSingleObjectResponse(Uri uri) throws MiroException {
|
||||
public JSONObject getSingleObjectResponse(Uri uri) throws MiroGuideException {
|
||||
try {
|
||||
JSONObject result = new JSONObject(executeRequest(uri));
|
||||
return result;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
throw new MiroException();
|
||||
throw new MiroGuideException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,9 +63,9 @@ public class MiroConnector {
|
||||
* Executes a HTTP GET request with the given URI and returns the content of
|
||||
* the return value.
|
||||
*
|
||||
* @throws MiroException
|
||||
* @throws MiroGuideException
|
||||
*/
|
||||
private String executeRequest(Uri uri) throws MiroException {
|
||||
private String executeRequest(Uri uri) throws MiroGuideException {
|
||||
HttpGet httpGet = new HttpGet(uri.toString());
|
||||
String result = null;
|
||||
try {
|
||||
@ -80,19 +80,19 @@ public class MiroConnector {
|
||||
result = reader.readLine();
|
||||
}
|
||||
} else {
|
||||
throw new MiroException(response.getStatusLine()
|
||||
throw new MiroGuideException(response.getStatusLine()
|
||||
.getReasonPhrase());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new MiroException(e.getMessage());
|
||||
throw new MiroGuideException(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public Uri createGetChannelsUri(String filter, String filterValue,
|
||||
String sort, String limit, String offset) throws MiroException {
|
||||
String sort, String limit, String offset) throws MiroGuideException {
|
||||
Uri.Builder resultBuilder = getBaseURIBuilder(PATH_GET_CHANNELS);
|
||||
resultBuilder.appendQueryParameter("filter", filter)
|
||||
.appendQueryParameter("filter_value", filterValue);
|
||||
@ -110,14 +110,14 @@ public class MiroConnector {
|
||||
return result;
|
||||
}
|
||||
|
||||
public Uri createListCategoriesURI() throws MiroException {
|
||||
public Uri createListCategoriesURI() throws MiroGuideException {
|
||||
Uri.Builder resultBuilder = getBaseURIBuilder(PATH_LIST_CATEGORIES);
|
||||
Uri result = resultBuilder.build();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Uri createGetChannelUri(String id) throws MiroException {
|
||||
public Uri createGetChannelUri(String id) throws MiroGuideException {
|
||||
Uri.Builder resultBuilder = getBaseURIBuilder(PATH_GET_CHANNEL)
|
||||
.appendQueryParameter("id", id);
|
||||
Uri result = resultBuilder.build();
|
||||
@ -0,0 +1,23 @@
|
||||
package de.danoeh.antennapod.miroguide.con;
|
||||
|
||||
public class MiroGuideException extends Exception {
|
||||
private static final long serialVersionUID = -8834656185748713194L;
|
||||
|
||||
public MiroGuideException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public MiroGuideException(String arg0, Throwable arg1) {
|
||||
super(arg0, arg1);
|
||||
}
|
||||
|
||||
public MiroGuideException(String arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
public MiroGuideException(Throwable arg0) {
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -16,7 +16,7 @@ import de.danoeh.antennapod.miroguide.model.MiroItem;
|
||||
|
||||
|
||||
/** Provides methods to communicate with the Miroguide API on an abstract level. */
|
||||
public class MiroService {
|
||||
public class MiroGuideService {
|
||||
public static final int DEFAULT_CHANNEL_LIMIT = 20;
|
||||
|
||||
public static final String FILTER_CATEGORY = "category";
|
||||
@ -27,7 +27,7 @@ public class MiroService {
|
||||
|
||||
public static final String JSON_DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
|
||||
|
||||
private MiroConnector connector;
|
||||
private MiroGuideConnector connector;
|
||||
|
||||
private static ThreadLocal<SimpleDateFormat> jSONDateFormat = new ThreadLocal<SimpleDateFormat>() {
|
||||
@Override
|
||||
@ -37,11 +37,11 @@ public class MiroService {
|
||||
|
||||
};
|
||||
|
||||
public MiroService() {
|
||||
connector = new MiroConnector();
|
||||
public MiroGuideService() {
|
||||
connector = new MiroGuideConnector();
|
||||
}
|
||||
|
||||
public String[] getCategories() throws MiroException {
|
||||
public String[] getCategories() throws MiroGuideException {
|
||||
JSONArray resultArray = connector.getArrayResponse(connector
|
||||
.createListCategoriesURI());
|
||||
String[] result = new String[resultArray.length()];
|
||||
@ -50,7 +50,7 @@ public class MiroService {
|
||||
result[i] = resultArray.getJSONObject(i).getString("name");
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
throw new MiroException();
|
||||
throw new MiroGuideException();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -58,7 +58,7 @@ public class MiroService {
|
||||
|
||||
/** Get a list of MiroChannel objects without their items. */
|
||||
public List<MiroChannel> getChannelList(String filter, String filterValue,
|
||||
String sort, int limit, int offset) throws MiroException {
|
||||
String sort, int limit, int offset) throws MiroGuideException {
|
||||
JSONArray resultArray = connector.getArrayResponse(connector
|
||||
.createGetChannelsUri(filter, filterValue, sort,
|
||||
Integer.toString(limit), Integer.toString(offset)));
|
||||
@ -72,7 +72,7 @@ public class MiroService {
|
||||
channels.add(channel);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
throw new MiroException();
|
||||
throw new MiroGuideException();
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,9 +82,9 @@ public class MiroService {
|
||||
/**
|
||||
* Get a single channel with its items.
|
||||
*
|
||||
* @throws MiroException
|
||||
* @throws MiroGuideException
|
||||
*/
|
||||
public MiroChannel getChannel(long id) throws MiroException {
|
||||
public MiroChannel getChannel(long id) throws MiroGuideException {
|
||||
JSONObject resultObject = connector.getSingleObjectResponse(connector
|
||||
.createGetChannelUri(Long.toString(id)));
|
||||
MiroChannel result = null;
|
||||
@ -92,7 +92,7 @@ public class MiroService {
|
||||
result = extractMiroChannel(resultObject, true);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
throw new MiroException();
|
||||
throw new MiroGuideException();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user