Added search buttons functionality
This commit is contained in:
parent
f61a7f44ef
commit
7904c139f6
3 changed files with 68 additions and 12 deletions
|
@ -2,10 +2,10 @@
|
||||||
<ScrollView android:layout_width="fill_parent"
|
<ScrollView android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:background="@color/dashboard_background"
|
android:background="@color/dashboard_background"
|
||||||
android:padding="6dp"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<LinearLayout android:orientation="vertical"
|
<LinearLayout android:orientation="vertical"
|
||||||
|
android:padding="6dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@
|
||||||
<Button android:id="@+id/poi"
|
<Button android:id="@+id/poi"
|
||||||
android:text="@string/poi"
|
android:text="@string/poi"
|
||||||
android:drawableTop="@drawable/ic_action_info_light"
|
android:drawableTop="@drawable/ic_action_info_light"
|
||||||
android:layout_marginRight="1dp"
|
|
||||||
style="@style/DashboardSearchButton"/>
|
style="@style/DashboardSearchButton"/>
|
||||||
<Button android:id="@+id/address"
|
<Button android:id="@+id/address"
|
||||||
android:text="@string/address"
|
android:text="@string/address"
|
||||||
|
@ -38,7 +37,6 @@
|
||||||
style="@style/DashboardSearchButton"/>
|
style="@style/DashboardSearchButton"/>
|
||||||
<Button android:id="@+id/coord"
|
<Button android:id="@+id/coord"
|
||||||
android:text="@string/coordinates"
|
android:text="@string/coordinates"
|
||||||
android:layout_marginLeft="1dp"
|
|
||||||
android:drawableTop="@drawable/ic_action_marker_light"
|
android:drawableTop="@drawable/ic_action_marker_light"
|
||||||
style="@style/DashboardSearchButton"/>
|
style="@style/DashboardSearchButton"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -46,10 +44,9 @@
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:background="@color/dashboard_divider"
|
android:background="@color/dashboard_divider"
|
||||||
android:layout_height="90dp">
|
android:layout_height="90dp">
|
||||||
<Button android:id="@+id/fav"
|
<Button android:id="@+id/fav_btn"
|
||||||
android:text="@string/my_favorites"
|
android:text="@string/my_favorites"
|
||||||
android:drawableTop="@drawable/ic_action_fav_light"
|
android:drawableTop="@drawable/ic_action_fav_light"
|
||||||
android:layout_marginRight="1dp"
|
|
||||||
style="@style/DashboardSearchButton"/>
|
style="@style/DashboardSearchButton"/>
|
||||||
<Button android:id="@+id/history"
|
<Button android:id="@+id/history"
|
||||||
android:text="@string/history"
|
android:text="@string/history"
|
||||||
|
@ -60,7 +57,6 @@
|
||||||
<Button android:id="@+id/transport"
|
<Button android:id="@+id/transport"
|
||||||
android:text="@string/rendering_category_transport"
|
android:text="@string/rendering_category_transport"
|
||||||
android:drawableTop="@drawable/ic_action_bus_light"
|
android:drawableTop="@drawable/ic_action_bus_light"
|
||||||
android:layout_marginLeft="1dp"
|
|
||||||
style="@style/DashboardSearchButton"/>
|
style="@style/DashboardSearchButton"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.actionbarsherlock.view.Menu;
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.*;
|
import net.osmand.plus.*;
|
||||||
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
import net.osmand.plus.render.MapVectorLayer;
|
import net.osmand.plus.render.MapVectorLayer;
|
||||||
import net.osmand.plus.views.MapTextLayer;
|
import net.osmand.plus.views.MapTextLayer;
|
||||||
|
@ -104,8 +105,7 @@ public class DashboardActivity extends SherlockFragmentActivity {
|
||||||
final Activity activity = this;
|
final Activity activity = this;
|
||||||
final OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
final OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||||
|
|
||||||
Button showMap = (Button) findViewById(R.id.show_map);
|
(findViewById(R.id.show_map)).setOnClickListener(new View.OnClickListener() {
|
||||||
showMap.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
final Intent mapIndent = new Intent(activity, appCustomization.getMapActivity());
|
final Intent mapIndent = new Intent(activity, appCustomization.getMapActivity());
|
||||||
|
@ -113,8 +113,7 @@ public class DashboardActivity extends SherlockFragmentActivity {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button showFavorites = (Button) findViewById(R.id.show_all);
|
(findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||||
showFavorites.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
|
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
|
||||||
|
@ -122,6 +121,66 @@ public class DashboardActivity extends SherlockFragmentActivity {
|
||||||
activity.startActivity(favorites);
|
activity.startActivity(favorites);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
(findViewById(R.id.poi)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.POI_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(findViewById(R.id.address)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.ADDRESS_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(findViewById(R.id.coord)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.LOCATION_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(findViewById(R.id.fav_btn)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.FAVORITES_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(findViewById(R.id.history)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.HISTORY_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
(findViewById(R.id.transport)).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
final Intent search = new Intent(activity, appCustomization.getSearchActivity());
|
||||||
|
search.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||||
|
getMyApplication().getSettings().SEARCH_TAB.set(SearchActivity.TRANSPORT_TAB_INDEX);
|
||||||
|
activity.startActivity(search);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupMapView() {
|
private void setupMapView() {
|
||||||
|
|
|
@ -53,8 +53,9 @@ public class SearchActivity extends SherlockFragmentActivity implements OsmAndLo
|
||||||
public static final int POI_TAB_INDEX = 0;
|
public static final int POI_TAB_INDEX = 0;
|
||||||
public static final int ADDRESS_TAB_INDEX = 1;
|
public static final int ADDRESS_TAB_INDEX = 1;
|
||||||
public static final int LOCATION_TAB_INDEX = 2;
|
public static final int LOCATION_TAB_INDEX = 2;
|
||||||
public static final int HISTORY_TAB_INDEX = 3;
|
public static final int FAVORITES_TAB_INDEX = 3;
|
||||||
public static final int TRANSPORT_TAB_INDEX = 4;
|
public static final int HISTORY_TAB_INDEX = 4;
|
||||||
|
public static final int TRANSPORT_TAB_INDEX = 5;
|
||||||
|
|
||||||
protected static final int POSITION_CURRENT_LOCATION = 1;
|
protected static final int POSITION_CURRENT_LOCATION = 1;
|
||||||
protected static final int POSITION_LAST_MAP_VIEW = 2;
|
protected static final int POSITION_LAST_MAP_VIEW = 2;
|
||||||
|
|
Loading…
Reference in a new issue