Upgraded HoloEverywhere

Some cleanup
This commit is contained in:
Doug Keen 2012-10-03 12:29:31 -07:00
parent 4f51b3bba0
commit a27222dbc6
15 changed files with 108 additions and 111 deletions

View File

@ -1,3 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="NewApi">
<ignore path="res\layout\train_alarm_dialog.xml" />
</issue>
</lint>

14
project.properties Normal file
View File

@ -0,0 +1,14 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-16
android.library.reference.1=..\\..\\..\\Documents\\GitHub\\NineOldAndroids\\library
android.library.reference.2=..\\..\\..\\Documents\\GitHub\\HoloEverywhere\\contrib\\ActionBarSherlock\\library
android.library.reference.3=..\\..\\..\\Documents\\GitHub\\HoloEverywhere\\library

View File

@ -23,14 +23,6 @@
android:visibility="gone" >
</com.dougkeen.bart.controls.YourTrainLayout>
<ProgressBar
android:id="@android:id/progress"
style="@style/Holo.ProgressBar.Horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="invisible" />
<TextView
android:id="@android:id/empty"
android:layout_width="fill_parent"
@ -43,7 +35,14 @@
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
<ProgressBar
android:id="@android:id/progress"
style="@style/Holo.ProgressBar.Horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="gone" />
<TextView
android:id="@+id/missingDepartureText"
style="@style/MissingDepartureText"
android:autoLink="email"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:holo="http://schemas.android.com/apk/res-auto"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:gravity="center_vertical" >
@ -17,9 +18,11 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/titleDivider"
android:drawSelectorOnTop="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="15dip" />
android:paddingTop="15dip"
holo:spinnerMode="dialog" />
<TextView
android:id="@+id/origin_label"
@ -42,9 +45,11 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/origin_spinner"
android:drawSelectorOnTop="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="15dip" />
android:paddingTop="15dip"
holo:spinnerMode="dialog" />
<TextView
android:id="@+id/destination_label"
@ -61,22 +66,14 @@
android:textSize="15sp" >
</TextView>
<TextView
android:id="@+id/return_checkbox_text"
<CheckBox
android:id="@+id/return_checkbox"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_height="wrap_content"
android:layout_below="@id/destination_spinner"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:text="@string/also_add_return_route"
android:visibility="gone" />
<CheckBox
android:id="@+id/return_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/destination_spinner"
android:layout_toLeftOf="@id/return_checkbox_text"
android:visibility="gone" />
</RelativeLayout>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:textColor="#fff"
android:paddingBottom="10dip"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:paddingTop="10dip"
android:singleLine="true" >
</TextView>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:background="#282829"
android:textColor="#fff"
android:paddingBottom="12dip"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:paddingTop="12dip"
android:singleLine="true" >
</TextView>

View File

@ -1,15 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:holo="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<net.simonvt.widget.NumberPicker
<NumberPicker
android:id="@+id/numberPicker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</net.simonvt.widget.NumberPicker>
</NumberPicker>
<TextView
android:id="@+id/textView1"

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="ButtonHoloBorderless" parent="@android:style/Widget.Holo.Button.Borderless.Small"></style>
</resources>

View File

@ -3,12 +3,7 @@
<!-- Base application theme is the default theme. -->
<style name="AppTheme" parent="@style/Theme.HoloEverywhereDark.Sherlock">
<item name="numberPickerUpButtonStyle">@style/NPWidget.Holo.ImageButton.NumberPickerUpButton</item>
<item name="numberPickerDownButtonStyle">@style/NPWidget.Holo.ImageButton.NumberPickerDownButton</item>
<item name="numberPickerInputTextStyle">@style/NPWidget.Holo.EditText.NumberPickerInputText</item>
<item name="numberPickerStyle">@style/NPWidget.Holo.NumberPicker</item>
</style>
<style name="AppTheme" parent="@style/Holo.Theme.Sherlock"></style>
<style name="ButtonBar">
<item name="android:layout_width">fill_parent</item>

View File

@ -1,18 +1,20 @@
package com.dougkeen.bart.activities;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
import android.view.View;
import com.WazaBe.HoloEverywhere.AlertDialog;
import com.WazaBe.HoloEverywhere.ArrayAdapter;
import com.WazaBe.HoloEverywhere.LayoutInflater;
import com.WazaBe.HoloEverywhere.app.AlertDialog;
import com.WazaBe.HoloEverywhere.app.Dialog;
import com.WazaBe.HoloEverywhere.app.DialogFragment;
import com.WazaBe.HoloEverywhere.widget.Spinner;
import com.WazaBe.HoloEverywhere.widget.Toast;
import com.dougkeen.bart.R;
import com.dougkeen.bart.model.Station;
@ -27,6 +29,12 @@ public abstract class AbstractRouteSelectionFragment extends DialogFragment {
mTitle = title;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setShowsDialog(true);
}
@Override
public void onStart() {
super.onStart();
@ -42,17 +50,18 @@ public abstract class AbstractRouteSelectionFragment extends DialogFragment {
final Dialog dialog = getDialog();
final FragmentActivity activity = getActivity();
ArrayAdapter<Station> originSpinnerAdapter = new ArrayAdapter<Station>(
activity, android.R.layout.simple_spinner_item,
activity, R.layout.simple_spinner_item,
Station.getStationList());
originSpinnerAdapter
.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
final Spinner originSpinner = (Spinner) dialog
.findViewById(R.id.origin_spinner);
originSpinner.setAdapter(originSpinnerAdapter);
originSpinner.setSelection(lastSelectedOriginPosition);
ArrayAdapter<Station> destinationSpinnerAdapter = new ArrayAdapter<Station>(
activity, android.R.layout.simple_spinner_item,
activity, R.layout.simple_spinner_item,
Station.getStationList());
destinationSpinnerAdapter
.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
@ -67,10 +76,13 @@ public abstract class AbstractRouteSelectionFragment extends DialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) {
final FragmentActivity activity = getActivity();
final View dialogView = LayoutInflater.inflate(activity,
R.layout.route_form);
return new AlertDialog.Builder(activity)
.setTitle(mTitle)
.setCancelable(true)
.setView(R.layout.route_form)
.setView(dialogView)
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override

View File

@ -17,17 +17,8 @@ public class AddRouteDialogFragment extends AbstractRouteSelectionFragment {
@Override
public void onStart() {
super.onStart();
final View checkboxText = getDialog().findViewById(
R.id.return_checkbox_text);
final View checkbox = getDialog().findViewById(R.id.return_checkbox);
checkboxText.setVisibility(View.VISIBLE);
checkbox.setVisibility(View.VISIBLE);
checkboxText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
checkbox.performClick();
}
});
}
@Override

View File

@ -10,7 +10,6 @@ import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
@ -18,10 +17,12 @@ import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.TextView;
import com.WazaBe.HoloEverywhere.AlertDialog;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.WazaBe.HoloEverywhere.widget.TextView;
import com.WazaBe.HoloEverywhere.app.AlertDialog;
import com.WazaBe.HoloEverywhere.app.DialogFragment;
import com.WazaBe.HoloEverywhere.sherlock.SActivity;
import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
@ -36,7 +37,7 @@ import com.dougkeen.bart.model.Station;
import com.dougkeen.bart.model.StationPair;
import com.dougkeen.bart.networktasks.GetRouteFareTask;
public class RoutesListActivity extends SherlockFragmentActivity implements
public class RoutesListActivity extends SActivity implements
LoaderCallbacks<Cursor> {
private static final int FAVORITES_LOADER_ID = 0;
@ -107,7 +108,8 @@ public class RoutesListActivity extends SherlockFragmentActivity implements
public void onClick(View v) {
DialogFragment dialog = new QuickRouteDialogFragment(
getString(R.string.quick_departure_lookup));
dialog.show(getSupportFragmentManager(), "dialog");
dialog.show(getSupportFragmentManager()
.beginTransaction());
}
});
@ -283,8 +285,8 @@ public class RoutesListActivity extends SherlockFragmentActivity implements
public boolean onOptionsItemSelected(MenuItem item) {
int itemId = item.getItemId();
if (itemId == R.id.add_favorite_menu_button) {
new AddRouteDialogFragment(getString(R.string.add_route)).show(
getSupportFragmentManager(), "dialog");
new AddRouteDialogFragment(getString(R.string.add_route))
.show(getSupportFragmentManager().beginTransaction());
return true;
} else if (itemId == R.id.view_system_map_button) {
startActivity(new Intent(this, ViewMapActivity.class));

View File

@ -1,16 +1,18 @@
package com.dougkeen.bart.activities;
import net.simonvt.widget.NumberPicker;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import com.WazaBe.HoloEverywhere.AlertDialog;
import com.WazaBe.HoloEverywhere.LayoutInflater;
import com.WazaBe.HoloEverywhere.app.AlertDialog;
import com.WazaBe.HoloEverywhere.app.Dialog;
import com.WazaBe.HoloEverywhere.app.DialogFragment;
import com.WazaBe.HoloEverywhere.widget.NumberPicker;
import com.dougkeen.bart.BartRunnerApplication;
import com.dougkeen.bart.R;
import com.dougkeen.bart.model.Departure;
@ -23,16 +25,25 @@ public class TrainAlarmDialogFragment extends DialogFragment {
super();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setShowsDialog(true);
}
@Override
public void onStart() {
super.onStart();
setUpNumberPickerValues(getDialog());
}
private void setUpNumberPickerValues(Dialog dialog) {
SharedPreferences preferences = getActivity().getPreferences(
Context.MODE_PRIVATE);
int lastAlarmLeadTime = preferences.getInt(KEY_LAST_ALARM_LEAD_TIME, 5);
NumberPicker numberPicker = (NumberPicker) getDialog().findViewById(
R.id.numberPicker);
NumberPicker numberPicker = (NumberPicker) dialog
.findViewById(R.id.numberPicker);
BartRunnerApplication application = (BartRunnerApplication) getActivity()
.getApplication();
@ -65,10 +76,13 @@ public class TrainAlarmDialogFragment extends DialogFragment {
public Dialog onCreateDialog(Bundle savedInstanceState) {
final FragmentActivity activity = getActivity();
final View dialogView = LayoutInflater.inflate(activity,
R.layout.train_alarm_dialog);
return new AlertDialog.Builder(activity)
.setTitle(R.string.set_up_departure_alarm)
.setCancelable(true)
.setView(R.layout.train_alarm_dialog)
.setView(dialogView)
.setPositiveButton(R.string.ok,
new DialogInterface.OnClickListener() {
@Override

View File

@ -27,12 +27,12 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Checkable;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.WazaBe.HoloEverywhere.sherlock.SActivity;
import com.WazaBe.HoloEverywhere.widget.ListView;
import com.WazaBe.HoloEverywhere.widget.ProgressBar;
import com.WazaBe.HoloEverywhere.widget.TextView;
import com.WazaBe.HoloEverywhere.widget.Toast;
import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
@ -54,7 +54,7 @@ import com.dougkeen.bart.services.EtdService.EtdServiceListener;
import com.dougkeen.util.Observer;
import com.dougkeen.util.WakeLocker;
public class ViewDeparturesActivity extends SherlockFragmentActivity implements
public class ViewDeparturesActivity extends SActivity implements
EtdServiceListener {
private static final int LOADER_ID = 123;
@ -183,7 +183,8 @@ public class ViewDeparturesActivity extends SherlockFragmentActivity implements
listView.setOnItemClickListener(mListItemClickListener);
listView.setOnItemLongClickListener(mListItemLongClickListener);
findViewById(R.id.missingDepartureText).setVisibility(View.VISIBLE);
mMissingDepartureText = findViewById(R.id.missingDepartureText);
mMissingDepartureText.setVisibility(View.VISIBLE);
findViewById(R.id.yourTrainSection).setOnClickListener(
mYourTrainSectionClickListener);
@ -344,6 +345,8 @@ public class ViewDeparturesActivity extends SherlockFragmentActivity implements
}
};
private View mMissingDepartureText;
protected DepartureArrayAdapter getListAdapter() {
return mDeparturesAdapter;
}
@ -640,8 +643,9 @@ public class ViewDeparturesActivity extends SherlockFragmentActivity implements
// Don't prompt for alarm if train is about to leave
if (application.getBoardedDeparture().getMeanSecondsLeft() > 60) {
new TrainAlarmDialogFragment().show(
getSupportFragmentManager(), "dialog");
new TrainAlarmDialogFragment()
.show(getSupportFragmentManager()
.beginTransaction());
}
return true;
@ -694,7 +698,7 @@ public class ViewDeparturesActivity extends SherlockFragmentActivity implements
if (departures.isEmpty()) {
final TextView textView = mEmptyView;
textView.setText(R.string.no_data_message);
mProgress.setVisibility(View.INVISIBLE);
mProgress.setVisibility(View.GONE);
Linkify.addLinks(textView, Linkify.WEB_URLS);
} else {
// TODO: Figure out why Ticker occasionally stops
@ -771,7 +775,7 @@ public class ViewDeparturesActivity extends SherlockFragmentActivity implements
runOnUiThread(new Runnable() {
@Override
public void run() {
mProgress.setVisibility(View.INVISIBLE);
mProgress.setVisibility(View.GONE);
}
});
}

View File

@ -3,13 +3,13 @@ package com.dougkeen.bart.activities;
import android.os.Bundle;
import android.webkit.WebView;
import com.actionbarsherlock.app.SherlockActivity;
import com.WazaBe.HoloEverywhere.sherlock.SActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.dougkeen.bart.R;
public class ViewMapActivity extends SherlockActivity {
public class ViewMapActivity extends SActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {