update
This commit is contained in:
parent
89605e1bc5
commit
34909619dd
|
@ -1,24 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.best.ui"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
android:versionCode="5"
|
||||
android:versionName="3.0">
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/bestlogo">
|
||||
<activity android:name="Best" android:theme="@style/Theme.Transparent"
|
||||
android:clearTaskOnLaunch="true"
|
||||
android:label="@string/app_name">
|
||||
android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"></action>
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="SplashScreen1" android:theme="@style/Theme.Transparent" android:clearTaskOnLaunch="true" >
|
||||
<activity android:name="MainTab" android:theme="@android:style/Theme.NoTitleBar" android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden"/>
|
||||
<activity android:name="SplashScreen1" android:theme="@style/Theme.Transparent" android:configChanges="orientation|keyboardHidden" android:clearTaskOnLaunch="true" >
|
||||
</activity>
|
||||
<activity android:name="Find" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar" android:clearTaskOnLaunch="true"/>
|
||||
<!--<activity android:name="NearTripRoute" android:theme="@android:style/Theme.NoTitleBar" android:clearTaskOnLaunch="true" />
|
||||
<activity android:name="Routing" android:theme="@android:style/Theme.NoTitleBar" android:clearTaskOnLaunch="true" />-->
|
||||
<activity android:name="Routes" android:theme="@android:style/Theme.NoTitleBar" android:clearTaskOnLaunch="true" />
|
||||
<activity android:name="Map" android:theme="@android:style/Theme.NoTitleBar" android:clearTaskOnLaunch="true" />
|
||||
<activity android:name="ListLocation" android:theme="@android:style/Theme.Dialog" android:clearTaskOnLaunch="true" />
|
||||
<activity android:name="Search" android:theme="@android:style/Theme.Dialog" android:clearTaskOnLaunch="true" />
|
||||
<activity android:name="Buses" android:theme="@android:style/Theme.NoTitleBar" android:configChanges="orientation|keyboardHidden" android:clearTaskOnLaunch="true" />
|
||||
<activity android:name="Stops" android:theme="@android:style/Theme.NoTitleBar" android:configChanges="orientation|keyboardHidden" android:clearTaskOnLaunch="true" />
|
||||
<activity android:name="EmptyActivity" android:theme="@android:style/Theme.NoTitleBar" android:clearTaskOnLaunch="true" />
|
||||
<!--<activity android:name="TabGroup1Activity"></activity>
|
||||
<activity android:name="TabGroup2Activity"></activity>-->
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
|
|
@ -8,5 +8,5 @@
|
|||
Nikita:-
|
||||
1. Reset max sdk version in AndroidManifest.xml in tag <uses-sdk>. Now it is set as API level 11.
|
||||
2. Nearby stops button face.
|
||||
|
||||
3. Off GPS when not required.
|
||||
4.Map: Specify start and end bus stops
|
|
@ -3,5 +3,5 @@
|
|||
#
|
||||
|
||||
pushd bin/
|
||||
/cygdrive/c/Program\ Files/Android/android-sdk-windows/platform-tools/adb.exe install chalobest-debug.apk
|
||||
/cygdrive/c/Program\ Files/Android/android-sdk-windows/platform-tools/adb.exe -s emulator-5554 install chalobest-debug.apk
|
||||
popd
|
||||
|
|
|
@ -4,18 +4,19 @@
|
|||
<item android:state_pressed="false">
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#ebebeb"
|
||||
android:startColor="#b6b4b6"
|
||||
android:endColor="#b6b4b6"
|
||||
android:centerColor="#ebebeb"
|
||||
android:angle="270" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:width="2dp"
|
||||
android:color="#b4b5b4" />
|
||||
<corners
|
||||
android:radius="3dp" />
|
||||
android:radius="25dp" />
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:left="20dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:right="20dp"
|
||||
android:bottom="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
|
|
@ -1,10 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="false"
|
||||
android:drawable="@android:drawable/editbox_background" />
|
||||
<item android:state_pressed="true"
|
||||
android:drawable="@drawable/focused_application_background_static" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/focused_application_background_static" />
|
||||
<item android:state_pressed="true" >
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#ebebeb"
|
||||
android:endColor="#b6b4b6"
|
||||
android:angle="270" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#cc0000" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="false" >
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#ffffff"
|
||||
android:endColor="#ffffff"
|
||||
android:angle="270" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_focused="true">
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#ffffff"
|
||||
android:endColor="#ffffff"
|
||||
android:angle="270" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="#009900" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
|
@ -2,22 +2,53 @@
|
|||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/rellayoutmain"
|
||||
android:background="#efefef"
|
||||
android:background="#ffffff"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<LinearLayout
|
||||
<!--<LinearLayout
|
||||
android:id="@+id/titlelinearlayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
android:layout_height="wrap_content">-->
|
||||
<!--<ImageView
|
||||
android:id="@+id/besthead"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@drawable/bestheadbar"/>
|
||||
android:background="@drawable/bestheadbar"/>-->
|
||||
<!-- <TextView
|
||||
android:id="@+id/myroute"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_height="35dp"
|
||||
android:padding="10dp"
|
||||
android:text="@+string/myroute"
|
||||
android:background="#d2d2d2"
|
||||
android:textColor="#070707"/>
|
||||
<Button
|
||||
android:id="@+id/buses"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_height="35dp"
|
||||
android:layout_gravity="right"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/blue_button"
|
||||
android:text="@+string/buses" />
|
||||
<Button
|
||||
android:id="@+id/stops"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.25"
|
||||
android:layout_height="35dp"
|
||||
android:layout_gravity="right"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/blue_button"
|
||||
android:text="@+string/stops" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>-->
|
||||
<!--<LinearLayout
|
||||
android:id="@+id/titlelinearlayout"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -62,18 +93,6 @@
|
|||
android:src="@drawable/ic_minus_trans"/
|
||||
</LinearLayout>-->
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/ScrollView01"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:fillViewport="true"
|
||||
android:layout_below="@id/titlelinearlayout">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/mainlinearlayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/explinearlayout"
|
||||
|
@ -85,11 +104,11 @@
|
|||
android:id="@+id/linearlayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp">
|
||||
android:layout_marginTop="10dp">
|
||||
<EditText
|
||||
android:id="@+id/fromtxt"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.7"
|
||||
android:layout_weight="0.8"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_toLeftOf="@+id/findfrom"
|
||||
|
@ -109,7 +128,7 @@
|
|||
android:background="@drawable/image_btn_pressd"
|
||||
android:src="@drawable/magglass_tot_trans"/>
|
||||
|
||||
<Button
|
||||
<!-- <Button
|
||||
android:id="@+id/nearFrom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.1"
|
||||
|
@ -121,19 +140,19 @@
|
|||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/blue_button"
|
||||
android:text="@+string/nearbyBtnText" />
|
||||
android:text="@+string/nearbyBtnText" />-->
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_below="@id/linearlayout1">
|
||||
<EditText
|
||||
android:id="@+id/totxt"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.7"
|
||||
android:layout_weight="0.8"
|
||||
android:layout_height="30dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
|
@ -152,7 +171,7 @@
|
|||
android:background="@drawable/image_btn_pressd"
|
||||
android:src="@drawable/magglass_tot_trans"/>
|
||||
|
||||
<Button
|
||||
<!--<Button
|
||||
android:id="@+id/nearTo"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.1"
|
||||
|
@ -163,34 +182,108 @@
|
|||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:background="@drawable/blue_button"
|
||||
android:text="@+string/nearbyBtnText" />
|
||||
android:text="@+string/nearbyBtnText" />-->
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout3"
|
||||
android:id="@+id/linearlayoutparent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity = "left"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_below="@id/linearlayout2">
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout3"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.85"
|
||||
android:gravity = "right"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/findbus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="40dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:soundEffectsEnabled="true"
|
||||
android:gravity = "right"
|
||||
android:layout_alignParentRight="true"
|
||||
android:textSize="14sp"
|
||||
android:background="@drawable/blue_button"
|
||||
android:text="@+string/findBusText" />
|
||||
android:text="@+string/search" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/txtpr"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.15"
|
||||
android:gravity = "right"
|
||||
android:layout_height="35dp"
|
||||
android:textColor="#070707"
|
||||
android:visibility="invisible"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout4"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_below="@id/linearlayout3">
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_below="@id/explinearlayout">
|
||||
<Button
|
||||
android:id="@+id/expandable"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="20dp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/handle" />
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/ScrollView01"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:fillViewport="true"
|
||||
android:layout_below="@id/linearlayout4">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/mainlinearlayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout5"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtprevious"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="40dp"
|
||||
android:padding="10dp"
|
||||
android:text="@+string/previoussearch"
|
||||
android:background="#d2d2d2"
|
||||
android:textColor="#070707"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout6"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_below="@id/linearlayout5">
|
||||
|
||||
<com.best.ui.ExpandedListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollY="0dp"
|
||||
android:background="@drawable/listbackgrnd"
|
||||
android:dividerHeight="0dp"
|
||||
android:scrollbarSize="0dp"
|
||||
android:fastScrollEnabled="false"
|
||||
android:scrollbars="none"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<!--<TextView
|
||||
android:id="@+id/txthead"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="40dp"
|
||||
|
@ -198,34 +291,40 @@
|
|||
android:text="@+string/busListHead"
|
||||
android:background="#d2d2d2"
|
||||
android:textColor="#070707"
|
||||
android:visibility="invisible"/>
|
||||
</LinearLayout>
|
||||
|
||||
android:visibility="invisible"/>-->
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout5"
|
||||
android:id="@+id/linearlayout7"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_below="@id/linearlayout6">
|
||||
<TextView
|
||||
android:id="@+id/txtnearby"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="40dp"
|
||||
android:padding="10dp"
|
||||
android:text="@+string/nearbytext"
|
||||
android:background="#d2d2d2"
|
||||
android:textColor="#070707"/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout8"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_below="@id/linearlayout4">
|
||||
android:layout_below="@id/linearlayout7">
|
||||
|
||||
<com.best.ui.ExpandedListView
|
||||
android:id="@android:id/list"
|
||||
android:label="Buses"
|
||||
android:background="#efefef"
|
||||
android:id="@+id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:scrollY="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/listbackgrnd"
|
||||
android:dividerHeight="0dp"
|
||||
android:scrollbarSize="0dp"
|
||||
android:fastScrollEnabled="false"
|
||||
android:scrollbars="none"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView >
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -67,17 +67,38 @@
|
|||
<TextView
|
||||
android:id="@+id/totaldist"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_weight="0.35"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
android:paddingLeft="0dp"
|
||||
android:textColor="#5a5858"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/innerlinearlayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.3"
|
||||
android:gravity="center"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
android:id="@+id/busBlue"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/freq"
|
||||
android:background="@null"/>
|
||||
<TextView
|
||||
android:id="@+id/bus_freq"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:paddingLeft="0dp"
|
||||
android:textColor="#5a5858"/>
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/stopsno"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.5"
|
||||
android:layout_weight="0.35"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="14sp"
|
||||
|
|
|
@ -5,4 +5,6 @@
|
|||
android:drawable="@drawable/focused_application_background_static" />
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/focused_application_background_static" />
|
||||
<item android:state_selected="true"
|
||||
android:drawable="@drawable/focused_application_background_static" />
|
||||
</selector>
|
|
@ -2,6 +2,7 @@
|
|||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/ScrollView01"
|
||||
android:background="#ffffff"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:background="@android:drawable/editbox_background"
|
||||
android:background="@drawable/listbackgrnd"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<TextView
|
||||
android:id="@+id/stopname"
|
||||
|
@ -13,15 +13,16 @@
|
|||
android:layout_weight="0.75"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:gravity = "left"
|
||||
android:textColor="#4a81af">
|
||||
</TextView>
|
||||
<TextView
|
||||
android:id="@+id/dep"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.25"
|
||||
android:text = ""
|
||||
android:gravity = "right"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="16sp"
|
||||
android:textColor="#5a5858">
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
android:label="Somelabel1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="10dp"
|
||||
android:padding="5dp"
|
||||
android:gravity="center_vertical"
|
||||
android:background="@drawable/listbackgrnd"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
|
@ -14,28 +15,47 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_weight="0.8"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@android:drawable/editbox_background">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stopname"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.5"
|
||||
android:textSize="16sp"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_weight="0.7"
|
||||
android:textColor="#4a81af"/>
|
||||
<TextView
|
||||
android:id="@+id/dist"
|
||||
android:layout_width="fill_parent"
|
||||
<LinearLayout
|
||||
android:id="@+id/innerlinearlayout1"
|
||||
android:label="Somelabel1"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="0.5"
|
||||
android:textColor="#5a5858"
|
||||
android:layout_below="@+id/stopname"/>
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_weight="0.3"
|
||||
android:orientation="horizontal"
|
||||
android:layout_below="@+id/stopname">
|
||||
<TextView
|
||||
android:id="@+id/stopRoad"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.7"
|
||||
android:textSize="14sp"
|
||||
android:textColor="#5a5858"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/stopArea"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.3"
|
||||
android:textSize="14sp"
|
||||
android:gravity="right"
|
||||
android:textColor="#5a5858"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/map"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.2"
|
||||
android:layout_height="50dp"
|
||||
android:text="Map" />
|
||||
android:text="@string/txtMap" />
|
||||
</LinearLayout>
|
||||
<!--android:background="@android:drawable/editbox_background" android:layout_alignParentBottom="true" android:paddingTop="10dp"-->
|
||||
|
|
|
@ -4,8 +4,79 @@
|
|||
android:id="@+id/routeslayout"
|
||||
android:layout_width="fill_parent"
|
||||
android:background="#efefef"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/listheader"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/listheader1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/busBlue"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.1"
|
||||
android:gravity="left"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/bus_blue_small"
|
||||
android:background="@null"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/_routename"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.15"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"
|
||||
android:paddingLeft="0dp"
|
||||
android:textColor="#5a5858"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/_routelongname"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="0.75"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:textSize="18sp"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="#5a5858"/>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/listheader2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="0dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_below="@id/listheader1">
|
||||
<ImageView
|
||||
android:id="@+id/busBlue"
|
||||
android:layout_width="wrap_content"
|
||||
android:gravity="right"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/freq"
|
||||
android:background="@null"/>
|
||||
<TextView
|
||||
android:id="@+id/_freq"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left"
|
||||
android:textSize="18sp"
|
||||
android:paddingLeft="10dp"
|
||||
android:textColor="#5a5858"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<!--<LinearLayout
|
||||
android:id="@+id/listheader1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -16,17 +87,18 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="16sp"
|
||||
android:text="Stop Name"
|
||||
android:text="@+string/StopNameHeading"
|
||||
android:textColor="#070707">
|
||||
</TextView>
|
||||
</LinearLayout>
|
||||
</LinearLayout> -->
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearlayout2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/listheader1">
|
||||
android:layout_below="@id/listheader">
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:id="@+id/routeslist"
|
||||
android:label="Buses"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/fullRoute"
|
||||
android:icon="@drawable/ic_tab_newsel"
|
||||
android:icon="@drawable/ic_tab_sel"
|
||||
android:title="Full Route" />
|
||||
<item android:id="@+id/map"
|
||||
android:icon="@drawable/ic_tab_newsel"
|
||||
android:icon="@drawable/ic_tab_sel"
|
||||
android:title="Map" />
|
||||
</menu>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/mnuexitmain"
|
||||
android:icon="@drawable/ic_tab_newsel"
|
||||
android:icon="@drawable/ic_tab_sel"
|
||||
android:title="Exit" />
|
||||
</menu>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/map"
|
||||
android:icon="@drawable/ic_tab_newsel"
|
||||
android:icon="@drawable/ic_tab_sel"
|
||||
android:title="Map" />
|
||||
</menu>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Best</string>
|
||||
<string name="app_name">ChaloBEST</string>
|
||||
<string name="M_FIND_TAB_ID">find</string>
|
||||
<string name="M_ROUT_TAB_ID">route</string>
|
||||
<string name="fromListTitle">Select Your Start Location</string>
|
||||
|
@ -11,15 +11,30 @@
|
|||
<string name="findBtnText">F</string>
|
||||
<string name="nearbyBtnText">N</string>
|
||||
<string name="findBusText">Find Bus</string>
|
||||
<string name="busListHead">Buses Available</string>
|
||||
<string name="busListHead">Search Result</string>
|
||||
<string name="inittext">Initializing Application for the first time...</string>
|
||||
<string name="errMsgMoreChar">Please enter some more characters..</string>
|
||||
<string name="errMsgEnterSrcLoc">Please enter some source location..</string>
|
||||
<string name="errMsgEnterDestLoc">Please enter some destination location..</string>
|
||||
<string name="errMsgEnterValidDest">Enter valid destination</string>
|
||||
<string name="errMsgEnterValidSrc">Enter valid Source location</string>
|
||||
<string name="errMsgNoStopsMatch">No matching stops found</string>
|
||||
<string name="errMsgNoStopsMatch">No matching stop found</string>
|
||||
<string name="errMsgNoBusMatch">No matching Bus found</string>
|
||||
<string name="errMsgNoNearbyStop">No stops found near by</string>
|
||||
<string name="noLocation">No such Location</string>
|
||||
<string name="errNoMap">Sorry, unable to show map at this time.</string>
|
||||
<string name="buses">Buses</string>
|
||||
<string name="stops">Stops</string>
|
||||
<string name="search">Find Routes</string>
|
||||
<string name="myroute">My Route</string>
|
||||
<string name="previoussearch">Previous Searches:</string>
|
||||
<string name="nearbytext">Near by passing buses :</string>
|
||||
<string name="txtSearchFor">Search for :</string>
|
||||
<string name="StopNameHeading">Stop Name</string>
|
||||
<string name="txtsearch">Search</string>
|
||||
<string name="txtWorkInProgress">Work in progress...</string>
|
||||
<string name="txtMap">Map</string>
|
||||
<string name="txtSelectSource">Select as Source</string>
|
||||
<string name="txtSelectDest">Select as Destination</string>
|
||||
<string name="txtSmthingWentWrong">Sorry...Something went wrong...</string>
|
||||
</resources>
|
||||
|
|
|
@ -37,7 +37,9 @@ import android.content.DialogInterface;
|
|||
import android.widget.LinearLayout;
|
||||
import com.best.data.DBHandle;
|
||||
import com.best.data.GTStore;
|
||||
import com.best.data.GTStore_sqlite;
|
||||
import com.best.util.TransitionEffect;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Best extends Activity
|
||||
{
|
||||
|
@ -67,6 +69,8 @@ public class Best extends Activity
|
|||
TransitionEffect.callOverridePendingTransition(this);
|
||||
|
||||
me = this;
|
||||
log("BEST: onCreate called");
|
||||
getUpdatedPosition();
|
||||
DBHandle.init( me );
|
||||
|
||||
Intent intent = new Intent( ( Context )me,SplashScreen1.class );
|
||||
|
@ -74,16 +78,14 @@ public class Best extends Activity
|
|||
|
||||
LoadThread loadThread = new LoadThread( loadHandler );
|
||||
loadThread.start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
if( m_locationManager == null )
|
||||
m_locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
getUpdatedPosition();
|
||||
//getUpdatedPosition();
|
||||
log("BEST: onResume called");
|
||||
}
|
||||
|
||||
public Handler loadHandler = new Handler() {
|
||||
|
@ -94,8 +96,9 @@ public class Best extends Activity
|
|||
|
||||
if( allOK )
|
||||
{
|
||||
GTStore_sqlite.init(me);
|
||||
Intent intent = new Intent();
|
||||
intent.setClass( me, Find.class);
|
||||
intent.setClass( me, MainTab.class);
|
||||
startActivityForResult( intent, _activityRequestCode );
|
||||
}
|
||||
else
|
||||
|
@ -114,10 +117,9 @@ public class Best extends Activity
|
|||
|
||||
public void run()
|
||||
{
|
||||
//code to get all routes
|
||||
Bundle dataBundle = new Bundle();
|
||||
dataBundle.putBoolean( "allOK", DBHandle.dbFileReady() );
|
||||
|
||||
//dataBundle.putBoolean( "allOK", true );
|
||||
Message msg = _handler.obtainMessage();
|
||||
msg.setData( dataBundle );
|
||||
_handler.sendMessage( msg );
|
||||
|
@ -150,12 +152,12 @@ public class Best extends Activity
|
|||
|
||||
public static void showError(Context context, CharSequence msg)
|
||||
{
|
||||
showMessage( context, msg, "Error" );
|
||||
showMessage( context, msg, "Message" );
|
||||
}
|
||||
|
||||
public static void showError(Context context, int msg)
|
||||
{
|
||||
showMessage( context, msg, "Error" );
|
||||
showMessage( context, msg, "Message" );
|
||||
}
|
||||
|
||||
public static void showMessage(Context context, CharSequence msg,String title)
|
||||
|
@ -201,7 +203,9 @@ public class Best extends Activity
|
|||
|
||||
|
||||
/////////GPS
|
||||
public static void getUpdatedPosition()
|
||||
public void getUpdatedPosition()
|
||||
{
|
||||
try
|
||||
{
|
||||
if( !m_position_updation_on )
|
||||
{
|
||||
|
@ -209,16 +213,25 @@ public class Best extends Activity
|
|||
m_longitude = "";
|
||||
|
||||
m_position_updation_on = true;
|
||||
//m_locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 5000, 0, m_networkLocationListener );
|
||||
|
||||
if( m_locationManager == null )
|
||||
m_locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
|
||||
|
||||
m_locationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 5000, 0, m_networkLocationListener );
|
||||
m_locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 5000, 0, m_gpsLocationListener );
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{showMessage(this,e.toString(),"Error");}
|
||||
}
|
||||
|
||||
public static void cancelUpdatePosition()
|
||||
{
|
||||
log("GPS: Cancelling UPDATE POSITION");
|
||||
m_position_updation_on = false;
|
||||
cancelNetWorkUpdatePosition();
|
||||
cancelGPSUpdatePosition();
|
||||
log("GPS: Canceled UPDATE POSITION");
|
||||
}
|
||||
|
||||
public static void cancelNetWorkUpdatePosition()
|
||||
|
@ -240,8 +253,10 @@ public class Best extends Activity
|
|||
public void onProviderDisabled(String provider) { cancelGPSUpdatePosition(); }
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
try{ m_latitude = String.format("%9.6f", location.getLatitude()); }catch(Exception e){ m_latitude=""; }
|
||||
try{ m_longitude = String.format("%9.6f", location.getLongitude()); }catch(Exception e){ m_longitude=""; }
|
||||
try{ m_latitude = String.format("%9.6f", location.getLatitude()); }catch(Exception e){ }
|
||||
try{ m_longitude = String.format("%9.6f", location.getLongitude()); }catch(Exception e){ }
|
||||
log("Registered GPS LocationListener with values: Lat="+m_latitude+"--Long="+m_longitude);
|
||||
//showMessage(me,"Registered GPS LocationListener with values: Lat="+m_latitude+"--Long="+m_longitude,"GPS");
|
||||
cancelUpdatePosition();
|
||||
}
|
||||
};
|
||||
|
@ -255,17 +270,18 @@ public class Best extends Activity
|
|||
public void onProviderDisabled(String provider) { cancelNetWorkUpdatePosition(); }
|
||||
@Override
|
||||
public void onLocationChanged(Location location) {
|
||||
try{ m_latitude = String.format("%9.6f", location.getLatitude()); }catch(Exception e){ m_latitude=""; }
|
||||
try{ m_longitude = String.format("%9.6f", location.getLongitude()); }catch(Exception e){ m_longitude=""; }
|
||||
try{ m_latitude = String.format("%9.6f", location.getLatitude()); }catch(Exception e){ }
|
||||
try{ m_longitude = String.format("%9.6f", location.getLongitude()); }catch(Exception e){ }
|
||||
//showMessage(me,"Registered GPS LocationListener with values: Lat="+m_latitude+"--Long="+m_longitude,"GPS");
|
||||
cancelUpdatePosition();
|
||||
}
|
||||
};
|
||||
|
||||
public static boolean checkGPS(Context context)
|
||||
{
|
||||
if( !m_locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) )
|
||||
if( !m_locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) && !m_locationManager.isProviderEnabled( LocationManager.NETWORK_PROVIDER ) )
|
||||
{
|
||||
showMessage( context, "GPS Service not working.Please check option for GPS in \"Location & Security settings\" is checked.", "Service" );
|
||||
showMessage( context, "GPS/Network Service not working.Please check option for GPS in \"Location & Security settings\" is checked.", "Service" );
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
|
|
|
@ -26,8 +26,24 @@ public class ExpandedListView extends ListView {
|
|||
if (getCount() != old_count) {
|
||||
old_count = getCount();
|
||||
params = getLayoutParams();
|
||||
params.height = 0;
|
||||
if( old_count > 0 )
|
||||
params.height = ( getCount() * getChildAt(0).getHeight() ) + 20;
|
||||
{
|
||||
for(int i = 0; i < getCount(); i++)
|
||||
{
|
||||
System.out.println("===getCount()"+getCount()+"==="+i);
|
||||
try{
|
||||
params.height += getChildAt(i).getHeight();
|
||||
}catch(Exception e){
|
||||
System.out.println( "ERROR in getHeight:"+i );
|
||||
params.height += 75;
|
||||
}
|
||||
}
|
||||
params.height += 20;
|
||||
//params.height = ( getCount() * getChildAt(0).getHeight() ) + 20;
|
||||
System.out.println("====Child Height===="+getChildAt(0).getHeight());
|
||||
System.out.println("====List View Height===="+params.height);
|
||||
}
|
||||
else
|
||||
params.height = 0;
|
||||
setLayoutParams(params);
|
||||
|
|
|
@ -52,24 +52,28 @@ import android.view.KeyEvent;
|
|||
import android.view.View.OnKeyListener;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.Locale;
|
||||
import android.os.Message;
|
||||
import android.os.Handler;
|
||||
import android.os.Environment;
|
||||
|
||||
import java.lang.Double;
|
||||
|
||||
import android.text.Html;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import com.best.data.GTStore;
|
||||
import com.best.data.GTStore_sqlite;
|
||||
import com.best.util.Funcs;
|
||||
import com.best.util.TransitionEffect;
|
||||
import com.best.ui.Routing;
|
||||
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
public class Find extends ListActivity {
|
||||
public class Find extends Activity {
|
||||
|
||||
public static Activity me ;
|
||||
public static Context m_context ;
|
||||
|
||||
public static ListActivity me;
|
||||
public static Context m_context;
|
||||
public static AttributeSet attr;
|
||||
public static LayoutInflater mInflater;
|
||||
|
||||
|
@ -86,16 +90,35 @@ public class Find extends ListActivity {
|
|||
public static String[] stopLatitude;
|
||||
public static String[] stopLongitude;
|
||||
public static String[][] resultTemp;
|
||||
public static String[][] nearByTripsInfo = null;
|
||||
public static List<String[]> prevSearchList = new ArrayList<String[]>();
|
||||
public static ArrayList<String[]> listOfTrips;
|
||||
public static List<String> tripIdList;
|
||||
public static List<String> routeNamesList ;
|
||||
public static List<String> busHeadList ;
|
||||
public static List<String> busFreqList ;
|
||||
public static List<String> totalDistList ;
|
||||
public static List<String> no_StopsList ;
|
||||
|
||||
public static int selPosition = 0;
|
||||
public static int flagSourceSel = -1;
|
||||
public static int flagDestSel = -1;
|
||||
public static int flagSourceSel ;
|
||||
public static int flagDestSel ;
|
||||
public static int listDisplayed = -1;
|
||||
|
||||
public static boolean flagPanelVisible = true;
|
||||
public static boolean contentChanged = false ;
|
||||
public static boolean nearByBusClick = false ;
|
||||
public static boolean callFromNearTripRoute = false;
|
||||
public static boolean directRouteDisplayed = false;
|
||||
|
||||
public static String _sourceStopId = null;
|
||||
public static String _destStopId = null;
|
||||
|
||||
public static String _sourceStopId = null ;
|
||||
public static String _destStopId =null ;
|
||||
public static String sourceStop = "";
|
||||
public static String destStop = "";
|
||||
public static String _routeLongName ;
|
||||
public static String _routeName ;
|
||||
public static String _tripId ;
|
||||
public static String _freq ;
|
||||
public static Double latDouble=0.0;
|
||||
public static Double longDouble=0.0;
|
||||
|
||||
|
@ -104,16 +127,28 @@ public class Find extends ListActivity {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
System.out.println("SDK VERSION ========="+android.os.Build.VERSION.SDK_INT );
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.DONUT)
|
||||
TransitionEffect.callOverridePendingTransition(this);
|
||||
|
||||
//overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
|
||||
me = this;
|
||||
m_context = this;
|
||||
me.setContentView( com.best.ui.R.layout.find );
|
||||
this.setContentView( com.best.ui.R.layout.find );
|
||||
GTStore_sqlite.init(this);
|
||||
flagSourceSel=-1;
|
||||
flagDestSel=-1;
|
||||
sourceStop = "";
|
||||
destStop = "";
|
||||
init();
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onContentChanged() {
|
||||
if(callFromNearTripRoute == true)
|
||||
{
|
||||
init();
|
||||
callFromNearTripRoute = false;
|
||||
}
|
||||
Best.log("CONTENT CHANGED");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,23 +160,13 @@ public class Find extends ListActivity {
|
|||
|
||||
@Override
|
||||
protected void onRestoreInstanceState(final Bundle outState) {
|
||||
if(outState.getInt("listDisplay")!=-1)
|
||||
{
|
||||
EfficientAdapter adapter = new EfficientAdapter( m_context,resultTemp);
|
||||
me.setListAdapter( adapter );
|
||||
( (TextView) me.findViewById(com.best.ui.R.id.txthead) ).setVisibility( WIDGET_VISIBLE );
|
||||
//((ImageButton) me.findViewById(com.best.ui.R.id.expandable)).setVisibility( WIDGET_VISIBLE );
|
||||
}
|
||||
flagSourceSel=outState.getInt("src");
|
||||
flagDestSel=outState.getInt("dest");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
|
||||
// do something or nothing when configuration change.
|
||||
super.onConfigurationChanged(newConfig);
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,7 +176,17 @@ public class Find extends ListActivity {
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu (Menu menu){
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
menu.clear();
|
||||
if(nearByBusClick == true)
|
||||
inflater.inflate(com.best.ui.R.menu.onlymap, menu);
|
||||
else
|
||||
inflater.inflate(com.best.ui.R.menu.menustart, menu);
|
||||
return true;
|
||||
}
|
||||
|
@ -163,6 +198,20 @@ public class Find extends ListActivity {
|
|||
case com.best.ui.R.id.mnuexitmain:
|
||||
Best.exit( me );
|
||||
return true;
|
||||
|
||||
case com.best.ui.R.id.map:
|
||||
if(NearTripRoute._stopLat != null && NearTripRoute._stopLon != null)
|
||||
{
|
||||
Bundle bundle1 = new Bundle();
|
||||
bundle1.putBoolean( "showSingle", false );
|
||||
bundle1.putSerializable("StopsGeoX",NearTripRoute._stopLat);
|
||||
bundle1.putSerializable("StopsGeoY",NearTripRoute._stopLon);
|
||||
Intent intent = new Intent(m_context, Map.class);
|
||||
intent.putExtras( bundle1 );
|
||||
me.startActivityForResult(intent,5);
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -171,14 +220,45 @@ public class Find extends ListActivity {
|
|||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
// cancelUpdatePosition();
|
||||
//cancelUpdatePosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Best.exit( me );
|
||||
//return;
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{//If back was pressed
|
||||
if (keyCode==KeyEvent.KEYCODE_BACK)
|
||||
{
|
||||
back();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
public void back()
|
||||
{
|
||||
if(contentChanged == true )
|
||||
{
|
||||
this.setContentView( com.best.ui.R.layout.find );
|
||||
contentChanged = false;
|
||||
init();
|
||||
nearByBusClick = false;
|
||||
}
|
||||
else if(!contentChanged)
|
||||
Best.exit( this );
|
||||
|
||||
}
|
||||
// @Override
|
||||
// public void onBackPressed() {
|
||||
|
||||
// if(contentChanged == true )
|
||||
// {
|
||||
// this.setContentView( com.best.ui.R.layout.find );
|
||||
// contentChanged = false;
|
||||
// init();
|
||||
// nearByBusClick = false;
|
||||
// }
|
||||
// else if(!contentChanged)
|
||||
// Best.exit( this );
|
||||
// }
|
||||
|
||||
|
||||
public void handleFromSearch(String fromTxt)
|
||||
{
|
||||
|
@ -187,7 +267,10 @@ public class Find extends ListActivity {
|
|||
if( fromTxt.length() > 2 )
|
||||
findBusStops( false, fromTxt, M_FROM_LIST_CAPTION );
|
||||
else
|
||||
{
|
||||
Best.showError( m_context, com.best.ui.R.string.errMsgMoreChar );
|
||||
Best.log("ERROR MESSAGE IN MARATHI: "+com.best.ui.R.string.errMsgMoreChar);
|
||||
}
|
||||
}
|
||||
else
|
||||
Best.showError( m_context, com.best.ui.R.string.errMsgEnterSrcLoc );
|
||||
|
@ -219,28 +302,63 @@ public class Find extends ListActivity {
|
|||
|
||||
public void init()
|
||||
{
|
||||
final TextView txthead = (TextView) me.findViewById(com.best.ui.R.id.txthead);
|
||||
//final LinearLayout expLayout = (LinearLayout) me.findViewById(com.best.ui.R.id.explinearlayout);
|
||||
me = this;
|
||||
m_context = this;
|
||||
callSwitchLang();
|
||||
tripIdList = new ArrayList<String>();
|
||||
routeNamesList = new ArrayList<String>();
|
||||
busHeadList = new ArrayList<String>();
|
||||
busFreqList = new ArrayList<String>();
|
||||
totalDistList = new ArrayList<String>();
|
||||
no_StopsList = new ArrayList<String>();
|
||||
|
||||
// final ImageButton btnexpand = (ImageButton) me.findViewById(com.best.ui.R.id.expandable);
|
||||
// btnexpand.setOnClickListener(new View.OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// if(flagPanelVisible == true)
|
||||
// {
|
||||
// expLayout.setVisibility(LinearLayout.GONE);
|
||||
// flagPanelVisible = false;
|
||||
// btnexpand.setImageResource(R.drawable.ic_plus_trans);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expLayout.setVisibility(LinearLayout.VISIBLE);
|
||||
// flagPanelVisible = true;
|
||||
// btnexpand.setImageResource(R.drawable.ic_minus_trans);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
if(prevSearchList != null && prevSearchList.size() > 0)
|
||||
{
|
||||
((LinearLayout) me.findViewById(com.best.ui.R.id.linearlayout5)).setVisibility(LinearLayout.VISIBLE);
|
||||
EfficientAdapter adapter = new EfficientAdapter( m_context, prevSearchList.toArray( new String[ prevSearchList.size() ][] ) );
|
||||
( ( ListView ) me.findViewById(android.R.id.list) ).setAdapter( adapter );
|
||||
}
|
||||
|
||||
final EditText txtFrm = (EditText) me.findViewById(com.best.ui.R.id.fromtxt);
|
||||
final EditText txtTo = (EditText) me.findViewById(com.best.ui.R.id.totxt);
|
||||
if(sourceStop != null && sourceStop.length() > 0)
|
||||
txtFrm.setText(sourceStop);
|
||||
if(destStop != null && destStop.length() > 0)
|
||||
txtTo.setText(destStop);
|
||||
if(prevSearchList == null || prevSearchList.size() == 0)
|
||||
((LinearLayout) me.findViewById(com.best.ui.R.id.linearlayout5)).setVisibility(LinearLayout.GONE);
|
||||
final LinearLayout expLayout = (LinearLayout) me.findViewById(com.best.ui.R.id.explinearlayout);
|
||||
///////
|
||||
|
||||
if( Best.m_latitude.length() > 0 && Best.m_longitude.length() > 0 )
|
||||
{
|
||||
latDouble = Double.valueOf( Best.m_latitude );//Double.valueOf( "40.45939" ); 18.930075
|
||||
longDouble = Double.valueOf( Best.m_longitude );//Double.valueOf( "-3.78429" );72.833308
|
||||
}
|
||||
|
||||
Best.showProcessing( m_context, "Loading","Please wait..." );
|
||||
NearByTripsSearchThread nearByTripsSearch = new NearByTripsSearchThread( nearByTripsSearchHandler );
|
||||
nearByTripsSearch.start();
|
||||
|
||||
final Button btnexpand = (Button) me.findViewById(com.best.ui.R.id.expandable);
|
||||
btnexpand.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
if(flagPanelVisible == true)
|
||||
{
|
||||
expLayout.setVisibility(LinearLayout.GONE);
|
||||
flagPanelVisible = false;
|
||||
// btnexpand.setImageResource(R.drawable.ic_plus_trans);
|
||||
}
|
||||
else
|
||||
{
|
||||
expLayout.setVisibility(LinearLayout.VISIBLE);
|
||||
flagPanelVisible = true;
|
||||
// btnexpand.setImageResource(R.drawable.ic_minus_trans);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
txtFrm.setOnKeyListener( new OnKeyListener() {
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
handleEnter( event, txtFrm, true );
|
||||
|
@ -252,10 +370,10 @@ public class Find extends ListActivity {
|
|||
btnsearchfrm.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
handleFromSearch( txtFrm.getText().toString().trim() );
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
final EditText txtTo = (EditText) me.findViewById(com.best.ui.R.id.totxt);
|
||||
txtTo.setOnKeyListener( new OnKeyListener() {
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
handleEnter( event, txtTo, false );
|
||||
|
@ -270,19 +388,20 @@ public class Find extends ListActivity {
|
|||
}
|
||||
});
|
||||
|
||||
final Button btnnearfrom = (Button) me.findViewById(com.best.ui.R.id.nearFrom);
|
||||
btnnearfrom.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
findNearByStops( true );
|
||||
}
|
||||
});
|
||||
// final Button btnnearfrom = (Button) me.findViewById(com.best.ui.R.id.nearFrom);
|
||||
// btnnearfrom.setOnClickListener(new View.OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
//// Best.showMessage(me,"Registered GPS LocationListener with values: Lat="+latDouble+"--Long="+longDouble,"GPS");
|
||||
// findNearByStops( true );
|
||||
// }
|
||||
// });
|
||||
|
||||
final Button btnnearto = (Button) me.findViewById(com.best.ui.R.id.nearTo);
|
||||
btnnearto.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
findNearByStops( false );
|
||||
}
|
||||
});
|
||||
// final Button btnnearto = (Button) me.findViewById(com.best.ui.R.id.nearTo);
|
||||
// btnnearto.setOnClickListener(new View.OnClickListener() {
|
||||
// public void onClick(View v) {
|
||||
// findNearByStops( false );
|
||||
// }
|
||||
// });
|
||||
|
||||
final Button btnfindbus = ( Button ) me.findViewById( com.best.ui.R.id.findbus );
|
||||
btnfindbus.setOnClickListener( new View.OnClickListener() {
|
||||
|
@ -317,6 +436,67 @@ public class Find extends ListActivity {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
public Handler nearByTripsSearchHandler = new Handler() {
|
||||
public void handleMessage(Message msg) {
|
||||
Bundle dataBundle = msg.getData();
|
||||
Best.dissmissProcessing();
|
||||
nearByTripsInfo = ( String[][] )dataBundle.getSerializable( "rts" );
|
||||
|
||||
if( nearByTripsInfo != null && nearByTripsInfo.length > 0)
|
||||
{
|
||||
listOfTrips = new ArrayList<String[]>();
|
||||
|
||||
for(int i=0; i< nearByTripsInfo.length; i++)
|
||||
{
|
||||
System.out.println("======nearByTripsInfo=="+nearByTripsInfo[i][0]+"=="+nearByTripsInfo[i][1]+"==="+nearByTripsInfo[i][2]+"==="+nearByTripsInfo[i][3]);
|
||||
listOfTrips.add(nearByTripsInfo[i]);
|
||||
if(!(i >= (nearByTripsInfo.length - 2)))
|
||||
{
|
||||
if(nearByTripsInfo[i][3].equals(nearByTripsInfo[i+1][3]))
|
||||
{ i++;}
|
||||
}
|
||||
}
|
||||
if(listOfTrips.size() > 0 )
|
||||
{
|
||||
Best.log("listOfTrips NOT NULL");
|
||||
EfficientAdapterForNear adapter = new EfficientAdapterForNear( m_context, listOfTrips.toArray( new String[ listOfTrips.size() ][] ) );
|
||||
((TextView) me.findViewById(com.best.ui.R.id.txtnearby)).setVisibility( WIDGET_VISIBLE );
|
||||
( ( ListView )me.findViewById( com.best.ui.R.id.list ) ).setVisibility( WIDGET_VISIBLE );
|
||||
( ( ListView )me.findViewById( com.best.ui.R.id.list ) ).setAdapter( adapter );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("======No near by buses=====");
|
||||
( ( ListView )me.findViewById( com.best.ui.R.id.list ) ).setVisibility( WIDGET_INVISIBLE );
|
||||
((TextView) me.findViewById(com.best.ui.R.id.txtnearby)).setVisibility( WIDGET_INVISIBLE );
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private class NearByTripsSearchThread extends Thread
|
||||
{
|
||||
Handler _handler;
|
||||
|
||||
NearByTripsSearchThread(Handler handler )
|
||||
{
|
||||
_handler = handler;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
//code to get all routes
|
||||
Bundle dataBundle = new Bundle();
|
||||
|
||||
dataBundle.putSerializable( "rts", GTStore_sqlite.getNearByTripInfo(latDouble, longDouble));
|
||||
Message msg = _handler.obtainMessage();
|
||||
msg.setData( dataBundle );
|
||||
_handler.sendMessage( msg );
|
||||
}
|
||||
}
|
||||
|
||||
public Handler searchRoutesHandler = new Handler() {
|
||||
public void handleMessage(Message msg) {
|
||||
Bundle dataBundle = msg.getData();
|
||||
|
@ -325,25 +505,62 @@ public class Find extends ListActivity {
|
|||
|
||||
String[][] routesResult = ( String[][] )dataBundle.getSerializable( "rts" );
|
||||
|
||||
EfficientAdapter adapter = new EfficientAdapter( m_context, routesResult );
|
||||
me.setListAdapter( adapter );
|
||||
ListView listview = ( ListView )me.findViewById( android.R.id.list );
|
||||
listview.requestLayout();
|
||||
|
||||
if( routesResult != null && routesResult.length >0 )
|
||||
if(routesResult != null && routesResult.length > 0 )
|
||||
{
|
||||
( (TextView) me.findViewById(com.best.ui.R.id.txthead) ).setVisibility( WIDGET_VISIBLE );
|
||||
( ( ListView )me.findViewById( android.R.id.list ) ).setVisibility( WIDGET_VISIBLE );
|
||||
//((ImageButton) me.findViewById(com.best.ui.R.id.expandable)).setVisibility( WIDGET_VISIBLE );
|
||||
listDisplayed = 1;
|
||||
String currentTime = Funcs.getCurrentTime(true);
|
||||
|
||||
sourceStop =((EditText) me.findViewById(com.best.ui.R.id.fromtxt)).getText().toString().trim();
|
||||
destStop = ((EditText) me.findViewById(com.best.ui.R.id.totxt)).getText().toString().trim();
|
||||
String[] searchInfo = {_sourceStopId, sourceStop, _destStopId, destStop ,currentTime};
|
||||
if(prevSearchList.size() == 4)
|
||||
prevSearchList.remove(3);
|
||||
if(prevSearchList.size() > 0)
|
||||
{
|
||||
int addItem = 0;
|
||||
for(int i =0 ;i < prevSearchList.size(); i++)
|
||||
{
|
||||
String[] temp = prevSearchList.get(i);
|
||||
if(temp[0].equals(searchInfo[0]))
|
||||
{
|
||||
if(temp[2].equals(searchInfo[2]))
|
||||
{
|
||||
prevSearchList.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
prevSearchList.add(0,searchInfo);
|
||||
}
|
||||
else
|
||||
{ ( (TextView) me.findViewById(com.best.ui.R.id.txthead) ).setVisibility( WIDGET_INVISIBLE );
|
||||
( ( ListView )me.findViewById( android.R.id.list ) ).setVisibility( WIDGET_INVISIBLE );
|
||||
//((ImageButton) me.findViewById(com.best.ui.R.id.expandable)).setVisibility( WIDGET_INVISIBLE );
|
||||
Best.showMessage( m_context, "There are no routes to show.", "Processing" );
|
||||
prevSearchList.add(0,searchInfo);
|
||||
//GTStore.insertIntoPreviousSearch(_sourceStopId,_destStopId);
|
||||
//( prevSearchList.toArray( new String[ prevSearchList.size() ][] ) )
|
||||
|
||||
( ( ListView )me.findViewById( android.R.id.list ) ).setVisibility( WIDGET_VISIBLE );
|
||||
listDisplayed = 1;
|
||||
|
||||
|
||||
for(int i = 0; i< routesResult.length; i++)
|
||||
{
|
||||
tripIdList.add(routesResult[i][0]);
|
||||
routeNamesList.add(routesResult[i][1]);
|
||||
busHeadList.add(routesResult[i][2]);
|
||||
busFreqList.add(routesResult[i][5]);
|
||||
totalDistList.add(routesResult[i][4]);
|
||||
no_StopsList.add(routesResult[i][3]);
|
||||
if(!(i >= (routesResult.length - 2)))
|
||||
{
|
||||
if((routesResult[i][1]).equals(routesResult[i+1][1]))
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
me.setContentView( com.best.ui.R.layout.routing );
|
||||
contentChanged = true;
|
||||
Routing.init(m_context);
|
||||
}
|
||||
else
|
||||
Best.showMessage( m_context, "There are no routes to show.", "Processing" );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -361,18 +578,22 @@ public class Find extends ListActivity {
|
|||
//code to get all routes
|
||||
Bundle dataBundle = new Bundle();
|
||||
String currTime = Funcs.getCurrentTime( true );
|
||||
// dataBundle.putSerializable( "rts", GTStore.getRoutes( _sourceStopId, _destStopId, Funcs.getCurrentDay(), currTime, Funcs.addTime( currTime, "00:25:00" ) ) );
|
||||
|
||||
// dataBundle.putSerializable( "rts", GTStore.getRoutes( _sourceStopId, _destStopId, Funcs.getCurrentDay(), currTime, Funcs.addTime( currTime, "00:25:00" ) ) );
|
||||
//dataBundle.putSerializable( "rts", GTStore.findRoutes( 40.44938, -3.6912, 40.41876, -3.69263, Funcs.getCurrentDay() ) );
|
||||
|
||||
dataBundle.putSerializable( "rts", GTStore.getDirectRoutes( _sourceStopId, _destStopId ) );
|
||||
|
||||
//dataBundle.putSerializable( "rts", GTStore.getDirectRoutes( "714", "736" ) );
|
||||
//dataBundle.putSerializable( "rts", GTStore.getDirectRoutes( "46", "73" ) );
|
||||
try
|
||||
{
|
||||
String [][] _res = GTStore_sqlite.getDirectRoutes( _sourceStopId, _destStopId );
|
||||
// String [][] _res = GTStore.getDirectRoutes( _sourceStopId, _destStopId );
|
||||
|
||||
dataBundle.putSerializable( "rts", _res );
|
||||
Message msg = _handler.obtainMessage();
|
||||
msg.setData( dataBundle );
|
||||
_handler.sendMessage( msg );
|
||||
|
||||
}
|
||||
catch(Exception e){Best.dissmissProcessing(); e.printStackTrace();}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -387,7 +608,7 @@ public class Find extends ListActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public static Handler searchStopsHandler = new Handler() {
|
||||
public Handler searchStopsHandler = new Handler() {
|
||||
public void handleMessage(Message msg) {
|
||||
Bundle dataBundle = msg.getData();
|
||||
|
||||
|
@ -446,14 +667,15 @@ public class Find extends ListActivity {
|
|||
{
|
||||
//near by stops
|
||||
try{
|
||||
resultSet = GTStore.getNearByStops( latDouble, longDouble );
|
||||
|
||||
resultSet = GTStore_sqlite.getNearByStops( latDouble, longDouble );
|
||||
}catch(Exception e){System.out.println("Excp2: " + e.toString() );allOK = false;}
|
||||
}
|
||||
else
|
||||
{
|
||||
//search by inputtext
|
||||
try{
|
||||
resultSet = GTStore.getAllStopsByText( _txtSearch, latDouble, longDouble );
|
||||
resultSet = GTStore_sqlite.getAllStopsByText( _txtSearch, latDouble, longDouble );
|
||||
}catch(Exception e){allOK = false; e.printStackTrace();}
|
||||
}
|
||||
|
||||
|
@ -480,11 +702,13 @@ public class Find extends ListActivity {
|
|||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
Best.log("ON ACTIVITY RESULT");
|
||||
try{
|
||||
Bundle bundle = data.getExtras();
|
||||
int editBoxNo=bundle.getInt( "EditText" );
|
||||
selPosition=bundle.getInt( "position" );
|
||||
|
||||
Best.log("EDIT BOX NUMBER :" + editBoxNo);
|
||||
if( editBoxNo == 1 || editBoxNo == 3 )
|
||||
{
|
||||
String FrmLoc=bundle.getString( "frmLoc" );
|
||||
|
@ -504,17 +728,19 @@ public class Find extends ListActivity {
|
|||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
System.out.println("Exception-"+e.toString());
|
||||
}
|
||||
Best.log("Exception-"+e.toString());
|
||||
}
|
||||
|
||||
public static void displayList(String[][] resultSet,int editBoxNo)
|
||||
}
|
||||
|
||||
public void displayList(String[][] resultSet,int editBoxNo)
|
||||
{
|
||||
try{
|
||||
String[] stopsId, stopName, distance;
|
||||
String[] stopsId, stopName, stopRoad, stopArea;
|
||||
stopsId = new String[resultSet.length ];
|
||||
stopName = new String[resultSet.length ];
|
||||
distance = new String[resultSet.length ];
|
||||
stopRoad = new String[resultSet.length ];
|
||||
stopArea = new String[resultSet.length ];
|
||||
|
||||
for(int index=0; index<resultSet.length; index++)
|
||||
{
|
||||
|
@ -523,8 +749,9 @@ public class Find extends ListActivity {
|
|||
String[] stopDesc = (String[])(resultSet[ index ]);
|
||||
stopsId[ index ] = stopDesc[0];
|
||||
stopName[ index ] = stopDesc[1];
|
||||
distance[ index ] = stopDesc[2];
|
||||
Best.log( "ID : "+stopsId[ index ].toString()+" -- "+stopName[ index ].toString()+" --- "+distance[ index ].toString() );
|
||||
stopRoad[ index ] = stopDesc[2];
|
||||
stopArea[ index ] = stopDesc[3];
|
||||
Best.log( "ID : "+stopsId[ index ].toString()+" -- "+stopName[ index ].toString()+" --- "+stopRoad[ index ].toString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -532,19 +759,120 @@ public class Find extends ListActivity {
|
|||
Bundle bundle = new Bundle();
|
||||
bundle.putStringArray( "StopID", stopsId );
|
||||
bundle.putStringArray( "Stops", stopName );
|
||||
bundle.putStringArray( "Distance", distance );
|
||||
bundle.putStringArray( "stopRoad", stopRoad );
|
||||
bundle.putStringArray( "stopArea", stopArea );
|
||||
bundle.putInt( "EditText", editBoxNo );
|
||||
//edit.putExtras( bundle );
|
||||
intent.putExtras( bundle );
|
||||
//parentActivity.startChildActivity("EditActivity", edit);
|
||||
me.startActivityForResult( intent, 5 );
|
||||
}
|
||||
catch(Exception e){}
|
||||
}
|
||||
private void callSwitchLang() {
|
||||
|
||||
Locale[] locales = Locale.getAvailableLocales();
|
||||
for(int i = 0; i<locales.length; i++)
|
||||
System.out.println("LOCALE: "+locales[i]);
|
||||
// Locale locale = new Locale("mr");
|
||||
// Locale.setDefault(locale);
|
||||
// Configuration config = new Configuration();
|
||||
// config.locale = locale;
|
||||
// getBaseContext().getResources().updateConfiguration(config,getBaseContext().getResources().getDisplayMetrics());
|
||||
//onCreate(null);
|
||||
}
|
||||
|
||||
public class EfficientAdapter extends BaseAdapter implements Filterable {
|
||||
|
||||
public String[][] result;
|
||||
public int resultSetLength;
|
||||
|
||||
public EfficientAdapter(Context context, String[][] resultSet)
|
||||
{
|
||||
mInflater = LayoutInflater.from( context );
|
||||
result = new String[resultSet.length][];
|
||||
result=resultSet;
|
||||
resultSetLength = resultSet.length;
|
||||
|
||||
}
|
||||
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
|
||||
ViewHolder holder;
|
||||
if (convertView == null)
|
||||
{
|
||||
convertView = mInflater.inflate(com.best.ui.R.layout.listthreetext, null);
|
||||
|
||||
holder = new ViewHolder();
|
||||
holder.stop_name = (TextView) convertView.findViewById(com.best.ui.R.id.stopname);
|
||||
holder.dep_time = (TextView) convertView.findViewById(com.best.ui.R.id.dep);
|
||||
|
||||
convertView.setTag(holder);
|
||||
}
|
||||
else
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
|
||||
holder.stop_name.setText(Html.fromHtml("<font color = 'DarkSlateBlue'>"+result[position][1]+"</font>"+"<font color = 'black'>" +" TO "+ "</font>"+"<font color = 'DarkSlateBlue'>"+result[position][3]+"</font>"));
|
||||
//_startStopID = result[position][1];
|
||||
holder.stop_name.setTextSize(15);
|
||||
holder.dep_time.setTextSize(12);
|
||||
String timeDiff = Funcs.subtractTime(result[position][4], Funcs.getCurrentTime(true));
|
||||
System.out.println("==Current Time = "+Funcs.getCurrentTime(true)+"---Search Time= "+result[position][4]);
|
||||
|
||||
String[] timeDiffSplit = timeDiff.split( ":" );
|
||||
if( (Integer.parseInt( timeDiffSplit[ 0 ] )) > 0)
|
||||
holder.dep_time.setText("("+timeDiffSplit[ 0 ]+" hr)");
|
||||
else if( (Integer.parseInt( timeDiffSplit[ 1 ] )) > 0)
|
||||
holder.dep_time.setText("("+timeDiffSplit[ 1 ]+" min)");
|
||||
else
|
||||
holder.dep_time.setText("");
|
||||
|
||||
convertView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((EditText) me.findViewById(com.best.ui.R.id.fromtxt)).setText(result[position][1]);
|
||||
_sourceStopId = result[position][0];
|
||||
flagSourceSel = 1;
|
||||
((EditText) me.findViewById(com.best.ui.R.id.totxt)).setText(result[position][3]);
|
||||
_destStopId = result[position][2];
|
||||
flagDestSel = 1;
|
||||
}
|
||||
});
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public class ViewHolder {
|
||||
TextView stop_name;
|
||||
TextView dep_time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Filter getFilter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return result.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return result[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class EfficientAdapterForNear extends BaseAdapter implements Filterable {
|
||||
|
||||
public String[][] result;
|
||||
|
||||
public EfficientAdapterForNear(Context context, String[][] resultSet)
|
||||
{
|
||||
if(resultSet!= null)
|
||||
{
|
||||
|
@ -553,89 +881,56 @@ public class Find extends ListActivity {
|
|||
result=resultSet;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
|
||||
ViewHolder holder;
|
||||
if(result!= null)
|
||||
{
|
||||
|
||||
if (convertView == null)
|
||||
{
|
||||
convertView = mInflater.inflate(com.best.ui.R.layout.list_button, null);
|
||||
convertView = mInflater.inflate(com.best.ui.R.layout.list_route, null);
|
||||
|
||||
holder = new ViewHolder();
|
||||
holder.routename= (TextView) convertView.findViewById(com.best.ui.R.id.routename);
|
||||
holder.head = (TextView) convertView.findViewById(com.best.ui.R.id.bushead);
|
||||
holder.total_dist = (TextView) convertView.findViewById(com.best.ui.R.id.totaldist);
|
||||
holder.no_of_stops = (TextView) convertView.findViewById(com.best.ui.R.id.stopsno);
|
||||
holder.blue_bus = (ImageView) convertView.findViewById(com.best.ui.R.id.busBlue);
|
||||
convertView.setOnClickListener(new OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString( "tripID" , result[position][0] );
|
||||
bundle.putString( "sourceID" ,_sourceStopId);
|
||||
bundle.putString( "destID" ,_destStopId);
|
||||
bundle.putBoolean( "showFullRoute" ,false);
|
||||
Intent intent = new Intent(m_context, Routes.class);
|
||||
intent.putExtras( bundle );
|
||||
me.startActivityForResult(intent,6);
|
||||
|
||||
}
|
||||
});
|
||||
holder.routeName = (TextView) convertView.findViewById(com.best.ui.R.id.routename);
|
||||
|
||||
convertView.setTag(holder);
|
||||
}
|
||||
else
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
|
||||
String _routeName = result[position][1];
|
||||
String _headerName = result[position][2];
|
||||
String _betweenStopsNum = result[position][3];
|
||||
int _distance = 0;
|
||||
try{ _distance = Integer.parseInt( result[position][4] ); }catch(Exception e){}
|
||||
holder.head.setText( result[position][2] );
|
||||
holder.routeName.setText( result[position][3] );
|
||||
// convertView.setBackgroundColor(Color.parseColor(colors[position % colors.length]));
|
||||
convertView.setOnClickListener(new OnClickListener() {
|
||||
|
||||
holder.routename.setText( _routeName );
|
||||
holder.head.setText( _headerName );
|
||||
if( _distance > 1000)
|
||||
{
|
||||
if( _distance == 0 )
|
||||
{
|
||||
holder.total_dist.setText( "NA");
|
||||
}
|
||||
else
|
||||
{
|
||||
String dist = Double.toString(Funcs.roundDouble((Double.parseDouble(_distance+"")/1000), 1));
|
||||
holder.total_dist.setText( dist +" km");
|
||||
}
|
||||
}
|
||||
else
|
||||
holder.total_dist.setText( _distance +" m");
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Best.log("CLICKED POSITION :"+ position);
|
||||
Best.log("PASSED TRIP ID :"+result[position][1]+" PASSED Long NAME :"+result[position][2]+"PASSED ROUTE NAME :"+result[position][3]);
|
||||
|
||||
me.setContentView( com.best.ui.R.layout.routes );
|
||||
contentChanged = true;
|
||||
nearByBusClick = true;
|
||||
_routeLongName = result[position][2];
|
||||
_routeName = result[position][3];
|
||||
_tripId = result[position][1];
|
||||
_freq = result[position][4];
|
||||
//NearTripRoute object = new NearTripRoute();
|
||||
NearTripRoute.init(m_context,result[position][1],result[position][3],result[position][2],result[position][4],true);
|
||||
|
||||
if( _betweenStopsNum == null )
|
||||
{
|
||||
holder.no_of_stops.setText( "NA" );
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Integer.parseInt(_betweenStopsNum) == 1)
|
||||
holder.no_of_stops.setText( _betweenStopsNum + " Bus stop" );
|
||||
else
|
||||
holder.no_of_stops.setText( _betweenStopsNum + " Bus stops" );
|
||||
}
|
||||
});
|
||||
return convertView;
|
||||
}
|
||||
return (null);
|
||||
}
|
||||
|
||||
public class ViewHolder {
|
||||
TextView routename;
|
||||
TextView head;
|
||||
TextView routeName;
|
||||
ImageView blue_bus;
|
||||
TextView total_dist;
|
||||
TextView no_of_stops;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,7 @@ import android.view.View.OnClickListener;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import com.best.data.GTStore;
|
||||
import com.best.data.GTStore_sqlite;
|
||||
import com.best.util.TransitionEffect;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
|
@ -44,8 +44,9 @@ public class ListLocation extends ListActivity
|
|||
public EfficientAdapter adapter;
|
||||
public static LayoutInflater mInflater;
|
||||
public int EditTextNo;
|
||||
public static String[] locations;
|
||||
public static String[] distance;
|
||||
public static String[] stopNames;
|
||||
public static String[] stopsRoad;
|
||||
public static String[] stopsArea;
|
||||
public static String[] stopID;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
|
@ -62,8 +63,9 @@ public class ListLocation extends ListActivity
|
|||
|
||||
Bundle b = getIntent().getExtras();
|
||||
stopID = b.getStringArray( "StopID" );
|
||||
locations = b.getStringArray( "Stops" );
|
||||
distance = b.getStringArray( "Distance" );
|
||||
stopNames = b.getStringArray( "Stops" );
|
||||
stopsRoad = b.getStringArray( "stopRoad" );
|
||||
stopsArea = b.getStringArray( "stopArea" );
|
||||
EditTextNo = b.getInt( "EditText" );
|
||||
|
||||
if( EditTextNo == Find.M_FROM_LIST_CAPTION )
|
||||
|
@ -74,9 +76,9 @@ public class ListLocation extends ListActivity
|
|||
setTitle(com.best.ui.R.string.nearByListTitle);
|
||||
|
||||
try{
|
||||
if(locations.length>0)
|
||||
if(stopNames.length>0)
|
||||
{
|
||||
adapter = new EfficientAdapter(m_context,locations);
|
||||
adapter = new EfficientAdapter(m_context,stopNames);
|
||||
me.setListAdapter(adapter);
|
||||
}
|
||||
}catch(Exception e){}
|
||||
|
@ -86,7 +88,7 @@ public class ListLocation extends ListActivity
|
|||
|
||||
private Context context;
|
||||
|
||||
public EfficientAdapter(Context context , String[] locations)
|
||||
public EfficientAdapter(Context context , String[] stopNames)
|
||||
{
|
||||
mInflater = LayoutInflater.from(context);
|
||||
this.context = context;
|
||||
|
@ -101,7 +103,8 @@ public class ListLocation extends ListActivity
|
|||
|
||||
holder = new ViewHolder();
|
||||
holder.stopName = (TextView) convertView.findViewById(com.best.ui.R.id.stopname);
|
||||
holder.stopDistance = (TextView) convertView.findViewById(com.best.ui.R.id.dist);
|
||||
holder.stopRoad = (TextView) convertView.findViewById(com.best.ui.R.id.stopRoad);
|
||||
holder.stopArea = (TextView) convertView.findViewById(com.best.ui.R.id.stopArea);
|
||||
holder.btnMap = (Button) convertView.findViewById(com.best.ui.R.id.map);
|
||||
|
||||
holder.btnMap.setOnClickListener(new OnClickListener() {
|
||||
|
@ -109,7 +112,10 @@ public class ListLocation extends ListActivity
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String[][] resultset = GTStore.getLatitudeLongitude( stopID[ position ] );
|
||||
String[][] resultset = null;
|
||||
resultset = GTStore_sqlite.getLatitudeLongitude( stopID[ position ] );
|
||||
if(resultset != null)
|
||||
{
|
||||
String latitude = resultset[0][1];
|
||||
String longitude = resultset[0][2];
|
||||
|
||||
|
@ -124,26 +130,31 @@ public class ListLocation extends ListActivity
|
|||
intent.putExtras( bundle );
|
||||
me.startActivityForResult( intent, 5 );
|
||||
}
|
||||
else
|
||||
System.out.println("CANNOT DISPLAY MAP");
|
||||
}
|
||||
});
|
||||
|
||||
convertView.setTag(holder);
|
||||
}
|
||||
else
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
String strDistance = "";
|
||||
Double d = new Double( distance[ position ] );
|
||||
if(d < 500)
|
||||
{
|
||||
strDistance = ( new BigDecimal( d.doubleValue() ).round(new MathContext( 2, RoundingMode.HALF_UP ) ).toString() )+" km";
|
||||
if( d < 1 )
|
||||
{
|
||||
d = d * 1000;
|
||||
strDistance = ( new BigDecimal( d.doubleValue() ).intValue() )+" m";
|
||||
}
|
||||
}
|
||||
// String strDistance = "";
|
||||
// Double d = new Double( distance[ position ] );
|
||||
// if(d < 500)
|
||||
// {
|
||||
// strDistance = ( new BigDecimal( d.doubleValue() ).round(new MathContext( 2, RoundingMode.HALF_UP ) ).toString() )+" km";
|
||||
// if( d < 1 )
|
||||
// {
|
||||
// d = d * 1000;
|
||||
// strDistance = ( new BigDecimal( d.doubleValue() ).intValue() )+" m";
|
||||
// }
|
||||
// }
|
||||
|
||||
holder.stopName.setText( locations[position] );
|
||||
holder.stopDistance.setText( strDistance );
|
||||
holder.stopName.setText( stopNames[position] );
|
||||
holder.stopRoad.setText( stopsRoad[position] );
|
||||
holder.stopArea.setText( stopsArea[position] );
|
||||
//holder.stopDistance.setText( strDistance );
|
||||
holder.btnMap.setText( "Map" );
|
||||
convertView.setOnClickListener( new OnClickListener() {
|
||||
|
||||
|
@ -151,17 +162,18 @@ public class ListLocation extends ListActivity
|
|||
public void onClick(View view)
|
||||
{
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString( "frmLoc" , locations[ position ] );
|
||||
bundle.putString( "frmLoc" , stopNames[ position ] );
|
||||
bundle.putInt( "position" , position );
|
||||
bundle.putInt( "EditText" , EditTextNo );
|
||||
bundle.putString( "stopId" , stopID[ position ] );
|
||||
|
||||
|
||||
Intent mIntent = new Intent();
|
||||
mIntent.putExtras( bundle );
|
||||
|
||||
int res = 0;
|
||||
res = ( ( EditTextNo == Find.M_FROM_LIST_CAPTION || EditTextNo == Find.M_FROM_NEAR_BY_LIST_CAPTION )?( 1 ):( 2 ) );
|
||||
|
||||
Best.log("RES VALUE :"+res);
|
||||
setResult( res, mIntent );
|
||||
finish();
|
||||
}
|
||||
|
@ -171,7 +183,8 @@ public class ListLocation extends ListActivity
|
|||
|
||||
public class ViewHolder {
|
||||
TextView stopName;
|
||||
TextView stopDistance;
|
||||
TextView stopRoad;
|
||||
TextView stopArea;
|
||||
Button btnMap;
|
||||
}
|
||||
|
||||
|
@ -182,12 +195,12 @@ public class ListLocation extends ListActivity
|
|||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return locations.length;
|
||||
return stopNames.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return locations[position];
|
||||
return stopNames[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,6 +43,7 @@ import android.graphics.Path;
|
|||
import org.osmdroid.util.BoundingBoxE6;
|
||||
import android.content.Intent;
|
||||
import android.content.Context;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
|
@ -53,6 +54,7 @@ public class Map extends Activity implements MapViewConstants {
|
|||
private MapController mapController;
|
||||
public static GeoPoint geoPoint1 = null;
|
||||
public static GeoPoint geoPoint2 = null;
|
||||
public static GeoPoint centerGPoint = null;
|
||||
public static GeoPoint averagePoint = null;
|
||||
|
||||
public static boolean m_srcIsNew = true;
|
||||
|
@ -71,6 +73,14 @@ public class Map extends Activity implements MapViewConstants {
|
|||
public int minLongitude= 0;
|
||||
public int maxLongitude = 0;
|
||||
|
||||
public int minimumLat = 99999999;
|
||||
public int maxxLat = 0;
|
||||
public int minimumLong= 99999999;
|
||||
public int maxxLong = 0;
|
||||
|
||||
public static int bbLatSpan = 0;
|
||||
public static int bbLonSpan = 0;
|
||||
|
||||
@Override
|
||||
public void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate( savedInstanceState );
|
||||
|
@ -104,6 +114,21 @@ public class Map extends Activity implements MapViewConstants {
|
|||
{
|
||||
stopsGeoX = (String[])bundle.getSerializable("StopsGeoX");
|
||||
stopsGeoY = (String[])bundle.getSerializable("StopsGeoY");
|
||||
centerGPoint = new GeoPoint( Double.parseDouble(stopsGeoX[stopsGeoX.length - 1]), Double.parseDouble(stopsGeoY[stopsGeoY.length - 1]) );
|
||||
//ArrayList<GeoPoint> geoPointsList = new ArrayList<GeoPoint>();
|
||||
for(int i = 0;i < stopsGeoX.length; i++)
|
||||
{
|
||||
GeoPoint geoPoint = new GeoPoint( Double.parseDouble(stopsGeoX[i]), Double.parseDouble(stopsGeoY[i]) );
|
||||
|
||||
int latitude = geoPoint.getLatitudeE6();
|
||||
int longitude = geoPoint.getLongitudeE6();
|
||||
minimumLat = ( latitude > minimumLat ) ? minimumLat : latitude;
|
||||
maxxLat = ( latitude < maxxLat ) ? maxxLat : latitude;
|
||||
|
||||
minimumLong = ( longitude > minimumLong ) ? minimumLong : longitude;
|
||||
maxxLong = ( longitude < maxxLong ) ? maxxLong : longitude;
|
||||
|
||||
}
|
||||
geoPoint1 = new GeoPoint( Double.parseDouble(stopsGeoX[0]), Double.parseDouble(stopsGeoY[0]) );
|
||||
geoPoint2 = new GeoPoint( Double.parseDouble(stopsGeoX[stopsGeoX.length - 1]), Double.parseDouble(stopsGeoY[stopsGeoY.length - 1]) );
|
||||
}
|
||||
|
@ -122,24 +147,15 @@ public class Map extends Activity implements MapViewConstants {
|
|||
minLongitude = ( geoPointLon1 > geoPointLon2 ) ? geoPointLon2 : geoPointLon1;
|
||||
maxLongitude = ( geoPointLon1 < geoPointLon2 ) ? geoPointLon2 : geoPointLon1;
|
||||
|
||||
System.out.println("==minLatitude="+minLatitude+"==maxLatitude="+maxLatitude+"==minLongitude="+minLongitude+"==maxLongitude="+maxLongitude);
|
||||
System.out.println("==minimumLat="+minimumLat+"==maxLatitude="+maxxLat+"==minLongitude="+minimumLong+"==maxLongitude="+maxxLong);
|
||||
|
||||
System.out.println("=== maxLatitude - minLatitude ="+ (maxLatitude - minLatitude)+"==maxLongitude - minLongitude ="+(maxLongitude - minLongitude ) );
|
||||
int avgLat = ( maxLatitude + minLatitude )/2;
|
||||
int avgLong = ( maxLongitude + minLongitude )/2 ;
|
||||
|
||||
averagePoint = GeoPoint.fromCenterBetween( geoPoint1, geoPoint2 );//= new GeoPoint( avgLat, avgLong );
|
||||
// if( mapView.getBoundingBox().getDiagonalLengthInMeters() == 0 )
|
||||
// {
|
||||
// int latSpan = maxLatitude - minLatitude;
|
||||
// int longSpan = maxLongitude - minLongitude;
|
||||
// Integer maxSpan = Math.max( latSpan, longSpan );
|
||||
// Double ln = Math.log( maxSpan.doubleValue() );
|
||||
// zoomLevel = 20-ln.intValue();
|
||||
// if ( zoomLevel < 5 )
|
||||
// zoomLevel += 2;
|
||||
// else if ( zoomLevel > 18 )
|
||||
// zoomLevel = 18;
|
||||
// }
|
||||
// else
|
||||
// mapController.zoomToSpan( ( maxLatitude - minLatitude ),( maxLongitude - minLongitude ) );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -168,6 +184,25 @@ public class Map extends Activity implements MapViewConstants {
|
|||
super.onResume();
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{//If back was pressed
|
||||
if (keyCode==KeyEvent.KEYCODE_BACK)
|
||||
{
|
||||
back();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
public void back()
|
||||
{
|
||||
finish();
|
||||
}
|
||||
// @Override
|
||||
// public void onBackPressed() {
|
||||
|
||||
// finish();
|
||||
// }
|
||||
|
||||
|
||||
class MapOverlay extends org.osmdroid.views.overlay.MyLocationOverlay
|
||||
{
|
||||
|
@ -234,12 +269,22 @@ public class Map extends Activity implements MapViewConstants {
|
|||
}
|
||||
public void setZoomAndCentre()
|
||||
{
|
||||
mapController.zoomToSpan( ( maxLatitude - minLatitude ),( maxLongitude - minLongitude )) ;
|
||||
mapController.zoomToSpan(( maxxLat - minimumLat ),( maxxLong - minimumLong )) ;
|
||||
//mapController.zoomToSpan(( maxLatitude - minLatitude ),( maxLongitude - minLongitude )) ;
|
||||
System.out.println("=== maxxLat - minimumLat ="+ (maxxLat - minimumLat)+"==maxxLong - minimumLong ="+(maxxLong - minimumLong ) );
|
||||
System.out.println("===mapView.getZoomLevel()==="+mapView.getZoomLevel());
|
||||
if(m_showSingle == false && bbLatSpan != 0 && bbLonSpan != 0)
|
||||
{
|
||||
//mapController.zoomToSpan(bbLatSpan , bbLonSpan) ;
|
||||
mapController.setCenter( centerGPoint );
|
||||
mapController.animateTo( centerGPoint );
|
||||
}
|
||||
else
|
||||
{
|
||||
mapController.setCenter( averagePoint );
|
||||
mapController.animateTo( averagePoint );
|
||||
// BoundingBoxE6 bbox = mapView.getBoundingBox();
|
||||
// System.out.println("==========Bounding box latitudeSpan = "+bbox.getLatitudeSpanE6() );
|
||||
// System.out.println("==========Bounding box diameter = "+bbox.getDiagonalLengthInMeters() );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,27 +40,32 @@ import android.view.MenuItem;
|
|||
import android.view.MenuInflater;
|
||||
import android.view.View.OnClickListener;
|
||||
|
||||
import com.best.data.GTStore;
|
||||
import com.best.data.GTStore_sqlite;
|
||||
import com.best.util.TransitionEffect;
|
||||
import com.best.util.Funcs;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
import android.graphics.Color;
|
||||
import android.text.Html;
|
||||
|
||||
public class Routes extends ListActivity {
|
||||
public static ListActivity me;
|
||||
public class Routes extends Activity {
|
||||
public static Activity me;
|
||||
public static Context m_context;
|
||||
public static LayoutInflater mInflater;
|
||||
|
||||
public static String sourceId="";
|
||||
public static String destId="";
|
||||
public static String _tripID;
|
||||
public static String _routeLongName;
|
||||
public static String _routeName;
|
||||
public static String _freq;
|
||||
public static String _startStopID = "";
|
||||
public static String _endStopID = "";
|
||||
public static String[] stopGeoPoints;
|
||||
public static String[][]routeResult = null;
|
||||
public static String[] colors = {"#ffffff" , "#efefef"};
|
||||
|
||||
ArrayList<String> listStopsGeoX = new ArrayList<String>();
|
||||
ArrayList<String> listStopsGeoY = new ArrayList<String>();
|
||||
|
@ -81,10 +86,25 @@ public class Routes extends ListActivity {
|
|||
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
_tripID = bundle.getString( "tripID" );
|
||||
_routeLongName = bundle.getString("routeLongName");
|
||||
_routeName = bundle.getString("routeName");
|
||||
_freq = bundle.getString("freq");
|
||||
sourceId = bundle.getString("sourceID");
|
||||
destId = bundle.getString("destID");
|
||||
showFullRoute = bundle.getBoolean("showFullRoute");
|
||||
|
||||
(( TextView ) me.findViewById( com.best.ui.R.id._routename )).setText(_routeName);
|
||||
(( TextView ) me.findViewById( com.best.ui.R.id._routelongname )).setText(_routeLongName);
|
||||
|
||||
int freq = Integer.parseInt(_freq);
|
||||
int hr = freq / 60;
|
||||
|
||||
(( TextView ) me.findViewById( com.best.ui.R.id._freq )).setText(Funcs.secondsToMinHr(freq));
|
||||
// if(hr > 0)
|
||||
// (( TextView ) me.findViewById( com.best.ui.R.id._freq )).setText(hr +"hr "+freq % 60 + " min");
|
||||
// else
|
||||
// (( TextView ) me.findViewById( com.best.ui.R.id._freq )).setText(freq + " min");
|
||||
//(( TextView ) me.findViewById( com.best.ui.R.id._freq )).setText(_freq + " min");
|
||||
init( _tripID );
|
||||
}
|
||||
@Override
|
||||
|
@ -107,6 +127,7 @@ public class Routes extends ListActivity {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle item selection
|
||||
|
@ -126,6 +147,9 @@ public class Routes extends ListActivity {
|
|||
Intent intent1 = new Intent(m_context, Routes.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString( "tripID",_tripID );
|
||||
bundle.putString("routeLongName",_routeLongName);
|
||||
bundle.putString("routeName", _routeName);
|
||||
bundle.putString("freq", _freq);
|
||||
bundle.putString("sourceID", sourceId);
|
||||
bundle.putString("destID", destId);
|
||||
bundle.putBoolean("showFullRoute", true);
|
||||
|
@ -139,8 +163,31 @@ public class Routes extends ListActivity {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event)
|
||||
{//If back was pressed
|
||||
if (keyCode==KeyEvent.KEYCODE_BACK)
|
||||
{
|
||||
back();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
public void back()
|
||||
{
|
||||
finish();
|
||||
}
|
||||
// @Override
|
||||
// public void onBackPressed() {
|
||||
|
||||
// finish();
|
||||
// me.setContentView( com.best.ui.R.layout.routing );
|
||||
// contentChanged = true;
|
||||
// Routing.init(m_context);
|
||||
// return;
|
||||
//}
|
||||
public void init(String tripID)
|
||||
{
|
||||
Find.directRouteDisplayed = true;
|
||||
|
||||
if(showFullRoute == false)
|
||||
{
|
||||
|
@ -156,7 +203,8 @@ public class Routes extends ListActivity {
|
|||
listStopsGeoY.add( routeResult[index][4] );
|
||||
}
|
||||
EfficientAdapter adapter = new EfficientAdapter( m_context,routeResult);
|
||||
me.setListAdapter( adapter );
|
||||
//me.setListAdapter( adapter );
|
||||
( ( ListView ) me.findViewById( com.best.ui.R.id.routeslist ) ).setAdapter( adapter );
|
||||
}
|
||||
else
|
||||
Best.showMessage( m_context, "Sorry something went wrong.", "Processing" );
|
||||
|
@ -198,7 +246,8 @@ public class Routes extends ListActivity {
|
|||
if(listspecificRoute.toArray( new String[ listspecificRoute.size() ][] ) == null)
|
||||
Best.showMessage( m_context, "Sorry something went wrong.", "Processing" );
|
||||
EfficientAdapter adapter = new EfficientAdapter( m_context,listspecificRoute.toArray( new String[ listspecificRoute.size() ][] ) );
|
||||
me.setListAdapter( adapter );
|
||||
( ( ListView ) me.findViewById( com.best.ui.R.id.routeslist ) ).setAdapter( adapter );
|
||||
//me.setListAdapter( adapter );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -217,7 +266,7 @@ public class Routes extends ListActivity {
|
|||
{
|
||||
//code to get all routes
|
||||
Bundle dataBundle = new Bundle();
|
||||
dataBundle.putSerializable( "rts", GTStore.getTripInfo(_tripID));
|
||||
dataBundle.putSerializable( "rts", GTStore_sqlite.getTripInfo(_tripID));
|
||||
Message msg = _handler.obtainMessage();
|
||||
msg.setData( dataBundle );
|
||||
_handler.sendMessage( msg );
|
||||
|
@ -245,42 +294,57 @@ public class Routes extends ListActivity {
|
|||
ViewHolder holder;
|
||||
if (convertView == null)
|
||||
{
|
||||
convertView = mInflater.inflate(com.best.ui.R.layout.listthreetext, null);
|
||||
convertView = mInflater.inflate(com.best.ui.R.layout.list_double_line, null);
|
||||
|
||||
holder = new ViewHolder();
|
||||
holder.stop_name = (TextView) convertView.findViewById(com.best.ui.R.id.stopname);
|
||||
holder.dep_time = (TextView) convertView.findViewById(com.best.ui.R.id.dep);
|
||||
holder.stop_area = (TextView) convertView.findViewById(com.best.ui.R.id.stoparea);
|
||||
convertView.setTag(holder);
|
||||
}
|
||||
else
|
||||
holder = (ViewHolder) convertView.getTag();
|
||||
|
||||
holder.stop_area.setText(result[position][5]);
|
||||
if(position==0 && showFullRoute == true)
|
||||
{
|
||||
holder.stop_name.setText(Html.fromHtml("<font color = 'black'>"+"Bus starts at: "+"</font>"+"<font color = 'DarkSlateBlue'>"+result[position][0]+"</font>"));
|
||||
//holder.stop_name.setText(Html.fromHtml("<font color = 'black'>"+"Bus starts at: "+"</font>"+"<font color = 'DarkSlateBlue'>"+result[position][0]+"</font>"));
|
||||
holder.stop_name.setText(result[position][0]);
|
||||
holder.dep_time.setText(Html.fromHtml("<font color = 'Green'>"+"Starting point"+"</font>"));
|
||||
_startStopID = result[position][1];
|
||||
}
|
||||
else if(position==(resultSetLength - 1) && showFullRoute == true )
|
||||
{
|
||||
holder.stop_name.setText(Html.fromHtml("<font color = 'black'>"+"Bus stops at: "+"</font>"+"<font color = 'DarkSlateBlue'>"+result[position][0]+"</font>"));
|
||||
//holder.stop_name.setText(Html.fromHtml("<font color = 'black'>"+"Bus stops at: "+"</font>"+"<font color = 'DarkSlateBlue'>"+result[position][0]+"</font>"));
|
||||
holder.stop_name.setText(result[position][0]);
|
||||
holder.dep_time.setText(Html.fromHtml("<font color = 'Blue'>"+"End Station"+"</font>"));
|
||||
_endStopID = result[position][1];
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.stop_name.setText(result[position][0]);
|
||||
holder.dep_time.setText("");
|
||||
}
|
||||
|
||||
//String[] depParts = result[position][2].split('+');
|
||||
//holder.dep_time.setText(result[position][2]);
|
||||
stopGeoPoints[position] = result[position][3];
|
||||
if((result[position][1]).equals(sourceId) || (result[position][1]).equals(destId))
|
||||
convertView.setBackgroundColor(Color.parseColor("#d4b6d4")); //0xffcccccc
|
||||
else if(position == 0 )
|
||||
convertView.setBackgroundColor(Color.parseColor("#e6ffe6"));
|
||||
else if(position == (resultSetLength - 1) )
|
||||
convertView.setBackgroundColor(Color.parseColor("#e1e1ff"));
|
||||
else
|
||||
convertView.setBackgroundColor(0xffffffff);
|
||||
convertView.setBackgroundColor(Color.parseColor(colors[position % colors.length]));
|
||||
//convertView.setBackgroundColor(0xffffffff);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public class ViewHolder {
|
||||
TextView stop_name;
|
||||
TextView dep_time;
|
||||
TextView stop_area;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user