diff --git a/OsmAnd/res/layout/dash_map_fragment.xml b/OsmAnd/res/layout/dash_map_fragment.xml index 9aa6348abd..a8d0e524de 100644 --- a/OsmAnd/res/layout/dash_map_fragment.xml +++ b/OsmAnd/res/layout/dash_map_fragment.xml @@ -9,7 +9,6 @@ diff --git a/OsmAnd/res/layout/default_list_view.xml b/OsmAnd/res/layout/default_list_view.xml index b0413d20ec..352f8aa797 100644 --- a/OsmAnd/res/layout/default_list_view.xml +++ b/OsmAnd/res/layout/default_list_view.xml @@ -2,8 +2,7 @@ + android:layout_height="match_parent"> + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="fill_parent" + android:layout_height="match_parent" + android:orientation="vertical"> - + - + - + - + - + - - + + - + - + - - - + + + - + - + android:text="@string/search_button"/> + style="@style/OsmandListView"/> \ No newline at end of file diff --git a/OsmAnd/res/layout/search_address_online_list_item.xml b/OsmAnd/res/layout/search_address_online_list_item.xml index 26eb651487..03f470464f 100644 --- a/OsmAnd/res/layout/search_address_online_list_item.xml +++ b/OsmAnd/res/layout/search_address_online_list_item.xml @@ -2,6 +2,8 @@ 12sp diff --git a/OsmAnd/res/values/styles.xml b/OsmAnd/res/values/styles.xml index 3cc03f321f..24808bf1fc 100644 --- a/OsmAnd/res/values/styles.xml +++ b/OsmAnd/res/values/styles.xml @@ -107,12 +107,18 @@ @style/Widget.Styled.ActionBarDark @drawable/check_dark + + + + + diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 169f323c1b..0055b30849 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -21,6 +21,7 @@ import net.osmand.access.AccessibleAlertBuilder; import net.osmand.access.AccessibleToast; import net.osmand.plus.access.AccessibilityMode; import net.osmand.plus.activities.DayNightHelper; +import net.osmand.plus.activities.MainMenuActivity; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.SettingsActivity; @@ -795,10 +796,11 @@ public class OsmandApplication extends Application { public void applyTheme(Context c) { int t = R.style.OsmandLightDarkActionBarTheme; + boolean mainmenu = c instanceof MainMenuActivity; if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_DARK_THEME) { - t = R.style.OsmandDarkTheme; + t = mainmenu ? R.style.DashboardDarkTheme : R.style.OsmandDarkTheme; } else if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME) { - t = R.style.OsmandLightTheme; + t = mainmenu ? R.style.DashboardLightTheme : R.style.OsmandLightTheme; } else if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_DARK_ACTIONBAR_THEME) { t = R.style.OsmandLightDarkActionBarTheme; } diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java index 4eb9c45da0..5e42bc9679 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesActivity.java @@ -46,11 +46,8 @@ public class FavoritesActivity extends TabActivity { @Override public void onCreate(Bundle icicle) { - //This has to be called before setContentView and you must use the - //class in com.actionbarsherlock.view and NOT android.view ((OsmandApplication) getApplication()).applyTheme(this); super.onCreate(icicle); - setSupportProgressBarIndeterminateVisibility(false); getSupportActionBar().setTitle(R.string.favorites_Button); getSupportActionBar().setElevation(0); @@ -165,121 +162,5 @@ public class FavoritesActivity extends TabActivity { } return false; } - - /** - * This is a helper class that implements the management of tabs and all - * details of connecting a ViewPager with associated TabHost. It relies on a - * trick. Normally a tab host has a simple API for supplying a View or - * Intent that each tab will show. This is not sufficient for switching - * between pages. So instead we make the content part of the tab host - * 0dp high (it is not shown) and the TabsAdapter supplies its own dummy - * view to show as the tab content. It listens to changes in tabs, and takes - * care of switch to the correct paged in the ViewPager whenever the selected - * tab changes. - */ - public static class TabsAdapter extends FragmentPagerAdapter - implements TabHost.OnTabChangeListener, ViewPager.OnPageChangeListener { - private final Context mContext; - private final TabHost mTabHost; - private final ViewPager mViewPager; - private final ArrayList mTabs = new ArrayList(); - private OsmandSettings osmSettings; - private boolean favorites; - - static final class TabInfo { - private final String tag; - private Class clss; - private Bundle args; - - TabInfo(String _tag, Class _class, Bundle _args) { - tag = _tag; - clss = _class; - args = _args; - } - } - - static class DummyTabFactory implements TabHost.TabContentFactory { - private final Context mContext; - - public DummyTabFactory(Context context) { - mContext = context; - } - - @Override - public View createTabContent(String tag) { - View v = new View(mContext); - v.setMinimumWidth(0); - v.setMinimumHeight(0); - return v; - } - } - - public TabsAdapter(FragmentActivity activity, TabHost tabHost,ViewPager pager, OsmandSettings settings, boolean favorites) { - super(activity.getSupportFragmentManager()); - this.favorites = favorites; - mContext = activity; - mTabHost = tabHost; - mViewPager = pager; - osmSettings = settings; - mTabHost.setOnTabChangedListener(this); - mViewPager.setAdapter(this); - mViewPager.setOnPageChangeListener(this); - } - - public TabSpec addTab(TabHost.TabSpec tabSpec, Class clss, Bundle args) { - tabSpec.setContent(new DummyTabFactory(mContext)); - String tag = tabSpec.getTag(); - - TabInfo info = new TabInfo(tag, clss, args); - mTabs.add(info); - mTabHost.addTab(tabSpec); - notifyDataSetChanged(); - return tabSpec; - } - - - @Override - public int getCount() { - return mTabs.size(); - } - - @Override - public Fragment getItem(int position) { - TabInfo info = mTabs.get(position); - return Fragment.instantiate(mContext, info.clss.getName(), info.args); - } - - @Override - public void onTabChanged(String tabId) { - int position = mTabHost.getCurrentTab(); - if (favorites){ - osmSettings.FAVORITES_TAB.set(position); - } - mViewPager.setCurrentItem(position); - } - - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - } - - @Override - public void onPageSelected(int position) { - // Unfortunately when TabHost changes the current tab, it kindly - // also takes care of putting focus on it when not in touch mode. - // The jerk. - // This hack tries to prevent this from pulling focus out of our - // ViewPager. - TabWidget widget = mTabHost.getTabWidget(); - int oldFocusability = widget.getDescendantFocusability(); - widget.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); - mTabHost.setCurrentTab(position); - widget.setDescendantFocusability(oldFocusability); - } - - @Override - public void onPageScrollStateChanged(int state) { - } - } - } diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesListActivity.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesListActivity.java index 44d71af761..9c43feba44 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesListActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesListActivity.java @@ -2,6 +2,8 @@ package net.osmand.plus.activities; import android.view.MenuItem; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; + import android.os.Bundle; @@ -11,6 +13,7 @@ public class FavoritesListActivity extends OsmandActionBarActivity { protected void onCreate(Bundle savedInstanceState) { ((OsmandApplication) getApplication()).applyTheme(this); super.onCreate(savedInstanceState); + setContentView(R.layout.single_fragment_layout); if (savedInstanceState == null) { // During initial setup, plug in the details fragment. FavoritesListFragment details = new FavoritesListFragment(); diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index b4f5ec604d..90f7b1d097 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -81,7 +81,6 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { private Set groupsToDelete = new LinkedHashSet(); private ActionMode actionMode; private SearchView searchView; - protected boolean hideActionBar; @Override public void onAttach(Activity activity) { @@ -563,7 +562,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment { @Override protected void onPreExecute() { showProgressBar(); - }; + } @Override protected void onPostExecute(String warning) { diff --git a/OsmAnd/src/net/osmand/plus/activities/HelpActivity.java b/OsmAnd/src/net/osmand/plus/activities/HelpActivity.java index d3a63d70eb..8b3db418a2 100644 --- a/OsmAnd/src/net/osmand/plus/activities/HelpActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/HelpActivity.java @@ -102,7 +102,7 @@ public class HelpActivity extends OsmandActionBarActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { createMenuItem(menu, HOME, R.string.home, - R.drawable.ic_action_home_light, R.drawable.ic_action_home_dark, + R.drawable.ic_action_home_dark, R.drawable.ic_action_home_dark, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM ); createMenuItem(menu, BACK, R.string.previous_button, 0, 0, //R.drawable.ic_action_home_light, R.drawable.ic_action_home_dark, @@ -111,7 +111,7 @@ public class HelpActivity extends OsmandActionBarActivity { 0, 0, //R.drawable.ic_action_home_light, R.drawable.ic_action_home_dark, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM ); createMenuItem(menu, CLOSE, R.string.close, - R.drawable.ic_action_ok_light, R.drawable.ic_action_ok_dark, + R.drawable.ic_action_ok_dark, R.drawable.ic_action_ok_dark, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM ); return super.onCreateOptionsMenu(menu); } diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java index 2457cdde45..c02c80989c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityLayers.java @@ -328,6 +328,7 @@ public class MapActivityLayers { } }); + builder.setNegativeButton(R.string.default_buttons_cancel, null); return builder.show(); } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressActivity.java index 7bae5238ab..70735bec7a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressActivity.java @@ -5,6 +5,8 @@ import android.view.MenuItem; import net.osmand.plus.OsmandApplication; import android.content.pm.ActivityInfo; import android.os.Bundle; + +import net.osmand.plus.R; import net.osmand.plus.activities.OsmandActionBarActivity; @@ -13,10 +15,8 @@ public class SearchAddressActivity extends OsmandActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { ((OsmandApplication) getApplication()).applyTheme(this); - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) { - getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); - } super.onCreate(savedInstanceState); + setContentView(R.layout.single_fragment_layout); if (savedInstanceState == null) { // During initial setup, plug in the details fragment. SearchAddressFragment details = new SearchAddressFragment(); diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java index 0b49b7c17a..9f2906ad02 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressFragment.java @@ -97,7 +97,7 @@ public class SearchAddressFragment extends Fragment { if(getActivity() instanceof SearchAddressActivity) { MenuItem menuItem = menu.add(0, SELECT_POINT, 0, ""); MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); - menuItem = menuItem.setIcon(light ? R.drawable.ic_action_ok_light : R.drawable.ic_action_ok_dark); + menuItem = menuItem.setIcon(light ? R.drawable.ic_action_ok_dark : R.drawable.ic_action_ok_dark); menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java index e02e75a79c..c57df1768e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java @@ -22,9 +22,12 @@ import android.support.v4.app.FragmentActivity; import android.text.Spannable; import android.text.style.ForegroundColorSpan; import android.view.View.OnClickListener; +import android.widget.AbsListView; +import android.widget.ActionMenuView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ImageButton; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; import android.widget.TextView.BufferType; @@ -39,10 +42,21 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit private HistoryAdapter historyAdapter; @Override - public void onViewCreated(View view, Bundle savedInstanceState) { - super.onViewCreated(view, savedInstanceState); - + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.search_history, container, false); + clearButton = (Button) view.findViewById(R.id.clearAll); + clearButton.setText(R.string.clear_all); + clearButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + helper.removeAll(); + historyAdapter.clear(); + clearButton.setVisibility(View.GONE); + } + }); + return view; } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -53,17 +67,6 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); historyAdapter = new HistoryAdapter(helper.getHistoryEntries()); - clearButton = new Button(getActivity()); - clearButton.setText(R.string.clear_all); - clearButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - helper.removeAll(); - historyAdapter.clear(); - clearButton.setVisibility(View.GONE); - } - }); - getListView().addFooterView(clearButton); setListAdapter(historyAdapter); setHasOptionsMenu(true); } diff --git a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java index e1475625d8..ca91efaaf0 100644 --- a/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java +++ b/OsmAnd/src/net/osmand/plus/download/LocalIndexesFragment.java @@ -49,6 +49,7 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.ExpandableListView; import android.widget.ExpandableListView.ExpandableListContextMenuInfo; +import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; @@ -1003,6 +1004,7 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment { v.findViewById(R.id.explist_indicator).setVisibility(View.GONE); TextView nameView = ((TextView) v.findViewById(R.id.category_name)); + nameView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); List list = data.get(group); int size = 0; for (LocalIndexInfo aList : list) { diff --git a/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java b/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java index 6fd1a6c8f0..8994c77ef9 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/PagerSlidingTabStrip.java @@ -192,7 +192,9 @@ public class PagerSlidingTabStrip extends HorizontalScrollView { tabTypefaceSelectedStyle = a.getInt(R.styleable.PagerSlidingTabStrip_pstsTextSelectedStyle, Typeface.BOLD); tabTextAlpha = a.getFloat(R.styleable.PagerSlidingTabStrip_pstsTextAlpha, HALF_TRANSP); tabTextSelectedAlpha = a.getFloat(R.styleable.PagerSlidingTabStrip_pstsTextSelectedAlpha, OPAQUE); - tabTypeface = FontCache.getRobotoMedium(context); + if (!isInEditMode()) { + tabTypeface = FontCache.getRobotoMedium(context); + } a.recycle(); setMarginBottomTabContainer();