Custom title bar applied to more activities, some color changes.
There is still lot to do.
This commit is contained in:
parent
d813bb716e
commit
f472640b0c
13 changed files with 122 additions and 64 deletions
|
@ -4,7 +4,7 @@
|
|||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/MainLayout">
|
||||
|
||||
<TextView android:id="@+id/Label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/select_index_file_to_download"></TextView>
|
||||
<!--TextView android:id="@+id/Label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/select_index_file_to_download"></TextView-->
|
||||
|
||||
<EditText android:id="@+id/search_box"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView android:id="@+id/download_index_category_name" android:gravity="center_vertical" android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:textSize="21sp" android:layout_marginTop="5dp" android:layout_marginLeft="40dp"></TextView>
|
||||
android:textSize="21sp" android:layout_marginTop="5dp" android:layout_marginLeft="40dp" android:autoLink="web"></TextView>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -5,43 +5,6 @@
|
|||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/RelativeLayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/favourites_back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_gravity="top"
|
||||
android:background="@drawable/tab_back_button"
|
||||
android:text="" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="27dp"
|
||||
android:src="@drawable/tab_favorites_screen_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TextView1"
|
||||
style="@style/WhiteTitleText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="29dp"
|
||||
android:layout_toRightOf="@+id/favourites_back_button"
|
||||
android:text="@string/favourites_activity" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/LoadingPanel"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
37
OsmAnd/res/layout/titlebar.xml
Normal file
37
OsmAnd/res/layout/titlebar.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/RelativeLayout1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/back_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_gravity="top"
|
||||
android:background="@drawable/tab_back_button"
|
||||
android:text="" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/title_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="27dp"
|
||||
android:src="@drawable/tab_favorites_screen_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_text"
|
||||
style="@style/WhiteTitleText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="29dp"
|
||||
android:layout_toRightOf="@+id/back_button"
|
||||
android:text="@string/favourites_activity" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -10,4 +10,5 @@
|
|||
<color name="color_transparent">#00000000</color>
|
||||
<color name="color_white">#FFFFFF</color>
|
||||
<color name="color_red">#FF0000</color>
|
||||
<color name="color_orange">#FD9822</color>
|
||||
</resources>
|
|
@ -63,6 +63,15 @@
|
|||
<item name="android:windowBackground">@color/activity_background</item>
|
||||
<item name="android:textColor">@color/activity_text</item>
|
||||
</style>
|
||||
<style name="CustomWindowTitleBackground">
|
||||
<item name="android:background">@color/activity_background</item>
|
||||
</style>
|
||||
<style name="CustomTitleTheme" parent="OsmandTheme">
|
||||
<item name="android:windowTitleSize">46dp</item>
|
||||
<item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
|
||||
<item name="android:preferenceScreenStyle">@style/OsmandTheme</item>
|
||||
<!-- item name="android:preferenceCategoryStyle">@style/OsmandTheme</item-->
|
||||
</style>
|
||||
<style name="OsmandListView">
|
||||
<item name="android:cacheColorHint">@color/activity_background</item>
|
||||
<item name="android:divider">@drawable/tab_text_separator</item>
|
||||
|
|
|
@ -31,7 +31,6 @@ import android.os.Environment;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ListView;
|
||||
|
@ -50,7 +49,7 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
|||
|
||||
private ProgressDialog progressDlg;
|
||||
private Date currentInstalledDate;
|
||||
|
||||
|
||||
private List<OsmAndBuild> downloadedBuilds = new ArrayList<OsmAndBuild>();
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||
private File pathToDownload = new File(Environment.getExternalStorageDirectory(), ResourceManager.APP_DIR + "osmandToInstall.apk");
|
||||
|
@ -60,8 +59,9 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
CustomTitleBar titleBar = new CustomTitleBar(this, R.string.download_files, R.drawable.tab_favorites_screen_icon);
|
||||
setContentView(R.layout.download_builds);
|
||||
titleBar.afterSetContentView();
|
||||
|
||||
String installDate = OsmandSettings.getOsmandSettings(this).CONTRIBUTION_INSTALL_APP_DATE.get();
|
||||
if(installDate != null){
|
||||
|
@ -255,9 +255,9 @@ public class ContributionVersionActivity extends OsmandListActivity {
|
|||
|
||||
if(currentInstalledDate != null){
|
||||
if(currentInstalledDate.before(build.date)){
|
||||
tagView.setTextColor(Color.GREEN);
|
||||
tagView.setTextColor(getResources().getColor(R.color.color_orange));
|
||||
} else {
|
||||
tagView.setTextColor(Color.BLUE);
|
||||
tagView.setTextColor(Color.WHITE);
|
||||
}
|
||||
} else {
|
||||
tagView.setTextColor(Color.WHITE);
|
||||
|
|
42
OsmAnd/src/net/osmand/plus/activities/CustomTitleBar.java
Normal file
42
OsmAnd/src/net/osmand/plus/activities/CustomTitleBar.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import android.app.Activity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class CustomTitleBar {
|
||||
|
||||
private Activity activity;
|
||||
private int titleStringRes;
|
||||
private int titleImageRes;
|
||||
|
||||
public CustomTitleBar(final Activity activity, int titleStringRes, int titleImageRes) {
|
||||
this.activity = activity;
|
||||
this.titleStringRes = titleStringRes;
|
||||
this.titleImageRes = titleImageRes;
|
||||
|
||||
this.activity.setTheme(R.style.CustomTitleTheme);
|
||||
this.activity.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
|
||||
}
|
||||
|
||||
public void afterSetContentView() {
|
||||
activity.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);
|
||||
|
||||
Button backButton = (Button) activity.findViewById(R.id.back_button);
|
||||
backButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
activity.finish();
|
||||
}
|
||||
});
|
||||
TextView title = (TextView) activity.findViewById(R.id.title_text);
|
||||
title.setText(titleStringRes);
|
||||
ImageView titleImg = (ImageView) activity.findViewById(R.id.title_image);
|
||||
titleImg.setImageResource(titleImageRes);
|
||||
}
|
||||
|
||||
}
|
|
@ -122,7 +122,6 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -130,7 +129,9 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
|||
downloadListIndexThread = new DownloadIndexListThread(Version.getVersionAsURLParam(this));
|
||||
}
|
||||
// recreation upon rotation is prevented in manifest file
|
||||
CustomTitleBar titleBar = new CustomTitleBar(this, R.string.local_index_download, R.drawable.tab_settings_screen_icon);
|
||||
setContentView(R.layout.download_index);
|
||||
titleBar.afterSetContentView();
|
||||
tracker = GoogleAnalyticsTracker.getInstance();
|
||||
// Start the tracker in manual dispatch mode...
|
||||
tracker.startNewSession(getString(R.string.ga_api_key), 60, this);
|
||||
|
@ -907,7 +908,12 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
|||
@Override
|
||||
protected void publishResults(CharSequence constraint, FilterResults results) {
|
||||
list.clear();
|
||||
list.addAll(categorizeIndexItems((Collection<IndexItem>) results.values));
|
||||
Collection<IndexItem> items = (Collection<IndexItem>) results.values;
|
||||
if (items != null && !items.isEmpty()) {
|
||||
list.addAll(categorizeIndexItems(items));
|
||||
} else {
|
||||
list.add(new IndexItemCategory(getResources().getString(R.string.select_index_file_to_download),1));
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
@ -958,6 +964,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
|||
final View row = v;
|
||||
TextView item = (TextView) row.findViewById(R.id.download_index_category_name);
|
||||
item.setText(group.name);
|
||||
item.setLinkTextColor(Color.YELLOW);
|
||||
return row;
|
||||
}
|
||||
|
||||
|
@ -997,7 +1004,7 @@ public class DownloadIndexActivity extends OsmandExpandableListActivity {
|
|||
} else if (e.getDate().equals(indexFileNames.get(sfName))) {
|
||||
item.setTextColor(Color.rgb(0,100,0));
|
||||
} else if (indexActivatedFileNames.containsKey(sfName)) {
|
||||
item.setTextColor(Color.BLUE);
|
||||
item.setTextColor(getResources().getColor(R.color.color_orange));
|
||||
} else {
|
||||
item.setTextColor(Color.rgb(0,0,139));
|
||||
}
|
||||
|
|
|
@ -38,11 +38,9 @@ import android.view.Menu;
|
|||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.BaseExpandableListAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
|
@ -77,16 +75,9 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
|||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
CustomTitleBar titleBar = new CustomTitleBar(this, R.string.favourites_activity, R.drawable.tab_favorites_screen_icon);
|
||||
setContentView(R.layout.favourites_list);
|
||||
|
||||
Button backButton = (Button) findViewById(R.id.favourites_back_button);
|
||||
backButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FavouritesActivity.this.finish();
|
||||
}
|
||||
});
|
||||
titleBar.afterSetContentView();
|
||||
|
||||
helper = ((OsmandApplication)getApplication()).getFavorites();
|
||||
favouritesAdapter = new FavouritesAdapter();
|
||||
|
@ -147,7 +138,7 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void cancelSelectingMode() {
|
||||
selectionMode = false;
|
||||
findViewById(R.id.ActionButton).setVisibility(View.GONE);
|
||||
|
|
|
@ -75,8 +75,9 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
CustomTitleBar titleBar = new CustomTitleBar(this, R.string.local_index_descr_title, R.drawable.tab_settings_screen_icon);
|
||||
setContentView(R.layout.local_index);
|
||||
titleBar.afterSetContentView();
|
||||
settings = OsmandSettings.getOsmandSettings(this);
|
||||
descriptionLoader = new LoadLocalIndexDescriptionTask();
|
||||
listAdapter = new LocalIndexesAdapter();
|
||||
|
|
|
@ -157,12 +157,16 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
}
|
||||
return setFiles;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
CustomTitleBar titleBar = new CustomTitleBar(this, R.string.settings_activity, R.drawable.tab_settings_screen_icon);
|
||||
super.onCreate(savedInstanceState);
|
||||
getListView().setCacheColorHint(getResources().getColor(R.color.activity_background));
|
||||
getListView().setDivider(getResources().getDrawable(R.drawable.tab_text_separator));
|
||||
addPreferencesFromResource(R.xml.settings_pref);
|
||||
titleBar.afterSetContentView();
|
||||
|
||||
String[] entries;
|
||||
String[] entrieValues;
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.PoiFilter;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.SearchByNameFilter;
|
||||
import net.osmand.plus.activities.CustomTitleBar;
|
||||
import net.osmand.plus.activities.EditPOIFilterActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandApplication;
|
||||
|
@ -114,7 +115,9 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
|||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
CustomTitleBar titleBar = new CustomTitleBar(this, R.string.searchpoi_activity, R.drawable.tab_search_poi_icon);
|
||||
setContentView(R.layout.searchpoi);
|
||||
titleBar.afterSetContentView();
|
||||
|
||||
uiHandler = new Handler();
|
||||
searchPOILevel = (Button) findViewById(R.id.SearchPOILevelButton);
|
||||
|
@ -862,11 +865,11 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
|||
|
||||
public void setOpenedColor(int opened){
|
||||
if(opened == 0){
|
||||
paintRouteDirection.setColor(Color.rgb(0, 205, 0));
|
||||
paintRouteDirection.setColor(Color.rgb(50, 205, 50));
|
||||
} else if(opened == -1){
|
||||
paintRouteDirection.setColor(Color.rgb(150, 150, 150));
|
||||
paintRouteDirection.setColor(Color.rgb(200, 200, 200));
|
||||
} else {
|
||||
paintRouteDirection.setColor(Color.rgb(238, 0, 0));
|
||||
paintRouteDirection.setColor(Color.rgb(238, 50, 50));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue