Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed the main activity back to a sub-class of Activity, so it is n…

…o longer an ExpandableListView type. This fixed the issues with RuntimeExceptions listing their cause as: 'Your content must have an ExpandableListView whose id attribute is "android.R.id.list"' from coming up. Minor changes have been made to cover this.

Turns out that refresh was not working simply because of the lack of a call to 'checkConnectivity()', which despite not being completely implemented at the moment, still sets the connected flag to 'true', which allows the application to continue and fetch data.
Minor additional tasks:
-	Refresh button should show indeterminate progress, so must change the AsyncTask to accomplish that.
-	The line and station activities need to be updated just to fix the ActionBar
-	Maybe need to use the bold version of Quicksand font more
-	Line and station buttons on main activity seem to have increased the size of font without warning
  • Loading branch information...
commit f6f68c652a868987445e7b6337243123ea6809d5 1 parent 4c5f287
@FDeSousa authored
View
25 res/layout/main.xml
@@ -1,25 +0,0 @@
-<!--
- Copyright 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <Button android:id="@+id/toggle_title"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:text="Toggle Title" />
-</FrameLayout>
View
5 ...nBar/ActionBarExpandableListActivity.java → ...sMyTrain/ActionBar/ActionBarActivity.java
@@ -1,7 +1,6 @@
package com.fdesousa.android.WheresMyTrain.ActionBar;
import android.app.Activity;
-import android.app.ExpandableListActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
@@ -17,10 +16,10 @@
* @version %I%, %G%
*
*/
-public abstract class ActionBarExpandableListActivity extends ExpandableListActivity {
+public abstract class ActionBarActivity extends Activity {
final ActionBarHelper mActionBarHelper;
- protected ActionBarExpandableListActivity() {
+ protected ActionBarActivity() {
mActionBarHelper = ActionBarHelper.createInstance(this);
}
View
10 ...roid/WheresMyTrain/Library/requests/DetailedPredictions/DetailedPredictionsAsyncTask.java
@@ -1,6 +1,6 @@
package com.fdesousa.android.WheresMyTrain.Library.requests.DetailedPredictions;
-import android.app.ExpandableListActivity;
+import android.app.Activity;
import android.os.AsyncTask;
import android.view.View;
import android.widget.ExpandableListView;
@@ -13,7 +13,7 @@
public class DetailedPredictionsAsyncTask extends AsyncTask<Void, Void, DetailedPredictionsContainer> {
private PlatformsExpListAdapter mPlatformAdapter;
private TflJsonReader<DetailedPredictionsContainer> mJsonR;
- private ExpandableListActivity activity;
+ private Activity activity;
private UiController uiController;
/**
@@ -22,12 +22,12 @@
*/
private ExpandableListView predictionsList;
- public DetailedPredictionsAsyncTask(ExpandableListActivity activity, UiController uiController,
+ public DetailedPredictionsAsyncTask(Activity activity, ExpandableListView predictionsList, UiController uiController,
final String line, final String station) {
this.activity = activity;
this.uiController = uiController;
- predictionsList = (ExpandableListView) this.activity.findViewById(android.R.id.list);
+ this.predictionsList = predictionsList;
mJsonR = new DetailedPredictionsReader(line, station);
}
@@ -59,7 +59,7 @@ protected void onPostExecute(DetailedPredictionsContainer result) {
mPlatformAdapter = new PlatformsExpListAdapter(result.stations.get(0).platforms,
activity.getLayoutInflater(), uiController);
// (Re)set the adapter onto the ExpandableListView
- activity.setListAdapter(mPlatformAdapter);
+ predictionsList.setAdapter(mPlatformAdapter);
// Show the expandable list view, to show new predictions
predictionsList.setVisibility(View.VISIBLE);
}
View
11 src/com/fdesousa/android/WheresMyTrain/WheresMyTrain.java
@@ -28,9 +28,10 @@
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
+import android.widget.ExpandableListView;
import android.widget.Toast;
-import com.fdesousa.android.WheresMyTrain.ActionBar.ActionBarExpandableListActivity;
+import com.fdesousa.android.WheresMyTrain.ActionBar.ActionBarActivity;
import com.fdesousa.android.WheresMyTrain.Library.ConfigCodes;
import com.fdesousa.android.WheresMyTrain.Library.requests.DetailedPredictions.DetailedPredictionsAsyncTask;
import com.fdesousa.android.WheresMyTrain.Library.requests.DetailedPredictions.DetailedPredictionsContainer;
@@ -57,7 +58,7 @@
* @version %I%, %G%
*
*/
-public class WheresMyTrain extends ActionBarExpandableListActivity {
+public class WheresMyTrain extends ActionBarActivity {
/** Tag to be used when Logging an exception/error/anything at all */
public static final String TAG = "com.fdesousa.android.WheresMyTrain";
/**
@@ -125,7 +126,7 @@ public void onCreate(Bundle savedInstanceState) {
protected void onStart() {
super.onStart();
// Check the connectivity
- // checkConnectivity();
+ checkConnectivity();
// if (!this.connected) {
// Toast.makeText(this, "Server is unreachable. Check connectivity",
// Toast.LENGTH_LONG).show();
@@ -318,6 +319,7 @@ private void performRefresh() {
if (getPredictions instanceof DetailedPredictionsAsyncTask)
getPredictions.cancel(true);
getPredictions = new DetailedPredictionsAsyncTask(this,
+ (ExpandableListView) findViewById(android.R.id.list),
uiController, linecode, stationcode).execute();
}
}
@@ -335,7 +337,8 @@ private void onLineChosen() {
stationsChooser.setText("Now choose a station");
stationsChooser.setTextColor(lines.getColourCode());
resetLineStatusButton();
- this.getExpandableListView().setVisibility(View.INVISIBLE);
+ ((ExpandableListView) findViewById(android.R.id.list))
+ .setVisibility(View.INVISIBLE);
}
private void onStationChosen() {
Please sign in to comment.
Something went wrong with that request. Please try again.