diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/cbaines/suma/BusSpecificStopView.java | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java index 723d7c0..79b1305 100644 --- a/src/net/cbaines/suma/BusSpecificStopView.java +++ b/src/net/cbaines/suma/BusSpecificStopView.java @@ -23,6 +23,7 @@ import java.sql.SQLException; import java.text.DateFormat; import android.app.Activity; +import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.net.Uri; @@ -31,15 +32,15 @@ import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; +import android.widget.LinearLayout; import android.widget.ProgressBar; -import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.dao.Dao; -public class BusSpecificStopView extends RelativeLayout implements OnClickListener, OnLongClickListener { +public class BusSpecificStopView extends LinearLayout implements OnClickListener, OnLongClickListener { private static final String TAG = "BusSpecificStopView"; @@ -62,14 +63,19 @@ public class BusSpecificStopView extends RelativeLayout implements OnClickListen this.context = context; - location = new TextView(context); + View.inflate(context, R.layout.bus_specific_stop_view, this); + + // location = new TextView(context); + location = (TextView) findViewById(R.id.busSpecificStopViewName); location.setTextSize(22f); location.setGravity(Gravity.LEFT); - time = new TextView(context); + // time = new TextView(context); + time = (TextView) findViewById(R.id.busSpecificStopViewTime); time.setTextSize(22f); - timeProgress = new ProgressBar(context, null, android.R.attr.progressBarStyleSmall); + // timeProgress = new ProgressBar(context, null, android.R.attr.progressBarStyleSmall); + timeProgress = (ProgressBar) findViewById(R.id.busSpecificStopViewProgressBar); Resources resources = context.getResources(); onClickHelpMessage = resources.getString(R.string.bus_stop_view_on_click_toast_help_message); @@ -77,22 +83,22 @@ public class BusSpecificStopView extends RelativeLayout implements OnClickListen setStop(stop); - RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, - LayoutParams.WRAP_CONTENT); - relativeParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); - - RelativeLayout.LayoutParams relativeParams2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, - LayoutParams.FILL_PARENT); - relativeParams2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - - addView(location, relativeParams); - addView(time, relativeParams2); - - // LinearLayout progressLayout = new LinearLayout(context); - // progressLayout.setOrientation(LinearLayout.VERTICAL); - // progressLayout.addView(timeProgress, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); - - addView(timeProgress, relativeParams2); + // RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, + // LayoutParams.WRAP_CONTENT); + // relativeParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); + // + // RelativeLayout.LayoutParams relativeParams2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, + // LayoutParams.FILL_PARENT); + // relativeParams2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + // + // addView(location, relativeParams); + // addView(time, relativeParams2); + // + // // LinearLayout progressLayout = new LinearLayout(context); + // // progressLayout.setOrientation(LinearLayout.VERTICAL); + // // progressLayout.addView(timeProgress, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + // + // addView(timeProgress, relativeParams2); } public void setStop(Stop stop) { |