Merge pull request #1104 from Bars107/master
Osm edits card. Parking card updated.
This commit is contained in:
commit
7acf1daaaa
45 changed files with 1821 additions and 962 deletions
|
@ -310,6 +310,7 @@ dependencies {
|
|||
"OsmAndCore_android.jar",
|
||||
"OsmAndCore_wrapper.jar"])
|
||||
compile "com.android.support:appcompat-v7:21.0.3"
|
||||
compile "com.github.shell-software:fab:1.0.5"
|
||||
legacyCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
|
||||
qtcoredebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
|
||||
qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||
|
|
318
OsmAnd/build.gradle~
Normal file
318
OsmAnd/build.gradle~
Normal file
|
@ -0,0 +1,318 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
// Global Paramers accepted
|
||||
// APK_NUMBER_VERSION - version number of apk
|
||||
// APK_VERSION - build number like #9999Z, for dev builds appended to app_version like 2.0.0 in no_translate.xml)
|
||||
// flavor Z : M=-master, D=-design, B=-Blackberry, MD=-main-default, MQA=-main-qt-arm, MQDA=-main-qt-default-arm, S=-sherpafy
|
||||
// TARGET_APP_NAME - app name
|
||||
// APP_EDITION - date stamp of builds
|
||||
// APP_FEATURES - features +play_market +gps_status -parking_plugin -blackberry -free_version -amazon
|
||||
|
||||
// TODO
|
||||
// 1. Filter fonts
|
||||
// <unzip src="OsmAndCore_android.aar" dest=".">
|
||||
// <patternset>
|
||||
// <include name="assets/**/map/fonts/OpenSans/*"/>
|
||||
// <include name="assets/**/map/fonts/NotoSans/*"/>
|
||||
// </patternset>
|
||||
// </unzip>
|
||||
// Less important
|
||||
// 2. fix_apostrophe_issues (replace match="[^=]([^\\])'" replace="\1\\\\'") res/**/strings.xml
|
||||
// 3. sherpafy/free/paid
|
||||
// 4. Release signature
|
||||
// 5. TARGET_APP_NAME, APP_EDITION uses flavor
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "21.1.2"
|
||||
|
||||
signingConfigs {
|
||||
development {
|
||||
storeFile file("../keystores/debug.keystore")
|
||||
storePassword "android"
|
||||
keyAlias "androiddebugkey"
|
||||
keyPassword "android"
|
||||
}
|
||||
|
||||
publishing {
|
||||
storeFile file("osmand_key")
|
||||
storePassword System.getenv("OSMAND_APK_PASSWORD")
|
||||
keyAlias "androiddebugkey"
|
||||
keyPassword System.getenv("OSMAND_APK_PASSWORD")
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 9
|
||||
targetSdkVersion 21
|
||||
|
||||
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
|
||||
//versionName already assigned in code
|
||||
//versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
lintConfig file("lint.xml")
|
||||
abortOnError false
|
||||
warningsAsErrors false
|
||||
}
|
||||
|
||||
// This is from OsmAndCore_android.aar - for some reason it's not inherited
|
||||
aaptOptions {
|
||||
// Don't compress any embedded resources
|
||||
noCompress "qz"
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
jumboMode = true
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile "AndroidManifest.xml"
|
||||
jni.srcDirs = []
|
||||
jniLibs.srcDirs = ["libs"]
|
||||
aidl.srcDirs = ["src"]
|
||||
java.srcDirs = ["src"]
|
||||
resources.srcDirs = ["src"]
|
||||
renderscript.srcDirs = ["src"]
|
||||
res.srcDirs = ["res"]
|
||||
assets.srcDirs = ["assets"]
|
||||
}
|
||||
free {
|
||||
manifest.srcFile "AndroidManifest-free.xml"
|
||||
}
|
||||
|
||||
legacy {
|
||||
jniLibs.srcDirs = ["libgnustl"]
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions "version", "coreversion", "abi"
|
||||
productFlavors {
|
||||
// ABI
|
||||
armv7 {
|
||||
flavorDimension "abi"
|
||||
ndk {
|
||||
abiFilter "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
armv5 {
|
||||
flavorDimension "abi"
|
||||
ndk {
|
||||
abiFilter "armeabi"
|
||||
}
|
||||
}
|
||||
x86 {
|
||||
flavorDimension "abi"
|
||||
ndk {
|
||||
abiFilter "x86"
|
||||
}
|
||||
}
|
||||
mips {
|
||||
flavorDimension "abi"
|
||||
ndk {
|
||||
abiFilter "mips"
|
||||
}
|
||||
}
|
||||
fat {
|
||||
flavorDimension "abi"
|
||||
}
|
||||
|
||||
// Version
|
||||
free {
|
||||
flavorDimension "version"
|
||||
applicationId "net.osmand"
|
||||
}
|
||||
full {
|
||||
flavorDimension "version"
|
||||
applicationId "net.osmand.plus"
|
||||
}
|
||||
|
||||
// CoreVersion
|
||||
legacy {
|
||||
flavorDimension "coreversion"
|
||||
}
|
||||
|
||||
qtcore {
|
||||
flavorDimension "coreversion"
|
||||
}
|
||||
|
||||
qtcoredebug {
|
||||
flavorDimension "coreversion"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
signingConfig signingConfigs.development
|
||||
}
|
||||
release {
|
||||
signingConfig signingConfigs.publishing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def replaceNoTranslate(line) {
|
||||
if (line.contains("\"app_name\"") && System.getenv("TARGET_APP_NAME")) {
|
||||
return line.replaceAll(">[^<]*<", ">" + System.getenv("TARGET_APP_NAME") + "<")
|
||||
}
|
||||
if (line.contains("\"app_edition\"") && System.getenv("APP_EDITION")) {
|
||||
return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_EDITION") + "<")
|
||||
}
|
||||
if (line.contains("\"app_version\"") && System.getenv("APK_VERSION")) {
|
||||
// appends build number to version number for dev builds
|
||||
return line.replaceAll("</", System.getenv("APK_VERSION") + "</")
|
||||
}
|
||||
if (line.contains("\"versionFeatures\"") && System.getenv("APP_FEATURES")) {
|
||||
return line.replaceAll(">[^<]*<", ">" + System.getenv("APP_FEATURES") + "<")
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
task updateNoTranslate(type: Copy) {
|
||||
inputs.property 'appName', System.getenv().get("APP_NAME")
|
||||
inputs.property 'appEdition', System.getenv().get("APP_EDITION")
|
||||
inputs.property 'appFeatures', System.getenv().get("APP_FEATURES")
|
||||
inputs.property 'apkVersion', System.getenv().get("APK_VERSION")
|
||||
from('.') {
|
||||
include 'no_translate.xml'
|
||||
filter {
|
||||
line -> replaceNoTranslate(line);
|
||||
}
|
||||
}
|
||||
into 'res/values/'
|
||||
}
|
||||
|
||||
task collectVoiceAssets(type: Sync) {
|
||||
from "../../resources/voice"
|
||||
into "assets/voice"
|
||||
include "**/*.p"
|
||||
}
|
||||
|
||||
task collectSpecialPhrasesAssets(type: Sync) {
|
||||
from "../../resources/specialphrases"
|
||||
into "assets/specialphrases"
|
||||
include "*.txt"
|
||||
}
|
||||
|
||||
task collectHelpContentsAssets(type: Sync) {
|
||||
from "../../help"
|
||||
into "assets/help"
|
||||
include "*.html"
|
||||
include "images/**/*.png"
|
||||
|
||||
from "assets/"
|
||||
into "assets/help"
|
||||
include "style.css"
|
||||
}
|
||||
|
||||
task collectRoutingResources(type: Sync) {
|
||||
from "../../resources/routing"
|
||||
into "src/net/osmand/router"
|
||||
include "*.xml"
|
||||
}
|
||||
|
||||
task collectMiscResources(type: Copy) {
|
||||
into "src/net/osmand/osm"
|
||||
from("../../resources/obf_creation") {
|
||||
include "rendering_types.xml"
|
||||
}
|
||||
from("../../resources/poi") {
|
||||
include "poi_types.xml"
|
||||
}
|
||||
}
|
||||
|
||||
task collectRenderingStylesResources(type: Sync) {
|
||||
from "../../resources/rendering_styles"
|
||||
into "src/net/osmand/render"
|
||||
include "*.xml"
|
||||
}
|
||||
|
||||
task collectRegionsInfoResources(type: Copy) {
|
||||
from "../../resources/countries-info"
|
||||
into "src/net/osmand/map"
|
||||
include "regions.ocbf"
|
||||
}
|
||||
|
||||
task copyStyleIcons(type: Copy) {
|
||||
from "../../resources/rendering_styles/style-icons/"
|
||||
into "res/"
|
||||
include "**/*.png"
|
||||
}
|
||||
|
||||
task collectExternalResources << {}
|
||||
collectExternalResources.dependsOn collectVoiceAssets,
|
||||
collectSpecialPhrasesAssets,
|
||||
collectHelpContentsAssets,
|
||||
collectRoutingResources,
|
||||
collectRenderingStylesResources,
|
||||
collectRegionsInfoResources,
|
||||
collectMiscResources,
|
||||
copyStyleIcons,
|
||||
updateNoTranslate
|
||||
tasks.whenTaskAdded { task ->
|
||||
if (task.name.startsWith("generate") && task.name.endsWith("Resources")) {
|
||||
task.dependsOn collectExternalResources
|
||||
}
|
||||
}
|
||||
|
||||
// Legacy core build
|
||||
import org.apache.tools.ant.taskdefs.condition.Os
|
||||
|
||||
task buildOsmAndCore(type: Exec) {
|
||||
description "Build Legacy OsmAndCore"
|
||||
|
||||
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
commandLine "bash", file("./old-ndk-build.sh").getAbsolutePath()
|
||||
} else {
|
||||
commandLine "cmd", "/c", "echo", "Not supported"
|
||||
}
|
||||
}
|
||||
|
||||
task cleanupDuplicatesInCore() {
|
||||
dependsOn buildOsmAndCore
|
||||
// doesn't work for legacy debug builds
|
||||
doLast {
|
||||
file("libgnustl/armeabi").mkdirs()
|
||||
println file("libs/armeabi/libgnustl_shared.so").renameTo(file("libgnustl/armeabi/libgnustl_shared.so"))
|
||||
file("libgnustl/armeabi-v7a").mkdirs()
|
||||
println file("libs/armeabi-v7a/libgnustl_shared.so").renameTo(file("libgnustl/armeabi-v7a/libgnustl_shared.so"))
|
||||
file("libgnustl/mips").mkdirs()
|
||||
println file("libs/mips/libgnustl_shared.so").renameTo(file("libgnustl/mips/libgnustl_shared.so"))
|
||||
file("libgnustl/x86").mkdirs()
|
||||
println file("libs/x86/libgnustl_shared.so").renameTo(file("libgnustl/x86/libgnustl_shared.so"))
|
||||
}
|
||||
}
|
||||
tasks.withType(JavaCompile) {
|
||||
compileTask -> compileTask.dependsOn << [buildOsmAndCore, cleanupDuplicatesInCore]
|
||||
}
|
||||
|
||||
repositories {
|
||||
ivy {
|
||||
name = "OsmAndBinariesIvy"
|
||||
url = "http://builder.osmand.net"
|
||||
layout "pattern", {
|
||||
artifact "ivy/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile project(path: ":OsmAnd-java", configuration: "android")
|
||||
compile fileTree(
|
||||
dir: "libs",
|
||||
include: ["*.jar"],
|
||||
exclude: [
|
||||
"QtAndroid-bundled.jar",
|
||||
"QtAndroidAccessibility-bundled.jar",
|
||||
"android-support*.jar",
|
||||
"OsmAndCore_android.jar",
|
||||
"OsmAndCore_wrapper.jar"])
|
||||
compile "com.android.support:appcompat-v7:21.0.3"
|
||||
legacyCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@jar"
|
||||
qtcoredebugCompile "net.osmand:OsmAndCore_androidNativeDebug:0.1-SNAPSHOT@aar"
|
||||
qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||
qtcoreCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
|
||||
qtcoreCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||
}
|
7
OsmAnd/res/drawable/dash_parking_dark.xml
Normal file
7
OsmAnd/res/drawable/dash_parking_dark.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/dashboard_parking_dark_selected" android:state_enabled="false"/>
|
||||
<item android:drawable="@color/dashboard_parking_dark_selected" android:state_pressed="true"/>
|
||||
<item android:drawable="@color/dashboard_parking_dark_selected" android:state_focused="true"/>
|
||||
<item android:drawable="@color/dashboard_parking_dark_color"/>
|
||||
</selector>
|
7
OsmAnd/res/drawable/dash_parking_light.xml
Normal file
7
OsmAnd/res/drawable/dash_parking_light.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false" android:drawable="@color/parking_card_selected" />
|
||||
<item android:state_pressed="true" android:drawable="@color/parking_card_selected" />
|
||||
<item android:state_focused="true" android:drawable="@color/parking_card_selected" />
|
||||
<item android:drawable="@color/dashboard_blue" />
|
||||
</selector>
|
|
@ -1,91 +1,94 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:orientation="vertical" >
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/osmo_header_background"
|
||||
android:minHeight="@dimen/osmo_header_height"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dashboard_parking_left_margin"
|
||||
android:paddingRight="@dimen/dashboard_parking_left_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/osmo_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:src="@drawable/mon_osmo_conn_small" />
|
||||
<ImageView
|
||||
android:id="@+id/osmo_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:src="@drawable/mon_osmo_conn_small"/>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/enable_service"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/osmo_start_service" />
|
||||
</LinearLayout>
|
||||
<Switch
|
||||
android:id="@+id/enable_service"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:focusable="false"
|
||||
android:textColor="@color/color_white"
|
||||
android:text="@string/osmo_start_service"/>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/osmo_log_off_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginTop="3dp" >
|
||||
<RelativeLayout
|
||||
android:id="@+id/osmo_log_off_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dashboard_parking_left_margin"
|
||||
android:layout_marginRight="@dimen/dashboard_parking_left_margin"
|
||||
android:minHeight="@dimen/osmo_header_height">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osmo_user_name_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/anonymous_user"
|
||||
android:textAppearance="?android:attr/textAppearance" />
|
||||
<TextView
|
||||
android:id="@+id/osmo_user_name_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/anonymous_user"
|
||||
android:textAppearance="?android:attr/textAppearance"/>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/osmo_login_logoff"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical" />
|
||||
<Switch
|
||||
android:id="@+id/osmo_login_logoff"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/osmo_login_hint_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/osmo_user_name_text_view"
|
||||
android:minHeight="0dp"
|
||||
android:minWidth="0dp"
|
||||
android:text="\?"
|
||||
android:textAppearance="?android:attr/textAppearance" />
|
||||
|
||||
</RelativeLayout>
|
||||
<Button
|
||||
android:id="@+id/osmo_login_hint_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/osmo_user_name_text_view"
|
||||
android:minHeight="0dp"
|
||||
android:minWidth="0dp"
|
||||
android:text="\?"
|
||||
android:textAppearance="?android:attr/textAppearance"/>
|
||||
|
||||
<Switch
|
||||
android:id="@+id/enable_tracker"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/osmo_enable_tracker" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/motd"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dip"
|
||||
android:autoLink="web"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp" />
|
||||
<Switch
|
||||
android:id="@+id/enable_tracker"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dashboard_parking_left_margin"
|
||||
android:layout_marginRight="@dimen/dashboard_parking_left_margin"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/osmo_header_height"
|
||||
android:text="@string/osmo_enable_tracker"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/motd"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dip"
|
||||
android:autoLink="web"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,77 +1,111 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:background="?attr/card_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout android:id="@+id/header_layout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashHeaderHeight">
|
||||
<TextView android:id="@+id/osmo_text"
|
||||
android:text="@string/map_widget_av_notes"
|
||||
style="?attr/dashboardSubHeaderStyle"/>
|
||||
<Button android:id="@+id/manage"
|
||||
android:text="@string/shared_string_show_all"
|
||||
style="?attr/dashboardGeneralButtonStyle"/>
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/card_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/header_layout"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashHeaderHeight"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osmo_text"
|
||||
style="?attr/dashboardSubHeaderStyle"
|
||||
android:text="@string/osmo"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/manage"
|
||||
style="?attr/dashboardGeneralButtonStyle"
|
||||
android:text="@string/osm_editing_manage"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashHeaderHeight">
|
||||
<TextView android:text="@string/shared_string_my_location"
|
||||
style="?attr/dashboardSubHeaderStyle"
|
||||
android:layout_weight="1"/>
|
||||
<Button android:id="@+id/share"
|
||||
android:text="@string/shared_string_show_all"
|
||||
style="?attr/dashboardGeneralButtonStyle"/>
|
||||
<include layout="@layout/check_item_rel" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/dashHeaderHeight"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
style="?attr/dashboardSubHeaderStyle"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/shared_string_my_location"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/share"
|
||||
style="?attr/dashboardGeneralButtonStyle"
|
||||
android:text="@string/shared_string_show_all"/>
|
||||
|
||||
<include layout="@layout/check_item_rel"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"/>
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<LinearLayout android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView android:id="@+id/points_icon"
|
||||
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
|
||||
android:src="@drawable/ic_small_point"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView android:id="@+id/points_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView android:id="@+id/distance_icon"
|
||||
android:src="@drawable/ic_small_distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView android:id="@+id/distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageView
|
||||
android:id="@+id/points_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
|
||||
android:src="@drawable/ic_small_point"/>
|
||||
|
||||
<ImageView android:id="@+id/time_icon"
|
||||
android:src="@drawable/ic_small_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<TextView android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/showAllButtonMarginRight"/>
|
||||
<TextView
|
||||
android:id="@+id/points_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/distance_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_small_distance"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/time_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_small_time"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/showAllButtonMarginRight"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:orientation="vertical"
|
||||
android:id="@+id/items"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/items"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -7,6 +7,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/parking_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dash_parking_height"
|
||||
android:background="?attr/dash_parking_bg"
|
||||
|
@ -62,6 +63,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/left_lbl"
|
||||
android:layout_gravity="right"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmand_parking_time_left"
|
||||
|
|
|
@ -1,101 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
android:paddingLeft="@dimen/dialog_content_margin"
|
||||
android:paddingRight="@dimen/dialog_content_margin"
|
||||
android:paddingTop="@dimen/dialog_content_bottom_margin">
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="7dp"
|
||||
android:paddingRight="7dp"
|
||||
android:stretchColumns="1">
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="7dp"
|
||||
android:paddingRight="7dp"
|
||||
android:stretchColumns="1">
|
||||
|
||||
<TableRow>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_name"/>
|
||||
|
||||
<TextView
|
||||
android:paddingLeft="3dp"
|
||||
android:layout_span="2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/osmo_group_create_info"
|
||||
android:textSize="18sp"
|
||||
android:drawableRight="@drawable/ic_action_info_dark"
|
||||
android:text="@string/osmo_group_information" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:paddingLeft="3dp"
|
||||
android:id="@+id/osmo_group_create_dinfo"
|
||||
android:textSize="16sp"
|
||||
android:layout_span="2"
|
||||
android:minLines="3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_information_desc"
|
||||
android:animateLayoutChanges="true"
|
||||
android:visibility="gone" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_name" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/Name"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="3dp" />
|
||||
</TableRow>
|
||||
|
||||
<TableRow>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_description" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/Description"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="3"
|
||||
android:paddingLeft="3dp" />
|
||||
</TableRow>
|
||||
<EditText
|
||||
android:id="@+id/Name"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<TableRow>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_description"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_by_invite" />
|
||||
<EditText
|
||||
android:id="@+id/Description"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/OnlyByInvite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="3dp" />
|
||||
</TableRow>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_policy"/>
|
||||
|
||||
<TableRow>
|
||||
<EditText
|
||||
android:id="@+id/Policy"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_policy" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/Policy"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lines="2"
|
||||
android:paddingLeft="3dp" />
|
||||
</TableRow>
|
||||
</TableLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_by_invite"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/OnlyByInvite"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osmo_group_create_info"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/osmo_group_information"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/info"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/options_button_background"
|
||||
android:src="@drawable/ic_action_info_dark"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osmo_group_create_dinfo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/osmo_group_information_desc"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -2,8 +2,10 @@
|
|||
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="7dp"
|
||||
android:paddingRight="7dp"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
android:paddingTop="@dimen/dialog_content_bottom_margin"
|
||||
android:paddingLeft="@dimen/dialog_content_margin"
|
||||
android:paddingRight="@dimen/dialog_content_margin"
|
||||
android:stretchColumns="1">
|
||||
|
||||
<TableRow>
|
||||
|
|
|
@ -1,37 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_category_color"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="3dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="5dp">
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="3dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/explist_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingLeft="6dp"
|
||||
android:src="@drawable/expandable_category_unpushed" />
|
||||
<ImageView
|
||||
android:id="@+id/explist_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingLeft="6dp"
|
||||
android:src="@drawable/expandable_category_unpushed"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/category_name"
|
||||
style="@style/ListText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:layout_marginLeft="8dp"
|
||||
<TextView
|
||||
android:id="@+id/category_name"
|
||||
style="@style/ListText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="1"
|
||||
tools:text="@string/lorem_ipsum"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="18sp" />
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="18sp"
|
||||
tools:text="@string/lorem_ipsum"/>
|
||||
|
||||
<include layout="@layout/check_item_rel" />
|
||||
<include layout="@layout/check_item_rel"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
|
|
|
@ -25,4 +25,10 @@
|
|||
android:layout_weight="1"
|
||||
android:groupIndicator="@android:color/transparent"/>
|
||||
|
||||
<net.osmand.plus.activities.search.toolbar.SplitToolbar
|
||||
android:id="@+id/bottomControls"
|
||||
android:background="?attr/bottomToolBarColor"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,36 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="5dp">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingRight="4dp"
|
||||
android:paddingTop="5dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/osmo_user_icon"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:paddingRight="2dp"
|
||||
android:paddingTop="2dp" />
|
||||
<ImageView
|
||||
android:id="@+id/osmo_user_icon"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:paddingRight="2dp"
|
||||
android:paddingTop="2dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osmo_label"
|
||||
style="@style/ListText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:maxLines="7"
|
||||
android:layout_weight="1" />
|
||||
<TextView
|
||||
android:id="@+id/osmo_label"
|
||||
style="@style/ListText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:maxLines="7"
|
||||
tools:text="@string/abc_action_bar_home_description"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osmo_label_time"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp" />
|
||||
<TextView
|
||||
android:id="@+id/osmo_label_time"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"/>
|
||||
|
||||
<!-- <include layout="@layout/check_item" /> -->
|
||||
<!-- <include layout="@layout/check_item" /> -->
|
||||
|
||||
</LinearLayout>
|
|
@ -1,91 +1,95 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:orientation="vertical">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/osmo_header_background"
|
||||
android:minHeight="@dimen/osmo_header_height"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/dashboard_parking_left_margin"
|
||||
android:paddingRight="@dimen/dashboard_parking_left_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/osmo_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:src="@drawable/mon_osmo_conn_small" />
|
||||
<ImageView
|
||||
android:id="@+id/osmo_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingLeft="4dp"
|
||||
android:paddingRight="4dp"
|
||||
android:src="@drawable/mon_osmo_conn_small"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/enable_service"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/osmo_start_service" />
|
||||
</LinearLayout>
|
||||
<CheckBox
|
||||
android:id="@+id/enable_service"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:focusable="false"
|
||||
android:textColor="@color/color_white"
|
||||
android:text="@string/osmo_start_service"/>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/osmo_log_off_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginTop="3dp">
|
||||
<RelativeLayout
|
||||
android:id="@+id/osmo_log_off_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dashboard_parking_left_margin"
|
||||
android:layout_marginRight="@dimen/dashboard_parking_left_margin"
|
||||
android:minHeight="@dimen/osmo_header_height">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/osmo_user_name_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/anonymous_user"
|
||||
android:textAppearance="?android:attr/textAppearance" />
|
||||
<TextView
|
||||
android:id="@+id/osmo_user_name_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/anonymous_user"
|
||||
android:textAppearance="?android:attr/textAppearance"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/osmo_login_logoff"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical" />
|
||||
<CheckBox
|
||||
android:id="@+id/osmo_login_logoff"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/osmo_login_hint_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/osmo_user_name_text_view"
|
||||
android:minHeight="0dp"
|
||||
android:minWidth="0dp"
|
||||
android:text="\?"
|
||||
android:textAppearance="?android:attr/textAppearance" />
|
||||
<Button
|
||||
android:id="@+id/osmo_login_hint_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toRightOf="@id/osmo_user_name_text_view"
|
||||
android:minHeight="0dp"
|
||||
android:minWidth="0dp"
|
||||
android:text="\?"
|
||||
android:textAppearance="?android:attr/textAppearance"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/enable_tracker"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/osmo_enable_tracker" />
|
||||
<CheckBox
|
||||
android:id="@+id/enable_tracker"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dashboard_parking_left_margin"
|
||||
android:layout_marginRight="@dimen/dashboard_parking_left_margin"
|
||||
android:checked="false"
|
||||
android:focusable="false"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/osmo_header_height"
|
||||
android:text="@string/osmo_enable_tracker"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/motd"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dip"
|
||||
android:autoLink="web"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp" />
|
||||
<TextView
|
||||
android:id="@+id/motd"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="web"
|
||||
android:gravity="center"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,48 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
android:paddingLeft="@dimen/dialog_content_margin"
|
||||
android:paddingRight="@dimen/dialog_content_margin"
|
||||
android:paddingTop="@dimen/dialog_content_bottom_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/parkTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/osmand_parking_position_description_add" />
|
||||
<TextView
|
||||
android:id="@+id/parkTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/osmand_parking_position_description_add"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="center_horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/osmand_parking_hours" />
|
||||
<TextView
|
||||
android:id="@+id/textView1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/osmand_parking_hours"/>
|
||||
|
||||
<TimePicker
|
||||
android:id="@+id/parking_time_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
<TimePicker
|
||||
android:id="@+id/parking_time_picker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/osmand_parking_minutes" />
|
||||
<TextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:text="@string/osmand_parking_minutes"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_event_in_calendar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="@string/osmand_parking_add_event" />
|
||||
<CheckBox
|
||||
android:id="@+id/check_event_in_calendar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="@string/osmand_parking_add_event"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -37,5 +37,5 @@
|
|||
android:paddingLeft="4dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingTop="2dp"
|
||||
android:src="@android:drawable/ic_input_get" />
|
||||
android:src="@drawable/ic_action_filter_dark" />
|
||||
</LinearLayout>
|
||||
|
|
|
@ -36,7 +36,8 @@
|
|||
<attr name="expandable_list_background" format="color"/>
|
||||
<attr name="list_settings_icon" format="reference"/>
|
||||
<attr name="size_progress_bar" format="reference"/>
|
||||
<attr name="dash_parking_bg" format="color"/>
|
||||
<attr name="dash_parking_bg" format="reference"/>
|
||||
<attr name="osmo_header_background" format="color"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PagerSlidingTabStrip">
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<color name="osmo_header_dark">#2d383d</color>
|
||||
<color name="osmo_header_light">#b36d12</color>
|
||||
|
||||
<color name="parking_card_selected">#234DDE</color>
|
||||
<color name="dashboard_parking_dark_color">#54778c</color>
|
||||
<color name="dashboard_parking_dark_selected">#446072</color>
|
||||
|
||||
<color name="list_divider_dark">#1f2326</color>
|
||||
<color name="list_divider_light">@color/color_white</color>
|
||||
<color name="list_background_dark">#292f33</color>
|
||||
|
@ -33,7 +40,7 @@
|
|||
<color name="dashboard_subheader_text_light">#212121</color>
|
||||
<color name="dashboard_general_button_text_dark">#ff8f00</color>
|
||||
<color name="dashboard_general_button_text_light">#536DFE</color>
|
||||
<color name="dashboard_parking_dark">#54778c</color>
|
||||
|
||||
|
||||
<color name="color_transparent">#00000000</color>
|
||||
<color name="widgettext_night">#ffC8C8C8</color>
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
<dimen name="dashboard_parking_icon_size">48dp</dimen>
|
||||
<dimen name="map_button_size">40dp</dimen>
|
||||
<dimen name="map_button_margin">8dp</dimen>
|
||||
<dimen name="osmo_header_height">56dp</dimen>
|
||||
|
||||
|
||||
<!-- TextSizes -->
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="osmand_parking_outdated">Outdated</string>
|
||||
<string name="action_create">Action create</string>
|
||||
<string name="action_modify">Action modify</string>
|
||||
<string name="action_delete">Action delete</string>
|
||||
|
|
|
@ -165,7 +165,8 @@
|
|||
<item name="expandable_list_background">@color/color_white</item>
|
||||
<item name="list_settings_icon">@drawable/ic_overflow_menu_light</item>
|
||||
<item name="size_progress_bar">@drawable/size_progressbar_light</item>
|
||||
<item name="dash_parking_bg">@color/dashboard_blue</item>
|
||||
<item name="dash_parking_bg">@drawable/dash_parking_light</item>
|
||||
<item name="osmo_header_background">@color/osmo_header_light</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||
|
@ -209,7 +210,8 @@
|
|||
<item name="expandable_list_background">@color/list_background_dark</item>
|
||||
<item name="list_settings_icon">@drawable/ic_overflow_menu_dark</item>
|
||||
<item name="size_progress_bar">@drawable/size_progressbar_dark</item>
|
||||
<item name="dash_parking_bg">@color/dashboard_parking_dark</item>
|
||||
<item name="dash_parking_bg">@drawable/dash_parking_dark</item>
|
||||
<item name="osmo_header_background">@color/osmo_header_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Styled.ActionBarDark" parent="Widget.AppCompat.Light.ActionBar.Solid.Inverse">
|
||||
|
|
|
@ -32,6 +32,7 @@ public class PointDescription {
|
|||
public static final String POINT_TYPE_LOCATION = "location";
|
||||
public static final String POINT_TYPE_ALARM = "alarm";
|
||||
public static final String POINT_TYPE_TARGET = "destination";
|
||||
public static final String POINT_TYPE_OSM_BUG = "bug";
|
||||
|
||||
|
||||
public static final PointDescription LOCATION_POINT = new PointDescription(POINT_TYPE_LOCATION, "");
|
||||
|
|
|
@ -39,7 +39,8 @@ public class IconsCache {
|
|||
public Drawable getIcon(int id, int colorId) {
|
||||
return getDrawable(id, colorId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Drawable getContentIcon(int id) {
|
||||
return getDrawable(id, app.getSettings().isLightContent() ? R.color.icon_color_light : 0);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 23.01.15.
|
||||
|
@ -29,4 +32,23 @@ public class ActionBarProgressActivity extends OsmandActionBarActivity {
|
|||
public void setSupportProgressBarIndeterminateVisibility(boolean visible) {
|
||||
getSupportActionBar().getCustomView().setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public Toolbar getClearToolbar(boolean visible) {
|
||||
final Toolbar tb = (Toolbar) findViewById(R.id.bottomControls);
|
||||
if (tb == null) {
|
||||
return null;
|
||||
}
|
||||
tb.setTitle(null);
|
||||
tb.getMenu().clear();
|
||||
tb.setVisibility(visible? View.VISIBLE : View.GONE);
|
||||
return tb;
|
||||
}
|
||||
|
||||
public void setToolbarVisibility(boolean visible){
|
||||
View toolbar = findViewById(R.id.bottomControls);
|
||||
if (toolbar != null) {
|
||||
toolbar.setVisibility(visible? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.osmand.plus.dashboard.NotifyingScrollView;
|
|||
import net.osmand.plus.download.BaseDownloadActivity;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import net.osmand.plus.sherpafy.TourViewActivity;
|
||||
import net.osmand.plus.views.controls.FloatingActionButton;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
|
@ -53,7 +52,6 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
|
|||
int defaultMargin;
|
||||
|
||||
private Drawable actionBarBackground;
|
||||
FloatingActionButton fabButton;
|
||||
|
||||
private NotifyingScrollView.OnScrollChangedListener onScrollChangedListener = new NotifyingScrollView.OnScrollChangedListener() {
|
||||
public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) {
|
||||
|
@ -69,18 +67,7 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
|
|||
margintop,
|
||||
r.getDisplayMetrics());
|
||||
int margin = px + defaultMargin;
|
||||
if (headerHeight < t - margin){
|
||||
//hiding action bar - showing floating button
|
||||
//getSupportActionBar().hide();
|
||||
if (fabButton != null) {
|
||||
fabButton.showFloatingActionButton();
|
||||
}
|
||||
} else {
|
||||
//getSupportActionBar().show();
|
||||
if (fabButton != null) {
|
||||
fabButton.hideFloatingActionButton();
|
||||
}
|
||||
|
||||
if (headerHeight >= t - margin){
|
||||
//makes other cards to move on top of the map card to make it look like android animations
|
||||
View fragments = findViewById(R.id.fragments);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
@ -158,22 +145,6 @@ public class MainMenuActivity extends BaseDownloadActivity implements OsmAndLoca
|
|||
startMapActivity();
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
fabButton = new FloatingActionButton.Builder(this)
|
||||
.withDrawable(getResources().getDrawable(R.drawable.ic_action_map))
|
||||
.withButtonColor(Color.parseColor("#ff8f00"))
|
||||
.withGravity(Gravity.BOTTOM | Gravity.RIGHT)
|
||||
.withMargins(0, 0, 16, 16)
|
||||
.create();
|
||||
fabButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startMapActivity();
|
||||
}
|
||||
});
|
||||
fabButton.hideFloatingActionButton();
|
||||
}
|
||||
|
||||
getLocationProvider().addCompassListener(this);
|
||||
getLocationProvider().registerOrUnregisterCompassListener(true);
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@ import android.support.v7.app.ActionBarActivity;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.ExpandableListView;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.graphics.Shader.TileMode;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
|
@ -17,7 +19,7 @@ import android.view.View;
|
|||
|
||||
public abstract class OsmandExpandableListActivity extends
|
||||
ActionBarProgressActivity {
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
((OsmandApplication) getApplication()).applyTheme(this);
|
||||
|
@ -27,22 +29,22 @@ public abstract class OsmandExpandableListActivity extends
|
|||
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication)getApplication();
|
||||
return (OsmandApplication) getApplication();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
switch (itemId) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconLight, int iconDark, int menuItemType) {
|
||||
int r = isLightActionBar() ? iconLight : iconDark;
|
||||
MenuItem menuItem = m.add(0, id, 0, titleRes);
|
||||
|
@ -58,7 +60,11 @@ public abstract class OsmandExpandableListActivity extends
|
|||
MenuItemCompat.setShowAsAction(menuItem, menuItemType);
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
|
||||
public MenuItem createMenuItem(Menu m, int id, int titleRes, int icon, int menuItemType) {
|
||||
return createMenuItem(m, id, titleRes, icon, icon, menuItemType);
|
||||
}
|
||||
|
||||
public void fixBackgroundRepeat(View view) {
|
||||
Drawable bg = view.getBackground();
|
||||
if (bg != null) {
|
||||
|
@ -69,18 +75,18 @@ public abstract class OsmandExpandableListActivity extends
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setListAdapter(OsmandBaseExpandableListAdapter adapter){
|
||||
((ExpandableListView)findViewById(android.R.id.list)).setAdapter(adapter);
|
||||
|
||||
public void setListAdapter(OsmandBaseExpandableListAdapter adapter) {
|
||||
((ExpandableListView) findViewById(android.R.id.list)).setAdapter(adapter);
|
||||
}
|
||||
|
||||
public ExpandableListView getExpandableListView() {
|
||||
return (ExpandableListView)findViewById(android.R.id.list);
|
||||
return (ExpandableListView) findViewById(android.R.id.list);
|
||||
}
|
||||
|
||||
public void setOnChildClickListener(ExpandableListView.OnChildClickListener childClickListener){
|
||||
((ExpandableListView)findViewById(android.R.id.list)).setOnChildClickListener(childClickListener);
|
||||
public void setOnChildClickListener(ExpandableListView.OnChildClickListener childClickListener) {
|
||||
((ExpandableListView) findViewById(android.R.id.list)).setOnChildClickListener(childClickListener);
|
||||
}
|
||||
|
||||
public boolean isLightActionBar() {
|
||||
|
|
|
@ -148,10 +148,11 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
|||
}
|
||||
TextView label = (TextView) row.findViewById(R.id.folder_label);
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.folder_icon);
|
||||
OsmandApplication app = getMyApplication();
|
||||
final PoiLegacyFilter model = getItem(position);
|
||||
label.setText(model.getName());
|
||||
if(model.getFilterId().equals(PoiLegacyFilter.CUSTOM_FILTER_ID)) {
|
||||
icon.setImageResource(android.R.drawable.ic_input_get);
|
||||
icon.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_filter_dark));
|
||||
} else if (model.getFilterId().equals(PoiLegacyFilter.BY_NAME_FILTER_ID)) {
|
||||
icon.setImageResource(android.R.drawable.ic_search_category_default);
|
||||
} else {
|
||||
|
@ -191,4 +192,8 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv
|
|||
public void locationUpdate(LatLon l) {
|
||||
}
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -45,13 +46,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Activity activity = getActivity();
|
||||
Class<FavoritesActivity> fa = getMyApplication().getAppCustomization().getFavoritesActivity();
|
||||
final Intent favorites = new Intent(activity, fa);
|
||||
favorites.putExtra("TAB", "AUDIO");
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.NOTES_TAB);
|
||||
activity.startActivity(favorites);
|
||||
startFavoritesActivity(FavoritesActivity.NOTES_TAB);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
||||
/**
|
||||
* Created by Denis on 24.11.2014.
|
||||
|
@ -63,4 +67,13 @@ public abstract class DashBaseFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
protected void startFavoritesActivity(int tab) {
|
||||
Activity activity = getActivity();
|
||||
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
getMyApplication().getSettings().FAVORITES_TAB.set(tab);
|
||||
activity.startActivity(favorites);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Created by Denis on 24.11.2014.
|
||||
* Created by Denis
|
||||
* on 24.11.2014.
|
||||
*/
|
||||
public class DashFavoritesFragment extends DashLocationFragment {
|
||||
public static final String TAG = "DASH_FAVORITES_FRAGMENT";
|
||||
|
@ -47,12 +48,7 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
|||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Activity activity = getActivity();
|
||||
OsmAndAppCustomization appCustomization = getMyApplication().getAppCustomization();
|
||||
final Intent favorites = new Intent(activity, appCustomization.getFavoritesActivity());
|
||||
favorites.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
getMyApplication().getSettings().FAVORITES_TAB.set(FavoritesActivity.FAVORITES_TAB);
|
||||
activity.startActivity(favorites);
|
||||
startFavoritesActivity(FavoritesActivity.FAVORITES_TAB);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.osmand.plus.OsmAndFormatter;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.views.DirectionDrawable;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
|
@ -31,34 +32,34 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
private static final int ORIENTATION_180 = 2;
|
||||
protected List<DashLocationView> distances = new ArrayList<DashLocationFragment.DashLocationView>();
|
||||
private int screenOrientation;
|
||||
|
||||
|
||||
public static class DashLocationView {
|
||||
public ImageView arrow;
|
||||
public TextView txt;
|
||||
public LatLon loc;
|
||||
public int arrowResId;
|
||||
|
||||
public boolean paint = true;
|
||||
|
||||
public DashLocationView(ImageView arrow, TextView txt, LatLon loc) {
|
||||
super();
|
||||
this.arrow = arrow;
|
||||
this.txt = txt;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onOpenDash() {
|
||||
//Hardy: getRotation() is the correction if device's screen orientation != the default display's standard orientation
|
||||
screenOrientation = getScreenOrientation(getActivity());
|
||||
screenOrientation = getScreenOrientation(getActivity());
|
||||
}
|
||||
|
||||
public static int getScreenOrientation(Activity a) {
|
||||
int screenOrientation = ((WindowManager) a.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation();
|
||||
switch (screenOrientation)
|
||||
{
|
||||
switch (screenOrientation) {
|
||||
case ORIENTATION_0: // Device default (normally portrait)
|
||||
screenOrientation = 0;
|
||||
break;
|
||||
|
@ -73,16 +74,16 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
break;
|
||||
}
|
||||
//Looks like screenOrientation correction must not be applied for devices without compass?
|
||||
Sensor compass = ((SensorManager) a.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
|
||||
Sensor compass = ((SensorManager) a.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
|
||||
if (compass == null) {
|
||||
screenOrientation = 0;
|
||||
}
|
||||
return screenOrientation;
|
||||
}
|
||||
|
||||
|
||||
public LatLon getDefaultLocation() {
|
||||
DashboardOnMap d = dashboard;
|
||||
if(d == null) {
|
||||
if (d == null) {
|
||||
return null;
|
||||
}
|
||||
return d.getMapViewLocation();
|
||||
|
@ -90,7 +91,7 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
|
||||
public void updateAllWidgets() {
|
||||
DashboardOnMap d = dashboard;
|
||||
if(d == null) {
|
||||
if (d == null) {
|
||||
return;
|
||||
}
|
||||
float head = d.getHeading();
|
||||
|
@ -103,19 +104,20 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
LatLon loc = (useCenter ? mw : myLoc);
|
||||
float h = useCenter ? -mapRotation : head;
|
||||
for (DashLocationView lv : distances) {
|
||||
updateLocationView(useCenter, loc, h, lv.arrow, lv.arrowResId, lv.txt, lv.loc.getLatitude(), lv.loc.getLongitude(),
|
||||
screenOrientation, getMyApplication(), getActivity());
|
||||
updateLocationView(useCenter, loc, h, lv.arrow, lv.arrowResId, lv.txt, lv.loc.getLatitude(), lv.loc.getLongitude(),
|
||||
screenOrientation, getMyApplication(), getActivity(), lv.paint);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, TextView txt, double toLat, double toLon,
|
||||
int screenOrientation, OsmandApplication app, Context ctx) {
|
||||
updateLocationView(useCenter, fromLoc, h, arrow, 0, txt, toLat, toLon, screenOrientation, app, ctx);
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, TextView txt, double toLat, double toLon,
|
||||
int screenOrientation, OsmandApplication app, Context ctx) {
|
||||
updateLocationView(useCenter, fromLoc, h, arrow, 0, txt, toLat, toLon, screenOrientation, app, ctx, true);
|
||||
}
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, int arrowResId, TextView txt, double toLat, double toLon,
|
||||
int screenOrientation, OsmandApplication app, Context ctx) {
|
||||
|
||||
public static void updateLocationView(boolean useCenter, LatLon fromLoc, Float h,
|
||||
ImageView arrow, int arrowResId, TextView txt, double toLat, double toLon,
|
||||
int screenOrientation, OsmandApplication app, Context ctx, boolean paint) {
|
||||
float[] mes = new float[2];
|
||||
if (fromLoc != null) {
|
||||
Location.distanceBetween(toLat, toLon, fromLoc.getLatitude(), fromLoc.getLongitude(), mes);
|
||||
|
@ -129,7 +131,11 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
arrowResId = R.drawable.ic_destination_arrow_white;
|
||||
}
|
||||
DirectionDrawable dd = (DirectionDrawable) arrow.getDrawable();
|
||||
dd.setImage(arrowResId, useCenter ? R.color.color_distance : R.color.color_myloc_distance);
|
||||
if (paint) {
|
||||
dd.setImage(arrowResId, useCenter ? R.color.color_distance : R.color.color_myloc_distance);
|
||||
} else {
|
||||
dd.setImage(arrowResId);
|
||||
}
|
||||
if (fromLoc == null || h == null) {
|
||||
dd.setAngle(0);
|
||||
} else {
|
||||
|
@ -139,8 +145,10 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
}
|
||||
if (txt != null) {
|
||||
if (fromLoc != null) {
|
||||
txt.setTextColor(app.getResources().getColor(
|
||||
useCenter ? R.color.color_distance : R.color.color_myloc_distance));
|
||||
if (paint) {
|
||||
txt.setTextColor(app.getResources().getColor(
|
||||
useCenter ? R.color.color_distance : R.color.color_myloc_distance));
|
||||
}
|
||||
txt.setText(OsmAndFormatter.getFormattedDistance(mes[0], app));
|
||||
} else {
|
||||
txt.setText("");
|
||||
|
@ -149,7 +157,7 @@ public abstract class DashLocationFragment extends DashBaseFragment {
|
|||
}
|
||||
|
||||
public void updateLocation(boolean centerChanged, boolean locationChanged, boolean compassChanged) {
|
||||
if(compassChanged && !dashboard.isMapLinkedToLocation()) {
|
||||
if (compassChanged && !dashboard.isMapLinkedToLocation()) {
|
||||
return;
|
||||
}
|
||||
updateAllWidgets();
|
||||
|
|
|
@ -1,9 +1,26 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.Animation.AnimationListener;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
import com.software.shell.fab.ActionButton;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -16,29 +33,16 @@ import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
|||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.monitoring.DashTrackFragment;
|
||||
import net.osmand.plus.osmo.DashOsmoFragment;
|
||||
import net.osmand.plus.parkingpoint.DashParkingFragment;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.DownloadedRegionsLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.controls.FloatingActionButton;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Gravity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.Animation.AnimationListener;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
|
@ -52,8 +56,7 @@ public class DashboardOnMap {
|
|||
private static final int CONFIGURE_SCREEN_ID = 3;
|
||||
private static final int SETTINGS_ID = 4;
|
||||
private MapActivity mapActivity;
|
||||
FloatingActionButton fabButton;
|
||||
boolean floatingButtonVisible = true;
|
||||
ActionButton actionButton;
|
||||
private FrameLayout dashboardView;
|
||||
|
||||
private boolean visible = false;
|
||||
|
@ -97,29 +100,30 @@ public class DashboardOnMap {
|
|||
mapActivity.getMapActions().toggleDrawer();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
fabButton = new FloatingActionButton.Builder(mapActivity)
|
||||
.withDrawable(mapActivity.getResources().getDrawable(R.drawable.ic_action_map))
|
||||
.withButtonColor(mapActivity.getResources().getColor(R.color.color_myloc_distance))
|
||||
.withGravity(landscape ? Gravity.BOTTOM | Gravity.RIGHT : Gravity.TOP | Gravity.RIGHT)
|
||||
.withMargins(0, landscape ? 0 : 160, 16, landscape ? 16 : 0).create();
|
||||
fabButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (getMyApplication().accessibilityEnabled()) {
|
||||
mapActivity.getMapActions().whereAmIDialog();
|
||||
} else {
|
||||
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
|
||||
}
|
||||
setDashboardVisibility(false);
|
||||
|
||||
actionButton = new ActionButton(mapActivity);
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
int marginRight = convertPixelsToDp(16, mapActivity);
|
||||
params.setMargins(0, landscape ? 0 : convertPixelsToDp(164, mapActivity), marginRight, landscape ? marginRight : 0);
|
||||
|
||||
params.gravity = landscape ? Gravity.BOTTOM | Gravity.RIGHT : Gravity.TOP | Gravity.RIGHT;
|
||||
actionButton.setLayoutParams(params);
|
||||
actionButton.setImageDrawable(mapActivity.getResources().getDrawable(R.drawable.ic_action_map));
|
||||
actionButton.setButtonColor(mapActivity.getResources().getColor(R.color.color_myloc_distance));
|
||||
actionButton.hide();
|
||||
actionButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (getMyApplication().accessibilityEnabled()) {
|
||||
mapActivity.getMapActions().whereAmIDialog();
|
||||
} else {
|
||||
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
|
||||
}
|
||||
});
|
||||
fabButton.hideFloatingActionButton();
|
||||
}
|
||||
setDashboardVisibility(false);
|
||||
}
|
||||
});
|
||||
dashboardView.addView(actionButton);
|
||||
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(mapActivity)) {
|
||||
((NotifyingScrollView) dashboardView.findViewById(R.id.main_scroll))
|
||||
|
@ -127,6 +131,11 @@ public class DashboardOnMap {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public static int convertPixelsToDp(float dp, Context context){
|
||||
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
|
||||
return Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
|
||||
}
|
||||
|
||||
public net.osmand.Location getMyLocation() {
|
||||
return myLocation;
|
||||
|
@ -165,7 +174,8 @@ public class DashboardOnMap {
|
|||
setupActionBar();
|
||||
updateDownloadBtn();
|
||||
dashboardView.setVisibility(View.VISIBLE);
|
||||
fabButton.showFloatingActionButton();
|
||||
actionButton.show();
|
||||
//fabButton.showFloatingActionButton();
|
||||
open(dashboardView.findViewById(R.id.animateContent));
|
||||
|
||||
mapActivity.getMapActions().disableDrawer();
|
||||
|
@ -179,7 +189,8 @@ public class DashboardOnMap {
|
|||
hide(dashboardView.findViewById(R.id.animateContent));
|
||||
mapActivity.findViewById(R.id.MapInfoControls).setVisibility(View.VISIBLE);
|
||||
mapActivity.findViewById(R.id.MapButtons).setVisibility(View.VISIBLE);
|
||||
fabButton.hideFloatingActionButton();
|
||||
actionButton.hide();
|
||||
//fabButton.hideFloatingActionButton();
|
||||
for (WeakReference<DashBaseFragment> df : fragList) {
|
||||
if (df.get() != null) {
|
||||
df.get().onCloseDash();
|
||||
|
@ -350,6 +361,8 @@ public class DashboardOnMap {
|
|||
showFragment(manager, fragmentTransaction, DashFavoritesFragment.TAG, DashFavoritesFragment.class);
|
||||
showFragment(manager, fragmentTransaction, DashAudioVideoNotesFragment.TAG, DashAudioVideoNotesFragment.class);
|
||||
showFragment(manager, fragmentTransaction, DashTrackFragment.TAG, DashTrackFragment.class);
|
||||
showFragment(manager, fragmentTransaction, DashOsmoFragment.TAG, DashOsmoFragment.class);
|
||||
//showFragment(manager, fragmentTransaction, DashOsmEditsFragment.TAG, DashOsmEditsFragment.class);
|
||||
// showFragment(manager, fragmentTransaction, DashUpdatesFragment.TAG, DashUpdatesFragment.class);
|
||||
showFragment(manager, fragmentTransaction, DashPluginsFragment.TAG, DashPluginsFragment.class);
|
||||
|
||||
|
@ -385,9 +398,9 @@ public class DashboardOnMap {
|
|||
public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) {
|
||||
int sy = who.getScrollY();
|
||||
double scale = who.getContext().getResources().getDisplayMetrics().density;
|
||||
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) fabButton.getLayoutParams();
|
||||
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) actionButton.getLayoutParams();
|
||||
lp.topMargin = (int) Math.max(30 * scale, 160 * scale - sy);
|
||||
((FrameLayout) fabButton.getParent()).updateViewLayout(fabButton, lp);
|
||||
((FrameLayout) actionButton.getParent()).updateViewLayout(actionButton, lp);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,45 +1,5 @@
|
|||
package net.osmand.plus.myplaces;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.download.LocalIndexesFragment;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
|
@ -77,6 +37,47 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.GPXTrackAnalysis;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.download.LocalIndexesFragment;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.text.DateFormat;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
||||
|
||||
public static final int SEARCH_ID = -1;
|
||||
|
@ -349,12 +350,12 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
return true;
|
||||
}
|
||||
};
|
||||
optionsMenuAdapter.item(R.string.shared_string_show_on_map).icons(R.drawable.ic_show_on_map, R.drawable.ic_show_on_map)
|
||||
optionsMenuAdapter.item(R.string.shared_string_show_on_map).icon(R.drawable.ic_show_on_map)
|
||||
.listen(listener).reg();
|
||||
optionsMenuAdapter.item(R.string.shared_string_delete)
|
||||
.icons(R.drawable.ic_action_delete_dark, R.drawable.ic_action_delete_dark).listen(listener).reg();
|
||||
.icon(R.drawable.ic_action_delete_dark).listen(listener).reg();
|
||||
optionsMenuAdapter.item(R.string.local_index_mi_reload)
|
||||
.icons(R.drawable.ic_action_refresh_dark, R.drawable.ic_action_refresh_dark).listen(listener).reg();
|
||||
.icon(R.drawable.ic_action_refresh_dark).listen(listener).reg();
|
||||
OsmandPlugin.onOptionsMenuActivity(getActivity(), this, optionsMenuAdapter);
|
||||
for (int j = 0; j < optionsMenuAdapter.length(); j++) {
|
||||
final MenuItem item;
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.FavoritesTreeFragment;
|
||||
import net.osmand.plus.activities.TabActivity;
|
||||
import net.osmand.plus.myplaces.AvailableGPXFragment;
|
||||
import net.osmand.plus.osmedit.OsmEditingPlugin;
|
||||
import net.osmand.plus.views.controls.PagerSlidingTabStrip;
|
||||
import android.app.Activity;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
@ -73,7 +74,6 @@ public class FavoritesActivity extends TabActivity {
|
|||
ViewPager mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
|
||||
List<TabItem> mTabs = new ArrayList<TabItem>();
|
||||
// mTabs.add(new TabItem("\t\t\t", FavoritesTreeFragment.class));
|
||||
mTabs.add(getTabIndicator(R.string.shared_string_my_favorites, FavoritesTreeFragment.class));
|
||||
if (hasGpx) {
|
||||
mTabs.add(getTabIndicator(R.string.shared_string_my_tracks, AvailableGPXFragment.class));
|
||||
|
@ -82,9 +82,14 @@ public class FavoritesActivity extends TabActivity {
|
|||
|
||||
Integer tab = settings.FAVORITES_TAB.get();
|
||||
if (tab == NOTES_TAB) {
|
||||
tab = mTabs.size() -1;
|
||||
if (OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class) != null){
|
||||
tab = mTabs.size() - 2;
|
||||
} else {
|
||||
tab = mTabs.size() - 1;
|
||||
}
|
||||
|
||||
} else if (tab == OSM_EDITS_TAB) {
|
||||
//TODO implement method of counting position for other plugins
|
||||
tab = mTabs.size() - 1;
|
||||
}
|
||||
|
||||
setViewPagerAdapter(mViewPager, mTabs);
|
||||
|
@ -93,7 +98,7 @@ public class FavoritesActivity extends TabActivity {
|
|||
if (tab > mTabs.size() - 1){
|
||||
tab = 0;
|
||||
}
|
||||
mViewPager.setCurrentItem(tab );
|
||||
mViewPager.setCurrentItem(tab);
|
||||
// setupHomeButton();
|
||||
}
|
||||
|
||||
|
@ -122,18 +127,6 @@ public class FavoritesActivity extends TabActivity {
|
|||
}
|
||||
|
||||
|
||||
public Toolbar getClearToolbar(boolean visible) {
|
||||
final Toolbar tb = (Toolbar) findViewById(R.id.bottomControls);
|
||||
tb.setTitle(null);
|
||||
tb.getMenu().clear();
|
||||
tb.setVisibility(visible? View.VISIBLE : View.GONE);
|
||||
return tb;
|
||||
}
|
||||
|
||||
public void setToolbarVisibility(boolean visible){
|
||||
findViewById(R.id.bottomControls).setVisibility(visible? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
|
|
|
@ -1,22 +1,38 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.ProgressImplementation;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 20.01.2015.
|
||||
*/
|
||||
public class DashOsmEditsFragment extends DashBaseFragment {
|
||||
public class DashOsmEditsFragment extends DashBaseFragment implements OsmEditsUploadListener {
|
||||
public static final String TAG = "DASH_OSM_EDITS_FRAGMENT";
|
||||
|
||||
OsmEditingPlugin plugin;
|
||||
|
||||
@Override
|
||||
|
@ -31,6 +47,12 @@ public class DashOsmEditsFragment extends DashBaseFragment {
|
|||
Button manage = ((Button) view.findViewById(R.id.show_all));
|
||||
manage.setTypeface(typeface);
|
||||
manage.setText(R.string.osm_editing_manage);
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startFavoritesActivity(FavoritesActivity.OSM_EDITS_TAB);
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -44,12 +66,113 @@ public class DashOsmEditsFragment extends DashBaseFragment {
|
|||
setupEditings();
|
||||
}
|
||||
|
||||
|
||||
private void setupEditings() {
|
||||
View mainView = getView();
|
||||
if (plugin == null){
|
||||
mainView.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<OsmPoint> dataPoints = new ArrayList<>();
|
||||
getOsmPoints(dataPoints);
|
||||
if (dataPoints.size() == 0){
|
||||
mainView.setVisibility(View.GONE);
|
||||
return;
|
||||
} else {
|
||||
mainView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
LinearLayout osmLayout = (LinearLayout) mainView.findViewById(R.id.notes);
|
||||
osmLayout.removeAllViews();
|
||||
|
||||
for (final OsmPoint point : dataPoints){
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.note, null, false);
|
||||
|
||||
OsmEditsFragment.getOsmEditView(view, point, getMyApplication());
|
||||
ImageButton send =(ImageButton) view.findViewById(R.id.play);
|
||||
send.setImageDrawable(getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_gup_dark));
|
||||
send.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
OpenstreetmapRemoteUtil remotepoi = new OpenstreetmapRemoteUtil(getActivity(), getActivity().getWindow().getDecorView());
|
||||
OsmPoint[] toUpload = new OsmPoint[]{point};
|
||||
OsmBugsRemoteUtil remotebug = new OsmBugsRemoteUtil(getMyApplication());
|
||||
ProgressDialog dialog = ProgressImplementation.createProgressDialog(
|
||||
getActivity(),
|
||||
getString(R.string.uploading),
|
||||
getString(R.string.local_openstreetmap_uploading),
|
||||
ProgressDialog.STYLE_HORIZONTAL).getDialog();
|
||||
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog,DashOsmEditsFragment.this, remotepoi,
|
||||
remotebug, toUpload.length);
|
||||
uploadTask.execute(toUpload);
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.options).setVisibility(View.GONE);
|
||||
view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean poi = point.getGroup() == OsmPoint.Group.POI;
|
||||
String name = poi ?
|
||||
((OpenstreetmapPoint) point).getName() : ((OsmNotesPoint) point).getText();
|
||||
getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(),
|
||||
15, new PointDescription(poi ? PointDescription.POINT_TYPE_POI : PointDescription.POINT_TYPE_OSM_BUG, name), true,
|
||||
point); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
});
|
||||
osmLayout.addView(view);
|
||||
}
|
||||
}
|
||||
|
||||
private void getOsmPoints(ArrayList<OsmPoint> dataPoints) {
|
||||
OpenstreetmapsDbHelper dbpoi = new OpenstreetmapsDbHelper(getActivity());
|
||||
OsmBugsDbHelper dbbug = new OsmBugsDbHelper(getActivity());
|
||||
|
||||
List<OpenstreetmapPoint> l1 = dbpoi.getOpenstreetmapPoints();
|
||||
List<OsmNotesPoint> l2 = dbbug.getOsmbugsPoints();
|
||||
if (l1.isEmpty()){
|
||||
int i = 0;
|
||||
for(OsmPoint point : l2){
|
||||
if (i > 2) {
|
||||
break;
|
||||
}
|
||||
dataPoints.add(point);
|
||||
i++;
|
||||
}
|
||||
} else if (l2.isEmpty()) {
|
||||
int i = 0;
|
||||
for(OsmPoint point : l1){
|
||||
if (i > 2) {
|
||||
break;
|
||||
}
|
||||
dataPoints.add(point);
|
||||
i++;
|
||||
}
|
||||
} else {
|
||||
dataPoints.add(l1.get(0));
|
||||
dataPoints.add(l2.get(0));
|
||||
if (l1.size() > 1){
|
||||
dataPoints.add(l1.get(1));
|
||||
} else if (l2.size() > 1){
|
||||
dataPoints.add(l2.get(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadUpdated(OsmPoint point) {
|
||||
if (!this.isDetached()){
|
||||
onOpenDash();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadEnded(Integer result) {
|
||||
if (!this.isDetached()){
|
||||
onOpenDash();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,11 +88,11 @@ public class LocalOpenstreetmapActivity extends OsmandListActivity {
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
createMenuItem(menu, UPLOAD_ID, R.string.local_openstreetmap_uploadall, R.drawable.ic_action_gup_light, R.drawable.ic_action_gup_dark,
|
||||
createMenuItem(menu, UPLOAD_ID, R.string.local_openstreetmap_uploadall, R.drawable.ic_action_gup_dark, R.drawable.ic_action_gup_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
createMenuItem(menu, BACKUP_ID, R.string.local_osm_changes_backup, R.drawable.ic_action_gsave_light, R.drawable.ic_action_gsave_dark,
|
||||
createMenuItem(menu, BACKUP_ID, R.string.local_osm_changes_backup, R.drawable.ic_action_gsave_dark, R.drawable.ic_action_gsave_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete_all, R.drawable.ic_action_gdiscard_light, R.drawable.ic_action_gdiscard_dark,
|
||||
createMenuItem(menu, DELETE_ID, R.string.shared_string_delete_all, R.drawable.ic_action_gdiscard_dark, R.drawable.ic_action_gdiscard_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.util.Xml;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -15,6 +20,9 @@ import android.widget.AdapterView.OnItemClickListener;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -22,16 +30,24 @@ import net.osmand.plus.ProgressImplementation;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 06.03.2015.
|
||||
*/
|
||||
public class OsmEditsFragment extends ListFragment {
|
||||
public class OsmEditsFragment extends ListFragment implements OsmEditsUploadListener {
|
||||
OsmEditingPlugin plugin;
|
||||
private ArrayList<OsmPoint> dataPoints;
|
||||
private OsmEditsAdapter listAdapter;
|
||||
|
@ -39,8 +55,13 @@ public class OsmEditsFragment extends ListFragment {
|
|||
private OpenstreetmapsDbHelper dbpoi;
|
||||
private OsmBugsDbHelper dbbug;
|
||||
|
||||
private OpenstreetmapRemoteUtil remotepoi;
|
||||
private OsmBugsRemoteUtil remotebug;
|
||||
|
||||
protected OsmPoint[] toUpload = new OsmPoint[0];
|
||||
|
||||
ProgressDialog dialog;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
setHasOptionsMenu(true);
|
||||
|
@ -51,13 +72,73 @@ public class OsmEditsFragment extends ListFragment {
|
|||
dbpoi = new OpenstreetmapsDbHelper(getActivity());
|
||||
dbbug = new OsmBugsDbHelper(getActivity());
|
||||
|
||||
remotepoi = new OpenstreetmapRemoteUtil(getActivity(), getActivity().getWindow().getDecorView());
|
||||
remotebug = new OsmBugsRemoteUtil(getMyApplication());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
menu.clear();
|
||||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
||||
|
||||
if (ScreenOrientationHelper.isOrientationPortrait(getActivity())) {
|
||||
menu = ((FavoritesActivity) getActivity()).getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
((FavoritesActivity) getActivity()).getClearToolbar(false);
|
||||
}
|
||||
MenuItem item = menu.add(R.string.local_openstreetmap_uploadall).
|
||||
setIcon(R.drawable.ic_action_export);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
toUpload = dataPoints.toArray(new OsmPoint[0]);
|
||||
showUploadItemsDialog();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
|
||||
item = menu.add(R.string.local_osm_changes_backup).
|
||||
setIcon(R.drawable.ic_action_gsave_dark);
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
new BackupOpenstreetmapPointAsyncTask().execute(dataPoints.toArray(new OsmPoint[0]));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
item = menu.add(R.string.shared_string_delete_all).
|
||||
setIcon(R.drawable.ic_action_delete_dark);
|
||||
MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
|
||||
b.setMessage(getString(R.string.local_osm_changes_delete_all_confirm, dataPoints.size()));
|
||||
b.setPositiveButton(R.string.shared_string_delete, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Iterator<OsmPoint> it = dataPoints.iterator();
|
||||
while(it.hasNext()) {
|
||||
OsmPoint info = it.next();
|
||||
if (info.getGroup() == OsmPoint.Group.POI) {
|
||||
dbpoi.deletePOI((OpenstreetmapPoint) info);
|
||||
} else if (info.getGroup() == OsmPoint.Group.BUG) {
|
||||
dbbug.deleteAllBugModifications((OsmNotesPoint) info);
|
||||
}
|
||||
it.remove();
|
||||
listAdapter.delete(info);
|
||||
}
|
||||
listAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
b.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
b.show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,12 +157,36 @@ public class OsmEditsFragment extends ListFragment {
|
|||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
OsmPoint it = listAdapter.getItem(position);
|
||||
openPopUpMenu(view, it);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void getOsmEditView(View v, OsmPoint child, OsmandApplication app){
|
||||
TextView viewName = ((TextView) v.findViewById(R.id.name));
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
String idPrefix = (child.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + child.getId();
|
||||
if (child.getGroup() == OsmPoint.Group.POI) {
|
||||
viewName.setText(idPrefix + " (" + ((OpenstreetmapPoint) child).getSubtype() + ") " + ((OpenstreetmapPoint) child).getName());
|
||||
icon.setImageDrawable(app.getIconsCache().
|
||||
getIcon(R.drawable.ic_type_info, R.color.color_distance));
|
||||
} else if (child.getGroup() == OsmPoint.Group.BUG) {
|
||||
viewName.setText(idPrefix + " (" + ((OsmNotesPoint) child).getAuthor() + ") " + ((OsmNotesPoint) child).getText());
|
||||
icon.setImageDrawable(app.getIconsCache().
|
||||
getIcon(R.drawable.ic_type_bug, R.color.color_distance));
|
||||
}
|
||||
|
||||
TextView descr = (TextView) v.findViewById(R.id.descr);
|
||||
if (child.getAction() == OsmPoint.Action.CREATE) {
|
||||
descr.setText(R.string.action_create);
|
||||
} else if (child.getAction() == OsmPoint.Action.MODIFY) {
|
||||
descr.setText(R.string.action_modify);
|
||||
} else if (child.getAction() == OsmPoint.Action.DELETE) {
|
||||
descr.setText(R.string.action_delete);
|
||||
}
|
||||
}
|
||||
|
||||
protected class OsmEditsAdapter extends ArrayAdapter<OsmPoint> {
|
||||
|
||||
public OsmEditsAdapter(List<OsmPoint> points) {
|
||||
|
@ -102,29 +207,10 @@ public class OsmEditsFragment extends ListFragment {
|
|||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
v = inflater.inflate(net.osmand.plus.R.layout.note, parent, false);
|
||||
}
|
||||
TextView viewName = ((TextView) v.findViewById(R.id.name));
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
getOsmEditView(v, child, getMyApplication());
|
||||
|
||||
v.findViewById(R.id.play).setVisibility(View.GONE);
|
||||
String idPrefix = (child.getGroup() == OsmPoint.Group.POI ? "POI " : "Bug ") + " id: " + child.getId();
|
||||
if (child.getGroup() == OsmPoint.Group.POI) {
|
||||
viewName.setText(idPrefix + " (" + ((OpenstreetmapPoint) child).getSubtype() + ") " + ((OpenstreetmapPoint) child).getName());
|
||||
icon.setImageDrawable(getMyApplication().getIconsCache().
|
||||
getIcon(R.drawable.ic_type_info, R.color.color_distance));
|
||||
} else if (child.getGroup() == OsmPoint.Group.BUG) {
|
||||
viewName.setText(idPrefix + " (" + ((OsmNotesPoint) child).getAuthor() + ") " + ((OsmNotesPoint) child).getText());
|
||||
icon.setImageDrawable(getMyApplication().getIconsCache().
|
||||
getIcon(R.drawable.ic_type_bug, R.color.color_distance));
|
||||
}
|
||||
|
||||
TextView descr = (TextView) v.findViewById(R.id.descr);
|
||||
if (child.getAction() == OsmPoint.Action.CREATE) {
|
||||
descr.setText(R.string.action_create);
|
||||
} else if (child.getAction() == OsmPoint.Action.MODIFY) {
|
||||
descr.setText(R.string.action_modify);
|
||||
} else if (child.getAction() == OsmPoint.Action.DELETE) {
|
||||
descr.setText(R.string.action_delete);
|
||||
}
|
||||
v.findViewById(R.id.options).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -166,17 +252,12 @@ public class OsmEditsFragment extends ListFragment {
|
|||
}
|
||||
});
|
||||
item = optionsMenu.getMenu().add(R.string.local_openstreetmap_upload).
|
||||
setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_gup_dark));
|
||||
setIcon(app.getIconsCache().getContentIcon(R.drawable.ic_action_export));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
toUpload = new OsmPoint[]{info};
|
||||
ProgressDialog implementation = ProgressImplementation.createProgressDialog(
|
||||
getActivity(),
|
||||
getString(R.string.uploading),
|
||||
getString(R.string.local_openstreetmap_uploading),
|
||||
ProgressDialog.STYLE_HORIZONTAL).getDialog();
|
||||
implementation.show();
|
||||
showUploadItemsDialog();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -187,4 +268,133 @@ public class OsmEditsFragment extends ListFragment {
|
|||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
private void showUploadItemsDialog(){
|
||||
dialog = ProgressImplementation.createProgressDialog(
|
||||
getActivity(),
|
||||
getString(R.string.uploading),
|
||||
getString(R.string.local_openstreetmap_uploading),
|
||||
ProgressDialog.STYLE_HORIZONTAL).getDialog();
|
||||
UploadOpenstreetmapPointAsyncTask uploadTask = new UploadOpenstreetmapPointAsyncTask(dialog, this, remotepoi,
|
||||
remotebug, toUpload.length);
|
||||
uploadTask.execute(toUpload);
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
public class BackupOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPoint, String> {
|
||||
|
||||
|
||||
private File osmchange;
|
||||
|
||||
public BackupOpenstreetmapPointAsyncTask() {
|
||||
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
||||
osmchange = app.getAppPath("poi_modification.osc");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected String doInBackground(OsmPoint... points) {
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream(osmchange);
|
||||
XmlSerializer sz = Xml.newSerializer();
|
||||
|
||||
sz.setOutput(out, "UTF-8");
|
||||
sz.startDocument("UTF-8", true);
|
||||
sz.startTag("", "osmChange");
|
||||
sz.attribute("", "generator", "OsmAnd");
|
||||
sz.attribute("", "version", "0.6");
|
||||
sz.startTag("", "create");
|
||||
writeContent(sz, points, OsmPoint.Action.CREATE);
|
||||
sz.endTag("", "create");
|
||||
sz.startTag("", "modify");
|
||||
writeContent(sz, points, OsmPoint.Action.MODIFY);
|
||||
sz.endTag("", "modify");
|
||||
sz.startTag("", "delete");
|
||||
writeContent(sz, points, OsmPoint.Action.DELETE);
|
||||
sz.endTag("", "delete");
|
||||
sz.endTag("", "osmChange");
|
||||
sz.endDocument();
|
||||
} catch (Exception e) {
|
||||
return e.getMessage();
|
||||
} finally {
|
||||
try {
|
||||
if(out!= null) out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void writeContent(XmlSerializer sz, OsmPoint[] points, OsmPoint.Action a) throws IllegalArgumentException, IllegalStateException, IOException {
|
||||
for (OsmPoint point : points) {
|
||||
if (point.getGroup() == OsmPoint.Group.POI) {
|
||||
OpenstreetmapPoint p = (OpenstreetmapPoint) point;
|
||||
if (p.getAction() == a) {
|
||||
sz.startTag("", "node");
|
||||
sz.attribute("", "lat", p.getLatitude() + "");
|
||||
sz.attribute("", "lon", p.getLongitude() + "");
|
||||
sz.attribute("", "id", p.getId() + "");
|
||||
sz.attribute("", "version", "1");
|
||||
for (String tag : p.getEntity().getTagKeySet()) {
|
||||
String val = p.getEntity().getTag(tag);
|
||||
sz.startTag("", "tag");
|
||||
sz.attribute("", "k", tag);
|
||||
sz.attribute("", "v", val);
|
||||
sz.endTag("", "tag");
|
||||
}
|
||||
sz.endTag("", "node");
|
||||
}
|
||||
} else if (point.getGroup() == OsmPoint.Group.BUG) {
|
||||
OsmNotesPoint p = (OsmNotesPoint) point;
|
||||
if (p.getAction() == a) {
|
||||
sz.startTag("", "note");
|
||||
sz.attribute("", "lat", p.getLatitude() + "");
|
||||
sz.attribute("", "lon", p.getLongitude() + "");
|
||||
sz.attribute("", "id", p.getId() + "");
|
||||
sz.startTag("", "comment");
|
||||
sz.attribute("", "text", p.getText() +"");
|
||||
sz.endTag("", "comment");
|
||||
sz.endTag("", "note");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
getActivity().setProgressBarIndeterminateVisibility(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
getActivity().setProgressBarIndeterminateVisibility(false);
|
||||
if (result != null) {
|
||||
AccessibleToast.makeText(getActivity(), getString(R.string.local_osm_changes_backup_failed) + " " + result, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
AccessibleToast.makeText(getActivity(), getString(R.string.local_osm_changes_backup_successful, osmchange.getAbsolutePath()), Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadUpdated(OsmPoint point){
|
||||
listAdapter.delete(point);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadEnded(Integer result){
|
||||
listAdapter.notifyDataSetChanged();
|
||||
if (result != null) {
|
||||
AccessibleToast.makeText(getActivity(),
|
||||
MessageFormat.format(getString(R.string.local_openstreetmap_were_uploaded), result), Toast.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 11.03.2015.
|
||||
*/
|
||||
public interface OsmEditsUploadListener {
|
||||
|
||||
public void uploadUpdated(OsmPoint point);
|
||||
|
||||
public void uploadEnded(Integer result);
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.osm.edit.EntityInfo;
|
||||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 11.03.2015.
|
||||
*/
|
||||
public class UploadOpenstreetmapPointAsyncTask extends AsyncTask<OsmPoint, OsmPoint, Integer> {
|
||||
|
||||
private ProgressDialog progress;
|
||||
|
||||
private OpenstreetmapRemoteUtil remotepoi;
|
||||
|
||||
private OsmBugsRemoteUtil remotebug;
|
||||
|
||||
private OpenstreetmapsDbHelper dbpoi;
|
||||
private OsmBugsDbHelper dbbug;
|
||||
|
||||
private int listSize = 0;
|
||||
|
||||
private boolean interruptUploading = false;
|
||||
|
||||
private Fragment ctx;
|
||||
|
||||
public UploadOpenstreetmapPointAsyncTask(ProgressDialog progress,Fragment ctx, OpenstreetmapRemoteUtil remotepoi, OsmBugsRemoteUtil remotebug,
|
||||
int listSize) {
|
||||
this.progress = progress;
|
||||
this.remotepoi = remotepoi;
|
||||
this.remotebug = remotebug;
|
||||
this.listSize = listSize;
|
||||
dbpoi = new OpenstreetmapsDbHelper(ctx.getActivity());
|
||||
dbbug = new OsmBugsDbHelper(ctx.getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer doInBackground(OsmPoint... points) {
|
||||
int uploaded = 0;
|
||||
|
||||
for (OsmPoint point : points) {
|
||||
if (interruptUploading)
|
||||
break;
|
||||
|
||||
if (point.getGroup() == OsmPoint.Group.POI) {
|
||||
OpenstreetmapPoint p = (OpenstreetmapPoint) point;
|
||||
EntityInfo entityInfo = null;
|
||||
if (OsmPoint.Action.CREATE != p.getAction()) {
|
||||
entityInfo = remotepoi.loadNode(p.getEntity());
|
||||
}
|
||||
Node n = remotepoi.commitNodeImpl(p.getAction(), p.getEntity(), entityInfo, p.getComment(), false);
|
||||
if (n != null) {
|
||||
dbpoi.deletePOI(p);
|
||||
publishProgress(p);
|
||||
uploaded++;
|
||||
}
|
||||
} else if (point.getGroup() == OsmPoint.Group.BUG) {
|
||||
OsmNotesPoint p = (OsmNotesPoint) point;
|
||||
boolean success = false;
|
||||
if (p.getAction() == OsmPoint.Action.CREATE) {
|
||||
success = remotebug.createNewBug(p.getLatitude(), p.getLongitude(), p.getText()) == null;
|
||||
} else if (p.getAction() == OsmPoint.Action.MODIFY) {
|
||||
success = remotebug.addingComment(p.getId(), p.getText()) == null;
|
||||
} else if (p.getAction() == OsmPoint.Action.DELETE) {
|
||||
success = remotebug.closingBug(p.getId(), p.getText()) == null;
|
||||
}
|
||||
if (success) {
|
||||
dbbug.deleteAllBugModifications(p);
|
||||
uploaded++;
|
||||
publishProgress(p);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return uploaded;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
interruptUploading = false;
|
||||
|
||||
progress.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
UploadOpenstreetmapPointAsyncTask.this.setInterruptUploading(true);
|
||||
}
|
||||
});
|
||||
progress.setIndeterminate(false);
|
||||
progress.setMax(listSize);
|
||||
progress.setProgress(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Integer result) {
|
||||
if (ctx instanceof OsmEditsUploadListener){
|
||||
((OsmEditsUploadListener)ctx).uploadEnded(result);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInterruptUploading(boolean b) {
|
||||
interruptUploading = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onProgressUpdate(OsmPoint... points) {
|
||||
for(OsmPoint p : points) {
|
||||
if (ctx instanceof OsmEditsUploadListener){
|
||||
((OsmEditsUploadListener)ctx).uploadUpdated(p);
|
||||
}
|
||||
progress.incrementProgressBy(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,22 +1,32 @@
|
|||
package net.osmand.plus.osmo;
|
||||
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.NavigationService;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.dashboard.DashBaseFragment;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
|
||||
/**
|
||||
* Created by Denis
|
||||
* on 20.01.2015.
|
||||
*/
|
||||
public class DashOsmoFragment extends DashBaseFragment {
|
||||
|
||||
public static final String TAG = "DASH_OSMO_FRAGMENT";
|
||||
|
||||
OsMoPlugin plugin;
|
||||
|
||||
@Override
|
||||
|
@ -26,14 +36,105 @@ public class DashOsmoFragment extends DashBaseFragment {
|
|||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_osmo_fragment, container, false);
|
||||
Typeface typeface = FontCache.getRobotoMedium(getActivity());
|
||||
((TextView) view.findViewById(R.id.osmo_text)).setTypeface(typeface);
|
||||
Button manage = (Button) view.findViewById(R.id.manage);
|
||||
|
||||
view.findViewById(R.id.manage).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(getActivity(), OsMoGroupsActivity.class);
|
||||
getActivity().startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
setupHader(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpenDash() {
|
||||
plugin = OsmandPlugin.getEnabledPlugin(OsMoPlugin.class);
|
||||
plugin = OsmandPlugin.getEnabledPlugin(OsMoPlugin.class);
|
||||
|
||||
setupOsMoView();
|
||||
}
|
||||
|
||||
private void setupOsMoView() {
|
||||
View mainView = getView();
|
||||
|
||||
boolean show = plugin != null;
|
||||
if (show) {
|
||||
show = plugin.getService().isEnabled();
|
||||
}
|
||||
if (!show) {
|
||||
mainView.setVisibility(View.GONE);
|
||||
return;
|
||||
} else {
|
||||
mainView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
private void setupHader(final View header) {
|
||||
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.check_item);
|
||||
|
||||
final OsmandApplication app = getMyApplication();
|
||||
trackr.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if(isChecked) {
|
||||
if (plugin != null && plugin.getTracker() != null){
|
||||
plugin.getTracker().enableTracker();
|
||||
}
|
||||
app.startNavigationService(NavigationService.USED_BY_LIVE);
|
||||
//interval setting not needed here, handled centrally in app.startNavigationService
|
||||
//app.getSettings().SERVICE_OFF_INTERVAL.set(0);
|
||||
} else {
|
||||
if (plugin != null && plugin.getTracker() != null){
|
||||
plugin.getTracker().disableTracker();
|
||||
}
|
||||
if (app.getNavigationService() != null) {
|
||||
app.getNavigationService().stopIfNeeded(app,NavigationService.USED_BY_LIVE);
|
||||
}
|
||||
}
|
||||
updateStatus();
|
||||
}
|
||||
});
|
||||
ImageButton share = (ImageButton) header.findViewById(R.id.share);
|
||||
IconsCache cache = getMyApplication().getIconsCache();
|
||||
share.setImageDrawable(cache.getContentIcon(R.drawable.ic_action_gshare_dark));
|
||||
share.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
OsMoGroupsActivity.shareSessionUrl(plugin, getActivity());
|
||||
}
|
||||
});
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
private void updateStatus(){
|
||||
|
||||
View header = getView();
|
||||
if(getView() == null) {
|
||||
return;
|
||||
}
|
||||
CompoundButton trackr = (CompoundButton) header.findViewById(R.id.check_item);
|
||||
if(plugin != null && plugin.getTracker() != null){
|
||||
trackr.setChecked(plugin.getTracker().isEnabledTracker());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void synchronizeGroups(boolean clear){
|
||||
View mainView = getView();
|
||||
|
||||
LinearLayout items = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
items.removeAllViews();
|
||||
if (clear) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void showProgress(boolean show) {
|
||||
if (getView() != null){
|
||||
getView().findViewById(R.id.progress).setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,21 +3,61 @@
|
|||
*/
|
||||
package net.osmand.plus.osmo;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.view.ActionMode;
|
||||
import android.view.*;
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import android.text.Spannable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
|
@ -38,53 +78,23 @@ import net.osmand.plus.activities.OsmandExpandableListActivity;
|
|||
import net.osmand.plus.activities.actions.ShareDialog;
|
||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||
import net.osmand.plus.helpers.ColorDialogs;
|
||||
import net.osmand.plus.helpers.ScreenOrientationHelper;
|
||||
import net.osmand.plus.osmo.OsMoGroups.OsMoGroupsUIListener;
|
||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoGroup;
|
||||
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Paint.Style;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.Spannable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -433,31 +443,31 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
if (device != null && device.getLastLocation() != null) {
|
||||
createMenuItem(menu, SHOW_ON_MAP_ID, R.string.shared_string_show_on_map, R.drawable.ic_action_marker_light, R.drawable.ic_action_marker_dark,
|
||||
createMenuItem(menu, SHOW_ON_MAP_ID, R.string.shared_string_show_on_map, R.drawable.ic_action_marker_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
}
|
||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_light, R.drawable.ic_action_gshare_dark,
|
||||
createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark,
|
||||
// there is a bug in Android 4.2 layout
|
||||
device != null && device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
///
|
||||
if (device != null) {
|
||||
createMenuItem(menu, SETTINGS_DEV_ID, R.string.shared_string_settings, R.drawable.ic_action_settings_enabled_light, R.drawable.ic_action_settings_enabled_dark,
|
||||
createMenuItem(menu, SETTINGS_DEV_ID, R.string.shared_string_settings, R.drawable.ic_action_settings_enabled_dark,
|
||||
// there is a bug in Android 4.2 layout
|
||||
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
}
|
||||
if (device != null && device.getLastLocation() != null) {
|
||||
MenuItem menuItem = createMenuItem(menu, TRACK_DEV_ID, R.string.osmo_set_moving_target, R.drawable.ic_action_flage_light, R.drawable.ic_action_flage_dark,
|
||||
// there is a bug in Android 4.2 layout
|
||||
MenuItem menuItem = createMenuItem(menu, TRACK_DEV_ID, R.string.osmo_set_moving_target, R.drawable.ic_action_flage_dark,
|
||||
// there is a bug in Android 4.2 layout
|
||||
device.getLastLocation() != null ? MenuItemCompat.SHOW_AS_ACTION_NEVER : MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
menuItem.setTitleCondensed(getString(R.string.osmo_follow));
|
||||
}
|
||||
if (group != null) {
|
||||
createMenuItem(menu, GROUP_INFO, R.string.osmo_group_info, R.drawable.ic_action_info_light, R.drawable.ic_action_info_dark,
|
||||
createMenuItem(menu, GROUP_INFO, R.string.osmo_group_info, R.drawable.ic_action_info_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
}
|
||||
if ((group != null && !group.isMainGroup()) || (device != null && device.getGroup().isMainGroup())) {
|
||||
createMenuItem(menu, DELETE_ACTION_ID, R.string.shared_string_delete,
|
||||
R.drawable.ic_action_delete_light, R.drawable.ic_action_delete_dark,
|
||||
R.drawable.ic_action_delete_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
}
|
||||
|
||||
|
@ -664,7 +674,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == 0) {
|
||||
shareSessionUrl();
|
||||
shareSessionUrl(osMoPlugin, OsMoGroupsActivity.this);
|
||||
} else {
|
||||
OsMoService service = osMoPlugin.getService();
|
||||
SessionInfo ci = service.getCurrentSessionInfo();
|
||||
|
@ -676,15 +686,15 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
bld.show();
|
||||
}
|
||||
|
||||
private void shareSessionUrl() {
|
||||
public static void shareSessionUrl(OsMoPlugin osMoPlugin, Activity ctx) {
|
||||
String sessionURL = osMoPlugin.getTracker().getSessionURL();
|
||||
if(sessionURL == null ) {
|
||||
AccessibleToast.makeText(this, R.string.osmo_session_not_available, Toast.LENGTH_SHORT).show();
|
||||
AccessibleToast.makeText(ctx, R.string.osmo_session_not_available, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
ShareDialog dlg = new ShareDialog(this);
|
||||
dlg.setTitle(getString(R.string.osmo_share_session));
|
||||
ShareDialog dlg = new ShareDialog(ctx);
|
||||
dlg.setTitle(ctx.getString(R.string.osmo_share_session));
|
||||
dlg.viewContent(sessionURL);
|
||||
dlg.shareURLOrText(sessionURL, getString(R.string.osmo_session_id_share, sessionURL), null);
|
||||
dlg.shareURLOrText(sessionURL, ctx.getString(R.string.osmo_session_id_share, sessionURL), null);
|
||||
dlg.showDialog();
|
||||
}
|
||||
}
|
||||
|
@ -850,7 +860,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
final EditText description = (EditText) v.findViewById(R.id.Description);
|
||||
final EditText name = (EditText) v.findViewById(R.id.Name);
|
||||
final CheckBox onlyByInvite = (CheckBox) v.findViewById(R.id.OnlyByInvite);
|
||||
final TextView warnCreate = (TextView) v.findViewById(R.id.osmo_group_create_info);
|
||||
|
||||
final TextView warnCreateDesc = (TextView) v.findViewById(R.id.osmo_group_create_dinfo);
|
||||
View.OnClickListener click = new View.OnClickListener() {
|
||||
|
||||
|
@ -860,7 +870,9 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
warnCreateDesc.setVisibility(vls == View.VISIBLE? View.GONE : View.VISIBLE);
|
||||
}
|
||||
};
|
||||
warnCreate.setOnClickListener(click);
|
||||
ImageButton info = (ImageButton) v.findViewById(R.id.info);
|
||||
info.setImageDrawable(app.getIconsCache().getContentIcon(R.drawable.ic_action_info_dark));
|
||||
info.setOnClickListener(click);
|
||||
warnCreateDesc.setOnClickListener(click);
|
||||
|
||||
builder.setView(v);
|
||||
|
@ -957,18 +969,26 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
menu.clear();
|
||||
Menu oldMenu = menu;
|
||||
boolean portrait = ScreenOrientationHelper.isOrientationPortrait(this);
|
||||
if (portrait) {
|
||||
menu = getClearToolbar(true).getMenu();
|
||||
} else {
|
||||
getClearToolbar(false);
|
||||
}
|
||||
createMenuItem(menu, CONNECT_TO, R.string.osmo_connect,
|
||||
0, 0,/*R.drawable.ic_action_marker_light,*/
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
createMenuItem(menu, SHARE_SESSION, R.string.osmo_share_session,
|
||||
R.drawable.ic_action_gshare_dark, R.drawable.ic_action_gshare_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
R.drawable.ic_action_gshare_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
createMenuItem(menu, CREATE_GROUP, R.string.osmo_create_group,
|
||||
R.drawable.ic_action_plus_dark, R.drawable.ic_action_plus_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT);
|
||||
createMenuItem(menu, SETTINGS_ID, R.string.shared_string_settings,
|
||||
R.drawable.ic_action_settings_enabled_dark, R.drawable.ic_action_settings_enabled_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
|
||||
R.drawable.ic_group_add,
|
||||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
createMenuItem(oldMenu, SETTINGS_ID, R.string.shared_string_settings,
|
||||
R.drawable.ic_action_settings_enabled_dark,
|
||||
MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
|
@ -1220,7 +1240,11 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
if(selectedObject == model) {
|
||||
row.setBackgroundColor(getResources().getColor(R.color.row_selection_color));
|
||||
} else {
|
||||
row.setBackgroundColor(Color.TRANSPARENT);
|
||||
if (app.getSettings().isLightContent()){
|
||||
row.setBackgroundResource(R.drawable.expandable_list_item_background_light);
|
||||
} else {
|
||||
row.setBackgroundResource(R.drawable.expandable_list_item_background_dark);
|
||||
}
|
||||
}
|
||||
TextView label = (TextView) row.findViewById(R.id.osmo_label);
|
||||
TextView labelTime = (TextView) row.findViewById(R.id.osmo_label_time);
|
||||
|
|
|
@ -2,26 +2,23 @@ package net.osmand.plus.parkingpoint;
|
|||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.util.TimeUtils;
|
||||
import android.text.format.DateFormat;
|
||||
import android.text.format.DateUtils;
|
||||
import android.text.format.Time;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import net.osmand.Location;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
|
@ -52,6 +49,16 @@ public class DashParkingFragment extends DashLocationFragment {
|
|||
});
|
||||
remove.setTypeface(typeface);
|
||||
|
||||
view.findViewById(R.id.parking_header).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LatLon point = plugin.getParkingPosition();
|
||||
getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(),
|
||||
15, new PointDescription(PointDescription.POINT_TYPE_FAVORITE, plugin.getParkingDescription(getActivity())), true,
|
||||
point); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -75,29 +82,41 @@ public class DashParkingFragment extends DashLocationFragment {
|
|||
|
||||
LatLon loc = getDefaultLocation();
|
||||
LatLon position = plugin.getParkingPosition();
|
||||
boolean limited = plugin.getParkingType();
|
||||
boolean limited = plugin.getParkingType();
|
||||
String parking_name = limited ?
|
||||
getString(R.string.parking_place_limited) : getString(R.string.parking_place);
|
||||
if (limited) {
|
||||
long endtime = plugin.getParkingTime();
|
||||
long currTime = Calendar.getInstance().getTimeInMillis();
|
||||
String time = getFormattedTime(endtime - currTime);
|
||||
((TextView)mainView.findViewById(R.id.time_left)).setText(time);
|
||||
long timeDiff = endtime - currTime;
|
||||
String time = getFormattedTime(timeDiff);
|
||||
TextView timeLeft = (TextView) mainView.findViewById(R.id.time_left);
|
||||
TextView leftLabel = (TextView) mainView.findViewById(R.id.left_lbl);
|
||||
timeLeft.setText(time);
|
||||
if (timeDiff < 0) {
|
||||
timeLeft.setTextColor(Color.RED);
|
||||
leftLabel.setTextColor(Color.RED);
|
||||
leftLabel.setText(R.string.osmand_parking_outdated);
|
||||
} else {
|
||||
timeLeft.setTextColor(Color.WHITE);
|
||||
leftLabel.setTextColor(Color.WHITE);
|
||||
leftLabel.setText(R.string.osmand_parking_time_left);
|
||||
}
|
||||
mainView.findViewById(R.id.left_lbl).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
((TextView)mainView.findViewById(R.id.time_left)).setText("");
|
||||
((TextView) mainView.findViewById(R.id.time_left)).setText("");
|
||||
mainView.findViewById(R.id.left_lbl).setVisibility(View.GONE);
|
||||
}
|
||||
((TextView) mainView.findViewById(R.id.name)).setText(parking_name);
|
||||
ImageView direction = (ImageView) mainView.findViewById(R.id.direction_icon);
|
||||
if (loc != null){
|
||||
if (loc != null) {
|
||||
DashLocationView dv = new DashLocationView(direction, (TextView) mainView.findViewById(R.id.distance), position);
|
||||
dv.paint = false;
|
||||
dv.arrowResId = R.drawable.ic_parking_postion_arrow;
|
||||
distances.add(dv);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
String getFormattedTime(long timeInMillis) {
|
||||
|
@ -106,16 +125,20 @@ public class DashParkingFragment extends DashLocationFragment {
|
|||
}
|
||||
StringBuilder timeStringBuilder = new StringBuilder();
|
||||
int hours = (int) timeInMillis / (1000 * 60 * 60);
|
||||
int miutes = (int) timeInMillis / (1000 * 60 * 60 * 60);
|
||||
int minMills = (int) timeInMillis % (1000 * 60 * 60);
|
||||
int minutes = minMills / (1000 * 60);
|
||||
if (hours > 0) {
|
||||
timeStringBuilder.append(hours);
|
||||
timeStringBuilder.append(" ");
|
||||
timeStringBuilder.append(getResources().getString(R.string.osmand_parking_hour));
|
||||
}
|
||||
|
||||
timeStringBuilder.append(" ");
|
||||
timeStringBuilder.append(miutes);
|
||||
timeStringBuilder.append(minutes);
|
||||
timeStringBuilder.append(" ");
|
||||
timeStringBuilder.append(getResources().getString(R.string.osmand_parking_minute));
|
||||
|
||||
|
||||
return timeStringBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,45 +136,12 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
|
|||
|
||||
@Override
|
||||
public String getObjectDescription(Object o) {
|
||||
if (o instanceof LatLon) {
|
||||
StringBuilder timeLimitDesc = new StringBuilder();
|
||||
timeLimitDesc.append(map.getString(R.string.osmand_parking_position_description_add_time) + " ");
|
||||
timeLimitDesc.append(getFormattedTime(plugin.getStartParkingTime()) + ".");
|
||||
if (plugin.getParkingType()) {
|
||||
// long parkingTime = settings.getParkingTime();
|
||||
// long parkingStartTime = settings.getStartParkingTime();
|
||||
// Time time = new Time();
|
||||
// time.set(parkingTime);
|
||||
// timeLimitDesc.append(map.getString(R.string.osmand_parking_position_description_add) + " ");
|
||||
// timeLimitDesc.append(time.hour);
|
||||
// timeLimitDesc.append(":");
|
||||
// int minute = time.minute;
|
||||
// timeLimitDesc.append(minute<10 ? "0" + minute : minute);
|
||||
// if (!DateFormat.is24HourFormat(map.getApplicationContext())) {
|
||||
// timeLimitDesc.append(time.hour >= 12 ? map.getString(R.string.osmand_parking_pm) :
|
||||
// map.getString(R.string.osmand_parking_am));
|
||||
// }
|
||||
timeLimitDesc.append(map.getString(R.string.osmand_parking_position_description_add) + " ");
|
||||
timeLimitDesc.append(getFormattedTime(plugin.getParkingTime()));
|
||||
}
|
||||
return map.getString(R.string.osmand_parking_position_description, timeLimitDesc.toString());
|
||||
}
|
||||
return null;
|
||||
return plugin.getParkingDescription(map);
|
||||
|
||||
}
|
||||
|
||||
String getFormattedTime(long timeInMillis) {
|
||||
StringBuilder timeStringBuilder = new StringBuilder();
|
||||
Time time = new Time();
|
||||
time.set(timeInMillis);
|
||||
timeStringBuilder.append(time.hour);
|
||||
timeStringBuilder.append(":");
|
||||
int minute = time.minute;
|
||||
timeStringBuilder.append(minute < 10 ? "0" + minute : minute);
|
||||
if (!DateFormat.is24HourFormat(map)) {
|
||||
timeStringBuilder.append(time.hour >= 12 ? map.getString(R.string.osmand_parking_pm) : map
|
||||
.getString(R.string.osmand_parking_am));
|
||||
}
|
||||
return timeStringBuilder.toString();
|
||||
public String getFormattedTime(long time){
|
||||
return plugin.getFormattedTime(time, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,6 +27,8 @@ import android.app.Dialog;
|
|||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Paint;
|
||||
import android.text.format.DateFormat;
|
||||
import android.text.format.Time;
|
||||
import android.view.View;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
|
@ -524,4 +526,43 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
|||
public int getLogoResourceId() {
|
||||
return R.drawable.ic_action_parking_dark;
|
||||
}
|
||||
|
||||
String getFormattedTime(long timeInMillis, Activity ctx) {
|
||||
StringBuilder timeStringBuilder = new StringBuilder();
|
||||
Time time = new Time();
|
||||
time.set(timeInMillis);
|
||||
timeStringBuilder.append(time.hour);
|
||||
timeStringBuilder.append(":");
|
||||
int minute = time.minute;
|
||||
timeStringBuilder.append(minute < 10 ? "0" + minute : minute);
|
||||
if (!DateFormat.is24HourFormat(ctx)) {
|
||||
timeStringBuilder.append(time.hour >= 12 ? ctx.getString(R.string.osmand_parking_pm) : ctx
|
||||
.getString(R.string.osmand_parking_am));
|
||||
}
|
||||
return timeStringBuilder.toString();
|
||||
}
|
||||
|
||||
public String getParkingDescription(Activity ctx) {
|
||||
StringBuilder timeLimitDesc = new StringBuilder();
|
||||
timeLimitDesc.append(ctx.getString(R.string.osmand_parking_position_description_add_time) + " ");
|
||||
timeLimitDesc.append(getFormattedTime(getStartParkingTime(), ctx) + ".");
|
||||
if (getParkingType()) {
|
||||
// long parkingTime = settings.getParkingTime();
|
||||
// long parkingStartTime = settings.getStartParkingTime();
|
||||
// Time time = new Time();
|
||||
// time.set(parkingTime);
|
||||
// timeLimitDesc.append(map.getString(R.string.osmand_parking_position_description_add) + " ");
|
||||
// timeLimitDesc.append(time.hour);
|
||||
// timeLimitDesc.append(":");
|
||||
// int minute = time.minute;
|
||||
// timeLimitDesc.append(minute<10 ? "0" + minute : minute);
|
||||
// if (!DateFormat.is24HourFormat(map.getApplicationContext())) {
|
||||
// timeLimitDesc.append(time.hour >= 12 ? map.getString(R.string.osmand_parking_pm) :
|
||||
// map.getString(R.string.osmand_parking_am));
|
||||
// }
|
||||
timeLimitDesc.append(ctx.getString(R.string.osmand_parking_position_description_add) + " ");
|
||||
timeLimitDesc.append(getFormattedTime(getParkingTime(),ctx));
|
||||
}
|
||||
return ctx.getString(R.string.osmand_parking_position_description, timeLimitDesc.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,11 @@ public class DirectionDrawable extends Drawable {
|
|||
arrowImage = iconsCache.getIcon(resourceId, clrId);
|
||||
}
|
||||
|
||||
public void setImage(int resourceId){
|
||||
IconsCache iconsCache = ((OsmandApplication) ctx.getApplicationContext()).getIconsCache();
|
||||
arrowImage = iconsCache.getIcon(resourceId, 0);
|
||||
}
|
||||
|
||||
|
||||
public DirectionDrawable(Context ctx, float width, float height) {
|
||||
this.ctx = ctx;
|
||||
|
|
|
@ -1,197 +0,0 @@
|
|||
package net.osmand.plus.views.controls;
|
||||
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Gravity;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.OvershootInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
/*
|
||||
* Created by John Hogan
|
||||
* https://gist.github.com/Jogan/9def6110edf3247825c9
|
||||
*/
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public class FloatingActionButton extends View {
|
||||
|
||||
final static OvershootInterpolator overshootInterpolator = new OvershootInterpolator();
|
||||
final static AccelerateInterpolator accelerateInterpolator = new AccelerateInterpolator();
|
||||
|
||||
Context context;
|
||||
Paint mButtonPaint;
|
||||
Paint mDrawablePaint;
|
||||
Bitmap mBitmap;
|
||||
boolean mHidden = false;
|
||||
|
||||
public FloatingActionButton(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
init(Color.WHITE);
|
||||
}
|
||||
|
||||
public void setFloatingActionButtonColor(int FloatingActionButtonColor) {
|
||||
init(FloatingActionButtonColor);
|
||||
}
|
||||
|
||||
public void setFloatingActionButtonDrawable(Drawable FloatingActionButtonDrawable) {
|
||||
mBitmap = ((BitmapDrawable) FloatingActionButtonDrawable).getBitmap();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void init(int FloatingActionButtonColor) {
|
||||
setWillNotDraw(false);
|
||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
mButtonPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
mButtonPaint.setColor(FloatingActionButtonColor);
|
||||
mButtonPaint.setStyle(Paint.Style.FILL);
|
||||
mButtonPaint.setShadowLayer(10.0f, 0.0f, 3.5f, Color.argb(100, 0, 0, 0));
|
||||
mDrawablePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
setClickable(true);
|
||||
canvas.drawCircle(getWidth() / 2, getHeight() / 2, (float) (getWidth() / 2.6), mButtonPaint);
|
||||
canvas.drawBitmap(mBitmap, (getWidth() - mBitmap.getWidth()) / 2,
|
||||
(getHeight() - mBitmap.getHeight()) / 2, mDrawablePaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
setAlpha(1.0f);
|
||||
} else if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
setAlpha(0.6f);
|
||||
}
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
|
||||
public void hideFloatingActionButton() {
|
||||
if (!mHidden) {
|
||||
ObjectAnimator scaleX = ObjectAnimator.ofFloat(this, "scaleX", 1, 0);
|
||||
ObjectAnimator scaleY = ObjectAnimator.ofFloat(this, "scaleY", 1, 0);
|
||||
AnimatorSet animSetXY = new AnimatorSet();
|
||||
animSetXY.playTogether(scaleX, scaleY);
|
||||
animSetXY.setInterpolator(accelerateInterpolator);
|
||||
animSetXY.setDuration(100);
|
||||
animSetXY.start();
|
||||
mHidden = true;
|
||||
setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void showFloatingActionButton() {
|
||||
if (mHidden) {
|
||||
ObjectAnimator scaleX = ObjectAnimator.ofFloat(this, "scaleX", 0, 1);
|
||||
ObjectAnimator scaleY = ObjectAnimator.ofFloat(this, "scaleY", 0, 1);
|
||||
AnimatorSet animSetXY = new AnimatorSet();
|
||||
animSetXY.playTogether(scaleX, scaleY);
|
||||
animSetXY.setInterpolator(overshootInterpolator);
|
||||
animSetXY.setDuration(200);
|
||||
animSetXY.start();
|
||||
mHidden = false;
|
||||
setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
return mHidden;
|
||||
}
|
||||
|
||||
static public class Builder {
|
||||
private FrameLayout.LayoutParams params;
|
||||
private final Activity activity;
|
||||
int gravity = Gravity.BOTTOM | Gravity.RIGHT; // default bottom right
|
||||
Drawable drawable;
|
||||
int color = Color.WHITE;
|
||||
int size = 0;
|
||||
float scale = 0;
|
||||
|
||||
public Builder(Activity context) {
|
||||
scale = context.getResources().getDisplayMetrics().density;
|
||||
size = convertToPixels(72, scale); // default size is 72dp by 72dp
|
||||
params = new FrameLayout.LayoutParams(size, size);
|
||||
params.gravity = gravity;
|
||||
|
||||
this.activity = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gravity for the FAB
|
||||
*/
|
||||
public Builder withGravity(int gravity) {
|
||||
this.gravity = gravity;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the margins for the FAB in dp
|
||||
*/
|
||||
public Builder withMargins(int left, int top, int right, int bottom) {
|
||||
params.setMargins(
|
||||
convertToPixels(left, scale),
|
||||
convertToPixels(top, scale),
|
||||
convertToPixels(right, scale),
|
||||
convertToPixels(bottom, scale));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the FAB drawable
|
||||
*/
|
||||
public Builder withDrawable(final Drawable drawable) {
|
||||
this.drawable = drawable;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the FAB color
|
||||
*/
|
||||
public Builder withButtonColor(final int color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the FAB size in dp
|
||||
*/
|
||||
public Builder withButtonSize(int size) {
|
||||
size = convertToPixels(size, scale);
|
||||
params = new FrameLayout.LayoutParams(size, size);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FloatingActionButton create() {
|
||||
final FloatingActionButton button = new FloatingActionButton(activity);
|
||||
button.setFloatingActionButtonColor(this.color);
|
||||
button.setFloatingActionButtonDrawable(this.drawable);
|
||||
params.gravity = this.gravity;
|
||||
ViewGroup root = (ViewGroup) activity.findViewById(android.R.id.content);
|
||||
root.addView(button, params);
|
||||
return button;
|
||||
}
|
||||
|
||||
// The calculation (value * scale + 0.5f) is a widely used to convert to dps to pixel units
|
||||
// based on density scale
|
||||
// see developer.android.com (Supporting Multiple Screen Sizes)
|
||||
private int convertToPixels(int dp, float scale){
|
||||
return (int) (dp * scale + 0.5f) ;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue