Summary
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..412eeda
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b9d6bd9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,215 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+
+[Dd]ebug/
+[Rr]elease/
+x64/
+build/
+[Bb]in/
+[Oo]bj/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.log
+*.scc
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+*.cachefile
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+*.ncrunch*
+.*crunch*.local.xml
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.Publish.xml
+*.pubxml
+
+# NuGet Packages Directory
+## TODO: If you have NuGet Package Restore enabled, uncomment the next line
+#packages/
+
+# Windows Azure Build Output
+csx
+*.build.csdef
+
+# Windows Store app package directory
+AppPackages/
+
+# Others
+sql/
+*.Cache
+ClientBin/
+[Ss]tyle[Cc]op.*
+~$*
+*~
+*.dbmdl
+*.[Pp]ublish.xml
+*.pfx
+*.publishsettings
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+App_Data/*.mdf
+App_Data/*.ldf
+
+#############
+## Windows detritus
+#############
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+
+# Folder config file
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Mac crap
+.DS_Store
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist/
+build/
+eggs/
+parts/
+var/
+sdist/
+develop-eggs/
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000..21b86d3
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.climbingguide.main"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:allowBackup="true"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="org.climbingguide.main.MainActivity"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+
+
+ </activity>
+
+ <activity android:name="org.climbingguide.gui.ShowAreasSearch" android:label="@string/app_name"/>
+ <activity android:name="org.climbingguide.gui.ShowSectorsSearch" android:label="@string/app_name"/>
+ <activity android:name="org.climbingguide.gui.ShowRoutesSearch" android:label="@string/app_name"/>
+
+ <activity android:name="org.climbingguide.gui.ShowAreas" android:label="@string/app_name"/>
+ <activity android:name="org.climbingguide.gui.ShowRoute" android:label="@string/app_name"/>
+ <activity android:name="org.climbingguide.gui.ShowRoutes" android:label="@string/app_name"/>
+ <activity android:name="org.climbingguide.gui.ShowSectors" android:label="@string/app_name"/>
+
+ <activity android:name="org.climbingguide.main.MarekLauncher" android:label="@string/app_name"/>
+ <activity android:name="org.climbingguide.main.LukasLauncher" android:label="@string/app_name"/>
+
+ </application>
+
+</manifest>
diff --git a/Projekt/.gitignore b/Projekt/.gitignore
new file mode 100644
index 0000000..d8fe4fa
--- /dev/null
+++ b/Projekt/.gitignore
@@ -0,0 +1 @@
+/.project
diff --git a/gen/org/climbingguide/main/BuildConfig.java b/gen/org/climbingguide/main/BuildConfig.java
new file mode 100644
index 0000000..00a161b
--- /dev/null
+++ b/gen/org/climbingguide/main/BuildConfig.java
@@ -0,0 +1,6 @@
+/** Automatically generated file. DO NOT MODIFY */
+package org.climbingguide.main;
+
+public final class BuildConfig {
+ public final static boolean DEBUG = true;
+}
\ No newline at end of file
diff --git a/gen/org/climbingguide/main/R.java b/gen/org/climbingguide/main/R.java
new file mode 100644
index 0000000..f8fe3cb
--- /dev/null
+++ b/gen/org/climbingguide/main/R.java
@@ -0,0 +1,157 @@
+/* AUTO-GENERATED FILE. DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found. It
+ * should not be modified by hand.
+ */
+
+package org.climbingguide.main;
+
+public final class R {
+ public static final class array {
+ public static final int nav_drawer_icons=0x7f080001;
+ public static final int nav_drawer_items=0x7f080000;
+ }
+ public static final class attr {
+ }
+ public static final class color {
+ public static final int counter_text_bg=0x7f050004;
+ public static final int counter_text_color=0x7f050005;
+ public static final int list_background=0x7f050001;
+ public static final int list_background_pressed=0x7f050002;
+ public static final int list_divider=0x7f050003;
+ public static final int list_item_title=0x7f050000;
+ }
+ public static final class dimen {
+ /** Default screen margins, per the Android Design guidelines.
+
+ Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
+
+ */
+ public static final int activity_horizontal_margin=0x7f060000;
+ public static final int activity_vertical_margin=0x7f060001;
+ }
+ public static final class drawable {
+ public static final int counter_bg=0x7f020000;
+ public static final int ic_action_location_searching=0x7f020001;
+ public static final int ic_action_new=0x7f020002;
+ public static final int ic_action_refresh=0x7f020003;
+ public static final int ic_action_search=0x7f020004;
+ public static final int ic_communities=0x7f020005;
+ public static final int ic_drawer=0x7f020006;
+ public static final int ic_home=0x7f020007;
+ public static final int ic_launcher=0x7f020008;
+ public static final int ic_pages=0x7f020009;
+ public static final int ic_people=0x7f02000a;
+ public static final int ic_photos=0x7f02000b;
+ public static final int ic_whats_hot=0x7f02000c;
+ public static final int list_item_bg_normal=0x7f02000d;
+ public static final int list_item_bg_pressed=0x7f02000e;
+ public static final int list_selector=0x7f02000f;
+ }
+ public static final class id {
+ public static final int LinearLayout1=0x7f0b0003;
+ public static final int action_search=0x7f0b001a;
+ public static final int action_settings=0x7f0b001b;
+ public static final int button1=0x7f0b000e;
+ public static final int counter=0x7f0b0012;
+ public static final int drawer_layout=0x7f0b0000;
+ public static final int editText1=0x7f0b0005;
+ public static final int editText2=0x7f0b0007;
+ public static final int editText3=0x7f0b0009;
+ public static final int editText4=0x7f0b000b;
+ public static final int editText5=0x7f0b000d;
+ public static final int frame_container=0x7f0b0001;
+ public static final int icon=0x7f0b0010;
+ public static final int listView1=0x7f0b0013;
+ public static final int list_slidermenu=0x7f0b0002;
+ public static final int textView1=0x7f0b0004;
+ public static final int textView2=0x7f0b0006;
+ public static final int textView3=0x7f0b0008;
+ public static final int textView4=0x7f0b000a;
+ public static final int textView5=0x7f0b000c;
+ public static final int textView6=0x7f0b000f;
+ public static final int textViewBolts=0x7f0b0018;
+ public static final int textViewDifficulty=0x7f0b0017;
+ public static final int textViewLatitude=0x7f0b0015;
+ public static final int textViewLength=0x7f0b0016;
+ public static final int textViewLongitude=0x7f0b0019;
+ public static final int textViewName=0x7f0b0014;
+ public static final int title=0x7f0b0011;
+ }
+ public static final class layout {
+ public static final int activity_main=0x7f030000;
+ public static final int create_route=0x7f030001;
+ public static final int drawer_list_item=0x7f030002;
+ public static final int fragment_list_item=0x7f030003;
+ public static final int route=0x7f030004;
+ }
+ public static final class menu {
+ public static final int main=0x7f0a0000;
+ }
+ public static final class string {
+ public static final int Update=0x7f070005;
+ public static final int action_settings=0x7f070001;
+ public static final int action_update=0x7f07000f;
+ public static final int app_name=0x7f070000;
+ public static final int areaName=0x7f07001d;
+ public static final int bolts_=0x7f07000d;
+ public static final int create=0x7f070006;
+ public static final int desc_list_item_icon=0x7f07001e;
+ public static final int difficulty_=0x7f07000a;
+ public static final int drawer_close=0x7f070011;
+ public static final int drawer_open=0x7f070010;
+ public static final int hello_world=0x7f070002;
+ public static final int large_text=0x7f070009;
+ public static final int latitude_=0x7f07000b;
+ public static final int length_=0x7f07000c;
+ public static final int longitude_=0x7f07000e;
+ public static final int newArea=0x7f070013;
+ public static final int newRoute=0x7f070012;
+ public static final int newSector=0x7f070014;
+ public static final int routeBolts=0x7f070019;
+ public static final int routeDiff=0x7f070017;
+ public static final int routeLength=0x7f070018;
+ public static final int routeName=0x7f070015;
+ public static final int routeSector=0x7f070016;
+ public static final int search=0x7f070007;
+ public static final int search_hint=0x7f070008;
+ public static final int sector=0x7f070003;
+ public static final int sectorArea=0x7f07001c;
+ public static final int sectorName=0x7f07001b;
+ public static final int send=0x7f07001a;
+ public static final int update=0x7f070004;
+ }
+ public static final class style {
+ /**
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+
+
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+
+
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+
+ API 11 theme customizations can go here.
+
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+
+ API 14 theme customizations can go here.
+ */
+ public static final int AppBaseTheme=0x7f090000;
+ /** Application theme.
+ All customizations that are NOT specific to a particular API-level can go here.
+ */
+ public static final int AppTheme=0x7f090001;
+ }
+ public static final class xml {
+ public static final int searchable=0x7f040000;
+ }
+}
diff --git a/ic_launcher-web.png b/ic_launcher-web.png
new file mode 100644
index 0000000..a18cbb4
--- /dev/null
+++ b/ic_launcher-web.png
Binary files differ
diff --git a/libs/android-support-v4.jar b/libs/android-support-v4.jar
new file mode 100644
index 0000000..96644ed
--- /dev/null
+++ b/libs/android-support-v4.jar
Binary files differ
diff --git a/proguard-project.txt b/proguard-project.txt
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/project.properties b/project.properties
new file mode 100644
index 0000000..ce39f2d
--- /dev/null
+++ b/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-18
diff --git a/res/drawable-hdpi/ic_action_location_searching.png b/res/drawable-hdpi/ic_action_location_searching.png
new file mode 100644
index 0000000..0ae2a58
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_location_searching.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_action_new.png b/res/drawable-hdpi/ic_action_new.png
new file mode 100644
index 0000000..d866d61
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_new.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_action_refresh.png b/res/drawable-hdpi/ic_action_refresh.png
new file mode 100644
index 0000000..dae2790
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_refresh.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_action_search.png b/res/drawable-hdpi/ic_action_search.png
new file mode 100644
index 0000000..772e359
--- /dev/null
+++ b/res/drawable-hdpi/ic_action_search.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_communities.png b/res/drawable-hdpi/ic_communities.png
new file mode 100644
index 0000000..b48522f
--- /dev/null
+++ b/res/drawable-hdpi/ic_communities.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_drawer.png b/res/drawable-hdpi/ic_drawer.png
new file mode 100644
index 0000000..ff7b1de
--- /dev/null
+++ b/res/drawable-hdpi/ic_drawer.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_home.png b/res/drawable-hdpi/ic_home.png
new file mode 100644
index 0000000..2265126
--- /dev/null
+++ b/res/drawable-hdpi/ic_home.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_launcher.png b/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..9d64579
--- /dev/null
+++ b/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_pages.png b/res/drawable-hdpi/ic_pages.png
new file mode 100644
index 0000000..3ea4bd4
--- /dev/null
+++ b/res/drawable-hdpi/ic_pages.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_people.png b/res/drawable-hdpi/ic_people.png
new file mode 100644
index 0000000..efedfe9
--- /dev/null
+++ b/res/drawable-hdpi/ic_people.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_photos.png b/res/drawable-hdpi/ic_photos.png
new file mode 100644
index 0000000..33cfc1d
--- /dev/null
+++ b/res/drawable-hdpi/ic_photos.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_whats_hot.png b/res/drawable-hdpi/ic_whats_hot.png
new file mode 100644
index 0000000..142746a
--- /dev/null
+++ b/res/drawable-hdpi/ic_whats_hot.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_location_searching.png b/res/drawable-mdpi/ic_action_location_searching.png
new file mode 100644
index 0000000..90ca6e5
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_location_searching.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_new.png b/res/drawable-mdpi/ic_action_new.png
new file mode 100644
index 0000000..f17e798
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_new.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_refresh.png b/res/drawable-mdpi/ic_action_refresh.png
new file mode 100644
index 0000000..94ab6f4
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_refresh.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_action_search.png b/res/drawable-mdpi/ic_action_search.png
new file mode 100644
index 0000000..4edb1ff
--- /dev/null
+++ b/res/drawable-mdpi/ic_action_search.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_communities.png b/res/drawable-mdpi/ic_communities.png
new file mode 100644
index 0000000..773fd2b
--- /dev/null
+++ b/res/drawable-mdpi/ic_communities.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_drawer.png b/res/drawable-mdpi/ic_drawer.png
new file mode 100644
index 0000000..fb681ba
--- /dev/null
+++ b/res/drawable-mdpi/ic_drawer.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_home.png b/res/drawable-mdpi/ic_home.png
new file mode 100644
index 0000000..8f61a16
--- /dev/null
+++ b/res/drawable-mdpi/ic_home.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_launcher.png b/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..2151de9
--- /dev/null
+++ b/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_pages.png b/res/drawable-mdpi/ic_pages.png
new file mode 100644
index 0000000..def0352
--- /dev/null
+++ b/res/drawable-mdpi/ic_pages.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_people.png b/res/drawable-mdpi/ic_people.png
new file mode 100644
index 0000000..707967c
--- /dev/null
+++ b/res/drawable-mdpi/ic_people.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_photos.png b/res/drawable-mdpi/ic_photos.png
new file mode 100644
index 0000000..1ab590f
--- /dev/null
+++ b/res/drawable-mdpi/ic_photos.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_whats_hot.png b/res/drawable-mdpi/ic_whats_hot.png
new file mode 100644
index 0000000..8f082c3
--- /dev/null
+++ b/res/drawable-mdpi/ic_whats_hot.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_location_searching.png b/res/drawable-xhdpi/ic_action_location_searching.png
new file mode 100644
index 0000000..90ca6e5
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_location_searching.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_new.png b/res/drawable-xhdpi/ic_action_new.png
new file mode 100644
index 0000000..f17e798
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_new.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_refresh.png b/res/drawable-xhdpi/ic_action_refresh.png
new file mode 100644
index 0000000..94ab6f4
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_refresh.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_action_search.png b/res/drawable-xhdpi/ic_action_search.png
new file mode 100644
index 0000000..4edb1ff
--- /dev/null
+++ b/res/drawable-xhdpi/ic_action_search.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_communities.png b/res/drawable-xhdpi/ic_communities.png
new file mode 100644
index 0000000..e1d4bb4
--- /dev/null
+++ b/res/drawable-xhdpi/ic_communities.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_drawer.png b/res/drawable-xhdpi/ic_drawer.png
new file mode 100644
index 0000000..b9bc3d7
--- /dev/null
+++ b/res/drawable-xhdpi/ic_drawer.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_home.png b/res/drawable-xhdpi/ic_home.png
new file mode 100644
index 0000000..0ef3e29
--- /dev/null
+++ b/res/drawable-xhdpi/ic_home.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_launcher.png b/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..2151de9
--- /dev/null
+++ b/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_pages.png b/res/drawable-xhdpi/ic_pages.png
new file mode 100644
index 0000000..4fffa1e
--- /dev/null
+++ b/res/drawable-xhdpi/ic_pages.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_people.png b/res/drawable-xhdpi/ic_people.png
new file mode 100644
index 0000000..b535a18
--- /dev/null
+++ b/res/drawable-xhdpi/ic_people.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_photos.png b/res/drawable-xhdpi/ic_photos.png
new file mode 100644
index 0000000..5fdcf97
--- /dev/null
+++ b/res/drawable-xhdpi/ic_photos.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_whats_hot.png b/res/drawable-xhdpi/ic_whats_hot.png
new file mode 100644
index 0000000..7940e38
--- /dev/null
+++ b/res/drawable-xhdpi/ic_whats_hot.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_location_searching.png b/res/drawable-xxhdpi/ic_action_location_searching.png
new file mode 100644
index 0000000..057ca4b
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_location_searching.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_new.png b/res/drawable-xxhdpi/ic_action_new.png
new file mode 100644
index 0000000..c42c2bf
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_new.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_refresh.png b/res/drawable-xxhdpi/ic_action_refresh.png
new file mode 100644
index 0000000..44ee117
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_refresh.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_action_search.png b/res/drawable-xxhdpi/ic_action_search.png
new file mode 100644
index 0000000..a108638
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_action_search.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_communities.png b/res/drawable-xxhdpi/ic_communities.png
new file mode 100644
index 0000000..a6dd232
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_communities.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_home.png b/res/drawable-xxhdpi/ic_home.png
new file mode 100644
index 0000000..ae1e67d
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_home.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_launcher.png b/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..e7b1d09
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_pages.png b/res/drawable-xxhdpi/ic_pages.png
new file mode 100644
index 0000000..c09640e
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_pages.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_people.png b/res/drawable-xxhdpi/ic_people.png
new file mode 100644
index 0000000..853a8fb
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_people.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_photos.png b/res/drawable-xxhdpi/ic_photos.png
new file mode 100644
index 0000000..8a2c9be
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_photos.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_whats_hot.png b/res/drawable-xxhdpi/ic_whats_hot.png
new file mode 100644
index 0000000..6d4d7f7
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_whats_hot.png
Binary files differ
diff --git a/res/drawable/counter_bg.xml b/res/drawable/counter_bg.xml
new file mode 100644
index 0000000..0b4e084
--- /dev/null
+++ b/res/drawable/counter_bg.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle" >
+
+ <!-- view background color -->
+ <solid android:color="@color/counter_text_bg" >
+ </solid>
+
+ <!-- If you want to add some padding -->
+ <padding
+ android:right="3dp"
+ android:left="3dp" >
+ </padding>
+
+ <!-- Here is the corner radius -->
+ <corners android:radius="2dp" >
+ </corners>
+
+</shape>
\ No newline at end of file
diff --git a/res/drawable/list_item_bg_normal.xml b/res/drawable/list_item_bg_normal.xml
new file mode 100644
index 0000000..d1ee060
--- /dev/null
+++ b/res/drawable/list_item_bg_normal.xml
@@ -0,0 +1,7 @@
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <gradient
+ android:startColor="@color/list_background"
+ android:endColor="@color/list_background"
+ android:angle="90" />
+</shape>
\ No newline at end of file
diff --git a/res/drawable/list_item_bg_pressed.xml b/res/drawable/list_item_bg_pressed.xml
new file mode 100644
index 0000000..7b26349
--- /dev/null
+++ b/res/drawable/list_item_bg_pressed.xml
@@ -0,0 +1,7 @@
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <gradient
+ android:startColor="@color/list_background_pressed"
+ android:endColor="@color/list_background_pressed"
+ android:angle="90" />
+</shape>
\ No newline at end of file
diff --git a/res/drawable/list_selector.xml b/res/drawable/list_selector.xml
new file mode 100644
index 0000000..7488a45
--- /dev/null
+++ b/res/drawable/list_selector.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:drawable="@drawable/list_item_bg_normal" android:state_activated="false"/>
+ <item android:drawable="@drawable/list_item_bg_pressed" android:state_pressed="true"/>
+ <item android:drawable="@drawable/list_item_bg_pressed" android:state_activated="true"/>
+
+</selector>
\ No newline at end of file
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
new file mode 100644
index 0000000..0cd7767
--- /dev/null
+++ b/res/layout/activity_main.xml
@@ -0,0 +1,23 @@
+<android.support.v4.widget.DrawerLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/drawer_layout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+
+ <FrameLayout
+ android:id="@+id/frame_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ <ListView
+ android:id="@+id/list_slidermenu"
+ android:layout_width="240dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="start"
+ android:choiceMode="singleChoice"
+ android:divider="@color/list_divider"
+ android:dividerHeight="1dp"
+ android:listSelector="@drawable/list_selector"
+ android:background="@color/list_background"/>
+</android.support.v4.widget.DrawerLayout>
\ No newline at end of file
diff --git a/res/layout/create_route.xml b/res/layout/create_route.xml
new file mode 100644
index 0000000..8d91152
--- /dev/null
+++ b/res/layout/create_route.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/LinearLayout1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/textView1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/routeName" />
+
+ <EditText
+ android:id="@+id/editText1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="text" />
+
+ <TextView
+ android:id="@+id/textView2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/routeSector" />
+
+ <EditText
+ android:id="@+id/editText2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="text" />
+
+ <TextView
+ android:id="@+id/textView3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/routeDiff" />
+
+ <EditText
+ android:id="@+id/editText3"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="number" />
+
+ <TextView
+ android:id="@+id/textView4"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/routeLength" />
+
+ <EditText
+ android:id="@+id/editText4"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="number" />
+
+ <TextView
+ android:id="@+id/textView5"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/routeBolts" />
+
+ <EditText
+ android:id="@+id/editText5"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:ems="10"
+ android:inputType="number" />
+
+ <Button
+ android:id="@+id/button1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/send" />
+
+ <TextView
+ android:id="@+id/textView6"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="TextView" />
+
+</LinearLayout>
diff --git a/res/layout/drawer_list_item.xml b/res/layout/drawer_list_item.xml
new file mode 100644
index 0000000..c40d806
--- /dev/null
+++ b/res/layout/drawer_list_item.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="48dp"
+ android:background="@drawable/list_selector">
+
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_width="25dp"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_marginLeft="12dp"
+ android:layout_marginRight="12dp"
+ android:src="@drawable/ic_launcher"
+ android:layout_centerVertical="true" />
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_toRightOf="@id/icon"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:textColor="@color/list_item_title"
+ android:gravity="center_vertical"
+ android:paddingRight="40dp"/>
+
+ <TextView android:id="@+id/counter"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@drawable/counter_bg"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:layout_marginRight="8dp"
+ android:textColor="@color/counter_text_color"/>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/fragment_list_item.xml b/res/layout/fragment_list_item.xml
new file mode 100644
index 0000000..8dab159
--- /dev/null
+++ b/res/layout/fragment_list_item.xml
@@ -0,0 +1,12 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <ListView
+ android:id="@+id/listView1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp" >
+ </ListView>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/route.xml b/res/layout/route.xml
new file mode 100644
index 0000000..160756f
--- /dev/null
+++ b/res/layout/route.xml
@@ -0,0 +1,72 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:paddingLeft="@dimen/activity_horizontal_margin"
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingTop="@dimen/activity_vertical_margin"
+ tools:context=".MainActivity" >
+
+ <TextView
+ android:id="@+id/textViewName"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_marginRight="14dp"
+ android:layout_marginTop="26dp"
+ android:text="@string/large_text"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+
+ <TextView
+ android:id="@+id/textViewLatitude"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/textViewLength"
+ android:layout_below="@+id/textViewLength"
+ android:layout_marginTop="46dp"
+ android:text="@string/latitude_"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/textViewDifficulty"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/textViewBolts"
+ android:layout_below="@+id/textViewName"
+ android:layout_marginTop="20dp"
+ android:text="@string/difficulty_"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/textViewLength"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/textViewBolts"
+ android:layout_below="@+id/textViewBolts"
+ android:layout_marginTop="20dp"
+ android:text="@string/length_"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/textViewBolts"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/textViewName"
+ android:layout_below="@+id/textViewDifficulty"
+ android:layout_marginLeft="30dp"
+ android:layout_marginTop="20dp"
+ android:text="@string/bolts_"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/textViewLongitude"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignLeft="@+id/textViewLatitude"
+ android:layout_below="@+id/textViewLatitude"
+ android:layout_marginTop="20dp"
+ android:text="@string/longitude_"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/res/menu/main.xml b/res/menu/main.xml
new file mode 100644
index 0000000..d7324d7
--- /dev/null
+++ b/res/menu/main.xml
@@ -0,0 +1,19 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/action_search"
+ android:icon="@drawable/ic_action_search"
+ android:showAsAction="always"
+ android:actionViewClass="android.widget.SearchView"
+ android:title="@string/search"/>
+
+
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:showAsAction="never"
+ android:title="@string/action_settings"/>
+
+
+
+</menu>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..44f01db
--- /dev/null
+++ b/res/values-sw600dp/dimens.xml
@@ -0,0 +1,8 @@
+<resources>
+
+ <!--
+ Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw600dp devices (e.g. 7" tablets) here.
+ -->
+
+</resources>
diff --git a/res/values-sw720dp-land/dimens.xml b/res/values-sw720dp-land/dimens.xml
new file mode 100644
index 0000000..61e3fa8
--- /dev/null
+++ b/res/values-sw720dp-land/dimens.xml
@@ -0,0 +1,9 @@
+<resources>
+
+ <!--
+ Customize dimensions originally defined in res/values/dimens.xml (such as
+ screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
+ -->
+ <dimen name="activity_horizontal_margin">128dp</dimen>
+
+</resources>
diff --git a/res/values-v11/styles.xml b/res/values-v11/styles.xml
new file mode 100644
index 0000000..3c02242
--- /dev/null
+++ b/res/values-v11/styles.xml
@@ -0,0 +1,11 @@
+<resources>
+
+ <!--
+ Base application theme for API 11+. This theme completely replaces
+ AppBaseTheme from res/values/styles.xml on API 11+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+ <!-- API 11 theme customizations can go here. -->
+ </style>
+
+</resources>
diff --git a/res/values-v14/styles.xml b/res/values-v14/styles.xml
new file mode 100644
index 0000000..a91fd03
--- /dev/null
+++ b/res/values-v14/styles.xml
@@ -0,0 +1,12 @@
+<resources>
+
+ <!--
+ Base application theme for API 14+. This theme completely replaces
+ AppBaseTheme from BOTH res/values/styles.xml and
+ res/values-v11/styles.xml on API 14+ devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- API 14 theme customizations can go here. -->
+ </style>
+
+</resources>
diff --git a/res/values/color.xml b/res/values/color.xml
new file mode 100644
index 0000000..25b4738
--- /dev/null
+++ b/res/values/color.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <color name="list_item_title">#fff</color>
+ <color name="list_background">#303030</color>
+ <color name="list_background_pressed">#992416</color>
+ <color name="list_divider">#272727</color>
+ <color name="counter_text_bg">#626262</color>
+ <color name="counter_text_color">#c5c4c4</color>
+</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
new file mode 100644
index 0000000..55c1e59
--- /dev/null
+++ b/res/values/dimens.xml
@@ -0,0 +1,7 @@
+<resources>
+
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
new file mode 100644
index 0000000..a7cc0b2
--- /dev/null
+++ b/res/values/strings.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="app_name">ClimbingGuide-Projekt</string>
+ <string name="action_settings">Settings</string>
+ <string name="hello_world">Hello world!</string>
+
+ <string name="sector">Sector</string>
+ <string name="update">Update</string>
+ <string name="Update">Update</string>
+ <string name="create">Create</string>
+ <string name="search">Search</string>
+ <string name="search_hint">Search</string>
+ <string name="large_text">Large Text</string>
+ <string name="difficulty_">"Difficulty: "</string>
+ <string name="latitude_">"Latitude: "</string>
+ <string name="length_">"Length: "</string>
+ <string name="bolts_">"Bolts: "</string>
+ <string name="longitude_">"Longitude: "</string>
+
+ <string name="action_update">Update</string>
+ <string name="drawer_open">Open Drawer</string>
+ <string name="drawer_close">Close Drawer</string>
+ <string name="newRoute">Vytvorit novu cestu</string>
+ <string name="newArea">Vytvorit novu oblast</string>
+ <string name="newSector">Vytvorit novy sektor</string>
+ <string name="routeName">Meno cesty:</string>
+ <string name="routeSector">Umiestnenie v sektore:</string>
+ <string name="routeDiff">Obtiaznost cesty:</string>
+ <string name="routeLength">Dlzka cesty (v metroch):</string>
+ <string name="routeBolts">Pocet isteni v ceste:</string>
+ <string name="send">Odoslat</string>
+ <string name="sectorName">Nazov sektora</string>
+ <string name="sectorArea">Umiestnenie v oblasti</string>
+ <string name="areaName">Nazov oblasti</string>
+
+
+ <string-array name="nav_drawer_items">
+ <item >Areas</item>
+ <item >Sectors</item>
+ <item >Routes</item>
+ <item >Create</item>
+ <item >Update</item>
+ <item >GPS</item>
+ </string-array>
+
+ <array name="nav_drawer_icons">
+ <item>@drawable/ic_home</item>
+ <item>@drawable/ic_people</item>
+ <item>@drawable/ic_photos</item>
+ <item>@drawable/ic_communities</item>
+ <item>@drawable/ic_pages</item>
+ <item>@drawable/ic_whats_hot</item>
+ </array>
+
+ <string name="desc_list_item_icon">Item Icon</string>
+</resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
new file mode 100644
index 0000000..6ce89c7
--- /dev/null
+++ b/res/values/styles.xml
@@ -0,0 +1,20 @@
+<resources>
+
+ <!--
+ Base application theme, dependent on API level. This theme is replaced
+ by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+ -->
+ <style name="AppBaseTheme" parent="android:Theme.Light">
+ <!--
+ Theme customizations available in newer API levels can go in
+ res/values-vXX/styles.xml, while customizations related to
+ backward-compatibility can go here.
+ -->
+ </style>
+
+ <!-- Application theme. -->
+ <style name="AppTheme" parent="AppBaseTheme">
+ <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+ </style>
+
+</resources>
diff --git a/res/xml/searchable.xml b/res/xml/searchable.xml
new file mode 100644
index 0000000..3ade3c1
--- /dev/null
+++ b/res/xml/searchable.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<searchable xmlns:android="http://schemas.android.com/apk/res/android"
+ android:hint="@string/search_hint"
+ android:label="@string/app_name" />
\ No newline at end of file
diff --git a/src/org/climbingguide/dao/AreaDao.java b/src/org/climbingguide/dao/AreaDao.java
new file mode 100644
index 0000000..47820ae
--- /dev/null
+++ b/src/org/climbingguide/dao/AreaDao.java
@@ -0,0 +1,98 @@
+package org.climbingguide.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.model.Area;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.util.Log;
+
+public class AreaDao {
+
+ private static final String LOG = AreaDao.class.getName();
+
+ private SQLiteDatabase db;
+ private SQLHelper dbHelperArea;
+
+ public AreaDao(Context context){
+ dbHelperArea = new SQLHelper(context);
+ }
+
+ public void open(){
+ db = dbHelperArea.getWritableDatabase();
+ }
+
+ public void close(){
+ dbHelperArea.close();
+ }
+
+//---------------GET-ALL-AREAS--------------------------------------------------------------------------------------------
+ public List<Area> getAllAreas()
+ {
+ List<Area> areaList = new ArrayList<Area>();
+
+
+ String selectQuery = " SELECT * FROM " + SQLHelper.TABLE_AREAS;
+
+ Log.i(LOG, selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Area area = new Area();
+ area.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_AREA)));
+ area.setName(c.getString(c.getColumnIndex(SQLHelper.AREA_NAME)));
+ areaList.add(area);
+
+ }while(c.moveToNext());
+
+ }
+ c.close();
+ return areaList;
+ }
+//----------------ADD-AREAS-----------------------------------------------------------------------------------------------
+ public void addArea(Area area){
+ ContentValues value = new ContentValues();
+
+ //value.put(SQLHelper.ID_AREA ,area.getId());
+ value.put(SQLHelper.AREA_NAME,area.getName());
+
+ Log.i(LOG,"Inster to table area -->" + value);
+
+ db.insert(SQLHelper.TABLE_AREAS, null, value);
+ db.close();
+ }
+//-----------------SEARCH-------------------------------------------------------------------------------------------------
+ public List<Area> areasSearch(String query)
+ {
+ List<Area> areaList = new ArrayList<Area>();
+ String searchQuery = query + "%";
+
+ String selectQuery = " SELECT * FROM " + SQLHelper.TABLE_AREAS +" WHERE " + SQLHelper.AREA_NAME + " LIKE " + "'" + searchQuery +"'";
+
+ Log.i(LOG,selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Area area = new Area();
+ area.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_AREA)));
+ area.setName(c.getString(c.getColumnIndex(SQLHelper.AREA_NAME)));
+ areaList.add(area);
+
+ }while(c.moveToNext());
+
+ }
+ c.close();
+ return areaList;
+ }
+
+}
diff --git a/src/org/climbingguide/dao/RouteDao.java b/src/org/climbingguide/dao/RouteDao.java
new file mode 100644
index 0000000..2def3d2
--- /dev/null
+++ b/src/org/climbingguide/dao/RouteDao.java
@@ -0,0 +1,182 @@
+package org.climbingguide.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.model.Route;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.util.Log;
+
+public class RouteDao {
+
+private static final String LOG = RouteDao.class.getName();
+
+ private SQLiteDatabase db;
+ private SQLHelper dbHelperRoute;
+
+ public RouteDao(Context context){
+ dbHelperRoute = new SQLHelper(context);
+ }
+
+ public void open(){
+ db = dbHelperRoute.getWritableDatabase();
+ }
+
+ public void close(){
+ dbHelperRoute.close();
+ }
+//------------GET-ALL-ROUTES----------------------------------------------------------------------------------------------
+ public List<Route> getAllRoutes()
+ {
+ List<Route> routeList = new ArrayList<Route>();
+
+ String selectQuery = " SELECT * FROM " + SQLHelper.TABLE_ROUTE;
+ Log.i(LOG,selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Route route = new Route();
+
+ route.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_ROUTE)));
+ route.setName(c.getString(c.getColumnIndex(SQLHelper.ROUTE_NAME)));
+ route.setIdOfSector(c.getInt(c.getColumnIndex(SQLHelper.ID_OF_SECTOR)));
+ route.setDificulty(c.getString(c.getColumnIndex(SQLHelper.DIFFICULTY)));
+ route.setBolts(c.getInt(c.getColumnIndex(SQLHelper.BOLTS)));
+ route.setLength(c.getInt(c.getColumnIndex(SQLHelper.LENGTH)));
+ route.setLatitute(c.getDouble(c.getColumnIndex(SQLHelper.LATITUTE)));
+ route.setLongitude(c.getDouble(c.getColumnIndex(SQLHelper.LONGITUDE)));
+
+ routeList.add(route);
+
+ }while(c.moveToNext());
+ }
+ c.close();
+ return routeList;
+ }
+//----------GET--BY--ID----ROUTES-----------------------------------------------------------------------------------------
+ public List<Route> getRoute(int find){
+
+ List<Route> routeList = new ArrayList<Route>();
+ String selectQuery = " SELECT * FROM " + SQLHelper.TABLE_ROUTE + " WHERE "+SQLHelper.ID_OF_SECTOR + " = " + "'"+ find +"'" ;
+ Log.i(LOG, selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Route route = new Route();
+
+ route.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_ROUTE)));
+ route.setName(c.getString(c.getColumnIndex(SQLHelper.ROUTE_NAME)));
+ route.setIdOfSector(c.getInt(c.getColumnIndex(SQLHelper.ID_OF_SECTOR)));
+ route.setDificulty(c.getString(c.getColumnIndex(SQLHelper.DIFFICULTY)));
+ route.setBolts(c.getInt(c.getColumnIndex(SQLHelper.BOLTS)));
+ route.setLength(c.getInt(c.getColumnIndex(SQLHelper.LENGTH)));
+ route.setLatitute(c.getDouble(c.getColumnIndex(SQLHelper.LATITUTE)));
+ route.setLongitude(c.getDouble(c.getColumnIndex(SQLHelper.LONGITUDE)));
+
+ routeList.add(route);
+
+ }while(c.moveToNext());
+ }
+ c.close();
+ return routeList;
+
+ }
+//-----------ADD-ROUTE----------------------------------------------------------------------------------------------------
+ public void addRoute(Route route)
+ {
+
+ ContentValues value = new ContentValues();
+
+ value.put(SQLHelper.ROUTE_NAME,route.getName());
+ value.put(SQLHelper.ID_OF_SECTOR,route.getIdOfSector());
+ value.put(SQLHelper.DIFFICULTY,route.getDificulty());
+ value.put(SQLHelper.BOLTS, route.getBolts());
+ value.put(SQLHelper.LENGTH,route.getLength());
+ value.put(SQLHelper.LATITUTE,route.getLatitute());
+ value.put(SQLHelper.LONGITUDE, route.getLongitude());
+
+ Log.i(LOG,"Inster to table route -->" + value);
+
+ db.insert(SQLHelper.TABLE_ROUTE, null, value);
+ db.close();
+ }
+//-----------------SEARCH---------------------------------------------------------------------------------------------------
+ public List<Route> routeSearch(String query)
+ {
+ List<Route> routeList = new ArrayList<Route>();
+ String searchQuery = query + "%";
+ String selectQuery;
+
+ selectQuery = " SELECT * FROM " + SQLHelper.TABLE_ROUTE +" WHERE " + SQLHelper.ROUTE_NAME + " LIKE " + "'" + searchQuery +"'";
+
+ Log.i(LOG,selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Route route = new Route();
+
+ route.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_ROUTE)));
+ route.setName(c.getString(c.getColumnIndex(SQLHelper.ROUTE_NAME)));
+ route.setIdOfSector(c.getInt(c.getColumnIndex(SQLHelper.ID_OF_SECTOR)));
+ route.setDificulty(c.getString(c.getColumnIndex(SQLHelper.DIFFICULTY)));
+ route.setBolts(c.getInt(c.getColumnIndex(SQLHelper.BOLTS)));
+ route.setLength(c.getInt(c.getColumnIndex(SQLHelper.LENGTH)));
+ route.setLatitute(c.getDouble(c.getColumnIndex(SQLHelper.LATITUTE)));
+ route.setLongitude(c.getDouble(c.getColumnIndex(SQLHelper.LONGITUDE)));
+
+ routeList.add(route);
+
+ }while(c.moveToNext());
+ }
+ c.close();
+ return routeList;
+ }
+//----------------SEARCH---ID-OF-SECTOR-----------------------------------------------------------------------------------------------
+ public List<Route> routeSearchId(String query,int idOfSector)
+ {
+ List<Route> routeList = new ArrayList<Route>();
+ String searchQuery = query + "%";
+ String selectQuery;
+
+ selectQuery = " SELECT * FROM " + SQLHelper.TABLE_ROUTE +" WHERE " + SQLHelper.ROUTE_NAME + " LIKE " + "'" + searchQuery +"'" + " AND "+SQLHelper.ID_OF_SECTOR+" = "+idOfSector;
+
+
+ Log.i(LOG,selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Route route = new Route();
+
+ route.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_ROUTE)));
+ route.setName(c.getString(c.getColumnIndex(SQLHelper.ROUTE_NAME)));
+ route.setIdOfSector(c.getInt(c.getColumnIndex(SQLHelper.ID_OF_SECTOR)));
+ route.setDificulty(c.getString(c.getColumnIndex(SQLHelper.DIFFICULTY)));
+ route.setBolts(c.getInt(c.getColumnIndex(SQLHelper.BOLTS)));
+ route.setLength(c.getInt(c.getColumnIndex(SQLHelper.LENGTH)));
+ route.setLatitute(c.getDouble(c.getColumnIndex(SQLHelper.LATITUTE)));
+ route.setLongitude(c.getDouble(c.getColumnIndex(SQLHelper.LONGITUDE)));
+
+ routeList.add(route);
+
+ }while(c.moveToNext());
+ }
+ c.close();
+ return routeList;
+ }
+}
diff --git a/src/org/climbingguide/dao/SQLHelper.java b/src/org/climbingguide/dao/SQLHelper.java
new file mode 100644
index 0000000..a5ffcb2
--- /dev/null
+++ b/src/org/climbingguide/dao/SQLHelper.java
@@ -0,0 +1,82 @@
+package org.climbingguide.dao;
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+public class SQLHelper extends SQLiteOpenHelper {
+
+ private static final String LOG = SQLHelper.class.getName();
+
+ public static final int DATABASE_VERSION = 1;
+ public static final String DATABASE_NAME = "climbingGuide.db";
+
+ public static final String TABLE_AREAS = "areas";
+ public static final String ID_AREA = "id_area";
+ public static final String AREA_NAME = "area_name";
+ public static final String AREA_DATE = "area_date";
+
+ private static final String CREATE_TABLE_AREAS = "CREATE TABLE " + TABLE_AREAS
+ + " ( " + ID_AREA + " INTEGER PRIMARY KEY AUTOINCREMENT , "
+ + AREA_NAME + " TEXT " + " ) ;";
+ private static final String DROP_TABLE_AREAS = "DROP TABLE IF EXIST " + TABLE_AREAS;
+//-----------------------------------------------------------------------------------------------
+ public static final String TABLE_SECTOR = "sectors";
+ public static final String ID_SECTOR = "id_sector";
+ public static final String SECTOR_NAME = "sector_name";
+ public static final String ID_OF_AREA = "id_of_area";
+ public static final String SECTOR_DATE = "sector_date";
+
+ public static final String CREATE_TABLE_SECTOR = "CREATE TABLE " + TABLE_SECTOR
+ + " ( " + ID_SECTOR + " INTEGER PRIMARY KEY AUTOINCREMENT , "
+ + SECTOR_NAME + " TEXT , " + ID_OF_AREA + " INTEGER " + " ) ;";
+ public static final String DROP_TABLE_SECTOR = "DROP TABLE IF EXIST" + TABLE_SECTOR;
+
+ //---------------------------------------------------------------------------------------------
+ public static final String TABLE_ROUTE = "routes";
+ public static final String ID_ROUTE = "id_route";
+ public static final String ROUTE_NAME = "route_name";
+ public static final String ID_OF_SECTOR = "id_sector";
+ public static final String DIFFICULTY = "difficulty";
+ public static final String BOLTS = "bolts";
+ public static final String LENGTH = "length";
+ public static final String ROUTE_DATE = "route_date";
+ public static final String LATITUTE = "lantitute";
+ public static final String LONGITUDE = "longitude";
+
+
+
+ public static final String CREATE_TABLE_ROUTE = "CREATE TABLE " + TABLE_ROUTE + " ( "
+ + ID_ROUTE + " INTEGER PRIMARY KEY AUTOINCREMENT , " + ROUTE_NAME
+ + " TEXT , " + ID_OF_SECTOR + " INTEGER , " + DIFFICULTY + " TEXT , "
+ + BOLTS + " INTEGER , " + LENGTH + " INTEGER, " + LATITUTE + " DOUBLE, " + LONGITUDE +" DOUBLE " + " ) ;";
+ private static final String DROP_TABLE_ROUTE = "DROP TABLE IF EXIST " + TABLE_ROUTE;
+
+
+
+ public SQLHelper(Context context) {
+ super(context, DATABASE_NAME, null, DATABASE_VERSION);
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ Log.i(LOG, "Create areas database -> " + CREATE_TABLE_AREAS);
+ db.execSQL(CREATE_TABLE_AREAS);
+
+ Log.i(LOG, "Create sector database -> " + CREATE_TABLE_SECTOR);
+ db.execSQL(CREATE_TABLE_SECTOR);
+
+ Log.i(LOG, "Create route database -> " + CREATE_TABLE_ROUTE);
+ db.execSQL(CREATE_TABLE_ROUTE);
+
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ db.execSQL(DROP_TABLE_AREAS);
+ db.execSQL(DROP_TABLE_SECTOR);
+ db.execSQL(DROP_TABLE_ROUTE);
+ onCreate(db);
+ }
+}
diff --git a/src/org/climbingguide/dao/SectorDao.java b/src/org/climbingguide/dao/SectorDao.java
new file mode 100644
index 0000000..6c3f1b2
--- /dev/null
+++ b/src/org/climbingguide/dao/SectorDao.java
@@ -0,0 +1,156 @@
+package org.climbingguide.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.model.Sector;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.util.Log;
+
+public class SectorDao {
+
+ private static final String LOG = SectorDao.class.getName();
+
+ private SQLiteDatabase db;
+ private SQLHelper dbHelperSector;
+
+ public SectorDao(Context context){
+ dbHelperSector = new SQLHelper(context);
+ }
+
+ public void open(){
+ db = dbHelperSector.getWritableDatabase();
+ }
+
+ public void close(){
+ dbHelperSector.close();
+ }
+//----------GET-ALL-SECTORS------------------------------------------------------------------------------------------------
+ public List<Sector> getAllSectors()
+ {
+ List<Sector> sectorList = new ArrayList<Sector>();
+
+ String selectQuery = " SELECT * FROM " + SQLHelper.TABLE_SECTOR;
+ Log.i(LOG,selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Sector sector = new Sector();
+
+
+ sector.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_SECTOR)));
+ sector.setName(c.getString(c.getColumnIndex(SQLHelper.SECTOR_NAME)));
+ sector.setIdOfArea(c.getInt(c.getColumnIndex(SQLHelper.ID_OF_AREA)));
+
+ sectorList.add(sector);
+ }while(c.moveToNext());
+ }
+ c.close();
+ return sectorList;
+ }
+//-------GET-BY-ID-SECTORS------------------------------------------------------------------------------------------------
+ public List<Sector> getSector(int find){
+
+ List<Sector> sectorList = new ArrayList<Sector>();
+ String selectQuery = " SELECT * FROM " + SQLHelper.TABLE_SECTOR + " WHERE "+SQLHelper.ID_OF_AREA + " = " + "'"+ find +"'" ;
+ Log.i(LOG, selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Sector sector = new Sector();
+
+ sector.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_SECTOR)));
+ sector.setName(c.getString(c.getColumnIndex(SQLHelper.SECTOR_NAME)));
+ sector.setIdOfArea(c.getInt(c.getColumnIndex(SQLHelper.ID_OF_AREA)));
+
+ sectorList.add(sector);
+ }while(c.moveToNext());
+ }
+ c.close();
+ return sectorList;
+
+ }
+//---------------ADD-SECTOR-----------------------------------------------------------------------------------------------
+ public void addSector(Sector sector)
+ {
+
+ ContentValues value = new ContentValues();
+
+ value.put(SQLHelper.SECTOR_NAME,sector.getName());
+ value.put(SQLHelper.ID_OF_AREA,sector.getIdOfArea());
+
+ Log.i(LOG,"Inster to table sector -->" + value);
+
+ db.insert(SQLHelper.TABLE_SECTOR, null, value);
+ db.close();
+ }
+//----------------SEARCH--------------------------------------------------------------------------------------------------
+ public List<Sector> sectorSearch(String query){
+
+ List<Sector> sectorList = new ArrayList<Sector>();
+ String searchQuery = query + "%";
+ String selectQuery;
+
+ selectQuery = " SELECT * FROM " + SQLHelper.TABLE_SECTOR +" WHERE " + SQLHelper.SECTOR_NAME + " LIKE " + "'" + searchQuery +"'";
+
+ Log.i(LOG, selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Sector sector = new Sector();
+
+ sector.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_SECTOR)));
+ sector.setName(c.getString(c.getColumnIndex(SQLHelper.SECTOR_NAME)));
+ sector.setIdOfArea(c.getInt(c.getColumnIndex(SQLHelper.ID_OF_AREA)));
+
+ sectorList.add(sector);
+ }while(c.moveToNext());
+ }
+ c.close();
+ return sectorList;
+
+ }
+//------------------------SEARCH---ID-OF-AREA---------------------------------------------------------------------------
+ public List<Sector> sectorSearchId(String query,int idOfArea){
+
+ List<Sector> sectorList = new ArrayList<Sector>();
+ String searchQuery = query + "%";
+ String selectQuery;
+
+ selectQuery = " SELECT * FROM " + SQLHelper.TABLE_SECTOR +" WHERE " + SQLHelper.SECTOR_NAME + " LIKE " + "'" + searchQuery +"'" + " AND "+SQLHelper.ID_OF_AREA + "=" +idOfArea;
+
+
+ Log.i(LOG, selectQuery);
+
+ Cursor c = db.rawQuery(selectQuery,null);
+
+ if (c.moveToFirst())
+ {
+ do{
+ Sector sector = new Sector();
+
+ sector.setId(c.getInt(c.getColumnIndex(SQLHelper.ID_SECTOR)));
+ sector.setName(c.getString(c.getColumnIndex(SQLHelper.SECTOR_NAME)));
+ sector.setIdOfArea(c.getInt(c.getColumnIndex(SQLHelper.ID_OF_AREA)));
+
+ sectorList.add(sector);
+ }while(c.moveToNext());
+ }
+ c.close();
+ return sectorList;
+
+ }
+}
diff --git a/src/org/climbingguide/gui/FragmentAreasAll.java b/src/org/climbingguide/gui/FragmentAreasAll.java
new file mode 100644
index 0000000..5693cea
--- /dev/null
+++ b/src/org/climbingguide/gui/FragmentAreasAll.java
@@ -0,0 +1,64 @@
+package org.climbingguide.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.AreaDao;
+import org.climbingguide.main.R;
+import org.climbingguide.model.Area;
+
+import android.os.Bundle;
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+
+public class FragmentAreasAll extends ListFragment{
+
+ private AreaDao getAreas;
+ private List<Area> areaList = new ArrayList<Area>();
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().setTitle("Areas");
+
+ getAreas = new AreaDao(getActivity());
+
+
+ getAreas.open();
+
+ areaList = getAreas.getAllAreas();
+
+ getAreas.close();
+
+
+ ArrayAdapter<Area> adapter = new ArrayAdapter<Area>(getActivity(),android.R.layout.simple_list_item_1,areaList);
+
+ setListAdapter(adapter);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+
+ Area area = new Area();
+ Bundle bundle = new Bundle();
+
+ area = areaList.get(position);
+
+ bundle.putInt("idOfArea",area.getId());
+ FragmentSectors fragobj = new FragmentSectors();
+ fragobj.setArguments(bundle);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ transaction.replace(R.id.frame_container, fragobj,"Sectors");
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+ }
+
+
+}
diff --git a/src/org/climbingguide/gui/FragmentCreate.java b/src/org/climbingguide/gui/FragmentCreate.java
new file mode 100644
index 0000000..218d7b8
--- /dev/null
+++ b/src/org/climbingguide/gui/FragmentCreate.java
@@ -0,0 +1,90 @@
+package org.climbingguide.gui;
+
+import org.climbingguide.main.R;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+
+public class FragmentCreate extends Fragment{
+ public String[] creating = new String[2];
+
+ public FragmentCreate(String[] current){
+ creating = current;
+ }
+
+ switch(creating){
+ case "area":
+ ;
+
+ default:
+ break;
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ getActivity().setTitle("Create");
+ View view = inflater.inflate(R.layout.create_route,container, false);
+
+ Button b1 = (Button) view.findViewById(R.id.button1);
+
+ b1.setOnClickListener(onClickListener);
+
+ return view;
+ }
+
+ private OnClickListener onClickListener = new OnClickListener() {
+ @Override
+ public void onClick(final View v) {
+ EditText e1 = (EditText)v.findViewById(R.id.editText1);
+ EditText e2 = (EditText)v.findViewById(R.id.editText2);
+ //id_of_sector, vyriesi sa potom
+ EditText e3 = (EditText)v.findViewById(R.id.editText3);
+ EditText e4 = (EditText)v.findViewById(R.id.editText4);
+ EditText e5 = (EditText)v.findViewById(R.id.editText5);
+ TextView v1 = (TextView)v.findViewById(R.id.textView1);
+ TextView v2 = (TextView)v.findViewById(R.id.textView2);
+ TextView v3 = (TextView)v.findViewById(R.id.textView3);
+ TextView v4 = (TextView)v.findViewById(R.id.textView4);
+ TextView v5 = (TextView)v.findViewById(R.id.textView5);
+ TextView v6 = (TextView)v.findViewById(R.id.textView6);
+
+ JSONObject json = new JSONObject();
+
+ try {
+ json.put("route_name", e1.getText().toString());
+ json.put("sector", e2.getText().toString());
+ json.put("difficulty", e3.getText().toString());
+ json.put("bolts", e4.getText().toString());
+ json.put("length", e5.getText().toString());
+ } catch (JSONException e) {
+ e.printStackTrace();
+ }
+
+
+ try {
+ v1.setText((CharSequence) json.get("route_name"));
+ v3.setText((CharSequence) json.get("difficulty"));
+ v4.setText((CharSequence) json.get("bolts"));
+ v5.setText((CharSequence) json.get("length"));
+ } catch (JSONException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
+ }
+ };
+
+ }
+
+
diff --git a/src/org/climbingguide/gui/FragmentRoute.java b/src/org/climbingguide/gui/FragmentRoute.java
new file mode 100644
index 0000000..d14ad3b
--- /dev/null
+++ b/src/org/climbingguide/gui/FragmentRoute.java
@@ -0,0 +1,70 @@
+package org.climbingguide.gui;
+
+
+
+
+import org.climbingguide.main.R;
+
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+
+public class FragmentRoute extends Fragment {
+
+ private String name;
+ private String difficulty;
+ private int bolts = 0;
+ private int length = 0;
+
+ private double latitude;
+ private double longitude;
+
+
+// @Override
+// public void onActivityCreated(Bundle savedInstanceState) {
+// super.onActivityCreated(savedInstanceState);
+//
+//
+// }
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+
+ getActivity().setTitle("Route");
+
+ name = getArguments().getString("name");
+ difficulty = getArguments().getString("difficulty");
+
+ bolts = getArguments().getInt("bolts");
+ length = getArguments().getInt("length");
+
+ latitude = getArguments().getDouble("latitude");
+ longitude = getArguments().getDouble("longitude");
+
+ View view = inflater.inflate(R.layout.route,container, false);
+
+ TextView nameView = (TextView) view.findViewById(R.id.textViewName);
+ TextView difficultyView = (TextView) view.findViewById(R.id.textViewDifficulty);
+ TextView boltsView = (TextView) view.findViewById(R.id.textViewBolts);
+ TextView lengthView = (TextView) view.findViewById(R.id.textViewLength);
+ TextView latitudeView = (TextView) view.findViewById(R.id.textViewLatitude);
+ TextView longitudeView = (TextView) view.findViewById(R.id.textViewLongitude);
+
+
+ nameView.setText("Name: "+name.toString());
+ difficultyView.setText("Difficulty: "+difficulty);
+
+ boltsView.setText("Bolts: "+bolts);
+ lengthView.setText("Length: "+length);
+
+ latitudeView.setText("latitude: "+latitude);
+ longitudeView.setText("longitude: "+longitude);
+
+ return view;
+ }
+}
diff --git a/src/org/climbingguide/gui/FragmentRoutes.java b/src/org/climbingguide/gui/FragmentRoutes.java
new file mode 100644
index 0000000..20738c1
--- /dev/null
+++ b/src/org/climbingguide/gui/FragmentRoutes.java
@@ -0,0 +1,93 @@
+package org.climbingguide.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.RouteDao;
+
+import org.climbingguide.model.Route;
+
+
+import android.os.Bundle;
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.view.View;
+
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+import org.climbingguide.main.R;
+
+public class FragmentRoutes extends ListFragment{
+
+ private RouteDao getRoutes;
+ private List<Route> routeList = new ArrayList<Route>();
+ private Route route = new Route();
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().setTitle("Routes");
+
+ getRoutes = new RouteDao(getActivity());
+ int idOfSector = getArguments().getInt("idOfSector");
+
+
+
+ getRoutes.open();
+
+ routeList = getRoutes.getRoute(idOfSector); //get by sector
+
+ getRoutes.close();
+
+
+ ArrayAdapter<Route> adapter = new ArrayAdapter<Route>(getActivity(),android.R.layout.simple_list_item_1,routeList);
+
+ setListAdapter(adapter);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+
+
+ Bundle bundle = new Bundle();
+
+ route = routeList.get(position);
+
+ bundle.putString("name",route.getName());
+ bundle.putString("difficulty",route.getDificulty());
+ bundle.putInt("bolts",route.getBolts());
+ bundle.putInt("length",route.getLength());
+
+ bundle.putDouble("longitude",route.getLongitude());
+ bundle.putDouble("latitude",route.getLatitute());
+
+ //Toast.makeText(getActivity(), "Bundle"+bundle.toString(), Toast.LENGTH_LONG).show();
+
+ FragmentRoute fragobj = new FragmentRoute();
+ fragobj.setArguments(bundle);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ transaction.replace(R.id.frame_container, fragobj,"Route");
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+ }
+
+ public int getIdOfSector()
+ {
+ int i;
+ if(routeList.isEmpty())
+ {
+ i = -1;
+ }
+ else
+ {
+ route = routeList.get(0);
+ i = route.getIdOfSector();
+ }
+ return i;
+ }
+}
diff --git a/src/org/climbingguide/gui/FragmentRoutesAll.java b/src/org/climbingguide/gui/FragmentRoutesAll.java
new file mode 100644
index 0000000..c8bfb63
--- /dev/null
+++ b/src/org/climbingguide/gui/FragmentRoutesAll.java
@@ -0,0 +1,86 @@
+package org.climbingguide.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.RouteDao;
+import org.climbingguide.main.R;
+import org.climbingguide.model.Route;
+
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+public class FragmentRoutesAll extends ListFragment{
+
+ private RouteDao getRoutes;
+ private List<Route> routeList = new ArrayList<Route>();
+ private Route route = new Route();
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().setTitle("Routes");
+
+ getRoutes = new RouteDao(getActivity());
+
+ getRoutes.open();
+
+ routeList = getRoutes.getAllRoutes();
+
+ getRoutes.close();
+
+
+ ArrayAdapter<Route> adapter = new ArrayAdapter<Route>(getActivity(),android.R.layout.simple_list_item_1,routeList);
+
+ setListAdapter(adapter);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+
+
+ Bundle bundle = new Bundle();
+
+ route = routeList.get(position);
+
+ bundle.putString("name",route.getName());
+ bundle.putString("difficulty",route.getDificulty());
+ bundle.putInt("bolts",route.getBolts());
+ bundle.putInt("length",route.getLength());
+
+ bundle.putDouble("longitude",route.getLongitude());
+ bundle.putDouble("latitude",route.getLatitute());
+
+ //Toast.makeText(getActivity(), "Bundle"+bundle.toString(), Toast.LENGTH_LONG).show();
+
+ FragmentRoute fragobj = new FragmentRoute();
+ fragobj.setArguments(bundle);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ transaction.replace(R.id.frame_container, fragobj,"Route");
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+ }
+
+ public int getIdOfSector()
+ {
+ int i;
+ if(routeList.isEmpty())
+ {
+ i = -1;
+ }
+ else
+ {
+ route = routeList.get(0);
+ i = route.getIdOfSector();
+ }
+ return i;
+ }
+}
diff --git a/src/org/climbingguide/gui/FragmentSectors.java b/src/org/climbingguide/gui/FragmentSectors.java
new file mode 100644
index 0000000..bb96fd0
--- /dev/null
+++ b/src/org/climbingguide/gui/FragmentSectors.java
@@ -0,0 +1,80 @@
+package org.climbingguide.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.SectorDao;
+import org.climbingguide.main.R;
+import org.climbingguide.model.Sector;
+
+import android.os.Bundle;
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+public class FragmentSectors extends ListFragment{
+
+ private SectorDao getSectors;
+ private List<Sector> sectorList = new ArrayList<Sector>();
+ private Sector sector = new Sector();
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().setTitle("Sectors");
+
+ getSectors = new SectorDao(getActivity());
+ int idOfArea = getArguments().getInt("idOfArea");
+
+
+
+ getSectors.open();
+
+ sectorList = getSectors.getSector(idOfArea); //get by area
+
+ getSectors.close();
+
+
+ ArrayAdapter<Sector> adapter = new ArrayAdapter<Sector>(getActivity(),android.R.layout.simple_list_item_1,sectorList);
+
+ setListAdapter(adapter);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+
+
+ Bundle bundle = new Bundle();
+
+ sector = sectorList.get(position);
+
+ bundle.putInt("idOfSector",sector.getId());
+ FragmentRoutes fragobj = new FragmentRoutes();
+ fragobj.setArguments(bundle);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ transaction.replace(R.id.frame_container, fragobj,"Routes");
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+ }
+
+ public int getIdOfArea()
+ {
+ int i;
+ if(sectorList.isEmpty())
+ {
+ i = -1;
+ }
+ else{
+ sector = sectorList.get(0);
+
+ i = sector.getIdOfArea();
+ }
+ return i;
+ }
+
+}
diff --git a/src/org/climbingguide/gui/FragmentSectorsAll.java b/src/org/climbingguide/gui/FragmentSectorsAll.java
new file mode 100644
index 0000000..154dcbf
--- /dev/null
+++ b/src/org/climbingguide/gui/FragmentSectorsAll.java
@@ -0,0 +1,78 @@
+package org.climbingguide.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.SectorDao;
+import org.climbingguide.main.R;
+import org.climbingguide.model.Sector;
+
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+public class FragmentSectorsAll extends ListFragment{
+
+ private SectorDao getSectors;
+ private List<Sector> sectorList = new ArrayList<Sector>();
+ private Sector sector = new Sector();
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().setTitle("Sectors");
+
+ getSectors = new SectorDao(getActivity());
+
+
+ getSectors.open();
+
+ sectorList = getSectors.getAllSectors();
+
+ getSectors.close();
+
+
+ ArrayAdapter<Sector> adapter = new ArrayAdapter<Sector>(getActivity(),android.R.layout.simple_list_item_1,sectorList);
+
+ setListAdapter(adapter);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+
+
+ Bundle bundle = new Bundle();
+
+ sector = sectorList.get(position);
+
+ bundle.putInt("idOfSector",sector.getId());
+ FragmentRoutes fragobj = new FragmentRoutes();
+ fragobj.setArguments(bundle);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ transaction.replace(R.id.frame_container, fragobj,"Routes");
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+ }
+
+ public int getIdOfArea()
+ {
+ int i;
+ if(sectorList.isEmpty())
+ {
+ i = -1;
+ }
+ else{
+ sector = sectorList.get(0);
+
+ i = sector.getIdOfArea();
+ }
+ return i;
+ }
+
+}
diff --git a/src/org/climbingguide/gui/FragmentSelectSector.java b/src/org/climbingguide/gui/FragmentSelectSector.java
new file mode 100644
index 0000000..9267142
--- /dev/null
+++ b/src/org/climbingguide/gui/FragmentSelectSector.java
@@ -0,0 +1,6 @@
+package org.climbingguide.gui;
+
+public class FragmentSelectSector extends FragmentSectorsAll{
+
+
+}
diff --git a/src/org/climbingguide/gui/SearchAreas.java b/src/org/climbingguide/gui/SearchAreas.java
new file mode 100644
index 0000000..1204c3d
--- /dev/null
+++ b/src/org/climbingguide/gui/SearchAreas.java
@@ -0,0 +1,63 @@
+package org.climbingguide.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.AreaDao;
+import org.climbingguide.main.R;
+import org.climbingguide.model.Area;
+
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+public class SearchAreas extends ListFragment{
+
+private AreaDao getAreas;
+private List<Area> areaList = new ArrayList<Area>();
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().setTitle("Areas");
+
+ getAreas = new AreaDao(getActivity());
+ String query = getArguments().getString("query");
+
+ getAreas.open();
+
+ areaList = getAreas.areasSearch(query);
+
+ getAreas.close();
+
+
+ ArrayAdapter<Area> adapter = new ArrayAdapter<Area>(getActivity(),android.R.layout.simple_list_item_1,areaList);
+
+ setListAdapter(adapter);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+
+ Area area = new Area();
+ Bundle bundle = new Bundle();
+
+ area = areaList.get(position);
+
+ bundle.putInt("idOfArea",area.getId());
+ FragmentSectors fragobj = new FragmentSectors();
+ fragobj.setArguments(bundle);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ transaction.replace(R.id.frame_container, fragobj,"Sectors");
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+ }
+
+
+}
diff --git a/src/org/climbingguide/gui/SearchRoutes.java b/src/org/climbingguide/gui/SearchRoutes.java
new file mode 100644
index 0000000..8f795f4
--- /dev/null
+++ b/src/org/climbingguide/gui/SearchRoutes.java
@@ -0,0 +1,93 @@
+package org.climbingguide.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.RouteDao;
+import org.climbingguide.main.R;
+import org.climbingguide.model.Route;
+
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+public class SearchRoutes extends ListFragment{
+
+ private RouteDao getRoutes;
+ private List<Route> routeList = new ArrayList<Route>();
+ private Route route = new Route();
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().setTitle("Routes");
+
+ getRoutes = new RouteDao(getActivity());
+ String query = getArguments().getString("query");
+ int idOfSector = getArguments().getInt("idOfSector");
+
+ getRoutes.open();
+ if(idOfSector >= 0)
+ {
+ routeList = getRoutes.routeSearchId(query, idOfSector);
+ }
+ else
+ {
+ routeList = getRoutes.routeSearch(query);
+ }
+ getRoutes.close();
+
+
+ ArrayAdapter<Route> adapter = new ArrayAdapter<Route>(getActivity(),android.R.layout.simple_list_item_1,routeList);
+
+ setListAdapter(adapter);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+
+
+ Bundle bundle = new Bundle();
+
+ route = routeList.get(position);
+
+ bundle.putString("name",route.getName());
+ bundle.putString("difficulty",route.getDificulty());
+ bundle.putInt("bolts",route.getBolts());
+ bundle.putInt("length",route.getLength());
+
+ bundle.putDouble("longitude",route.getLongitude());
+ bundle.putDouble("latitude",route.getLatitute());
+
+
+ FragmentRoute fragobj = new FragmentRoute();
+ fragobj.setArguments(bundle);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ transaction.replace(R.id.frame_container, fragobj,"Route");
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+ }
+
+ public int getIdOfSector()
+ {
+ int i;
+ if(routeList.isEmpty())
+ {
+ i = -1;
+ }
+ else
+ {
+ route = routeList.get(0);
+ i = route.getIdOfSector();
+ }
+ return i;
+ }
+}
+
diff --git a/src/org/climbingguide/gui/SearchSectors.java b/src/org/climbingguide/gui/SearchSectors.java
new file mode 100644
index 0000000..885eb3d
--- /dev/null
+++ b/src/org/climbingguide/gui/SearchSectors.java
@@ -0,0 +1,85 @@
+package org.climbingguide.gui;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.SectorDao;
+import org.climbingguide.main.R;
+import org.climbingguide.model.Sector;
+
+import android.app.FragmentTransaction;
+import android.app.ListFragment;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+public class SearchSectors extends ListFragment{
+
+ private SectorDao getSectors;
+ private List<Sector> sectorList = new ArrayList<Sector>();
+ private Sector sector = new Sector();
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getActivity().setTitle("Sectors");
+
+ getSectors = new SectorDao(getActivity());
+ String query = getArguments().getString("query");
+ int idOfArea = getArguments().getInt("idOfArea");
+
+ getSectors.open();
+ if(idOfArea >= 0)
+ {
+ sectorList = getSectors.sectorSearchId(query, idOfArea);
+ }
+ else
+ {
+ sectorList = getSectors.sectorSearch(query);
+ }
+ getSectors.close();
+
+
+ ArrayAdapter<Sector> adapter = new ArrayAdapter<Sector>(getActivity(),android.R.layout.simple_list_item_1,sectorList);
+
+ setListAdapter(adapter);
+ }
+
+ @Override
+ public void onListItemClick(ListView l, View v, int position, long id) {
+
+
+ Bundle bundle = new Bundle();
+
+ sector = sectorList.get(position);
+
+ bundle.putInt("idOfSector",sector.getId());
+ FragmentRoutes fragobj = new FragmentRoutes();
+ fragobj.setArguments(bundle);
+
+
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+
+ transaction.replace(R.id.frame_container, fragobj,"Routes");
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+ }
+
+ public int getIdOfArea()
+ {
+ int i;
+ if(sectorList.isEmpty())
+ {
+ i = -1;
+ }
+ else{
+ sector = sectorList.get(0);
+
+ i = sector.getIdOfArea();
+ }
+ return i;
+ }
+
+}
+
diff --git a/src/org/climbingguide/main/MainActivity.java b/src/org/climbingguide/main/MainActivity.java
new file mode 100644
index 0000000..f9614e9
--- /dev/null
+++ b/src/org/climbingguide/main/MainActivity.java
@@ -0,0 +1,471 @@
+package org.climbingguide.main;
+
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.climbingguide.dao.AreaDao;
+import org.climbingguide.dao.RouteDao;
+import org.climbingguide.dao.SectorDao;
+import org.climbingguide.gui.FragmentAreasAll;
+import org.climbingguide.gui.FragmentCreate;
+import org.climbingguide.gui.FragmentRoutes;
+import org.climbingguide.gui.FragmentRoutesAll;
+import org.climbingguide.gui.FragmentSectors;
+import org.climbingguide.gui.FragmentSectorsAll;
+import org.climbingguide.gui.SearchAreas;
+import org.climbingguide.gui.SearchRoutes;
+import org.climbingguide.gui.SearchSectors;
+import org.climbingguide.model.Area;
+import org.climbingguide.model.Route;
+import org.climbingguide.model.Sector;
+import org.climbingguide.update.Update;
+
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.content.res.TypedArray;
+import android.os.Bundle;
+import android.support.v4.app.ActionBarDrawerToggle;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.support.v4.widget.DrawerLayout;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ListView;
+import android.widget.SearchView;
+
+
+public class MainActivity extends Activity implements SearchView.OnQueryTextListener {
+ private static final String LOG = AreaDao.class.getName();
+ private DrawerLayout mDrawerLayout;
+ private ListView mDrawerList;
+ private ActionBarDrawerToggle mDrawerToggle;
+ private String[] current = new String[2];
+
+ //menu item
+ private SearchView mSearchView;
+ //for fragment taging
+ private String tagFragment = "FragmentName";
+ // nav drawer title
+ private CharSequence mDrawerTitle;
+
+ // used to store app title
+ private CharSequence mTitle;
+
+ // slide menu items
+ private String[] navMenuTitles;
+ private TypedArray navMenuIcons;
+
+ //Dao object
+ private AreaDao areaDao;
+
+
+ private ArrayList<NavDrawerItem> navDrawerItems;
+ private NavDrawerListAdapter adapter;
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ //Check for update
+ areaDao = new AreaDao(getApplicationContext());
+ areaDao.open();
+ List<Area> areaList = new ArrayList<Area>();
+ areaList = areaDao.getAllAreas();
+ areaDao.close();
+ //Update if db is empty
+ if(areaList.isEmpty())
+ {
+ Update update = new Update();
+ update.updateA(getApplicationContext());
+ update.updateR(getApplicationContext());
+ update.updateS(getApplicationContext());
+ }
+
+
+ mTitle = mDrawerTitle = getTitle();
+
+ // load slide menu items
+ navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
+
+ // nav drawer icons from resources
+ navMenuIcons = getResources()
+ .obtainTypedArray(R.array.nav_drawer_icons);
+
+ mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
+ mDrawerList = (ListView) findViewById(R.id.list_slidermenu);
+
+ navDrawerItems = new ArrayList<NavDrawerItem>();
+
+ // adding nav drawer items to array
+ // Home
+ navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1),true,getNumberOfAreas()));
+ // Find People
+ navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1),true,getNumberOfSectors()));
+ // Photos
+ navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1),true,getNumberOfRoutes()));
+ // Communities, Will add a counter here
+ navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1)));
+ // Pages
+ navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
+ // What's hot, We will add a counter here
+ navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1)));
+
+
+ // Recycle the typed array
+ navMenuIcons.recycle();
+
+ mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
+
+ // setting the nav drawer list adapter
+ adapter = new NavDrawerListAdapter(getApplicationContext(),
+ navDrawerItems);
+ mDrawerList.setAdapter(adapter);
+
+ // enabling action bar app icon and behaving it as toggle button
+ getActionBar().setDisplayHomeAsUpEnabled(true);
+ getActionBar().setHomeButtonEnabled(true);
+
+ mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
+ R.drawable.ic_drawer, //nav menu toggle icon
+ R.string.app_name, // nav drawer open - description for accessibility
+ R.string.app_name // nav drawer close - description for accessibility
+ ) {
+ public void onDrawerClosed(View view) {
+ getActionBar().setTitle(mTitle);
+ // calling onPrepareOptionsMenu() to show action bar icons
+ invalidateOptionsMenu();
+ }
+
+ public void onDrawerOpened(View drawerView) {
+ getActionBar().setTitle(mDrawerTitle);
+ // calling onPrepareOptionsMenu() to hide action bar icons
+ invalidateOptionsMenu();
+ }
+ };
+ mDrawerLayout.setDrawerListener(mDrawerToggle);
+
+ if (savedInstanceState == null) {
+ // on first time display view for first nav item
+ displayView(0);
+ }
+ }
+
+ /**
+ * Slide menu item click listener
+ * */
+ private class SlideMenuClickListener implements
+ ListView.OnItemClickListener {
+ @Override
+ public void onItemClick(AdapterView<?> parent, View view, int position,
+ long id) {
+ // display view for selected nav drawer item
+ displayView(position);
+ }
+ }
+ //Menu
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+
+ getMenuInflater().inflate(R.menu.main, menu);
+
+
+ MenuItem searchItem = menu.findItem(R.id.action_search);
+ mSearchView = (SearchView) searchItem.getActionView();
+
+ mSearchView.setOnQueryTextListener(this);
+
+ return super.onCreateOptionsMenu(menu);
+
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // toggle nav drawer on selecting action bar app icon/title
+ if (mDrawerToggle.onOptionsItemSelected(item)) {
+ return true;
+ }
+ // Handle action bar actions click
+
+ switch (item.getItemId()) {
+ case R.id.action_settings:
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+
+
+ @Override
+ public boolean onQueryTextChange(String newText) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean onQueryTextSubmit(String query) {
+ Bundle bundle = new Bundle();
+ bundle.putString("query", query);
+
+ FragmentAreasAll areaAll = (FragmentAreasAll)getFragmentManager().findFragmentByTag("AreasAll");
+ FragmentSectorsAll sectorAll = (FragmentSectorsAll)getFragmentManager().findFragmentByTag("SectorsAll");
+ FragmentRoutesAll routeAll = (FragmentRoutesAll)getFragmentManager().findFragmentByTag("RoutesAll");
+
+ FragmentSectors sector = (FragmentSectors)getFragmentManager().findFragmentByTag("Sectors");
+ FragmentRoutes route = (FragmentRoutes)getFragmentManager().findFragmentByTag("Routes");
+
+ if(areaAll != null && areaAll.isVisible()){
+
+ current[0] = "area";
+ current[1] = "-1";
+ SearchAreas fragment = new SearchAreas();
+ fragment.setArguments(bundle);
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+ tagFragment = "AreasSearch";
+ transaction.replace(R.id.frame_container, fragment,tagFragment);
+ transaction.addToBackStack(null);
+ query = "";
+ transaction.commit();
+
+
+
+ }
+ else
+ if(sectorAll != null && sectorAll.isVisible()){
+
+ current[0] = "sector";
+ current[1] = "-1";
+ SearchSectors fragment = new SearchSectors();
+ bundle.putInt("idOfArea",-1);
+ fragment.setArguments(bundle);
+ tagFragment="SectorsSearch";
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+ transaction.replace(R.id.frame_container, fragment,tagFragment);
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+
+
+ }
+ else
+ if(routeAll != null && routeAll.isVisible()){
+
+ current[0] = "route";
+ current[1] = "-1";
+ SearchRoutes fragment = new SearchRoutes();
+ bundle.putInt("idOfSector",-1);
+ fragment.setArguments(bundle);
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+ tagFragment="RoutesSearch";
+ transaction.replace(R.id.frame_container, fragment,tagFragment);
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+
+
+ }
+ else
+ if(sector != null && sector.isVisible()){
+
+ current[0] = "sector";
+ current[1] = (""+sector.getIdOfArea());
+ SearchSectors fragment = new SearchSectors();
+ bundle.putInt("idOfArea",sector.getIdOfArea());
+ fragment.setArguments(bundle);
+ tagFragment = "SectorsSearch";
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+ transaction.replace(R.id.frame_container, fragment,tagFragment);
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+
+
+ }
+ else
+ if(route != null && route.isVisible() ){
+
+ current[0] = "route";
+ current[1] = (""+route.getIdOfSector());
+ SearchRoutes fragment = new SearchRoutes();
+ bundle.putInt("idOfSector",route.getIdOfSector());
+ fragment.setArguments(bundle);
+ tagFragment = "RoutesSearch";
+ FragmentTransaction transaction = getFragmentManager().beginTransaction();
+ transaction.replace(R.id.frame_container, fragment,tagFragment);
+ transaction.addToBackStack(null);
+
+ transaction.commit();
+
+
+ }
+
+ Log.i(LOG,"TagFragmentt = "+tagFragment);
+ return false;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+ /* *
+ * Called when invalidateOptionsMenu() is triggered
+ */
+ @Override
+ public boolean onPrepareOptionsMenu(Menu menu) {
+ // if nav drawer is opened, hide the action items
+ boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
+ menu.findItem(R.id.action_settings).setVisible(!drawerOpen);
+ menu.findItem(R.id.action_search).setVisible(!drawerOpen);
+ return super.onPrepareOptionsMenu(menu);
+ }
+
+ /**
+ * Diplaying fragment view for selected nav drawer list item
+ * */
+ private void displayView(int position) {
+ // update the main content by replacing fragments
+ Fragment fragment = null;
+
+ switch (position) {
+ case 0:
+ fragment = new FragmentAreasAll();
+ tagFragment = "AreasAll";
+ break;
+ case 1:
+ fragment = new FragmentSectorsAll();
+ tagFragment = "SectorsAll";
+ break;
+ case 2:
+ fragment = new FragmentRoutesAll();
+ tagFragment = "RoutesAll";
+ break;
+ case 3:
+ fragment = new FragmentCreate(current);
+ tagFragment = "Create";
+ break;
+// case 4:
+// fragment = new ();
+// break;
+// case 5:
+// fragment = new ();
+// break;
+
+ default:
+ break;
+ }
+
+ if (fragment != null) {
+
+ FragmentManager fragmentManager = getFragmentManager();
+ fragmentManager.beginTransaction()
+ .replace(R.id.frame_container, fragment,tagFragment).commit();
+
+ // update selected item and title, then close the drawer
+ mDrawerList.setItemChecked(position, true);
+ mDrawerList.setSelection(position);
+ setTitle(navMenuTitles[position]);
+ mDrawerLayout.closeDrawer(mDrawerList);
+ Log.i(LOG,"TagFragment = "+tagFragment);
+
+ } else {
+ // error in creating fragment
+ Log.e("MainActivity", "Error in creating fragment");
+ }
+
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ mTitle = title;
+ getActionBar().setTitle(mTitle);
+ }
+
+ /**
+ * When using the ActionBarDrawerToggle, you must call it during
+ * onPostCreate() and onConfigurationChanged()...
+ */
+
+ @Override
+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+ // Sync the toggle state after onRestoreInstanceState has occurred.
+ mDrawerToggle.syncState();
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ // Pass any configuration change to the drawer toggls
+ mDrawerToggle.onConfigurationChanged(newConfig);
+ }
+ //Get number of areas , sectors,routes
+ public String getNumberOfAreas()
+ {
+ int numberOfareas = 0;
+ AreaDao areaDao = new AreaDao(getApplicationContext());
+ List<Area> areaList = new ArrayList<Area>();
+
+ areaDao.open();
+ areaList = areaDao.getAllAreas();
+ areaDao.close();
+
+ for(Area area : areaList)
+ {
+ numberOfareas++;
+ }
+
+
+ return Integer.toString(numberOfareas);
+ }
+
+ public String getNumberOfSectors()
+ {
+ int numberOfsectors = 0;
+ SectorDao sectorDao = new SectorDao(getApplicationContext());
+ List<Sector> sectorList = new ArrayList<Sector>();
+
+ sectorDao.open();
+ sectorList = sectorDao.getAllSectors();
+ sectorDao.close();
+
+ for(Sector sector : sectorList)
+ {
+ numberOfsectors++;
+ }
+
+ return Integer.toString(numberOfsectors);
+ }
+
+ public String getNumberOfRoutes()
+ {
+ int numberOfroutes = 0;
+ RouteDao routeDao = new RouteDao(getApplicationContext());
+ List<Route> routeList = new ArrayList<Route>();
+
+ routeDao.open();
+ routeList = routeDao.getAllRoutes();
+ routeDao.close();
+
+ for(Route route : routeList)
+ {
+ numberOfroutes++;
+ }
+ return Integer.toString(numberOfroutes);
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/org/climbingguide/main/NavDrawerItem.java b/src/org/climbingguide/main/NavDrawerItem.java
new file mode 100644
index 0000000..6b508ae
--- /dev/null
+++ b/src/org/climbingguide/main/NavDrawerItem.java
@@ -0,0 +1,56 @@
+package org.climbingguide.main;
+
+public class NavDrawerItem {
+
+ private String title;
+ private int icon;
+ private String count = "0";
+ // boolean to set visiblity of the counter
+ private boolean isCounterVisible = false;
+
+ public NavDrawerItem(){}
+
+ public NavDrawerItem(String title, int icon){
+ this.title = title;
+ this.icon = icon;
+ }
+
+ public NavDrawerItem(String title, int icon, boolean isCounterVisible, String count){
+ this.title = title;
+ this.icon = icon;
+ this.isCounterVisible = isCounterVisible;
+ this.count = count;
+ }
+
+ public String getTitle(){
+ return this.title;
+ }
+
+ public int getIcon(){
+ return this.icon;
+ }
+
+ public String getCount(){
+ return this.count;
+ }
+
+ public boolean getCounterVisibility(){
+ return this.isCounterVisible;
+ }
+
+ public void setTitle(String title){
+ this.title = title;
+ }
+
+ public void setIcon(int icon){
+ this.icon = icon;
+ }
+
+ public void setCount(String count){
+ this.count = count;
+ }
+
+ public void setCounterVisibility(boolean isCounterVisible){
+ this.isCounterVisible = isCounterVisible;
+ }
+}
diff --git a/src/org/climbingguide/main/NavDrawerListAdapter.java b/src/org/climbingguide/main/NavDrawerListAdapter.java
new file mode 100644
index 0000000..60640ae
--- /dev/null
+++ b/src/org/climbingguide/main/NavDrawerListAdapter.java
@@ -0,0 +1,66 @@
+package org.climbingguide.main;
+
+import java.util.ArrayList;
+
+import android.app.Activity;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+public class NavDrawerListAdapter extends BaseAdapter {
+
+ private Context context;
+ private ArrayList<NavDrawerItem> navDrawerItems;
+
+ public NavDrawerListAdapter(Context context, ArrayList<NavDrawerItem> navDrawerItems){
+ this.context = context;
+ this.navDrawerItems = navDrawerItems;
+ }
+
+ @Override
+ public int getCount() {
+ return navDrawerItems.size();
+ }
+
+ @Override
+ public Object getItem(int position) {
+ return navDrawerItems.get(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ if (convertView == null) {
+ LayoutInflater mInflater = (LayoutInflater)
+ context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
+ convertView = mInflater.inflate(R.layout.drawer_list_item, null);
+ }
+
+ ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
+ TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
+ TextView txtCount = (TextView) convertView.findViewById(R.id.counter);
+
+ imgIcon.setImageResource(navDrawerItems.get(position).getIcon());
+ txtTitle.setText(navDrawerItems.get(position).getTitle());
+
+ // displaying count
+ // check whether it set visible or not
+ if(navDrawerItems.get(position).getCounterVisibility()){
+ txtCount.setText(navDrawerItems.get(position).getCount());
+ }else{
+ // hide the counter view
+ txtCount.setVisibility(View.GONE);
+ }
+
+ return convertView;
+ }
+
+}
diff --git a/src/org/climbingguide/model/Area.java b/src/org/climbingguide/model/Area.java
new file mode 100644
index 0000000..c47af49
--- /dev/null
+++ b/src/org/climbingguide/model/Area.java
@@ -0,0 +1,39 @@
+package org.climbingguide.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Activity;
+
+public class Area extends Activity{
+
+ private int id;
+ private String name;
+ private List <Sector> sectors = new ArrayList<Sector>();
+
+ public List<Sector> getSectors() {
+ return sectors;
+ }
+ public void setSectors(List<Sector> sectors) {
+ this.sectors = sectors;
+ }
+ public int getId() {
+ return id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ @Override
+ public String toString(){
+ return name;
+ }
+
+
+
+}
diff --git a/src/org/climbingguide/model/Route.java b/src/org/climbingguide/model/Route.java
new file mode 100644
index 0000000..1a4ef56
--- /dev/null
+++ b/src/org/climbingguide/model/Route.java
@@ -0,0 +1,71 @@
+package org.climbingguide.model;
+
+import android.app.Activity;
+
+public class Route extends Activity{
+
+ private int id;
+ private String name;
+ private int idOfSector;
+ private String dificulty;
+ private int bolts;
+ private int length;
+
+ private double latitute;
+ private double longitude;
+
+ public int getId() {
+ return id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public int getIdOfSector() {
+ return idOfSector;
+ }
+ public void setIdOfSector(int idOfSector) {
+ this.idOfSector = idOfSector;
+ }
+ public String getDificulty() {
+ return dificulty;
+ }
+ public void setDificulty(String dificulty) {
+ this.dificulty = dificulty;
+ }
+ public int getBolts() {
+ return bolts;
+ }
+ public void setBolts(int bolts) {
+ this.bolts = bolts;
+ }
+ public int getLength() {
+ return length;
+ }
+ public void setLength(int length) {
+ this.length = length;
+ }
+ public double getLatitute() {
+ return latitute;
+ }
+ public void setLatitute(double latitute) {
+ this.latitute = latitute;
+ }
+ public double getLongitude() {
+ return longitude;
+ }
+ public void setLongitude(double longitude) {
+ this.longitude = longitude;
+ }
+ @Override
+ public String toString(){
+ return name;
+ }
+
+
+}
diff --git a/src/org/climbingguide/model/Sector.java b/src/org/climbingguide/model/Sector.java
new file mode 100644
index 0000000..7ce2423
--- /dev/null
+++ b/src/org/climbingguide/model/Sector.java
@@ -0,0 +1,45 @@
+package org.climbingguide.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Activity;
+
+public class Sector extends Activity{
+
+ private int id;
+ private String name;
+ private int idOfArea;
+ private List<Route> routes = new ArrayList <Route>();
+
+ public List<Route> getRoutes() {
+ return routes;
+ }
+ public void setRoutes(List<Route> routes) {
+ this.routes = routes;
+ }
+ public int getId() {
+ return id;
+ }
+ public void setId(int id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public int getIdOfArea() {
+ return idOfArea;
+ }
+ public void setIdOfArea(int idOfArea) {
+ this.idOfArea = idOfArea;
+ }
+ @Override
+ public String toString(){
+ return name;
+ }
+
+
+}
diff --git a/src/org/climbingguide/update/Update.java b/src/org/climbingguide/update/Update.java
new file mode 100644
index 0000000..aca88e3
--- /dev/null
+++ b/src/org/climbingguide/update/Update.java
@@ -0,0 +1,49 @@
+package org.climbingguide.update;
+
+import android.content.Context;
+
+public class Update {
+
+ //----------------------------------------------------------
+ public void updateA(Context context)
+ {
+ UpdateArea area = new UpdateArea();
+
+ area.updateArea(1, "Drevenik",context);
+ area.updateArea(2, "Turniska",context);
+ area.updateArea(3, "Zamutov",context);
+ area.updateArea(4, "Zadiel",context);
+
+
+ }
+//---------------------------------------------------------------
+ public void updateS(Context context)
+ {
+ UpdateSector sector = new UpdateSector();
+
+ sector.updateSector(1,"Peklo",1,context);
+ sector.updateSector(2,"Raj",1,context);
+ sector.updateSector(3,"Najvyssia turna",2,context);
+ sector.updateSector(4,"Velkonocna turna",2,context);
+ sector.updateSector(5,"Zarastena turna",2,context);
+ sector.updateSector(6,"Mur",2,context);
+ sector.updateSector(7,"Klemba",2,context);
+ sector.updateSector(8,"Najnisia turna",2,context);
+ sector.updateSector(9,"Cervene previsy",1,context);
+ sector.updateSector(10,"Marta",1,context);
+ sector.updateSector(11,"Amerika",1,context);
+ sector.updateSector(12,"Previsy",3,context);
+
+ }
+//---------------------------------------------------------------
+ public void updateR(Context context)
+ {
+ UpdateRoute route = new UpdateRoute();
+
+ route.updateRoute(1, "Moreplavec", 12, "7", 6, 10, 48.9947059,21.2347516, context);
+ route.updateRoute(2, "Vecko", 12, "7-", 8, 15, 48.9947059,21.2347516, context);
+ route.updateRoute(3, "Flora",3,"9/9+",6, 10, 48.9947059,21.2347516, context);
+ route.updateRoute(4, "Vanicky",3, "8+",10, 17, 48.9947059,21.2347516, context);
+
+ }
+}
diff --git a/src/org/climbingguide/update/UpdateArea.java b/src/org/climbingguide/update/UpdateArea.java
new file mode 100644
index 0000000..bcc1cf2
--- /dev/null
+++ b/src/org/climbingguide/update/UpdateArea.java
@@ -0,0 +1,25 @@
+package org.climbingguide.update;
+
+import org.climbingguide.dao.AreaDao;
+import org.climbingguide.model.Area;
+
+import android.app.Activity;
+import android.content.Context;
+
+
+public class UpdateArea extends Activity {
+
+
+ public void updateArea(int id, String name,Context context)
+ {
+ Area area = new Area();
+
+ area.setId(id);
+ area.setName(name);
+
+ AreaDao daoa = new AreaDao(context);
+ daoa.open();
+ daoa.addArea(area);
+ daoa.close();
+ }
+}
diff --git a/src/org/climbingguide/update/UpdateRoute.java b/src/org/climbingguide/update/UpdateRoute.java
new file mode 100644
index 0000000..617f686
--- /dev/null
+++ b/src/org/climbingguide/update/UpdateRoute.java
@@ -0,0 +1,30 @@
+package org.climbingguide.update;
+
+import org.climbingguide.dao.RouteDao;
+import org.climbingguide.model.Route;
+
+import android.content.Context;
+
+public class UpdateRoute {
+
+ public void updateRoute(int id, String name,int id_of_sector,String dificulty,int bolts,int length,double latitute,double longitude,Context context)
+ {
+ Route route = new Route ();
+
+ route.setId(id);
+ route.setName(name);
+ route.setIdOfSector(id_of_sector);
+ route.setDificulty(dificulty);
+ route.setBolts(bolts);
+ route.setLength(length);
+ route.setLatitute(latitute);
+ route.setLongitude(longitude);
+
+ RouteDao daor = new RouteDao(context);
+ daor.open();
+ daor.addRoute(route);
+ daor.close();
+
+ }
+
+}
diff --git a/src/org/climbingguide/update/UpdateSector.java b/src/org/climbingguide/update/UpdateSector.java
new file mode 100644
index 0000000..4193ec8
--- /dev/null
+++ b/src/org/climbingguide/update/UpdateSector.java
@@ -0,0 +1,23 @@
+package org.climbingguide.update;
+
+import org.climbingguide.dao.SectorDao;
+import org.climbingguide.model.Sector;
+
+import android.content.Context;
+
+public class UpdateSector {
+
+ public void updateSector(int id, String name,int idOfArea,Context context)
+ {
+ Sector sector = new Sector();
+
+ sector.setId(id);
+ sector.setName(name);
+ sector.setIdOfArea(idOfArea);
+
+ SectorDao daos = new SectorDao(context);
+ daos.open();
+ daos.addSector(sector);
+ daos.close();
+ }
+}