Full Code of lemberg/mappwidget for AI

master a5e233469da9 cached
139 files
453.0 KB
137.7k tokens
809 symbols
1 requests
Download .txt
Showing preview only (499K chars total). Download the full file or copy to clipboard to get everything.
Repository: lemberg/mappwidget
Branch: master
Commit: a5e233469da9
Files: 139
Total size: 453.0 KB

Directory structure:
gitextract_albf_jio/

├── .gitignore
├── LICENSE
├── README.md
├── bin/
│   ├── mAppWidget-1.4.2-javadoc.jar
│   └── mAppWidget-1.4.2.jar
├── mAppWidget/
│   ├── build.gradle
│   ├── demo1app/
│   │   ├── .gitignore
│   │   ├── build.gradle
│   │   ├── proguard-rules.pro
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── assets/
│   │           │   ├── grid/
│   │           │   │   └── grid.xml
│   │           │   ├── grid2/
│   │           │   │   └── grid.xml
│   │           │   └── map/
│   │           │       └── map.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── ls/
│   │           │           └── demo/
│   │           │               └── demo1/
│   │           │                   ├── BrowseMapActivity.java
│   │           │                   ├── CaptionMapObject.java
│   │           │                   ├── Category.java
│   │           │                   ├── ExBrowseMapActivity.java
│   │           │                   ├── HomeActivity.java
│   │           │                   ├── Location.java
│   │           │                   ├── Model.java
│   │           │                   ├── Sample1Activity.java
│   │           │                   ├── Sample2Activity.java
│   │           │                   ├── model/
│   │           │                   │   ├── MapObjectContainer.java
│   │           │                   │   └── MapObjectModel.java
│   │           │                   └── popup/
│   │           │                       ├── MapPopupBase.java
│   │           │                       └── TextPopup.java
│   │           └── res/
│   │               ├── layout/
│   │               │   ├── home.xml
│   │               │   └── main.xml
│   │               ├── menu/
│   │               │   ├── a1menu.xml
│   │               │   ├── map_menu.xml
│   │               │   └── menu.xml
│   │               └── values/
│   │                   ├── strings.xml
│   │                   ├── styles.xml
│   │                   └── theme.xml
│   ├── demo2app/
│   │   ├── .gitignore
│   │   ├── build.gradle
│   │   ├── proguard-rules.pro
│   │   └── src/
│   │       ├── androidTest/
│   │       │   └── java/
│   │       │       └── com/
│   │       │           └── ls/
│   │       │               └── demo/
│   │       │                   └── demo2/
│   │       │                       └── ApplicationTest.java
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── assets/
│   │           │   └── map/
│   │           │       └── map.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── ls/
│   │           │           └── demo/
│   │           │               └── demo2/
│   │           │                   ├── BrowseMapActivity.java
│   │           │                   ├── model/
│   │           │                   │   ├── MapObjectContainer.java
│   │           │                   │   └── MapObjectModel.java
│   │           │                   └── popup/
│   │           │                       ├── MapPopupBase.java
│   │           │                       └── TextPopup.java
│   │           └── res/
│   │               ├── layout/
│   │               │   ├── activity_main.xml
│   │               │   └── main.xml
│   │               ├── menu/
│   │               │   ├── menu.xml
│   │               │   └── menu_main.xml
│   │               ├── values/
│   │               │   ├── dimens.xml
│   │               │   ├── strings.xml
│   │               │   ├── styles.xml
│   │               │   └── theme.xml
│   │               └── values-w820dp/
│   │                   └── dimens.xml
│   ├── gradle/
│   │   └── wrapper/
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── mappwidgetlib/
│   │   ├── .gitignore
│   │   ├── build.gradle
│   │   ├── proguard-rules.pro
│   │   └── src/
│   │       ├── androidTest/
│   │       │   ├── assets/
│   │       │   │   └── map/
│   │       │   │       └── map.xml
│   │       │   └── java/
│   │       │       └── com/
│   │       │           └── ls/
│   │       │               └── widgets/
│   │       │                   └── map/
│   │       │                       ├── AllTests.java
│   │       │                       ├── CellTest.java
│   │       │                       ├── GridTest.java
│   │       │                       ├── MapLayerTest.java
│   │       │                       ├── MapObjectTest.java
│   │       │                       ├── MapWidgetTest.java
│   │       │                       ├── OfflineMapConfigTest.java
│   │       │                       └── OfflineMapUtilTest.java
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           └── java/
│   │               └── com/
│   │                   └── ls/
│   │                       └── widgets/
│   │                           └── map/
│   │                               ├── MapWidget.java
│   │                               ├── commands/
│   │                               │   ├── GetTileTask.java
│   │                               │   ├── MapCommand.java
│   │                               │   └── MapCommandDelegate.java
│   │                               ├── config/
│   │                               │   ├── GPSConfig.java
│   │                               │   ├── MapConfigParser.java
│   │                               │   ├── MapGraphicsConfig.java
│   │                               │   ├── OfflineMap.java
│   │                               │   └── OfflineMapConfig.java
│   │                               ├── events/
│   │                               │   ├── MapScrolledEvent.java
│   │                               │   ├── MapTouchedEvent.java
│   │                               │   └── ObjectTouchEvent.java
│   │                               ├── interfaces/
│   │                               │   ├── Layer.java
│   │                               │   ├── MapEventsListener.java
│   │                               │   ├── MapLocationListener.java
│   │                               │   ├── OnGridReadyListener.java
│   │                               │   ├── OnLocationChangedListener.java
│   │                               │   ├── OnMapDoubleTapListener.java
│   │                               │   ├── OnMapLongClickListener.java
│   │                               │   ├── OnMapScrollListener.java
│   │                               │   ├── OnMapTilesFinishedLoadingListener.java
│   │                               │   ├── OnMapTouchListener.java
│   │                               │   └── TileManagerDelegate.java
│   │                               ├── location/
│   │                               │   └── PositionMarker.java
│   │                               ├── model/
│   │                               │   ├── Cell.java
│   │                               │   ├── Grid.java
│   │                               │   ├── MapLayer.java
│   │                               │   ├── MapObject.java
│   │                               │   └── MapTouchable.java
│   │                               ├── providers/
│   │                               │   ├── AssetTileProvider.java
│   │                               │   ├── ExternalStorageTileProvider.java
│   │                               │   ├── GPSLocationProvider.java
│   │                               │   └── TileProvider.java
│   │                               └── utils/
│   │                                   ├── GeoUtils.java
│   │                                   ├── Graphics.java
│   │                                   ├── LogUtils.java
│   │                                   ├── MapCalibrationData.java
│   │                                   ├── MathUtils.java
│   │                                   ├── OfflineMapUtil.java
│   │                                   ├── PivotFactory.java
│   │                                   ├── Resources.java
│   │                                   ├── Size.java
│   │                                   └── TransformUtils.java
│   └── settings.gradle
└── slicingtool/
    ├── .classpath
    ├── .project
    ├── .settings/
    │   └── org.eclipse.jdt.core.prefs
    ├── META-INF/
    │   └── MANIFEST.MF
    ├── build.properties
    ├── contexts.xml
    ├── libs/
    │   └── org.eclipse.core.resources.jar
    ├── plugin.xml
    └── src/
        └── com/
            └── ls/
                └── mappwidget/
                    └── slicingtool/
                        ├── Activator.java
                        ├── cutter/
                        │   ├── Constants.java
                        │   ├── Cutter.java
                        │   ├── ImageXML.java
                        │   ├── OnCompliteListener.java
                        │   └── OnProgressUpdateListener.java
                        ├── utils/
                        │   ├── EclipseUtils.java
                        │   ├── FileUtils.java
                        │   └── XMLUtils.java
                        ├── views/
                        │   ├── DirectoryChooser.java
                        │   ├── FileChooser.java
                        │   ├── GPSChooser.java
                        │   ├── MainView.java
                        │   └── RadioGroup.java
                        └── vo/
                            └── PointVO.java

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
.gradle
.idea
local.properties
*.iml
.DS_Store
build

================================================
FILE: LICENSE
================================================

                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

================================================
FILE: README.md
================================================
![mAppWidget](images/app_anim.gif)

Map services are a major growth area for mobile applications. Services like Google maps have brought map technology to the masses in recent years, but it has been hard to integrate them into applications as Google maps and others require a constant Internet connection and use proprietary resources. This means that if the app has to work offline, use original graphics or other features, a custom map has to be built.

At Lemberg we’ve developed many Android apps with custom maps, and to streamline this process we came up with the mAppWidget code library.

![ill](images/ill-3_1.jpg)

Designed to simplify custom map building, mAppWidget is a powerful tool that significantly cuts time and reduces the cost of the developing offline maps. Now any Android developer can benefit from our experience.

Using apps developed with mAppWidget is possible without data connection, unlike most of the other solutions. mAppWidget also uses a tiling technique for graphics that generates a larger map byre-using smaller images (tiles). This approach saves RAM and increases real-time performance, which is especially important on mobile devices. Zooming into images is not limited by the resolution of the input map image, as beyond the maximum zoom level of the image, the library uses digital zoom.

## Features
* Create map from any image
* Tile engine rendering
* GPS support
* Zoom in/out
* Pinch to zoom gesture
* Zoom on double tap
* Digital zoom
* Pan
* Inertial scroll
* Smooth tiles appearing
* Support of more than one map per application
* Ability to move the map object after it was added to the map
* Add/remove layers
* Add/remove objects
* Click handlers/info bubbles
* Works offline
* External storage support

## Requirements
* Android API 7 or higher
* Android OS 2.1 or higher
* Latest JDK, Android Studio 1.1 is recommended

## Demo app
mAppWidget demo is available for download on Google Play - 
[https://play.google.com/store/apps/details?id=com.ls.mappwidgetdemo](https://play.google.com/store/apps/details?id=com.ls.mappwidgetdemo)

## How to use
Here you can find information on how to use mAppWidget library and FAQ's - 
[http://lemberg.github.io/mappwidget/user_guide.html](http://lemberg.github.io/mappwidget/user_guide.html)

## Proudly brought to you
mAppWidget code library has been developed and open sourced by Lemberg Solutions Android development team. If you are interested in integration or customization of the mAppWidget or looking for any other mobile app development solution please feel free to reach us - [http://lemberg.co.uk](http://lemberg.co.uk).


================================================
FILE: mAppWidget/build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}


================================================
FILE: mAppWidget/demo1app/.gitignore
================================================
/build


================================================
FILE: mAppWidget/demo1app/build.gradle
================================================
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.ls.demo.demo1"
        minSdkVersion 7
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile project(':mappwidgetlib')
}


================================================
FILE: mAppWidget/demo1app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/dmytrobaryskyy/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# 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 *;
#}


================================================
FILE: mAppWidget/demo1app/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ls.demo.demo1">

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" >
    </uses-permission>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" >
    </uses-permission>


    <application android:allowBackup="true" android:label="@string/app_name"
        android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme">

        <activity
            android:name=".HomeActivity"
            android:hardwareAccelerated="true"
            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=".Sample1Activity"
            android:hardwareAccelerated="true"
            android:label="Sample1">
        </activity>

        <activity
            android:name=".Sample2Activity"
            android:hardwareAccelerated="true"
            android:label="Sample2">
        </activity>

        <activity
            android:name=".ExBrowseMapActivity"
            android:hardwareAccelerated="true"
            android:label="Sample2">
        </activity>

    </application>

</manifest>


================================================
FILE: mAppWidget/demo1app/src/main/assets/grid/grid.xml
================================================
<?xml version="1.0" encoding="utf-8"?><Image TileSize="256" Overlap="1" Format="png"><Size Width="1600" Height="1600"/></Image>

================================================
FILE: mAppWidget/demo1app/src/main/assets/grid2/grid.xml
================================================
<?xml version="1.0" encoding="utf-8"?><Image TileSize="128" Overlap="1" Format="png"><Size Width="1600" Height="1600"/></Image>

================================================
FILE: mAppWidget/demo1app/src/main/assets/map/map.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<Image TileSize="256" Overlap="1" Format="png">
	<Size Width="1918" Height="978"/>
	<CalibrationRect>
		<Point x="257" y="54" lat="49.835401382423214" lon="23.954856991767883" topLeft="1"/>
		<Point x="1736" y="852" lat="49.81328710324948" lon="24.01834487915039"/>
	</CalibrationRect>
</Image>

================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/BrowseMapActivity.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.ls.widgets.map.MapWidget;
import com.ls.widgets.map.config.OfflineMap;
import com.ls.widgets.map.events.MapTouchedEvent;
import com.ls.widgets.map.interfaces.Layer;
import com.ls.widgets.map.interfaces.MapEventsListener;
import com.ls.widgets.map.interfaces.OnLocationChangedListener;
import com.ls.widgets.map.interfaces.OnMapTouchListener;
import com.ls.widgets.map.model.MapLayer;

import java.io.IOException;
import java.io.InputStream;

public class BrowseMapActivity 
    extends Activity 
{
    /** Called when the activity is first created. */
	
	private MapWidget mapWidget;
//	private static long PIN_ID = 0xdb70bca16186d187L;
	
	public static final long LAYER_ATTRACTIONS = 1000;
    public static final long LAYER_KIDS = 2000;
    public static final long LAYER_SPORT_AND_LEASURE = 3000;
    public static final long PIN_LAYER = 4000;
	
    private Model model;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        
        this.model = new Model();
        
        LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout);
        mapWidget = new MapWidget(this, OfflineMap.MAP_ROOT);
//        mapWidget.setMemoryEconomyMode(true);
        mapWidget.setBackgroundColor(Color.GREEN);

        MapLayer layer = mapWidget.createLayer(LAYER_ATTRACTIONS);
        initLayer(layer, Model.CAT_MAIN_ATTRACTIONS);
        
        layer = mapWidget.createLayer(LAYER_KIDS);
        initLayer(layer, Model.CAT_KIDS);
        
        layer = mapWidget.createLayer(LAYER_SPORT_AND_LEASURE);
        initLayer(layer, Model.CAT_SPORT_AND_LEISURE);
        
        mapWidget.getConfig().setMapCenteringEnabled(false); 
        
        mapWidget.createLayer(PIN_LAYER);
        
//        layer.addTouchable(id, drawable, offsetX, offsetY)
        
//        mapWidget.addLayer(2);
        mapWidget.setAnimationEnabled(true);
        mapWidget.setOnMapTouchListener(new OnMapTouchListener() {
			
			@Override
			public void onTouch(MapWidget v, MapTouchedEvent event){
				AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
				builder.setMessage("OnTouch, X: " + event.getScreenX() + " Y: " + event.getScreenY() 
						+ " MAPX: " + event.getMapX() + " MAPY: " + event.getMapY() +
						" Touched Count: " + event.getTouchedObjectIds().size());
				builder.create().show();
			}
		});
        
        
        mapWidget.addMapEventsListener(new MapEventsListener() {
			
			
			public void onPreZoomOut() 
			{
				Log.i("BrowseMapActivity", "On Map will zoom out");
			}
			
			
			public void onPreZoomIn() 
			{
				Log.i("BrowseMapActivity", "On Map will zoom in");
				
			}
			
			
			public void onPostZoomOut() 
			{
				Log.i("BrowseMapActivity", "On Map did zoom out");
				
			}
			
			
			public void onPostZoomIn() 
			{
				Log.i("BrowseMapActivity", "On Map did zoom in");
				
			} 

		});

        mapWidget.setOnLocationChangedListener(new OnLocationChangedListener()
        {   
           @Override
           public void onLocationChanged(MapWidget v, Location location)
           {
               v.scrollMapTo(location);            
           }
       });
        
        mapWidget.setMinZoomLevel(1);
 //       mapWidget.setScale(2.0f);
        
        layout.addView(mapWidget);
        
//        Runnable runnable = new Runnable() {
//        	@Override
//        	public void run() {
//                generateRandomMarkers();
//                BitmapDrawable image = (BitmapDrawable) getResources().getDrawable(R.drawable.maps_blue_dot);
//                if (image != null) {
//                	Layer layer = mapWidget.getLayerById(PIN_LAYER);
//                	MapObject object = new MapObject(PIN_ID, image, new Point(500, 250), PivotFactory.createPivotPoint(image, PivotPosition.PIVOT_CENTER), true);
//                	layer.addMapObject(object);
//	              //  Pin pin = new Pin(PIN_ID, image, new android.graphics.Point(image.getBitmap().getWidth()/2, image.getBitmap().getHeight()/2));
//	              //  pin.moveTo(500, 250);
//	              //  mapWidget.getPinLayer().addPin(pin);
//	              //  mapWidget.setPinLayerVisible(true);
//                }
//        	}
//        };
//        
//        Thread thread = new Thread(runnable);
//        thread.setPriority(Thread.MIN_PRIORITY);
//        thread.start();
    }


//	private void generateRandomMarkers() {
//		try {
//			final int GREEN_POINT_COUNT = 100;
//			final int BLUE_POINT_COUNT = GREEN_POINT_COUNT;
//			final int MAP_WIDTH = 1500;
//			final int MAP_HEIGHT = 900;
//			
//			InputStream is = getAssets().open("other/trail_difficulty_green_circle.png");
//			BitmapDrawable drawable = new BitmapDrawable(is);
//			is.close();
//			Random random = new Random(System.currentTimeMillis());
//			
//        	for (int i = 0; i < GREEN_POINT_COUNT; ++i) {
//				int randW = random.nextInt(MAP_WIDTH);
//				int randH = random.nextInt(MAP_HEIGHT);
//				BitmapDrawable dr = new BitmapDrawable(drawable.getBitmap());
//
//				Layer layer = mapWidget.getLayer(0);
//				layer.addMapObject(new MapObject(new Integer(random.nextInt(1000)), dr, randW, randH));
//			}
//        		
//			
//			is = getAssets().open("other/trail_difficulty_blue_rect.png");
//			drawable = new BitmapDrawable(is);
//			is.close();
//        	for (int i = 0; i < BLUE_POINT_COUNT; ++i) {
//				int randW = random.nextInt(MAP_WIDTH);
//				int randH = random.nextInt(MAP_HEIGHT);
//				
//				BitmapDrawable dr = new BitmapDrawable(drawable.getBitmap());	
//				
//				Layer layer = mapWidget.getLayer(1);
//				layer.addMapObject(new MapObject(new Integer(random.nextInt(1000)), dr, randW, randH, true, false));
//			}
//			
//		} catch (IOException e) {
//			Log.e("TileManagerWorkerThread", "Exception: " + e);
//			e.printStackTrace();
//		}
//	}
    
    
	
	private void initLayer(Layer theLayer, String theCategoryId)
	{
//	    List<com.ls.widgets.map.location.l> listLocations = this.model.getLocations();
//	    
//        for (Location location : listLocations)
//        {
//            try
//            {
//                String categoryId = location.getCategoryId();
//
//                if (categoryId.equals(theCategoryId))
//                {
//                    Point point = location.getPoint();
//                    MapObject object = new MapObject(location.getId(), 
//                    						getIcon(categoryId),
//                    						point,
//                    						true,  // Touchable
//                    						false); // scalable
//                   
//                    theLayer.addMapObject(object);
//                }
//
//            } catch (IOException e)
//            {
//                e.printStackTrace();
//            }
//        }
        
        theLayer.setVisible(true);
//        if (settings.isCategorySelected(CategoryIds.LEISURE))
//        {
//            layerLeisure.enable();
//        }
	}
	
	
	
	public Drawable getIcon(String theCatId) throws IOException
    {

        String path = "media/icons/";

        if (Model.CAT_MAIN_ATTRACTIONS.equalsIgnoreCase(theCatId))
        {
            path += "map_icon_leisure.png";
        } else if (Model.CAT_KIDS.equalsIgnoreCase(theCatId))
        {
            path += "map_icon_meals.png";
        } else if (Model.CAT_SPORT_AND_LEISURE.equalsIgnoreCase(theCatId))
        {
            path += "map_icon_others_3.png";
        } 

        AssetManager manager = getAssets();

        InputStream input = manager.open(path);

        return Drawable.createFromStream(input, null);
    }
	
	
    
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.map_menu, menu);
        return true;
    }
    
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
		int i = item.getItemId();
		if (i == R.id.zoom_in) {
			try {
				mapWidget.zoomIn();
			} catch (Exception e) {
				Log.e("BrowseMapActivity", "Exception while zoom in. " + e);
			}
			return true;
		}
		else if (i == R.id.zoom_out) {
			try {
				mapWidget.zoomOut();
			} catch (Exception e) {
				Log.e("BrowseMapActivity", "Exception while zoom out. " + e);
			}
			return true;
		}
		else if (i == R.id.double_size) {
			mapWidget.setScale(2.0f);
			return true;
		}
		else if (i == R.id.original_size) {
			mapWidget.setScale(1.0f);
			return true;
		}
		else if (i == R.id.half_size) {
			mapWidget.setScale(0.5f);
			return true;
		}
		else if (i == R.id.open_map) {
			Intent intent = new Intent(this, BrowseMapActivity.class);
			startActivity(intent);
			return true;
		}
		else {
			return super.onOptionsItemSelected(item);
		}
    }


	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		Layer layer = null;
		
		switch (keyCode) {
		case KeyEvent.KEYCODE_1:
			layer = mapWidget.getLayer(0);
			break;
		case KeyEvent.KEYCODE_2:
			layer = mapWidget.getLayer(1);
			break;
		}
		
		if (layer != null) {
			layer.setVisible(!layer.isVisible());
			
			return true;
		} else 
			return super.onKeyDown(keyCode, event);
	}


	@Override
	protected void onStop() {
		super.onStop();
	}

	
	@Override
	protected void onPause() {
		super.onPause();
	}



	@Override
	protected void onDestroy() 
	{
	//	mapWidget.destroy();
		super.onDestroy();
	}
};

================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/CaptionMapObject.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Point;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;

import com.ls.widgets.map.model.MapObject;

public class CaptionMapObject extends MapObject 
{

	private String caption;
	private Paint paint;
	
	public CaptionMapObject(Object id, Drawable drawable, Point position,
			Point pivotPoint, boolean isTouchable, boolean isScalable) {
		super(id, drawable, position, pivotPoint, isTouchable, isScalable);
		
		paint = new Paint(Paint.ANTI_ALIAS_FLAG);
		paint.setColor(Color.WHITE);
		paint.setTextAlign(Align.CENTER);
		paint.setTextSize(14);
		paint.setTypeface(Typeface.SANS_SERIF);
		paint.setFakeBoldText(true);
		paint.setShadowLayer(1, 0, 0, Color.BLACK);
	}

	
	public void setCaption(String caption)
	{
		this.caption = caption;
	}
	
	
	@Override
	public void draw(Canvas canvas) 
	{		
		super.draw(canvas);
		
		if (caption != null) {
			canvas.drawText(caption, posScaled.x, posScaled.y - 10, paint);
		}
	}
	
}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Category.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

public class Category
{

    private String id;
    
    private String name;

    
    
    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }
    
    
    
}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/ExBrowseMapActivity.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.location.Location;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.ls.widgets.map.MapWidget;
import com.ls.widgets.map.config.MapGraphicsConfig;
import com.ls.widgets.map.config.OfflineMapConfig;
import com.ls.widgets.map.events.MapScrolledEvent;
import com.ls.widgets.map.events.MapTouchedEvent;
import com.ls.widgets.map.interfaces.Layer;
import com.ls.widgets.map.interfaces.MapEventsListener;
import com.ls.widgets.map.interfaces.OnLocationChangedListener;
import com.ls.widgets.map.interfaces.OnMapScrollListener;
import com.ls.widgets.map.interfaces.OnMapTouchListener;
import com.ls.widgets.map.model.MapObject;
import com.ls.widgets.map.utils.PivotFactory;
import com.ls.widgets.map.utils.PivotFactory.PivotPosition;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Random;

public class ExBrowseMapActivity 
    extends Activity 
{
    /** Called when the activity is first created. */
	
	private MapWidget mapWidget;
	private Thread animationThread;
	private boolean stopThreads;
	
	
	public static final long LAYER_A = 1000;
	public static final long LAYER_B = 2000;
	public static final long LAYER_C = 3000;
	public static final long PIN_LAYER = 4000;
	
	private int amplitude = 400;
	private float currX = 0;
	private float currY = 0;
	
	private boolean followPointer;
	
	public static final long[] LAYERS = new long[]{};
	
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        stopThreads = false;
        followPointer = true;
        
        File dir = Environment.getExternalStorageDirectory();
        Log.d("ExBrowseActivity", "External Storage Directory: " + Environment.getDataDirectory().getAbsolutePath() + "/maps/grid2");
        
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.main);


        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        Log.d("ExBrowseActivity", "Window format is: " + getWindow().getAttributes().format);
        
        LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout);
        layout.setBackgroundColor(0xFFFFFFFF);
        mapWidget = new MapWidget(savedInstanceState, this, new File("/sdcard/maps/grid2"),12);

        mapWidget.createLayer(0);
        mapWidget.createLayer(1);
        mapWidget.setAnimationEnabled(true);
        mapWidget.setZoomButtonsVisible(true);
        
        MapGraphicsConfig gconfig = mapWidget.getMapGraphicsConfig();
        if (gconfig != null) {
            gconfig.setAccuracyAreaBorderColor(Color.RED);
            gconfig.setAccuracyAreaColor(0x4400FF00);
        }
        
        mapWidget.setOnMapTouchListener(new OnMapTouchListener() {
			
			@Override
			public void onTouch(MapWidget v, MapTouchedEvent event) {
				AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
				builder.setMessage("OnTouch, X: " + event.getScreenX() + " Y: " + event.getScreenY() 
						+ " MAPX: " + event.getMapX() + " MAPY: " + event.getMapY() +
						" Touched Count: " + event.getTouchedObjectIds().size());
				builder.create().show();
			}
		});
        
        
        mapWidget.setOnMapScrolledListener(new OnMapScrollListener()
        { 
            @Override
            public void onScrolledEvent(MapWidget v, MapScrolledEvent event)
            {           
                if (event.isByUser()) {
                    followPointer = false;
                }      
            }
        });
        
        
        mapWidget.setMinZoomLevel(1);
        mapWidget.setMaxZoomLevel(12);
       // mapWidget.setZoomButtonsVisible(true);
 //       mapWidget.setScale(2.0f);
        layout.addView(mapWidget);
        
     mapWidget.addMapEventsListener(new MapEventsListener() {
            
            
            public void onPreZoomOut() 
            {
                Log.i("BrowseMapActivity", "On Map will zoom out");
            }
            
            
            public void onPreZoomIn() 
            {
                Log.i("BrowseMapActivity", "On Map will zoom in");
                
            }
            
            
            public void onPostZoomOut() 
            {
                Log.i("BrowseMapActivity", "On Map did zoom out");
                
            }
            
            
            public void onPostZoomIn() 
            {
                Log.i("BrowseMapActivity", "On Map did zoom in");
                
            }

        });
     
     mapWidget.setOnLocationChangedListener(new OnLocationChangedListener()
     {   
        @Override
        public void onLocationChanged(MapWidget v, Location location)
        {
            if (followPointer) {
                v.scrollMapTo(location);
            }
        }
    });
        
        Runnable runnable = new Runnable() {
        	@Override
        	public void run() {
                generateRandomMarkers();
//                BitmapDrawable image = (BitmapDrawable) getResources().getDrawable(R.drawable.maps_blue_dot);
//                if (image != null) {
//                	Layer layer = mapWidget.getLayerById(PIN_LAYER);
//                	MapObject object = new MapObject(PIN_ID, image, new Point(500, 250), PivotFactory.createPivotPoint(image, PivotPosition.PIVOT_CENTER), false, true);
//    				layer.addMapObject(object);
//                 	layer.setVisible(true);
//                }
        	}
        };
        
        Thread thread = new Thread(runnable);
        thread.setPriority(Thread.MIN_PRIORITY);
        thread.run();
        
        OfflineMapConfig config = mapWidget.getConfig();
        if (config != null) {
            config.setFlingEnabled(true);
            config.setMapCenteringEnabled(false);
        }
        
        //layout.removeView(mapWidget);
       
        
        //mapWidget.setShowMyPosition(true);
        mapWidget.centerMap();
    }


	private void generateRandomMarkers() {
		try {
			final int GREEN_POINT_COUNT = 100;
			final int BLUE_POINT_COUNT = GREEN_POINT_COUNT;
			final int MAP_WIDTH = 1500;
			final int MAP_HEIGHT = 900;
			
			InputStream is = getAssets().open("other/trail_difficulty_green_circle.png");
			BitmapDrawable drawable = new BitmapDrawable(is);
			is.close();
			Random random = new Random(System.currentTimeMillis());
			
			Layer layer = mapWidget.getLayer(0);
			
        	for (int i = 0; i < GREEN_POINT_COUNT; ++i) {
				int randW = random.nextInt(MAP_WIDTH);
				int randH = random.nextInt(MAP_HEIGHT);
				BitmapDrawable dr = new BitmapDrawable(drawable.getBitmap());

				MapObject object = new MapObject(Integer.valueOf(random.nextInt(1000)), dr, randW, randH, false);
				layer.addMapObject(object);
				//layer.addTouchable(new Integer(random.nextInt(1000)), dr, randW, randH);
			}
        		
			
			is = getAssets().open("other/trail_difficulty_blue_rect.png");
			drawable = new BitmapDrawable(is);
			is.close();
			
			 layer = mapWidget.getLayer(1);
        	for (int i = 0; i < BLUE_POINT_COUNT; ++i) {
				int randW = random.nextInt(MAP_WIDTH);
				int randH = random.nextInt(MAP_HEIGHT);
				
				BitmapDrawable dr = new BitmapDrawable(drawable.getBitmap());	
				
				MapObject object = new MapObject(Integer.valueOf((random.nextInt(1000))), dr, new Point(randW, randH), PivotFactory.createPivotPoint(dr, PivotPosition.PIVOT_CENTER), true, false);
				layer.addMapObject(object);
				
				
				
//				layer.addTouchable(new Integer(random.nextInt(1000)), dr, new Point(randW, randH), PivotFactory.createPivotPoint(dr, PivotPosition.PIVOT_CENTER), false);

//				mapWidget.addDrawable(dr, randW, randH);
			}
			
		} catch (IOException e) {
			Log.e("TileManagerWorkerThread", "Exception: " + e);
			e.printStackTrace();
		}
	}
    
 
    
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.map_menu, menu);
        return true;
    }
    
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
		int i = item.getItemId();
		if (i == R.id.zoom_in) {
			try {
				mapWidget.zoomIn();
				mapWidget.scrollMapTo(1500, 700);
			} catch (Exception e) {
				Log.e("BrowseMapActivity", "Exception while zoom in. " + e);
			}
			return true;
		}
		else if (i == R.id.zoom_out) {
			try {
				mapWidget.zoomOut();
			} catch (Exception e) {
				Log.e("BrowseMapActivity", "Exception while zoom out. " + e);
			}
			return true;
		}
		else if (i == R.id.double_size) {
			mapWidget.setScale(2.0f);
			return true;
		}
		else if (i == R.id.original_size) {
			mapWidget.setScale(1.0f);
			return true;
		}
		else if (i == R.id.half_size) {
			mapWidget.setScale(0.5f);
			return true;
		}
		else if (i == R.id.open_map) {
			Intent intent = new Intent(this, ExBrowseMapActivity.class);
			startActivity(intent);
			return true;
		}
		else if (i == R.id.my_location) {
			//mapWidget.scrollToCurrentLocation();
			//followPointer = true;
			mapWidget.centerMap();
			return true;
		}
		else {
			return super.onOptionsItemSelected(item);
		}
    }


	private void animatePin() {
//		if (animationThread == null || (animationThread != null && !animationThread.isAlive())) {
//			animationThread = new Thread(new Runnable() {
//				@Override
//				public void run() {
//				//	MapObject pin = mapWidget.getLayerById(PIN_LAYER).getMapObject(PIN_ID);
//					
//					if (pin == null) {
//						Log.e("PIN", "Pin not foind");
//					}
//					
//					while (!stopThreads) {
//						currX += 0.01;
//						currY += 0.01;
//						
//						if (pin != null) {
//							pin.moveTo((int)(700 + Math.sin(currX) * amplitude), (int)(350 + Math.cos(currY)*250));
//						}
//						
//						try {
//							Thread.sleep(50);
//						} catch (InterruptedException e) {
//							e.printStackTrace();
//							return;
//						}
//					}
//					
//				}
//			});
//			
//			animationThread.start();
//		}
	}


	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		Layer layer = null;
		
		switch (keyCode) {
		case KeyEvent.KEYCODE_1:
			layer = mapWidget.getLayer(0);
			break;
		case KeyEvent.KEYCODE_2:
			layer = mapWidget.getLayer(1);
			break;
		}
		
		if (layer != null) {
			layer.setVisible(!layer.isVisible());
			return true;
		} else 
			return super.onKeyDown(keyCode, event);
	}



	@Override
	protected void onStop() {
		stopThreads = true;
		super.onStop();
	}

	
	@Override
	protected void onPause() {
		super.onPause();
	}



	@Override
	protected void onDestroy() 
	{
		//mapWidget.destroy();
		super.onDestroy();
	}


    @Override
    protected void onSaveInstanceState(Bundle outState)
    {
        mapWidget.saveState(outState);     
        super.onSaveInstanceState(outState);

    }
	
	
	
};

================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/HomeActivity.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class HomeActivity 
    extends Activity
{

    
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home);
        
        initWidgets();
    }
    
    
    private void initWidgets()
    {
        Button button1 = (Button) findViewById(R.id.button_sample_1);
        button1.setOnClickListener(new View.OnClickListener()
        {    
            public void onClick(View arg0)
            {
                doOpenSample1();
            }
        });
        
        Button button2 = (Button) findViewById(R.id.button_sample_2);
        button2.setOnClickListener(new View.OnClickListener()
        {    
            public void onClick(View arg0)
            {
                doOpenSample2();
            }
        });
        
        Button button3 = (Button) findViewById(R.id.button_sample_3);
        button3.setOnClickListener(new View.OnClickListener()
        {    
        	public void onClick(View arg0)
            {
        		doOpenExBrowseActivity();
            }
        });
    }
    
    
    private void doOpenExBrowseActivity()
    {
    	Intent intent = new Intent(this, ExBrowseMapActivity.class);
        startActivity(intent);
    }
    
    private void doOpenSample1()
    {
        Intent intent = new Intent(this,Sample1Activity.class);
        startActivity(intent);
    }
    
    
    private void doOpenSample2()
    {
        Intent intent = new Intent(this,Sample2Activity.class);
        startActivity(intent);
    }    
    
}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Location.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

import android.graphics.Point;

public class Location
{

    private String id;
    
    private String title;
    
    private String categoryId;
    
    private Point point;

    
    
    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }    
    
    public String getCategoryId()
    {
        return categoryId;
    }

    public void setCategoryId(String categoryId)
    {
        this.categoryId = categoryId;
    }

    public String getTitle()
    {
        return title;
    }

    public void setTitle(String title)
    {
        this.title = title;
    }

    public Point getPoint()
    {
        return point;
    }

    public void setPoint(Point point)
    {
        this.point = point;
    }
}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Model.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

import java.util.ArrayList;
import java.util.List;

import android.graphics.Point;

public class Model
{

    public static final String CAT_MAIN_ATTRACTIONS = "category.main.attractions";
    public static final String CAT_KIDS = "category.kids";
    public static final String CAT_SPORT_AND_LEISURE = "category.sport.and.leisure";
    
    
    private List<Location> locations;
    
    private List<Category> categories;
    
    
    public Model()
    {
        createCategories();
        createLocations();
    }
    
    
    public List<Category> getCategories()
    {
        return categories;
    }
    
    
    public List<Location> getLocations()
    {
        return locations;
    }
    
    
    
    private void createCategories()
    {
        this.categories = new ArrayList<Category>();
        
        
        Category category = new Category();
        category.setId(CAT_MAIN_ATTRACTIONS);
        category.setName("Main Attractions");
        
        this.categories.add(category);
        
        category = new Category();
        category.setId(CAT_KIDS);
        category.setName("Kids In the Park");
        
        this.categories.add(category);
        
        
        category = new Category();
        category.setId(CAT_SPORT_AND_LEISURE);
        category.setName("Sport and Leisure");
        
        this.categories.add(category);
    }
    
    
    private void createLocations()
    {
        this.locations = new ArrayList<Location>();
        
        Point point = new Point(20, 100);
        
        Location location = new Location();
        location.setId("id.thehub");
        location.setTitle("The Hub");
        location.setCategoryId(CAT_MAIN_ATTRACTIONS);
        location.setPoint(point);
        
        this.locations.add(location);
        
        point = new Point(20, 100);
        location = new Location();
        location.setId("id.queen.mary.garden");
        location.setTitle("Queen Mary's Garden");
        location.setCategoryId(CAT_MAIN_ATTRACTIONS);
        location.setPoint(point);
        
        this.locations.add(location);
        
        point = new Point(20, 100);
        location = new Location();
        location.setId("id.wildlifegarden");
        location.setTitle("Wildlife Garden");
        location.setCategoryId(CAT_KIDS);
        location.setPoint(point);
        
        this.locations.add(location);
        
        point = new Point(20, 100);
        location = new Location();
        location.setId("id.boatinglake");
        location.setTitle("Boating Lake");
        location.setCategoryId(CAT_KIDS);
        location.setPoint(point);
        
        this.locations.add(location);
        
        point = new Point(20, 100);
        location = new Location();
        location.setId("id.openairtheatre");
        location.setTitle("Open Air Theatre");
        location.setCategoryId(CAT_SPORT_AND_LEISURE);
        location.setPoint(point);
        
        this.locations.add(location);
        
        point = new Point(20, 100);
        location = new Location();
        location.setId("id.tenniscenter");
        location.setTitle("Tennis Center");
        location.setCategoryId(CAT_SPORT_AND_LEISURE);
        location.setPoint(point);
        
        this.locations.add(location);
    }
}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Sample1Activity.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

import android.app.Activity;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.View.OnTouchListener;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.ls.widgets.map.MapWidget;
import com.ls.widgets.map.config.OfflineMap;
import com.ls.widgets.map.events.MapTouchedEvent;
import com.ls.widgets.map.interfaces.MapEventsListener;
import com.ls.widgets.map.interfaces.OnMapDoubleTapListener;
import com.ls.widgets.map.model.MapLayer;
import com.ls.widgets.map.model.MapObject;
import com.ls.widgets.map.utils.PivotFactory;
import com.ls.widgets.map.utils.PivotFactory.PivotPosition;

public class Sample1Activity 
    extends Activity
{

    
    public static final int MAP_ID = 1; 
    private static final long LAYER_ID = 5;

    
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.main);
        
        final int initialZoomLevel = 10;
        
        final MapWidget mapWidget = new MapWidget(savedInstanceState, this, OfflineMap.MAP_ROOT, initialZoomLevel);
        mapWidget.setId(MAP_ID);
        
        LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout);
        layout.addView(mapWidget);
        
        mapWidget.getConfig().setFlingEnabled(true);
        mapWidget.getConfig().setPinchZoomEnabled(true);
        
        mapWidget.setMaxZoomLevel(13);
        mapWidget.setUseSoftwareZoom(true);
        mapWidget.setZoomButtonsVisible(true);
        mapWidget.setBackgroundColor(Color.GREEN);
        
        mapWidget.setOnLongClickListener(new OnLongClickListener() {
			
			@Override
			public boolean onLongClick(View v) {
				Toast.makeText(Sample1Activity.this, "Long press works!", Toast.LENGTH_SHORT).show();
				return true;
			}
		});
        
        
        mapWidget.setOnTouchListener(new OnTouchListener() {

			@Override
			public boolean onTouch(View arg0, MotionEvent arg1) {
				return false;
			}
        	
        });
        
        mapWidget.setOnDoubleTapListener(new OnMapDoubleTapListener() {
			@Override
			public boolean onDoubleTap(MapWidget v, MapTouchedEvent event) {
				Log.d("Sample1Activity", "On double tap");
				Toast.makeText(Sample1Activity.this, "Double tap overridden", Toast.LENGTH_SHORT).show();
				return true;
			}
        });

        MapLayer layer = mapWidget.createLayer(LAYER_ID);        
        
        // getting icon from assets
        Drawable icon = getResources().getDrawable(R.drawable.map_icon_attractions);
        
        // define coordinates of icon on map
        int x = 240;
        int y = 362;
        
        // set ID for the object
        final long OBJ_ID = 25;
        
        // adding object to layer
        layer.addMapObject(new MapObject(OBJ_ID, icon, new Point(x, y), PivotFactory.createPivotPoint(icon, PivotPosition.PIVOT_CENTER), false, false));

        
        
        mapWidget.addMapEventsListener(new MapEventsListener() {
			
			@Override
			public void onPreZoomOut() {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onPreZoomIn() {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void onPostZoomOut() {
				runOnUiThread(new Runnable() {
					@Override
					public void run() {
						setTitle("Zoom level: " + mapWidget.getZoomLevel());
					}
				});
			}
			
			@Override
			public void onPostZoomIn() {
				runOnUiThread(new Runnable() {
					@Override
					public void run() {
						setTitle("Zoom level: " + mapWidget.getZoomLevel());
					}
				});
				
			}
		});

    }


    @Override
    protected void onSaveInstanceState(Bundle outState)
    {
        super.onSaveInstanceState(outState);
        
        MapWidget map = (MapWidget) findViewById(MAP_ID);
        map.saveState(outState);
    }


    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState)
    {
        // TODO Auto-generated method stub
        super.onRestoreInstanceState(savedInstanceState);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu)
    {
        MenuInflater inflater = new MenuInflater(this);
        inflater.inflate(R.menu.a1menu, menu);
        
        return true;
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        MapWidget map = (MapWidget) findViewById(MAP_ID);

		int i = item.getItemId();
		if (i == R.id.scrollTo)
		{
			map.scrollMapTo(new Point(240, 320));
		}
		else if (i == R.id.jumpTo)
		{
			map.jumpTo(new Point(240, 320));
		}
        return super.onOptionsItemSelected(item);
    }

}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Sample2Activity.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1;

import android.app.Activity;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.ls.widgets.map.MapWidget;
import com.ls.widgets.map.events.MapTouchedEvent;
import com.ls.widgets.map.interfaces.Layer;
import com.ls.widgets.map.interfaces.MapEventsListener;
import com.ls.widgets.map.interfaces.OnLocationChangedListener;
import com.ls.widgets.map.interfaces.OnMapDoubleTapListener;
import com.ls.widgets.map.interfaces.OnMapLongClickListener;
import com.ls.widgets.map.interfaces.OnMapTilesFinishedLoadingListener;
import com.ls.widgets.map.model.MapLayer;
import com.ls.widgets.map.model.MapObject;
import com.ls.widgets.map.utils.GeoUtils;
import com.ls.widgets.map.utils.PivotFactory;
import com.ls.widgets.map.utils.PivotFactory.PivotPosition;

public class Sample2Activity 
    extends Activity
{
    public static final int MAP_ID = 1; 
    private int currId = 35;
    
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.main);
        
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        
        final MapWidget mapWidget = new MapWidget(savedInstanceState, this, "map", 10);
        mapWidget.setSaveEnabled(true);
        mapWidget.getConfig().setMinZoomLevelLimit(10);
        mapWidget.getConfig().setZoomBtnsVisible(false);
        mapWidget.setId(MAP_ID);
        
        // create map layer with specified ID
        final long LAYER_ID = 5;
        MapLayer layer = mapWidget.createLayer(LAYER_ID);        
        
        // getting icon from assets
        Drawable icon = getResources().getDrawable(R.drawable.map_icon_attractions);
        
        // define coordinates of icon on map
        int x = 200;
        int y = 300;
        
        // set ID for the object
        final long OBJ_ID = 25;
        
        // adding object to layer
        MapObject obj = new MapObject(OBJ_ID, icon, new Point(x, y), PivotFactory.createPivotPoint(icon, PivotPosition.PIVOT_CENTER), true, false);
       // obj.setCaption("5434 KNNB");
        
        //MapObject(OBJ_ID, icon, new Point(x, y), PivotFactory.createPivotPoint(icon, PivotPosition.PIVOT_CENTER), true, false)
        
        layer.addMapObject(obj);
          
        LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout);
        layout.setBackgroundColor(0xFFFFFFFF);
        layout.addView(mapWidget);
        
        mapWidget.getMapGraphicsConfig().setArrowPointerDrawableId(R.drawable.maps_blue_arrow);
        mapWidget.getMapGraphicsConfig().setDotPointerDrawableId(R.drawable.maps_blue_dot);
        
        mapWidget.setOnMapTilesFinishLoadingListener(new OnMapTilesFinishedLoadingListener() {
			
			@Override
			public void onMapTilesFinishedLoading() {
				mapWidget.zoomIn();
				mapWidget.scrollMapTo(1000, 800);
				mapWidget.setOnMapTilesFinishLoadingListener(null);
			}
		});
       // mapWidget.setShowMyPosition(true);
        
        
        mapWidget.addMapEventsListener(new MapEventsListener()
        {
            
            @Override
            public void onPreZoomOut()
            {
                // TODO Auto-generated method stub
                
            }
            
        
            @Override
            public void onPreZoomIn()
            {
                // TODO Auto-generated method stub
                
            }
            
        
            @Override
            public void onPostZoomOut()
            {
                // TODO Auto-generated method stub
                
            }
            
        
            @Override
            public void onPostZoomIn()
            {
                // TODO Auto-generated method stub
                
            }
        });
        
        
        mapWidget.setOnLocationChangedListener(new OnLocationChangedListener() {
            @Override
            public void onLocationChanged(MapWidget v, Location location)
            {
                v.scrollMapTo(location);               
            }
        });
        
        
        mapWidget.setOnDoubleTapListener(new OnMapDoubleTapListener() {
			@Override
			public boolean onDoubleTap(MapWidget v, MapTouchedEvent event) {
				Log.d("Sample1Activity", "On double tap");
				
				Location location = addObjetWhereTouched(mapWidget, event, R.drawable.map_icon_attractions);
				Toast.makeText(Sample2Activity.this, "New object coords: Lat: " + location.getLatitude() + " Lon:" + location.getLongitude(), Toast.LENGTH_SHORT).show();
				return true;
			}


        });
        
        
        mapWidget.setOnLongClickListener(new OnLongClickListener() {
			
			@Override
			public boolean onLongClick(View arg0) {
				
				return false;
			}
		});
        
        
        mapWidget.setOnMapLongClickListener(new OnMapLongClickListener() {

			@Override
			public boolean onLongClick(MapWidget v, MapTouchedEvent e) {

				if (e.getTouchedObjectIds().size() == 0) {
					addObjetWhereTouched(v, e, R.drawable.map_icon_leasure);
				} else {
					Toast.makeText(Sample2Activity.this, "Layer Id: " + e.getTouchedObjectIds().get(0).getLayerId(), Toast.LENGTH_SHORT).show();
				}
				
				
				return false;
			}
        	
        });        
    }

    
	private Location addObjetWhereTouched(final MapWidget mapWidget, MapTouchedEvent event, int iconId) {
		// getting icon from assets
        Drawable icon = getResources().getDrawable(iconId);
        MapObject obj = new MapObject(currId++, icon, new Point(0, 0), 
        		PivotFactory.createPivotPoint(icon, PivotPosition.PIVOT_CENTER), true, false);

        Layer layer = mapWidget.getLayerById(5);   
		layer.addMapObject(obj);

		Location location = new Location("custom");
		GeoUtils.translate(mapWidget, event.getMapX(), event.getMapY(), location);
        
		obj.moveTo(location);
		return location;
	}
    
    
	@Override
	protected void onSaveInstanceState(Bundle outState) {
		MapWidget map = (MapWidget) findViewById(MAP_ID);
		map.saveState(outState);
		super.onSaveInstanceState(outState);
	}
    
}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/model/MapObjectContainer.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1.model;

import java.util.ArrayList;

public class MapObjectContainer 
{
	private ArrayList<MapObjectModel> container;
	
	public MapObjectContainer()
	{
		container = new ArrayList<MapObjectModel>();
	}

	
	public void addObject(MapObjectModel object) 
	{
		container.add(object);
	}
	
	
	public void removeObject(MapObjectModel object)
	{
		container.remove(object);
	}
	
	
	public MapObjectModel getObject(int index)
	{
		return container.get(index);
	}
	
	
	public MapObjectModel getObjectById(int id)
	{
		for (MapObjectModel model:container) {
			if (model.getId() == id) {
				return model;
			}
		}
		
		return null;
	}
	
	
	public int size()
	{
		return container.size();
	}

}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/model/MapObjectModel.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1.model;

import android.location.Location;

public class MapObjectModel 
{
	private int x;
	private int y;
	private int id;
	private String caption;
	private Location location;
	
	public MapObjectModel(int id, Location location, String caption)
	{
		this.location = location;
		this.caption = caption;
		this.id = id;
	}
	
	public MapObjectModel(int id, int x, int y, String caption)
	{
		this.id = id;
		this.x = x;
		this.y = y;
		this.caption = caption;
	}

	public int getId() 
	{
		return id;
	}

	
	public int getX() 
	{
		return x;
	}


	public int getY() 
	{
		return y;
	}
	
	
	public Location getLocation()
	{
		return location;
	}
	
	
	public String getCaption()
	{
		return caption;
	}

}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/popup/MapPopupBase.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1.popup;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

public class MapPopupBase
{
	protected ViewGroup parentView;
	
	protected LinearLayout container;
	protected float dipScaleFactor;
	protected int lastX;
	protected int lastY;
	protected int screenHeight;
	protected int screenWidth;
	

	public MapPopupBase(Context context, ViewGroup parentView) 
	{
	    screenHeight = context.getResources().getDisplayMetrics().heightPixels;
	    screenWidth = context.getResources().getDisplayMetrics().widthPixels;
	    
		this.parentView = parentView;
    	dipScaleFactor = context.getResources().getDisplayMetrics().density;
    	
		container = new LinearLayout(context);
		container.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	
		lastX = lastY = -1;
	}		
	
	
	public void show(ViewGroup view, int theX, int theY)
	{
		hide();

		container.measure(view.getWidth(), view.getHeight());
		
		int x = theX - (getWidth() / 2);
		int y = theY - getHeight();
		
		container.setPadding(x, y, 0, 0);

		lastX = x;
		lastY = y;
		
		parentView.addView(container);
		container.setVisibility(View.VISIBLE);
	}

	
	public int getHeight()
	{
		return container.getMeasuredHeight();
	}
	
	
	public int getWidth()
	{
		return container.getMeasuredWidth();
	}
	
	
	public boolean isVisible()
	{
		return container.getVisibility() == View.VISIBLE;
	}
	
	
	public void hide()
	{
		container.setPadding(0, 0, 0, 0);
		container.setVisibility(View.INVISIBLE);
		parentView.removeView(container);
	}
	
	
	public void setOnClickListener(View.OnTouchListener listener)
	{
	    if(container != null){
	        container.setOnTouchListener(listener);
	    }
	}
}


================================================
FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/popup/TextPopup.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo1.popup;

import com.ls.demo.demo1.R;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class TextPopup
    extends MapPopupBase
{
	public final static int ZERO = 0;
	public final static int PADDING_BOTTOM = 11;
	public final static int PADDING_TOP = 5;
	public final static int PADDING_LEFT = 15;
	public final static int PADDING_RIGHT = 10;
	public final static float DEF_TEXT_SIZE = 16;
	public final static int IMAGE_SIZE = 30;
	public final static int MAX_EMS = 14;	
	
    private TextView text;

    public TextPopup(Context context, ViewGroup parentView) 
    {
        super(context, parentView);
        
        text = new TextView(context);
        
        text.setPadding((int)(PADDING_LEFT * dipScaleFactor),
                        (int)(PADDING_TOP * dipScaleFactor),
                        (int)(PADDING_RIGHT  * dipScaleFactor), 
                        (int)(PADDING_BOTTOM * dipScaleFactor));
        
        text.setBackgroundResource(R.drawable.map_description_background);
        text.setTextSize(DEF_TEXT_SIZE);
        text.setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL);
        text.setMaxEms(MAX_EMS);
        text.setTextColor(Color.WHITE);
        
        container.addView(text);
    
        text.setFocusable(true);
        text.setClickable(true);
    }       

 
    public void moveBy(int dx, int dy)
    {
        if (lastX != -1 && lastY != -1){
            int paddingBottom = 0;
            int paddingRight = 0;
            if(container.getPaddingTop() > (screenHeight - (text.getHeight() + 3))){
                paddingBottom = (container.getPaddingBottom() - dy);
            }
            
            if(container.getPaddingLeft() > (screenWidth - (text.getWidth() + 3))){
                paddingRight = container.getPaddingRight() - dx;
            }
            
            container.setPadding(container.getPaddingLeft() + dx,
                                 container.getPaddingTop() + dy, 
                                 paddingRight, paddingBottom);
        }
    }
 
    
    public void setText(String theText)
    {
        text.setPadding((int)(PADDING_LEFT * dipScaleFactor),
                (int)(PADDING_TOP * dipScaleFactor),
                (int)(PADDING_RIGHT  * dipScaleFactor), 
                (int)(PADDING_BOTTOM * dipScaleFactor));
        
        text.setText(theText + "   ");
    }
    
    
    public void setIcon(BitmapDrawable theDrawable)
    {
        if (theDrawable != null) {
            theDrawable.setBounds(0,0, (int) (theDrawable.getBitmap().getWidth()),
                                        (int)(theDrawable.getBitmap().getHeight()));
        }
        
        text.setCompoundDrawables(null, null, theDrawable, null);
    }
    
    
    public void removeIcon()
    {
        text.setCompoundDrawables(null, null, null, null);
    }
    
    
    public void setOnClickListener(View.OnTouchListener listener)
    {
        if(text != null){
            text.setOnTouchListener(listener);
        }
    }
}


================================================
FILE: mAppWidget/demo1app/src/main/res/layout/home.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" android:orientation="vertical" android:layout_gravity="center_vertical|center_horizontal" android:gravity="center_vertical|center_horizontal">
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button_sample_1" android:text="Sample 1"></Button>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button_sample_2" android:text="Sample 2"></Button>
    <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button_sample_3" android:text="Sample 3"></Button>
</LinearLayout>


================================================
FILE: mAppWidget/demo1app/src/main/res/layout/main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:baselineAligned="false"
    android:id="@+id/mainLayout" android:keepScreenOn="true">

</LinearLayout>


================================================
FILE: mAppWidget/demo1app/src/main/res/menu/a1menu.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:id="@+id/scrollTo" android:title="Scroll To"></item>
    <item android:id="@+id/jumpTo" android:title="Jump To"></item>

    

</menu>

================================================
FILE: mAppWidget/demo1app/src/main/res/menu/map_menu.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/zoom_in"
          android:title="Zoom In" />
    <item android:id="@+id/zoom_out"
          android:title="Zoom Out" />
<item android:title="Open Map" android:id="@+id/open_map"></item>
<item android:id="@+id/double_size" android:title="Double Size" android:visible="true" android:enabled="true"></item>
<item android:id="@+id/half_size" android:title="Half Size" android:visible="true" android:enabled="true"></item>
<item android:id="@+id/original_size" android:title="Original Size" android:visible="true" android:enabled="true"></item>
<item android:title="Go to my location" android:id="@+id/my_location"></item>
</menu>

================================================
FILE: mAppWidget/demo1app/src/main/res/menu/menu.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<menu
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/zoomIn" android:title="Zoom In"></item>
    <item android:id="@+id/zoomOut" android:title="Zoom Out"></item>
    <item android:id="@+id/hideLayer2" android:title="Hide Layer 2"></item>
    <item android:id="@+id/showLayer2" android:title="Show Layer 2"></item>
    <item android:title="Scroll to next object" android:id="@+id/scroll_next"></item>
</menu>


================================================
FILE: mAppWidget/demo1app/src/main/res/values/strings.xml
================================================
<resources>
    <string name="app_name">mAppWidget</string>
</resources>


================================================
FILE: mAppWidget/demo1app/src/main/res/values/styles.xml
================================================
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>


================================================
FILE: mAppWidget/demo1app/src/main/res/values/theme.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<style name="Theme.NoBackground" parent="android:Theme">
        <item name="android:windowBackground">@null</item>
    </style>
</resources>


================================================
FILE: mAppWidget/demo2app/.gitignore
================================================
/build


================================================
FILE: mAppWidget/demo2app/build.gradle
================================================
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.ls.demo.demo2"
        minSdkVersion 7
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile project(':mappwidgetlib')
}


================================================
FILE: mAppWidget/demo2app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/dmytrobaryskyy/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# 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 *;
#}


================================================
FILE: mAppWidget/demo2app/src/androidTest/java/com/ls/demo/demo2/ApplicationTest.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo2;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
 * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
 */
public class ApplicationTest extends ApplicationTestCase<Application> {
    public ApplicationTest() {
        super(Application.class);
    }
}

================================================
FILE: mAppWidget/demo2app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ls.demo.demo2" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name=".BrowseMapActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>


================================================
FILE: mAppWidget/demo2app/src/main/assets/map/map.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<Image TileSize="256" Overlap="1" Format="png" >
	<Size Width="1536" Height="768" />
	<CalibrationRect>
		<Point x="1006" y="141" lat="3.214993635535601" lon="73.03810715675354" topLeft="1"/>
		<Point x="1240" y="582" lat="3.211265870063092" lon="73.03981840610504"/>
	</CalibrationRect>
</Image>

================================================
FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/BrowseMapActivity.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo2;

import java.util.ArrayList;

import android.app.Activity;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.RelativeLayout;

import com.ls.demo.demo2.model.MapObjectContainer;
import com.ls.demo.demo2.model.MapObjectModel;
import com.ls.demo.demo2.popup.TextPopup;
import com.ls.widgets.map.MapWidget;
import com.ls.widgets.map.config.GPSConfig;
import com.ls.widgets.map.config.MapGraphicsConfig;
import com.ls.widgets.map.config.OfflineMapConfig;
import com.ls.widgets.map.events.MapScrolledEvent;
import com.ls.widgets.map.events.MapTouchedEvent;
import com.ls.widgets.map.events.ObjectTouchEvent;
import com.ls.widgets.map.interfaces.Layer;
import com.ls.widgets.map.interfaces.MapEventsListener;
import com.ls.widgets.map.interfaces.OnLocationChangedListener;
import com.ls.widgets.map.interfaces.OnMapScrollListener;
import com.ls.widgets.map.interfaces.OnMapTouchListener;
import com.ls.widgets.map.location.PositionMarker;
import com.ls.widgets.map.model.MapObject;
import com.ls.widgets.map.utils.PivotFactory;
import com.ls.widgets.map.utils.PivotFactory.PivotPosition;

public class BrowseMapActivity extends Activity 
implements MapEventsListener,
		   OnMapTouchListener
{
	private static final String TAG = "BrowseMapActivity";
	
	private static final Integer LAYER1_ID = 0;
	private static final Integer LAYER2_ID = 1;
	private static final int MAP_ID = 23;

	private int nextObjectId;
	private int pinHeight;
	
	private MapObjectContainer model;
	private MapWidget map;
	private TextPopup mapObjectInfoPopup;
	
	private Location points[];
	private int currentPoint;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        nextObjectId = 0;
        
        model = new MapObjectContainer();
        
        initTestLocationPoints();
        initMap(savedInstanceState);
        initModel();
        initMapObjects();
        initMapListeners();
        
        // Will show the position of the user on a map.
        // Do not forget to enable ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permission int the manifest.
        
       // Uncomment this if you are at Filitheyo island :) 
       // map.setShowMyPosition(true);
        
         map.centerMap();
    }
    
    
    @Override
	protected void onSaveInstanceState(Bundle outState) {
    	super.onSaveInstanceState(outState);
    	map.saveState(outState);
	}

    private void initTestLocationPoints() 
	{
		points = new Location[5];
		for (int i=0; i<points.length; ++i) {
			points[i] = new Location("test");
		}
		
		points[0].setLatitude(3.2127012756213316);
		points[0].setLongitude(73.03406774997711);
		
		points[1].setLatitude(3.2122245926560167);
		points[1].setLongitude(73.03744733333588);
		
		points[2].setLatitude(3.2112819380469135);
		points[2].setLongitude(73.03983449935913);
		
		points[3].setLatitude(3.2130494147249915);
		points[3].setLongitude(73.03946435451508);
		
		points[4].setLatitude(3.2148276002942713);
		points[4].setLongitude(73.03796768188477);
		
		currentPoint = 0;
	}
	
	
	private Location getNextLocationPoint()
	{
		if (currentPoint < points.length-1) {
			currentPoint += 1;
		} else {
			currentPoint = 0;
		}
		
		return points[currentPoint];
	}


	private void initMap(Bundle savedInstanceState) 
	{
		// In order to display the map on the screen you will need 
		// to initialize widget and place it into layout.
        map = new MapWidget(savedInstanceState, this, 
							  "map", // root name of the map under assets folder.
							  10); // initial zoom level

        map.setId(MAP_ID);
 
        OfflineMapConfig config = map.getConfig();
        config.setPinchZoomEnabled(true); // Sets pinch gesture to zoom
        config.setFlingEnabled(true);    // Sets inertial scrolling of the map
        config.setMaxZoomLevelLimit(20);
        config.setZoomBtnsVisible(true); // Sets embedded zoom buttons visible
        
        // Configuration of GPS receiver
        GPSConfig gpsConfig = config.getGpsConfig();
        gpsConfig.setPassiveMode(false);
        gpsConfig.setGPSUpdateInterval(500, 5);
        
        // Configuration of position marker
        MapGraphicsConfig graphicsConfig = config.getGraphicsConfig();
        graphicsConfig.setAccuracyAreaColor(0x550000FF); // Blue with transparency
        graphicsConfig.setAccuracyAreaBorderColor(Color.BLUE); // Blue without transparency

        RelativeLayout layout = (RelativeLayout) findViewById(R.id.rootLayout);
        // Adding the map to the layout
        layout.addView(map, 0);
        layout.setBackgroundColor(Color.parseColor("#0049FF"));
        
        // Adding layers in order to put there some map objects
        map.createLayer(LAYER1_ID); // you will need layer id's in order to access particular layer
        map.createLayer(LAYER2_ID);
	}
	
	
	private void initModel()
	{
		// Adding objects to the model
		// You may want to implement your own model 
		MapObjectModel objectModel = new MapObjectModel(0, 100, 100, "Shows above the image 1");
		model.addObject(objectModel);
		objectModel = new MapObjectModel(1, 600, 350, "Shows above the image 2");
		model.addObject(objectModel);
		
		int id = 2;
		for (Location point:points) {
			objectModel = new MapObjectModel(id, point, "Point " + id);
			model.addObject(objectModel);
			id += 1;
		}
		
	}


	private void initMapObjects() 
	{	
		
		mapObjectInfoPopup = new TextPopup(this, (RelativeLayout)findViewById(R.id.rootLayout));
		
		Layer layer1 = map.getLayerById(LAYER1_ID);
		Layer layer2 = map.getLayerById(LAYER2_ID);
		
		for (int i=0; i<model.size(); ++i) {
			addNotScalableMapObject(model.getObject(i), layer1);
		}
		
		// Adding two map objects to the second layer
		addScalableMapObject(800, 300, layer2);
		addNotScalableMapObject(900, 350, layer2);
	}

	
	private void addNotScalableMapObject(int x, int y,  Layer layer) 
	{
		// Getting the drawable of the map object
		Drawable drawable = getResources().getDrawable(R.drawable.map_object);
		pinHeight = drawable.getIntrinsicHeight();
		// Creating the map object
		MapObject object1 = new MapObject(Integer.valueOf(nextObjectId), // id, will be passed to the listener when user clicks on it 
										  drawable,  
										  new Point(x, y), // coordinates in original map coordinate system.
										  // Pivot point of center of the drawable in the drawable's coordinate system.
										  PivotFactory.createPivotPoint(drawable, PivotPosition.PIVOT_CENTER),
										  true, // This object will be passed to the listener
										  false); // is not scalable. It will have the same size on each zoom level

		// Adding object to layer
		layer.addMapObject(object1);
		nextObjectId += 1;
	}
	
	
	private void addNotScalableMapObject(MapObjectModel objectModel,  Layer layer) 
	{
		if (objectModel.getLocation() != null) {
			addNotScalableMapObject(objectModel.getLocation(), layer);
		} else {
			addNotScalableMapObject(objectModel.getX(), objectModel.getY(),  layer);
		}
	}

	
	private void addNotScalableMapObject(Location location, Layer layer) {
		if (location == null)
			return;
		
		// Getting the drawable of the map object
		Drawable drawable = getResources().getDrawable(R.drawable.map_object);
		// Creating the map object
		MapObject object1 = new MapObject(Integer.valueOf(nextObjectId), // id, will be passed to the listener when user clicks on it 
										  drawable,  
										  new Point(0, 0), // coordinates in original map coordinate system.
										  // Pivot point of center of the drawable in the drawable's coordinate system.
										  PivotFactory.createPivotPoint(drawable, PivotPosition.PIVOT_CENTER),
										  true, // This object will be passed to the listener
										  true); // is not scalable. It will have the same size on each zoom level
		layer.addMapObject(object1);
		
		// Will crash if you try to move before adding to the layer. 
		object1.moveTo(location);
		nextObjectId += 1;
	}


	private void addScalableMapObject(int x, int y, Layer layer) 
	{
		Drawable drawable = getResources().getDrawable(R.drawable.map_object);
		MapObject object1 = new MapObject(Integer.valueOf(nextObjectId), 
										  drawable, 
										  x, 
										  y, 
										  true, 
										  true);

		layer.addMapObject(object1);
		nextObjectId += 1;
	}
	

	private void initMapListeners() 
	{
		// In order to receive MapObject touch events we need to set listener
		map.setOnMapTouchListener(this);
		
		// In order to receive pre and post zoom events we need to set MapEventsListener
        map.addMapEventsListener(this); 
        
        // In order to receive map scroll events we set OnMapScrollListener
        map.setOnMapScrolledListener(new OnMapScrollListener()
        {
            public void onScrolledEvent(MapWidget v, MapScrolledEvent event)
            {
                handleOnMapScroll(v, event);
            }
        });
        
        
        map.setOnLocationChangedListener(new OnLocationChangedListener() {
			@Override
			public void onLocationChanged(MapWidget v, Location location) {
				// You can handle location change here.
				// For example you can scroll to new location by using v.scrollMapTo(location)
			}
		});
	}

	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) 
	{
		MenuInflater inflater = new MenuInflater(this);
		inflater.inflate(R.menu.menu, menu);
		return true;
	}


	@Override
	public boolean onOptionsItemSelected(MenuItem item) 
	{
		switch (item.getItemId()) {
		case R.id.zoomIn:
			map.zoomIn();
			return true;
		case R.id.zoomOut:
			map.zoomOut();
			return true;
		case R.id.hideLayer2: {
			Layer layer = map.getLayerById(LAYER2_ID);
			if (layer != null) {
				layer.setVisible(false);
				map.invalidate(); // Need to repaint the layer. This is a bug and will be fixed in next version.
			}
			return true;
			}
		case R.id.showLayer2: {
			Layer layer = map.getLayerById(LAYER2_ID);
			if (layer != null) {
				layer.setVisible(true);
				map.invalidate(); // Need to repaint the layer. This is a bug and will be fixed in next version.
			}
			return true;
			}
		
		case R.id.scroll_next:
			map.scrollMapTo(getNextLocationPoint());
			break;
			
		}
		
		return super.onOptionsItemSelected(item);
	}


	private void handleOnMapScroll(MapWidget v, MapScrolledEvent event) 
	{	
		// When user scrolls the map we receive scroll events
		// This is useful when need to move some object together with the map
		
		int dx = event.getDX(); // Number of pixels that user has scrolled horizontally
		int dy = event.getDY(); // Number of pixels that user has scrolled vertically
		
		if (mapObjectInfoPopup.isVisible()) {
			mapObjectInfoPopup.moveBy(dx, dy);
		}
	}
	
	
	
	@Override
	public void onPostZoomIn() 
	{
		Log.i(TAG, "onPostZoomIn()");
	}

	@Override
	public void onPostZoomOut() 
	{
		Log.i(TAG, "onPostZoomOut()");		
	}

	@Override
	public void onPreZoomIn() 
	{
		Log.i(TAG, "onPreZoomIn()");
		
		if (mapObjectInfoPopup != null) {
			mapObjectInfoPopup.hide();
		}	
	}

	@Override
	public void onPreZoomOut() 
	{
		Log.i(TAG, "onPreZoomOut()");		
		
		if (mapObjectInfoPopup != null) {
			mapObjectInfoPopup.hide();
		}	
	}


	//* On map touch listener implemetnation *//
	@Override
	public void onTouch(MapWidget v, MapTouchedEvent event) 
	{
		// Get touched object events from the MapTouchEvent
		ArrayList<ObjectTouchEvent> touchedObjs = event.getTouchedObjectIds();
		
		if (touchedObjs.size() > 0) {
			
			int xInMapCoords = event.getMapX();
			int yInMapCoords = event.getMapY();
			int xInScreenCoords = event.getScreenX();
			int yInScreenCoords = event.getScreenY();
			
			ObjectTouchEvent objectTouchEvent = event.getTouchedObjectIds().get(0);
			
			// Due to a bug this is not actually the layer id, but index of the layer in layers array.
			// Will be fixed in the next release.
			long layerId = objectTouchEvent.getLayerId();
			Integer objectId = (Integer)objectTouchEvent.getObjectId();
			// User has touched one or more map object
			// We will take the first one to show in the toast message.
			String message = "You touched the object with id: " + objectId + " on layer: " + layerId + 
			" mapX: " + xInMapCoords + " mapY: " + yInMapCoords + " screenX: " + xInScreenCoords + " screenY: " + 
			yInScreenCoords;
			
			Log.d(TAG, message);
				
			MapObjectModel objectModel = model.getObjectById(objectId.intValue());
					
			if (objectModel != null) {
				// This is a case when we want to show popup info exactly above the pin image
				
		        float density = getResources().getDisplayMetrics().density;
		        int imgHeight = (int) (pinHeight / density / 2);
					
		        // Calculating position of popup on the screen
	        	int x = xToScreenCoords(objectModel.getX());
				int y = yToScreenCoords(objectModel.getY()) - imgHeight;
				
				// Show it
				showLocationsPopup(x, y, objectModel.getCaption());
			} else {
				// This is a case when we want to show popup where the user has touched.
				showLocationsPopup(xInScreenCoords, yInScreenCoords, "Shows where user touched");
			}
			
			// Hint: If user touched more than one object you can show the dialog in which ask
			// the user to select concrete object
		} else {
			if (mapObjectInfoPopup != null) {
				mapObjectInfoPopup.hide();
			}
		}
	}
	
	
    private void showLocationsPopup(int x, int y, String text)
    {
        RelativeLayout mapLayout = (RelativeLayout) findViewById(R.id.rootLayout);

        if (mapObjectInfoPopup != null)
        {
            mapObjectInfoPopup.hide();
        }

        ((TextPopup) mapObjectInfoPopup).setIcon((BitmapDrawable) getResources().getDrawable(R.drawable.map_popup_arrow));
        ((TextPopup) mapObjectInfoPopup).setText(text);

        mapObjectInfoPopup.setOnClickListener(new OnTouchListener()
        {
            public boolean onTouch(View v, MotionEvent event)
            {
                if (event.getAction() == MotionEvent.ACTION_UP)
                {
                    if (mapObjectInfoPopup != null)
                    {
                        mapObjectInfoPopup.hide();
                    }
                }

                return false;
            }
        });

        ((TextPopup) mapObjectInfoPopup).show(mapLayout, x, y);
    }
    
    /***
     * Transforms coordinate in map coordinate system to screen coordinate system
     * @param mapCoord - X in map coordinate in pixels. 
     * @return X coordinate in screen coordinates. You can use this value to display any object on the screen.
     */
    private int xToScreenCoords(int mapCoord)
    {
    	return (int)(mapCoord *  map.getScale() - map.getScrollX());
    }
    
    private int yToScreenCoords(int mapCoord)
    {
    	return (int)(mapCoord *  map.getScale() - map.getScrollY());
    }
    
  
}

================================================
FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/model/MapObjectContainer.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo2.model;

import java.util.ArrayList;

public class MapObjectContainer 
{
	private ArrayList<MapObjectModel> container;
	
	public MapObjectContainer()
	{
		container = new ArrayList<MapObjectModel>();
	}

	
	public void addObject(MapObjectModel object) 
	{
		container.add(object);
	}
	
	
	public void removeObject(MapObjectModel object)
	{
		container.remove(object);
	}
	
	
	public MapObjectModel getObject(int index)
	{
		return container.get(index);
	}
	
	
	public MapObjectModel getObjectById(int id)
	{
		for (MapObjectModel model:container) {
			if (model.getId() == id) {
				return model;
			}
		}
		
		return null;
	}
	
	
	public int size()
	{
		return container.size();
	}

}


================================================
FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/model/MapObjectModel.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo2.model;

import android.location.Location;

public class MapObjectModel 
{
	private int x;
	private int y;
	private int id;
	private String caption;
	private Location location;
	
	public MapObjectModel(int id, Location location, String caption)
	{
		this.location = location;
		this.caption = caption;
		this.id = id;
	}
	
	public MapObjectModel(int id, int x, int y, String caption)
	{
		this.id = id;
		this.x = x;
		this.y = y;
		this.caption = caption;
	}

	public int getId() 
	{
		return id;
	}

	
	public int getX() 
	{
		return x;
	}


	public int getY() 
	{
		return y;
	}
	
	
	public Location getLocation()
	{
		return location;
	}
	
	
	public String getCaption()
	{
		return caption;
	}

}


================================================
FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/popup/MapPopupBase.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo2.popup;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;

public class MapPopupBase
{
	protected ViewGroup parentView;
	
	protected LinearLayout container;
	protected float dipScaleFactor;
	protected int lastX;
	protected int lastY;
	protected int screenHeight;
	protected int screenWidth;
	

	public MapPopupBase(Context context, ViewGroup parentView) 
	{
	    screenHeight = context.getResources().getDisplayMetrics().heightPixels;
	    screenWidth = context.getResources().getDisplayMetrics().widthPixels;
	    
		this.parentView = parentView;
    	dipScaleFactor = context.getResources().getDisplayMetrics().density;
    	
		container = new LinearLayout(context);
		container.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	
		lastX = lastY = -1;
	}		
	
	
	public void show(ViewGroup view, int theX, int theY)
	{
		hide();

		container.measure(view.getWidth(), view.getHeight());
		
		int x = theX - (getWidth() / 2);
		int y = theY - getHeight();
		
		container.setPadding(x, y, 0, 0);

		lastX = x;
		lastY = y;
		
		parentView.addView(container);
		container.setVisibility(View.VISIBLE);
	}

	
	public int getHeight()
	{
		return container.getMeasuredHeight();
	}
	
	
	public int getWidth()
	{
		return container.getMeasuredWidth();
	}
	
	
	public boolean isVisible()
	{
		return container.getVisibility() == View.VISIBLE;
	}
	
	
	public void hide()
	{
		container.setPadding(0, 0, 0, 0);
		container.setVisibility(View.INVISIBLE);
		parentView.removeView(container);
	}
	
	
	public void setOnClickListener(View.OnTouchListener listener)
	{
	    if(container != null){
	        container.setOnTouchListener(listener);
	    }
	}
}


================================================
FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/popup/TextPopup.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.demo.demo2.popup;

import com.ls.demo.demo2.R;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class TextPopup
    extends MapPopupBase
{
	public final static int ZERO = 0;
	public final static int PADDING_BOTTOM = 11;
	public final static int PADDING_TOP = 5;
	public final static int PADDING_LEFT = 15;
	public final static int PADDING_RIGHT = 10;
	public final static float DEF_TEXT_SIZE = 16;
	public final static int IMAGE_SIZE = 30;
	public final static int MAX_EMS = 14;	
	
    private TextView text;

    public TextPopup(Context context, ViewGroup parentView) 
    {
        super(context, parentView);
        
        text = new TextView(context);
        
        text.setPadding((int)(PADDING_LEFT * dipScaleFactor),
                        (int)(PADDING_TOP * dipScaleFactor),
                        (int)(PADDING_RIGHT  * dipScaleFactor), 
                        (int)(PADDING_BOTTOM * dipScaleFactor));
        
        text.setBackgroundResource(R.drawable.map_description_background);
        text.setTextSize(DEF_TEXT_SIZE);
        text.setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL);
        text.setMaxEms(MAX_EMS);
        text.setTextColor(Color.WHITE);
        
        container.addView(text);
    
        text.setFocusable(true);
        text.setClickable(true);
    }       

 
    public void moveBy(int dx, int dy)
    {
        if (lastX != -1 && lastY != -1){
            int paddingBottom = 0;
            int paddingRight = 0;
            if(container.getPaddingTop() > (screenHeight - (text.getHeight() + 3))){
                paddingBottom = (container.getPaddingBottom() - dy);
            }
            
            if(container.getPaddingLeft() > (screenWidth - (text.getWidth() + 3))){
                paddingRight = container.getPaddingRight() - dx;
            }
            
            container.setPadding(container.getPaddingLeft() + dx,
                                 container.getPaddingTop() + dy, 
                                 paddingRight, paddingBottom);
        }
    }
 
    
    public void setText(String theText)
    {
        text.setPadding((int)(PADDING_LEFT * dipScaleFactor),
                (int)(PADDING_TOP * dipScaleFactor),
                (int)(PADDING_RIGHT  * dipScaleFactor), 
                (int)(PADDING_BOTTOM * dipScaleFactor));
        
        text.setText(theText + "   ");
    }
    
    
    public void setIcon(BitmapDrawable theDrawable)
    {
        if (theDrawable != null) {
            theDrawable.setBounds(0,0, (int) (theDrawable.getBitmap().getWidth()),
                                        (int)(theDrawable.getBitmap().getHeight()));
        }
        
        text.setCompoundDrawables(null, null, theDrawable, null);
    }
    
    
    public void removeIcon()
    {
        text.setCompoundDrawables(null, null, null, null);
    }
    
    
    public void setOnClickListener(View.OnTouchListener listener)
    {
        if(text != null){
            text.setOnTouchListener(listener);
        }
    }
}


================================================
FILE: mAppWidget/demo2app/src/main/res/layout/activity_main.xml
================================================
<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:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <TextView android:text="@string/hello_world" android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>


================================================
FILE: mAppWidget/demo2app/src/main/res/layout/main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:id="@+id/rootLayout">
</RelativeLayout>


================================================
FILE: mAppWidget/demo2app/src/main/res/menu/menu.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<menu
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/zoomIn" android:title="Zoom In"></item>
    <item android:id="@+id/zoomOut" android:title="Zoom Out"></item>
    <item android:id="@+id/hideLayer2" android:title="Hide Layer 2"></item>
    <item android:id="@+id/showLayer2" android:title="Show Layer 2"></item>
    <item android:title="Scroll to next object" android:id="@+id/scroll_next"></item>
</menu>


================================================
FILE: mAppWidget/demo2app/src/main/res/menu/menu_main.xml
================================================
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
    <item android:id="@+id/action_settings" android:title="@string/action_settings"
        android:orderInCategory="100" app:showAsAction="never" />
</menu>


================================================
FILE: mAppWidget/demo2app/src/main/res/values/dimens.xml
================================================
<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
</resources>


================================================
FILE: mAppWidget/demo2app/src/main/res/values/strings.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Demo2</string>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>

</resources>


================================================
FILE: mAppWidget/demo2app/src/main/res/values/styles.xml
================================================
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>


================================================
FILE: mAppWidget/demo2app/src/main/res/values/theme.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<style name="Theme.NoBackground" parent="android:Theme">
        <item name="android:windowBackground">@null</item>
    </style>
</resources>


================================================
FILE: mAppWidget/demo2app/src/main/res/values-w820dp/dimens.xml
================================================
<resources>
    <!-- Example customization of dimensions originally defined in res/values/dimens.xml
         (such as screen margins) for screens with more than 820dp of available width. This
         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
    <dimen name="activity_horizontal_margin">64dp</dimen>
</resources>


================================================
FILE: mAppWidget/gradle/wrapper/gradle-wrapper.properties
================================================
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip


================================================
FILE: mAppWidget/gradle.properties
================================================
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

================================================
FILE: mAppWidget/gradlew
================================================
#!/usr/bin/env bash

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
    echo "$*"
}

die ( ) {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=$((i+1))
    done
    case $i in
        (0) set -- ;;
        (1) set -- "$args0" ;;
        (2) set -- "$args0" "$args1" ;;
        (3) set -- "$args0" "$args1" "$args2" ;;
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
    JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"


================================================
FILE: mAppWidget/gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega


================================================
FILE: mAppWidget/mappwidgetlib/.gitignore
================================================
/build


================================================
FILE: mAppWidget/mappwidgetlib/build.gradle
================================================
apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 23
        versionCode 1
        versionName "1.4.2"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    task androidJavadocs(type: Javadoc) {
        source = android.sourceSets.main.java.srcDirs
        classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    }

    task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
        classifier = 'javadoc'
        from androidJavadocs.destinationDir
    }

    task cleanJar(type: Delete) {
        delete 'build/outputs/mAppWidget.jar'
    }

    task makeJar(type: Copy) {
        from('build/intermediates/bundles/release/')
        into('build/outputs/')
        include('classes.jar')
        rename ('classes.jar', 'mAppWidget.jar')
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:23.1.1'
}


================================================
FILE: mAppWidget/mappwidgetlib/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/dmytrobaryskyy/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# 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 *;
#}


================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/assets/map/map.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<Image TileSize="256" Overlap="1" Format="png">
	<Size Width="1918" Height="978"/>
	<CalibrationRect>
		<Point x="257" y="54" lat="49.835401382423214" lon="23.954856991767883" topLeft="1"/>
		<Point x="1736" y="852" lat="49.81328710324948" lon="24.01834487915039"/>
	</CalibrationRect>
</Image>

================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/AllTests.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;

import junit.framework.Test;
import junit.framework.TestSuite;

public class AllTests extends TestSuite {

	public static Test suite() {
		TestSuite suite = new TestSuite(AllTests.class.getName());
		//$JUnit-BEGIN$
		suite.addTestSuite(OfflineMapUtilTest.class);
		suite.addTestSuite(GridTest.class);
		suite.addTestSuite(CellTest.class);
		suite.addTestSuite(OfflineMapConfigTest.class);
		suite.addTestSuite(MapLayerTest.class);
		suite.addTestSuite(MapWidgetTest.class);
		//$JUnit-END$
		return suite;
	}
}


================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/CellTest.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;
import com.ls.widgets.map.config.OfflineMapConfig;
import com.ls.widgets.map.model.Cell;
import com.ls.widgets.map.model.Grid;
import com.ls.widgets.map.providers.AssetTileProvider;

import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.test.AndroidTestCase;
import android.widget.LinearLayout;


public class CellTest extends AndroidTestCase 
{
	private static final int MAP_ORIGINAL_WIDTH = 1520;
	private static final int MAP_ORIGINAL_HEIGHT = 920;
	private static final int MAX_ZOOM_LEVEL = 11;

	private OfflineMapConfig config;
	private AssetTileProvider tileManager;
	private Drawable drawable;
	
	
	protected void setUp() throws Exception {
		super.setUp();
		config = new OfflineMapConfig("map", MAP_ORIGINAL_WIDTH, MAP_ORIGINAL_HEIGHT, 256, 1, "png");
	    tileManager = new AssetTileProvider(getContext(), config);
	    
	    drawable = new BitmapDrawable(Bitmap.createBitmap(config.getTileSize(), config.getTileSize(), Bitmap.Config.RGB_565));
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}
	
	
	public void testRecalculateDrawableRect()
	{
		Grid grid = new Grid(new LinearLayout(getContext()), config, tileManager, MAX_ZOOM_LEVEL);
		CellImpl cell = new CellImpl(grid, tileManager, 6, 0, 0, config.getTileSize(), 1.0f);
		cell.setImage(drawable);
		cell.recalculateDrawableRect(0, 0);
		
		Rect imageRect = cell.getDrawableRect();
		Rect shouldBe = new Rect(0,0,256,256);
		
		assertEquals(shouldBe, imageRect);
		
		cell.setScale(2.0f);
		imageRect = cell.getDrawableRect();
		shouldBe.set(0,0, 512, 512);
		
		assertEquals(shouldBe, imageRect);
		
		cell = new CellImpl(grid, tileManager, 11, 1, 1, config.getTileSize(), 1.0f);
	    drawable = new BitmapDrawable(Bitmap.createBitmap(config.getTileSize(), config.getTileSize(), Bitmap.Config.RGB_565));
		cell.setImage(drawable);
		cell.setScale(1.0f);
		cell.recalculateDrawableRect(0, 0);
		
		shouldBe.set(256, 256, 512, 512);
		imageRect = cell.getDrawableRect();
		
		assertEquals(shouldBe, imageRect);
	}
	
	
	private void assertEquals(Rect r1, Rect r2) 
	{
		assertEquals(r1.top,  r2.top);
		assertEquals(r1.left,  r2.left);
		assertEquals(r1.bottom, r2.bottom);
		assertEquals(r1.right,  r2.right);
	}
	
	private static class CellImpl extends Cell
	{
		public CellImpl(Grid parent, AssetTileProvider tileManager, int zoomLevel, int col, int row, int tileSize, float scale) {
			super(parent, tileManager, zoomLevel, col, row, tileSize, scale);
		}
		
		
		@Override
		protected void recalculateDrawableRect(float dx, float dy) {
			// TODO Auto-generated method stub
			super.recalculateDrawableRect(dx, dy);
		}
		
		
		public void setImage(Drawable drawable) 
		{
			this.image = drawable;
		}
		
		
		public Rect getDrawableRect()
		{
			return image.getBounds();
		}
	}

}


================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/GridTest.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;

import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.test.AndroidTestCase;
import android.view.View;
import android.widget.LinearLayout;

import com.ls.widgets.map.config.OfflineMapConfig;
import com.ls.widgets.map.interfaces.TileManagerDelegate;
import com.ls.widgets.map.model.Grid;
import com.ls.widgets.map.providers.AssetTileProvider;

public class GridTest extends AndroidTestCase {

	OfflineMapConfig config;
	AssetTileProvider tileManager;

	private static final int MAP_ORIGINAL_WIDTH = 1520;
	private static final int MAP_ORIGINAL_HEIGHT = 920;
	private static final int MAX_ZOOM_LEVEL = 11;
	
	 private int colCount[] = {1,1,1,1,1,1,1,1,1,2,3,6}; // col count on each zoom level
	 private int rowCount[] = {1,1,1,1,1,1,1,1,1,1,2,4}; // row count on each zoom level
	 private int widthOnZoomLevel[] = {1,2,3,6,12,24,48,95,190,380,760,1520}; // width of the grid on each zoom level in pixels
	 private int heightOnZoomLevel[] = {1,1,2,4,8,15,29,58,115,230,460,920}; // height of the grid on each zoom level in pixels
	 
	 // scale on each zoom level
	 private double scaleOnZoomLevel[] = {0.00048828125f, 0.0009765625f, 0.001953125f, 0.00390625f, 0.0078125f, 0.015625f, 0.03125f, 0.0625f, 0.125f, 0.25f, 0.5f, 1.0f};
	private BitmapDrawable drawable;
	
	protected void setUp() throws Exception 
	{
		super.setUp();
		
		config = new OfflineMapConfig("map", MAP_ORIGINAL_WIDTH, MAP_ORIGINAL_HEIGHT, 256, 1, "png");
		drawable = new BitmapDrawable(getContext().getResources(),
                BitmapFactory.decodeResource(getContext().getResources(),
			com.ls.widgets.map.test.R.drawable.maps_blue_dot));

	    tileManager = new TestTileManager(getContext(), config);
	}

	protected void tearDown() throws Exception 
	{
		super.tearDown();
	}

	public void testGetHeight() 
	{
		for (int i=0; i< heightOnZoomLevel.length; ++i) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, i);
			assertEquals(heightOnZoomLevel[i], grid.getHeight());
		}
	}

	public void testGetOriginalHeight() 
	{
		GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, MAX_ZOOM_LEVEL);
		assertEquals(MAP_ORIGINAL_HEIGHT, grid.getOriginalHeight());
	}

	public void testGetOriginalWidth() 
	{
		for (int i=0; i<=MAX_ZOOM_LEVEL; ++i) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, MAX_ZOOM_LEVEL);
			assertEquals(MAP_ORIGINAL_WIDTH, grid.getOriginalWidth());
		}
	}

	public void testGetWidth() 
	{
		for (int i=0; i<=MAX_ZOOM_LEVEL; ++i) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, i);
			assertEquals(widthOnZoomLevel[i], grid.getWidth());
		}
	}

	public void testGetMaxZoomLevel() 
	{
		for (int i=0; i<= MAX_ZOOM_LEVEL; ++i) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, i);
			assertEquals(MAX_ZOOM_LEVEL, grid.getMaxZoomLevel());
		}
	}

	public void testGetMinZoomLevel() 
	{
		for (int i=0; i<= MAX_ZOOM_LEVEL; ++i) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, i);
			assertEquals(0, grid.getMinZoomLevel());
		}
	}
	
	public void testGetColCount()
	{
		for (int i=0; i<colCount.length; ++i) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, i);
			
			assertEquals(colCount[i], grid.getColCountTest());
		}
	}
	
	
	public void testGetRowCount()
	{
		for (int i=0; i<rowCount.length; ++i) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, i);
			
			assertEquals(rowCount[i], grid.getRowCountTest());
		}
	}
	
	
	public void testGetScale()
	{
		for (int i=0; i<scaleOnZoomLevel.length; ++i) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, i);
			
			assertEquals(scaleOnZoomLevel[i], grid.getScale());
		}
	}
	

	public void testSetSoftScale()
	{
		final float scales[] = {0.125f, 0.25f, 0.5f, 2.0f, 4.0f, 8.0f};
		
		for (int zoom_level=7; zoom_level<=MAX_ZOOM_LEVEL; ++zoom_level) {
			GridToTest grid = new GridToTest(new LinearLayout(getContext()), config, tileManager, zoom_level);
			
			for (int i=0; i<scales.length; ++i) {
				grid.setSoftScale(1.0f);
				int width1 = grid.getWidth();
				grid.setSoftScale(scales[i]);
				int width2 = grid.getWidth();
				
				double scale = grid.getSoftScale();
				assertEquals(scales[i], (float)scale);
				
				assertEquals("ZL: " + zoom_level + ", Original W: " + width1 + ", Scaled W: " + width2 + ", scale: " + scales[i],
				(int)Math.ceil((float)width1 * scales[i]), width2);
			}
		}
	}
	

	private static class GridToTest extends Grid
	{
		public GridToTest(View parent, OfflineMapConfig config, AssetTileProvider tileManager,int initZoomLevel)
		{
			super(parent, config, tileManager, initZoomLevel);
		}
		
		
		public int getColCountTest()
		{
			return getColCount();
		}
		
		
		public int getRowCountTest()
		{
			return getRowCount();
		}
	}
	
	
	private class TestTileManager extends AssetTileProvider
	{

		public TestTileManager(Context context, OfflineMapConfig config) {
			super(context, config);
			
		}

		@Override
		public void requestTile(int zoomLevel, int col, int row,
				TileManagerDelegate delegate) {
			delegate.onTileReady(zoomLevel, col, row, drawable);
		}
	}
}


================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapLayerTest.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;

import java.util.ArrayList;

import android.R;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.test.AndroidTestCase;

import com.ls.widgets.map.MapWidget;
import com.ls.widgets.map.interfaces.Layer;
import com.ls.widgets.map.model.MapLayer;
import com.ls.widgets.map.model.MapObject;

public class MapLayerTest extends AndroidTestCase
{
	private MapWidget map;
	private Layer layer;
	private Drawable drawable;
	private FakeCanvas canvas;
	
	@Override
	protected void setUp() throws Exception 
	{
		map = new MapWidget(getContext(), "map", 11);
		drawable = new BitmapDrawable(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.presence_online));

		layer = map.createLayer(1);
		canvas = new FakeCanvas();
		
		super.setUp();
	}
	
	
	@Override
	protected void tearDown() throws Exception 
	{
		map.removeLayer(1);
		super.tearDown();
	}


	public void testAddMapObject()
	{
		for (int i=-1000; i <= 1000; ++i) {
			MapObject object = new MapObject(i,
											drawable,
											0, 0);
			layer.addMapObject(object);
			MapObject received = layer.getMapObject(i);
			
			assertSame(object, received);
		}
		
		layer.clearAll();
	}
	
	
	public void testRemoveMapObject()
	{
		for (int i=0; i <= 100; ++i) {
			MapObject object = new MapObject(i,
											drawable,
											0, 0);
			layer.addMapObject(object);
		}
		
		for (int i=0; i <= 100; ++i) {
			layer.removeMapObject(i);
			MapObject object = layer.getMapObject(i);
			assertNull("Failed for " + i + " element", object);
		}
	}

	
	public void testGetMapObject()
	{
		MapObject object1 = new MapObject(1,drawable, 0, 0);
		MapObject object4 = new MapObject(4,drawable, 4, 4);
		MapObject object16 = new MapObject(16,drawable, 16, 16);
		
		layer.addMapObject(object1);
		layer.addMapObject(object16);
		layer.addMapObject(object4);
		
		MapObject obj = layer.getMapObject(16);
		assertSame(object16, obj);
		assertEquals(16, obj.getX());
		assertEquals(16, obj.getY());
		
		obj = layer.getMapObject(1);
		assertSame(object1, obj);
		assertEquals(0, obj.getX());
		assertEquals(0, obj.getY());
		
		obj = layer.getMapObject(4);
		assertSame(object4, obj);
		assertEquals(4, obj.getX());
		assertEquals(4, obj.getY());
	}
	
	
	public void testIsVisible()
	{
		// Test default state
		assertTrue(layer.isVisible());
		
		// Test invisible state
		layer.setVisible(false);
		assertFalse(layer.isVisible());
		
		// Test visible state
		layer.setVisible(true);
		assertTrue(layer.isVisible());

		for (int i=0; i <= 20; ++i) {
			MapObject object = new MapObject(i,
											drawable,
											0, 0);
			layer.addMapObject(object);
		}		
		
		layer.setVisible(true);

		canvas.setDrawPerformed(false);
		((MapLayer)layer).draw(canvas, new Rect(0,0, 480, 800));
		assertTrue(canvas.drawPerformed);
		
		layer.setVisible(false);
		canvas.setDrawPerformed(false);
		((MapLayer)layer).draw(canvas, new Rect(0,0, 480, 800));
		assertFalse(canvas.drawPerformed);
		
		layer.setVisible(true);
		canvas.setDrawPerformed(false);
		((MapLayer)layer).draw(canvas, new Rect(480,0, 800, 800));
		assertFalse(canvas.drawPerformed);
	}
	
	
	public void testGetMapObjectByIndexInt()
	{
		for (int i=0; i < 100; ++i) {
			MapObject object = new MapObject(i,
											drawable,
											0, 0);
			layer.addMapObject(object);
		}
		
		int count = layer.getMapObjectCount();
		
		assertEquals(100, count);
		
		MapObject object = layer.getMapObject(5);
		assertEquals(object.getId(), 5);
	}
	
	public void testGetTouched()
	{
//		getTouchedTest1(true);
//		layer.clearAll();
//		getTouchedTest1(false);
//		layer.clearAll();
		
		getTouchedTest2(true);
		layer.clearAll();
		getTouchedTest2(false);
	}
	
	
	public void testSetScale()
	{
		for (int i=0; i < 200; ++i) {
			MapObject object = new MapObject(i,
										drawable,
										20, 10);
			layer.addMapObject(object);
		}
		
		float scaleToTest[] = {0.5f, 1.0f, 2.0f};
		int resultsX[] = {10, 20, 40};
		int resultsY[] = {5, 10, 20};
		
		for (int j=0; j<scaleToTest.length; ++j) {
			((MapLayer)layer).setScale(scaleToTest[j]);
			
			for (int i=0; i < 200; ++i) {
				MapObject obj = layer.getMapObject(i);
				assertNotNull(obj);
			
				assertEquals(20, obj.getX());
				assertEquals(10, obj.getY());
				assertEquals(resultsX[j], obj.getXScaled());
				assertEquals(resultsY[j], obj.getYScaled());
			}
		}
	}


//	private void getTouchedTest1(boolean touchable) 
//	{
//		int counter = 0; 
//		int width = drawable.getIntrinsicWidth();
//		int height = drawable.getIntrinsicHeight();
//		
//		getTouchedGenerateMapObjects(touchable, width, height);
//		
//		counter = 0;
//		for (int i=0; i < 480/width; ++i) {
//			for (int j=0; j < 800/height; ++j) {
//				int touchedX = (int)((float)i*(float)width+(float)width/2.0f);
//				int touchedY = (int)((float)j*(float)height+(float)height/2.0f);
//				ArrayList<Object> touchedIds = ((MapLayer)layer).getTouched(touchedX, touchedY);
//
//				if (touchable) {
//					assertEquals(1, touchedIds.size());
//				} else {
//					assertEquals(0, touchedIds.size());
//				}
//				
//				if (touchable) {
//					Object id = touchedIds.get(0);
//					assertEquals(counter, id);
//				}
//
//				counter += 1;
//			}
//		}
//	}
	
	
	private void getTouchedTest2(boolean touchable) 
	{
		int counter = 0; 
		int width = drawable.getIntrinsicWidth();
		int height = drawable.getIntrinsicHeight();
		
		getTouchedGenerateMapObjects(touchable, width, height);
		
		counter = 0;
		for (int i=0; i < 480/width; ++i) {
			for (int j=0; j < 800/height; ++j) {
				int touchedX = (int)((float)i*(float)width+(float)width/2.0f);
				int touchedY = (int)((float)j*(float)height+(float)height/2.0f);
				ArrayList<Object> touchedIds = ((MapLayer)layer).getTouched(new Rect(touchedX - 2, touchedY - 2, touchedX + 2, touchedY + 2));

				if (touchable) {
					assertEquals(1, touchedIds.size());
				} else {
					assertEquals(0, touchedIds.size());
				}
				
				if (touchable) {
					Object id = touchedIds.get(0);
					assertEquals(counter, id);
				}
				counter += 1;
			}
		}
		
		ArrayList<Object> touchedIds = ((MapLayer)layer).getTouched(new Rect(0, 0, width * 2, height * 2));
		
		if (touchable) {
			assertEquals(4, touchedIds.size());
		} else {
			assertEquals(0, touchedIds.size());
		}
	}


	private void getTouchedGenerateMapObjects(boolean touchable,
			int width, int height) 
	{
		int counter = 0;
		for (int i=0; i < 480/width; ++i) {
			for (int j=0; j < 800/height; ++j) {
				MapObject object = new MapObject(counter,
											drawable,
											i*width, j*height, touchable);
				layer.addMapObject(object);
				
				counter += 1;
			}
		}
	}

	
	private static class FakeCanvas extends Canvas
	{
		private boolean drawPerformed;
		
		public FakeCanvas()
		{
			drawPerformed = false;
		}
		
		@Override
		public void drawBitmap(Bitmap bitmap, float left, float top, Paint paint) 
		{
			super.drawBitmap(bitmap, left, top, paint);
			drawPerformed = true;
		}

		@Override
		public void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint) {
			super.drawBitmap(bitmap, matrix, paint);
			drawPerformed = true;
		}

		@Override
		public void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint) {
			super.drawBitmap(bitmap, src, dst, paint);
			drawPerformed = true;
		}

		@Override
		public void drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint) {
			super.drawBitmap(bitmap, src, dst, paint);
			drawPerformed = true;
		}
		
		
		public void setDrawPerformed(boolean performed)
		{
			drawPerformed = performed;
		}
	}
}


================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapObjectTest.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;

import com.ls.widgets.map.MapWidget;
import com.ls.widgets.map.interfaces.Layer;
import com.ls.widgets.map.model.MapLayer;
import com.ls.widgets.map.model.MapObject;
import com.ls.widgets.map.utils.Size;

import android.R;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.test.AndroidTestCase;

public class MapObjectTest extends AndroidTestCase
{
    
    
    private MapWidget map;
    private MapLayer layer;
    private Drawable drawable1;
    private Drawable drawable2;
    private FakeMapObject scalableObject;
    private FakeMapObject nonScalableObject;
    private Size originalDrawableSize;

  
    protected void setUp() throws Exception
    {
        super.setUp();
        
//        map = new MapWidget(getContext(), "map", 11);
        drawable1 = new BitmapDrawable(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.presence_online));
        drawable2 = new BitmapDrawable(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.presence_online));

        originalDrawableSize = new Size(drawable1.getIntrinsicWidth(), drawable1.getIntrinsicHeight());
//        layer = map.createLayer(1);   
        
        scalableObject = new FakeMapObject("1", drawable1, 10, 10, 0, 0, true, true);
        nonScalableObject = new FakeMapObject("2", drawable2, 100, 100, 0, 0, true, false);
    }


    protected void tearDown() throws Exception
    {
       // map.removeAllLayers();
        
        super.tearDown();
    }


    public void testMapObjectObjectDrawableIntIntIntIntBooleanBoolean()
    {
        fail("Not yet implemented");
    }


    public void testGetDrawable()
    {
        fail("Not yet implemented");
    }


    public void testSetDrawable()
    {
        fail("Not yet implemented");
    }


    public void testDraw()
    {
        fail("Not yet implemented");
    }


    public void testGetId()
    {
        fail("Not yet implemented");
    }


    public void testIsTouchedIntInt()
    {
        fail("Not yet implemented");
    }


    public void testIsTouchedRect()
    {      
        assertEquals(true, nonScalableObject.isTouchable());
        
        Rect touchRect = new Rect(100,100,101,101);
        
        assertEquals(true, nonScalableObject.isTouched(touchRect));
        
        touchRect.set(100, 99, 101, 100);
        
        assertEquals(false, nonScalableObject.isTouched(touchRect));
        
        Rect drawableRect = nonScalableObject.getDrawable().getBounds();
        Rect touchableRect = nonScalableObject.getTouchArea();
        
        assertEquals(drawableRect.width(), touchableRect.width());
        
        nonScalableObject.setNewScale(2.0f);
        
        assertEquals(drawableRect.width(), touchableRect.width() / 2);
    }


    public void testGetXScaled()
    {
        fail("Not yet implemented");
    }


    public void testGetYScaled()
    {
        fail("Not yet implemented");
    }


    public void testGetX()
    {
        fail("Not yet implemented");
    }


    public void testGetY()
    {
        fail("Not yet implemented");
    }


    public void testIsTouchable()
    {
        fail("Not yet implemented");
    }


    public void testGetBounds()
    {
        fail("Not yet implemented");
    }


    public void testMoveTo()
    {
        fail("Not yet implemented");
    }


    public void testSetScale()
    {
        fail("Not yet implemented");
    }


    public void testSetParent()
    {
        fail("Not yet implemented");
    }

    private class FakeMapObject extends MapObject {

        public FakeMapObject(Object id, Drawable drawable, int x, int y, int pivotX, int pivotY, boolean isTouchable,
                boolean isScalable)
        {
            super(id, drawable, x, y, pivotX, pivotY, isTouchable, isScalable);
        }
        
        
        public void setNewScale(float scale)
        {
            this.scale = scale;
            recalculateBounds();        
        }
        
        
        public Rect getTouchArea()
        {
            return this.touchRect;
        }
        


    }
    
}


================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapWidgetTest.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.graphics.drawable.BitmapDrawable;
import android.test.AndroidTestCase;
import android.util.Log;
import android.view.animation.Animation.AnimationListener;

import com.ls.widgets.map.config.OfflineMapConfig;
import com.ls.widgets.map.interfaces.Layer;
import com.ls.widgets.map.interfaces.MapEventsListener;
import com.ls.widgets.map.interfaces.TileManagerDelegate;
import com.ls.widgets.map.model.MapObject;
import com.ls.widgets.map.providers.AssetTileProvider;

public class MapWidgetTest
        extends AndroidTestCase {
    private TestMapWidget map;
    private BitmapDrawable drawable;

    @Override
    protected void setUp() throws Exception {
        map = new TestMapWidget(getContext(), "map", 11);
        map.setScale(1.0f);
        drawable = new BitmapDrawable(getContext().getResources(),
                BitmapFactory.decodeResource(getContext().getResources(),
                        com.ls.widgets.map.test.R.drawable.maps_blue_dot));
        super.setUp();
    }


    @Override
    protected void tearDown() throws Exception {
        map.removeAllLayers();
        map.startProcessing();
        super.tearDown();
    }


    public void testCreateLayer() {
        int layerIds[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        Layer layers[] = new Layer[layerIds.length];

        for (int i = 0; i < layerIds.length; ++i) {
            layers[i] = map.createLayer(layerIds[i]);
        }

        for (int i = 0; i < layerIds.length; ++i) {
            Layer layer = map.getLayerById(Integer.valueOf(i));

            assertNotNull(layer);
            assertSame(layers[i], layer);
        }

        boolean ok = false;
        try {
            map.createLayer(0);
        } catch (IllegalArgumentException e) {
            ok = true;
        }

        assertTrue(ok);
    }


    public void testRemoveLayer() {
        for (int i = -100; i <= 100; ++i) {
            map.createLayer(i);
        }

        for (int i = -100; i <= 100; ++i) {

            Layer layer = map.getLayerById(i);
            assertNotNull(layer);

            map.removeLayer(i);

            layer = map.getLayerById(i);
            assertNull(layer);
        }

        try {
            map.removeLayer(0);
        } catch (Exception e) {
            fail();
        }
    }


    public void testGetLayer() {
        int layerIds[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
        Layer layers[] = new Layer[layerIds.length];

        for (int i = 0; i < layerIds.length; ++i) {
            layers[i] = map.createLayer(layerIds[i]);
        }

        for (int i = 0; i < layerIds.length; ++i) {
            Layer layer = map.getLayer(i);
            assertSame(layers[i], layer);
        }

        boolean ok = false;
        try {
            map.getLayer(layerIds.length);
        } catch (IndexOutOfBoundsException e) {
            ok = true;
        }

        assertTrue(ok);
    }


    public void testGetLayerById() {
        int layerIds[] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
        Layer layers[] = new Layer[layerIds.length];

        for (int i = 0; i < layerIds.length; ++i) {
            layers[i] = map.createLayer(layerIds[i]);
        }

        for (int i = 0; i < layerIds.length; ++i) {
            Layer layer = map.getLayerById(layerIds[i]);
            assertSame(layers[i], layer);
        }

        assertNull(map.getLayerById(0));
    }


    public void testGetLayerCount() {
        for (int j = 0; j < 100; ++j) {
            for (int i = 0; i < j; ++i) {
                map.createLayer(i);
            }

            assertEquals(map.getLayerCount(), j);
            map.removeAllLayers();
        }
    }


    public void testGetMapHeight() {
        int height = map.getConfig().getImageHeight();

        for (int i = 1; i <= 11; ++i) {
            assertEquals("i:" + i, height, map.getMapHeight());
            map.zoomOut();
            height = (int) Math.ceil(height / 2.0f);
        }
    }


    public void testGetMapWidth() {
        int width = map.getConfig().getImageWidth();

        for (int i = 1; i <= 11; ++i) {
            assertEquals("i:" + i, width, map.getMapWidth());
            map.zoomOut();
            width = (int) Math.ceil(width / 2.0f);
        }
    }


    public void testGetOriginalMapWidth() {
        int width = map.getConfig().getImageWidth();

        for (int i = 1; i <= 11; ++i) {
            assertEquals(width, map.getOriginalMapWidth());
            map.zoomOut();
        }
    }


    public void testGetOriginalMapHeight() {
        int height = map.getConfig().getImageHeight();

        for (int i = 1; i <= 11; ++i) {
            assertEquals(height, map.getOriginalMapHeight());
            map.zoomOut();
        }
    }


    public void testGetConfig() {
        OfflineMapConfig config = map.getConfig();
        assertNotNull(config);

        config.setMaxZoomLevelLimit(1);
        config = map.getConfig();
        assertTrue(config.getMaxZoomLevelLimit() == 1);
    }


    public void testGetScale() {
        float scalesUp[] = {1.0f, 2.0f, 4.0f, 8.0f, 16f, 32f};
        float scalesDown[] = {1.0f, 0.5f, 0.25f, 0.125f};
        map.setAnimationEnabled(false);

        for (int i = 0; i < scalesUp.length; ++i) {
            assertEquals("i=" + i, scalesUp[i], map.getScale());
            map.zoomIn();
        }

        for (int i = 0; i < scalesUp.length; ++i) {
            map.zoomOut();
        }

        for (int i = 0; i < scalesDown.length; ++i) {
            assertEquals(scalesDown[i], map.getScale());
            map.zoomOut();
        }

        for (int i = 0; i < 20; i++) {
            double testScale = 0.1;
            final double step = 0.1;

            while (testScale < 3.0f) {
                float prevScale = map.getScale();
                int prevWidth = map.getMapWidth();

                Log.d("MapWidgetTest", "ZL: " + map.getZoomLevel() + ", scale: " + map.getScale() + ", width: " + map.getMapWidth() + ", testScale: " + testScale);

                map.setScale((float) testScale);

                assertEquals("ZL: " + map.getZoomLevel() + ", prevScale: " + prevScale + ", CurScale:" + (float) testScale + ", prevWidth: " + prevWidth,
                        (float) (prevScale * testScale), map.getScale());

                map.setScale(1.0f);

                testScale += step;
            }

            map.zoomIn();
        }
    }


    public void testGetZoomLevel() {
        map.setAnimationEnabled(false);

        // Test lower bound
        for (int i = 11; i >= -11; --i) {
            int zl = map.getZoomLevel();

            if (i >= 0) {
                assertEquals(i, zl);
            }

            map.zoomOut();
        }

        assertEquals(0, map.getZoomLevel());

        // Test regular zoom with software zoom is enabled
        for (int i = 0; i <= 22; ++i) {
            int zl = map.getZoomLevel();
            assertEquals(i, zl);

            map.zoomIn();
        }

        // Test upper bound when software zoom is disabled
        map = new TestMapWidget(getContext(), "map", 1);
        map.setScale(1.0f);
        map.setAnimationEnabled(false);

        OfflineMapConfig conf = map.getConfig();
        conf.setSoftwareZoomEnabled(false);

        for (int i = 1; i <= 22; ++i) {
            int zl = map.getZoomLevel();

            if (i <= 11) {
                assertEquals(i, zl);
            } else {
                assertEquals(11, zl);
            }

            map.zoomIn();
        }
    }


    public void testRemoveAllLayers() {
        for (int i = -50; i < 50; ++i) {
            map.createLayer(i);
        }

        assertEquals(100, map.getLayerCount());
        map.removeAllLayers();

        for (int i = -50; i < 50; ++i) {
            assertNull("i:" + i, map.getLayerById(i));
        }
    }

    public void testClearLayers() {
        int count = 50;
        MapObject[] objects = generateMapObjects(count);
        ArrayList<Layer> layers = new ArrayList<Layer>(10);


        for (int i = -5; i < 5; ++i) {
            Layer layer = map.createLayer(i);

            for (MapObject object : objects) {
                layer.addMapObject(object);
            }

            layers.add(layer);

            assertEquals(count, layer.getMapObjectCount());
        }

        map.clearLayers();

        for (Layer layer : layers) {
            assertEquals(0, layer.getMapObjectCount());
        }
    }


    public void testSetMinZoomLevel() {
        for (int j = 10; j >= 0; --j) {
            map = new TestMapWidget(getContext(), "map", 11);
            map.setAnimationEnabled(false);
            map.setMinZoomLevel(j);

            for (int i = j; i >= 0; --i) {
                map.zoomOut();

                int zl = map.getZoomLevel();

                if (zl < j) {
                    fail("ZL: " + zl + ", j: " + j);
                }
            }
        }
    }


    public void testSetMaxZoomLevel() {
        for (int j = 2; j <= 11; ++j) {
            map = new TestMapWidget(getContext(), "map", 1);
            map.setAnimationEnabled(false);
            map.setMaxZoomLevel(j);

            for (int i = 2; i <= 11; ++i) {
                map.zoomIn();

                int zl = map.getZoomLevel();

                if (zl > j) {
                    fail("ZL: " + zl + ", j: " + j);
                }
            }
        }
    }


    public void testSetScale() {
        map = new TestMapWidget(getContext(), "map", 1);
        map.setAnimationEnabled(false);

        float scalesUp[] = {1.0f, 2.0f, 4.0f, 8.0f, 16f, 32f};
        float scalesDown[] = {1.0f, 0.5f, 0.25f, 0.125f};

        for (int j = 0; j < 15; ++j) {
            for (int i = 0; i < scalesDown.length; ++i) {
                float oldScale = map.getScale();
                map.setScale(scalesDown[i]);
                float newScale = map.getScale();

                assertEquals("zl:" + map.getZoomLevel() + ", i:" + i + ", os:" + oldScale + ", ns:" + newScale,
                        scalesDown[i], newScale / oldScale);

                map.setScale(1.0f);
            }


            for (int i = 0; i < scalesUp.length; ++i) {
                float oldScale = map.getScale();
                map.setScale(scalesUp[i]);
                float newScale = map.getScale();

                assertEquals("zl:" + map.getZoomLevel(), scalesUp[i], newScale / oldScale);

                map.setScale(1.0f);
            }

            map.zoomIn();
        }
    }


    public void testUseSoftwareZoom() {
        map.setAnimationEnabled(false);
        map.setUseSoftwareZoom(false);

        for (int i = 0; i < 10; ++i) {
            map.zoomIn();
        }

        assertEquals(11, map.getZoomLevel());

        map.setUseSoftwareZoom(true);

        for (int i = 0; i < 10; ++i) {
            map.zoomIn();
        }

        assertEquals(11 + 10, map.getZoomLevel());
    }


    public void testZoomIn() {
        map = new TestMapWidget(getContext(), "map", 1);
        map.setAnimationEnabled(false);
        TestMapEventsListener listener = new TestMapEventsListener();

        for (int i = 2; i <= 13; ++i) {
            map.addMapEventsListener(listener);

            float oldScale = map.getScale();

            map.zoomIn();

            float newScale = map.getScale();

            assertTrue("I:" + i + ", zoomIn: " + listener.counters[TestMapEventsListener.PRE_ZOOM_IN] +
                            " " + listener.counters[TestMapEventsListener.POST_ZOOM_IN],
                    listener.zoomInValid());

            assertEquals("i:" + i, 2.0f, newScale / oldScale);

            map.removeMapEventsListener(listener);
            listener.clearCounters();
        }
    }


    public void testZoomOut() {
        map.setAnimationEnabled(false);
        TestMapEventsListener listener = new TestMapEventsListener();
        for (int i = 2; i <= 11; ++i) {

            map.addMapEventsListener(listener);

            float oldScale = map.getScale();
            map.zoomOut();

            float newScale = map.getScale();

            assertTrue("I:" + i + ", zoomOut: " + listener.counters[TestMapEventsListener.PRE_ZOOM_OUT] +
                    " " + listener.counters[TestMapEventsListener.POST_ZOOM_OUT], listener.zoomOutValid());

            assertEquals(2.0f, oldScale / newScale);

            map.removeMapEventsListener(listener);
            listener.clearCounters();
        }
    }

// FIXME: Temporarily disabled
//    public void testAnimatedZoomIn() {
//        map = new TestMapWidget(getContext(), "map", 1);
//        map.setAnimationEnabled(true);
//        final Object event = new Object();
//
//        TestMapEventsListener listener = new TestMapEventsListener() {
//            @Override
//            public void onPostZoomIn() {
//                super.onPostZoomIn();
//
//                synchronized (event) {
//                    event.notify();
//                }
//            }
//        };
//
//
//        for (int i = 2; i <= 11; ++i) {
//            map.addMapEventsListener(listener);
//            float oldScale = map.getScale();
//            map.zoomIn();
//
//            synchronized (event) {
//                try {
//                    event.wait(3000);
//                } catch (InterruptedException e) {
//                    fail(e.toString());
//                    e.printStackTrace();
//                }
//            }
//
//            float newScale = map.getScale();
//            map.removeMapEventsListener(listener);
//            assertTrue("I:" + i + ", zoomIn: " + listener.counters[TestMapEventsListener.PRE_ZOOM_IN] +
//                            " " + listener.counters[TestMapEventsListener.POST_ZOOM_IN],
//                    listener.zoomInValid());
//            assertEquals(2.0f, newScale / oldScale);
//            listener.clearCounters();
//        }
//    }


    public void testAnimatedZoomOut() {
        map.setAnimationEnabled(true);

        TestMapEventsListener listener = new TestMapEventsListener();


        for (int i = 2; i <= 11; ++i) {
            map.addMapEventsListener(listener);

            float oldScale = map.getScale();

            map.zoomOut();

            float newScale = map.getScale();

            map.removeMapEventsListener(listener);

            assertTrue("I:" + i + ", zoomOut: " + listener.counters[TestMapEventsListener.PRE_ZOOM_OUT] +
                            " " + listener.counters[TestMapEventsListener.POST_ZOOM_OUT],
                    listener.zoomOutValid());

            assertEquals(2.0f, oldScale / newScale);

            listener.clearCounters();
        }
    }


    private MapObject[] generateMapObjects(int count) {
        MapObject[] result = new MapObject[count];

        for (int i = 0; i < count; ++i) {
            MapObject object = new MapObject(i, drawable, new Point(0, 0));
            result[i] = object;
        }

        return result;
    }


    private class TestMapEventsListener implements MapEventsListener {
        public static final int PRE_ZOOM_IN = 0;
        public static final int PRE_ZOOM_OUT = 1;
        public static final int POST_ZOOM_IN = 2;
        public static final int POST_ZOOM_OUT = 3;

        private int counters[];

        public TestMapEventsListener() {
            counters = new int[]{0, 0, 0, 0};
        }

        @Override
        public void onPreZoomIn() {
            counters[PRE_ZOOM_IN] += 1;
        }

        @Override
        public void onPostZoomIn() {
            counters[POST_ZOOM_IN] += 1;
        }

        @Override
        public void onPreZoomOut() {
            counters[PRE_ZOOM_OUT] += 1;
        }

        @Override
        public void onPostZoomOut() {
            counters[POST_ZOOM_OUT] += 1;
        }


        public void clearCounters() {
            counters = new int[]{0, 0, 0, 0};
        }


        public boolean zoomInValid() {
            return counters[PRE_ZOOM_IN] == 1 && counters[POST_ZOOM_IN] == 1;
        }

        public boolean zoomOutValid() {
            return counters[PRE_ZOOM_OUT] == 1 && counters[POST_ZOOM_OUT] == 1;
        }
    }


    private class TestMapWidget extends MapWidget {

        public TestMapWidget(Context context, String rootMapFolder) {
            super(context, rootMapFolder);

            this.tileProvider = new TestTileManager(context, this.getConfig());
            this.setTileProvider(tileProvider);
        }

        public TestMapWidget(Context context, String rootMapFolder, int initialZl) {
            super(context, rootMapFolder, initialZl);

            this.tileProvider = new TestTileManager(context, this.getConfig());

            this.setTileProvider(tileProvider);
        }


        @Override
        protected void animateZoomIn(final AnimationListener listener, float pivotX,
                                     float pivotY) {
            (new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(300);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }

                    post(new Runnable() {
                        public void run() {
                            onAnimationEnd();
                        }
                    });

                }
            })).start();
        }

        @Override
        protected void animateZoomOut(final AnimationListener listener) {
            (new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(300);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }

                    post(new Runnable() {
                        public void run() {
                            onAnimationEnd();
                        }
                    });
                    //onAnimationEnd();
                    //listener.onAnimationEnd(null);
                }
            })).start();
        }

        public void startProcessing() {
            super.startProcessingRequests();
        }
    }


    private class TestTileManager extends AssetTileProvider {

        public TestTileManager(Context context, OfflineMapConfig config) {
            super(context, config);
        }

        @Override
        public void requestTile(int zoomLevel, int col, int row,
                                TileManagerDelegate delegate) {
            delegate.onTileReady(zoomLevel, col, row, drawable);
        }

    }
}


================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/OfflineMapConfigTest.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;

import android.test.AndroidTestCase;

import com.ls.widgets.map.config.OfflineMapConfig;

public class OfflineMapConfigTest extends AndroidTestCase {

	private static final int TEST_IMAGE_WIDTH = 1024;
	private static final int TEST_IMAGE_HEIGHT = 768;
	private static final int TEST_TILE_SIZE = 256;
	private static final int TEST_OVERLAP = 1;
	private static final String TEST_IMAGE_FORMAT = "png";
	private static final String MAP_ROOT_PATH = "map";
	
	private OfflineMapConfig config;
	
	protected void setUp() throws Exception 
	{
		config = new OfflineMapConfig(MAP_ROOT_PATH, TEST_IMAGE_WIDTH, TEST_IMAGE_HEIGHT, TEST_TILE_SIZE, TEST_OVERLAP, TEST_IMAGE_FORMAT);
		super.setUp();

	}

	protected void tearDown() throws Exception 
	{
		super.tearDown();
	}
	
	
	public void testDefaults()
	{
		assertEquals(0, config.getMaxZoomLevelLimit());
		assertEquals(0, config.getMinZoomLevelLimit());
		assertEquals(5, config.getTouchAreaSize());
		assertEquals(64, config.getTrackballScrollStepX());
		assertEquals(64, config.getTrackballScrollStepY());
		assertEquals(false, config.isPinchZoomEnabled());
		assertEquals(false, config.isFlingEnabled());
		assertEquals(true, config.isSoftwareZoomEnabled());
		assertEquals(true, config.isZoomBtnsVisible());
	}
	
	
	public void testConstructor()
	{
		assertEquals(TEST_IMAGE_WIDTH, config.getImageWidth());
		assertEquals(TEST_IMAGE_HEIGHT, config.getImageHeight());
		assertEquals(TEST_TILE_SIZE, config.getTileSize());
		assertEquals(TEST_OVERLAP, config.getOverlap());
		assertEquals(TEST_IMAGE_FORMAT, config.getImageFormat());
	}
	
	
	public void testCopyConstructor()
	{
		// If this exception is thrown, please, update this test in order to test new members or
		// throw the tests for removed fields out.
		assertEquals(19, config.getClass().getDeclaredFields().length);
		
		config.setFlingEnabled(true);
		config.setMaxZoomLevelLimit(15);
		config.setMinZoomLevelLimit(10);
		config.setPinchZoomEnabled(true);
		config.setMapCenteringEnabled(true);
		config.setSoftwareZoomEnabled(false);
		config.setTouchAreaSize(10);
		config.setTrackballScrollStepX(25);
		config.setTrackballScrollStepY(30);
		config.setZoomBtnsVisible(false);
		
		OfflineMapConfig testConfig = new OfflineMapConfig(config);
		
		assertEquals(MAP_ROOT_PATH, testConfig.getMapRootPath());
		assertEquals(true, testConfig.isFlingEnabled());
		assertEquals(15, testConfig.getMaxZoomLevelLimit());
		assertEquals(10, testConfig.getMinZoomLevelLimit());
		assertEquals(true, testConfig.isPinchZoomEnabled());
		assertEquals(true, testConfig.isMapCenteringEnabled());
		assertEquals(false, testConfig.isSoftwareZoomEnabled());
		assertEquals(10, testConfig.getTouchAreaSize());
		assertEquals(25, testConfig.getTrackballScrollStepX());
		assertEquals(30, testConfig.getTrackballScrollStepY());
		assertEquals(false, testConfig.isZoomBtnsVisible());
		
		assertNotSame(config, testConfig);
	}
	
	
	public void testFlingEnabledOption()
	{
		config.setFlingEnabled(true);
		assertEquals(true, config.isFlingEnabled());
		
		config.setFlingEnabled(false);
		assertEquals(false, config.isFlingEnabled());
	}
	
	
	public void testMaxZoomLevelLimitOption()
	{
		for (int i=-1000; i<0; ++i) {
			boolean result = false;
			
			try {
				config.setMaxZoomLevelLimit(i);
			} catch (IllegalArgumentException e) {
				result = true;
			}
			
			assertTrue("Exception was not thrown for i=" + i, result);
		}
		
		for (int i=0; i<1000; ++i) {
			config.setMaxZoomLevelLimit(i);
			assertEquals(i, config.getMaxZoomLevelLimit());
		}
	}
	
	
	public void testMinZoomLevelLimitOption()
	{
		for (int i=-1000; i<0; ++i) {
			boolean result = false;
			
			try {
				config.setMinZoomLevelLimit(i);
			} catch (IllegalArgumentException e) {
				result = true;
			}
			
			assertTrue("Exception was not thrown for i=" + i, result);
		}
		
		for (int i=0; i<1000; ++i) {
			config.setMinZoomLevelLimit(i);
			assertEquals(i, config.getMinZoomLevelLimit());
		}
	}
	
	
	public void testPinchZoomEnabledOption()
	{
		config.setPinchZoomEnabled(true);
		assertEquals(true, config.isPinchZoomEnabled());
		
		config.setPinchZoomEnabled(false);
		assertEquals(false, config.isPinchZoomEnabled());
	}
	
	
	public void testSoftwareZoomEnabledOption()
	{
		config.setSoftwareZoomEnabled(true);
		assertEquals(true, config.isSoftwareZoomEnabled());
		
		config.setSoftwareZoomEnabled(false);
		assertEquals(false, config.isSoftwareZoomEnabled());
	}
	
	
	public void testTouchAreaSizeOption()
	{
		for (int i=-1000; i<=0; ++i) {
			boolean result = false;
			
			try {
				config.setTouchAreaSize(i);
			} catch (IllegalArgumentException e) {
				result = true;
			}
			
			assertTrue("Exception was not thrown for i=" + i, result);
		}
		
		for (int i=1; i<1000; ++i) {
			config.setTouchAreaSize(i);
			assertEquals(i, config.getTouchAreaSize());
		}
	}
	
	
	public void testTrackballScrollStepXOption()
	{
		for (int i=-1000; i< 0; ++i) {
			boolean result = false;
			
			try {
				config.setTrackballScrollStepX(i);
			} catch (IllegalArgumentException e) {
				result = true;
			}
			
			assertTrue("Exception was not thrown for i=" + i, result);
		}
		
		for (int i=0; i<1000; ++i) {
			config.setTrackballScrollStepX(i);
			assertEquals(i, config.getTrackballScrollStepX());
		}
	}
	
	
	public void testTrackballScrollStepYOption()
	{
		for (int i=-1000; i< 0; ++i) {
			boolean result = false;
			
			try {
				config.setTrackballScrollStepY(i);
			} catch (IllegalArgumentException e) {
				result = true;
			}
			
			assertTrue("Exception was not thrown for i=" + i, result);
		}
		
		for (int i=0; i<1000; ++i) {
			config.setTrackballScrollStepX(i);
			assertEquals(i, config.getTrackballScrollStepX());
		}
	}
	
	
	public void testZoomBtnsVisibleOption()
	{
		config.setZoomBtnsVisible(true);
		assertEquals(true, config.isZoomBtnsVisible());
		
		config.setZoomBtnsVisible(false);
		assertEquals(false, config.isZoomBtnsVisible());
	}
}


================================================
FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/OfflineMapUtilTest.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;

import android.test.AndroidTestCase;

import com.ls.widgets.map.utils.OfflineMapUtil;

public class OfflineMapUtilTest extends AndroidTestCase
{

	private float imageSizesAtZoomLevel[] = {1,2,3,6,12,24,47,94,188,375,750,1500,3000,6000};
	// Zoom Level                   0  1  2  3  4   5   6   7    8    9    10    11    12    13
	private int zoomLevelStart[] = {1, 2, 3, 5, 9,  17, 33, 65,  129, 257, 513,  1025, 2049, 4097};
	private int zoomLevelEnd[]   = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192};

	public void testGetScaledImageSize()
	{
		for (int i=0; i<imageSizesAtZoomLevel.length; ++i) {
			float imageSize = OfflineMapUtil.getScaledImageSize(imageSizesAtZoomLevel.length-1, i, 6000);
			
			assertEquals(imageSizesAtZoomLevel[i], imageSize);
		}
	}
	
	
	public void testGetMaxZoomLevel()
	{
		for (int i = 0; i<zoomLevelStart.length; ++i) {
			for (int zls=zoomLevelStart[i]; zls <= zoomLevelEnd[i]; ++ zls) {
				assertEquals(i,  OfflineMapUtil.getMaxZoomLevel(zls,zls));
			}
		}
			
		for (int i = 0; i<zoomLevelStart.length; ++i) {
			for (int zls=zoomLevelStart[i]; zls <= zoomLevelEnd[i]; ++ zls) {
				assertEquals(i,  OfflineMapUtil.getMaxZoomLevel(zls,1));
			}
		}
		
		for (int i = 0; i<zoomLevelStart.length; ++i) {
			for (int zls=zoomLevelStart[i]; zls <= zoomLevelEnd[i]; ++ zls) {
				assertEquals(i,  OfflineMapUtil.getMaxZoomLevel(1,zls));
			}
		}
		
	}

}


================================================
FILE: mAppWidget/mappwidgetlib/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ls.widgets.map">
</manifest>


================================================
FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/MapWidget.java
================================================
/*************************************************************************
* Copyright (c) 2015 Lemberg Solutions
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**************************************************************************/

package com.ls.widgets.map;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.xml.sax.SAXException;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.location.Location;
import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.Scroller;
import android.widget.ZoomButtonsController;
import android.widget.ZoomButtonsController.OnZoomListener;

import com.ls.widgets.map.config.GPSConfig;
import com.ls.widgets.map.config.MapConfigParser;
import com.ls.widgets.map.config.MapGraphicsConfig;
import com.ls.widgets.map.config.OfflineMapConfig;
import com.ls.widgets.map.events.MapScrolledEvent;
import com.ls.widgets.map.events.MapTouchedEvent;
import com.ls.widgets.map.events.ObjectTouchEvent;
import com.ls.widgets.map.interfaces.Layer;
import com.ls.widgets.map.interfaces.MapEventsListener;
import com.ls.widgets.map.interfaces.MapLocationListener;
import com.ls.widgets.map.interfaces.OnGridReadyListener;
import com.ls.widgets.map.interfaces.OnLocationChangedListener;
import com.ls.widgets.map.interfaces.OnMapDoubleTapListener;
import com.ls.widgets.map.interfaces.OnMapLongClickListener;
import com.ls.widgets.map.interfaces.OnMapScrollListener;
import com.ls.widgets.map.interfaces.OnMapTilesFinishedLoadingListener;
import com.ls.widgets.map.interfaces.OnMapTouchListener;
import com.ls.widgets.map.location.PositionMarker;
import com.ls.widgets.map.model.Grid;
import com.ls.widgets.map.model.MapLayer;
import com.ls.widgets.map.providers.AssetTileProvider;
import com.ls.widgets.map.providers.ExternalStorageTileProvider;
import com.ls.widgets.map.providers.GPSLocationProvider;
import com.ls.widgets.map.providers.TileProvider;
import com.ls.widgets.map.utils.Graphics;
import com.ls.widgets.map.utils.MathUtils;
import com.ls.widgets.map.utils.OfflineMapUtil;
import com.ls.widgets.map.utils.PivotFactory;
import com.ls.widgets.map.utils.PivotFactory.PivotPosition;
import com.ls.widgets.map.utils.Resources;
import com.ls.widgets.map.utils.TransformUtils;

public class MapWidget extends View implements MapLocationListener {
	private static final String MSG_MAP_DATA_IS_CORRUPTED_OR_MISSING = "Map data is corrupted or missing.";

	private final static String TAG = "MAP WIDGET";

	private final static long POS_PIN_ID = 1;

	private enum Mode {
		NONE, ZOOMED, ZOOM
	};

	private OfflineMapConfig config;
	private ZoomButtonsController zoomBtnsController;

	private Grid grid;
	private Grid prevGrid;

	private Paint paint;

	private float scale;
	private double pinchZoomScale;

	private boolean doNotZoom;
	private boolean isAnimationEnabled;
	private boolean byUser;

	// Represents layers in the map
	private MapLayer topmostLayer;
	private ArrayList<MapLayer> layers;
	private Map<Long, Layer> layersMap;

	// Provider that handles loading of map tiles.
	protected TileProvider tileProvider;
	protected GPSLocationProvider locationProvider;

	// Listeners
	private OnMapTouchListener mapTouchListener;
	private OnMapTilesFinishedLoadingListener mapTilesReadyListener;
	private OnMapScrollListener mapScrollListener;
	private ArrayList<MapEventsListener> mapEventsListeners;
	private OnLocationChangedListener locationChangeListener;
	private OnLongClickListener longClickListener;
	private OnMapLongClickListener mapLongClicklistener;
	private OnMapDoubleTapListener onDoubleTapListener;
	private OnTouchListener onTouchListener;
	
	private Mode mode;

	// Smooth scrolling
	private GestureDetector gestureDetector;
	private Scroller scroller;

	// debug
	private boolean debugEnabled = false;
	private RectF lastTouchedRect;

	private boolean isZooming;
	private boolean isDestroying;
	private boolean userTouching;
	private double pinchStartDistance;
	private int mapPivotX;
	private int mapPivotY;

	private static Bitmap logo;
	private Rect drawingRect;

	private Runnable restoreScrollPosRunnable;
	private Runnable performAfterZoom;
	private Runnable performAfterTranslate;

	private boolean requestCenterMap;




	/**
	 * Creates instance of map widget.
	 * 
	 * @param context
	 *            - context
	 * @param rootMapFolder
	 *            - folder that contains map resources inside your assets.
	 * @param initialZoomLevel
	 *            - initial zoom level.
	 */
	public MapWidget(Context context, String rootMapFolder, int initialZoomLevel) {
		this(null, context, rootMapFolder, initialZoomLevel);
	}

	/**
	 * Creates instance of map widget.
	 * 
	 * @param context
	 *            - context
	 * @param rootMapFolder
	 *            - instance of File that points to the map resources which are
	 *            located on the external storage.
	 * @param initialZoomLevel
	 *            - initial zoom level
	 */
	public MapWidget(Context context, File rootMapFolder, int initialZoomLevel) {
		this(null, context, rootMapFolder, initialZoomLevel);
	}

	/**
	 * Creates instance of map widget. Zoom level will be set to 10.
	 * 
	 * @param context
	 *            - Context
	 * @param rootMapFolder
	 *            - folder that contains map resources inside your assets.
	 */
	public MapWidget(Context context, String rootMapFolder) {
		this(null, context, rootMapFolder, 10);
	}

	/**
	 * Creates instance of map widget. Zoom level will be set to 10.
	 * 
	 * @param context
	 *            - Context
	 * @param rootMapFolder
	 *            - instance of File that points to the map resources which are
	 *            located on the external storage.
	 */
	public MapWidget(Context context, File rootMapFolder) {
		this(null, context, rootMapFolder, 10);
	}

	/**
	 * Creates instance of map widget.
	 * 
	 * @param bundle
	 *            - bundle that were used to save map widget's state.
	 * @param context
	 *            - Context
	 * @param rootMapFolder
	 *            - instance of File that points to the map resources which are
	 *            located on the external storage.
	 * @param initialZoomLevel
	 *            - zoom level that will be set in case if bundle doesn't
	 *            contain previously saved state.
	 */
	public MapWidget(Bundle bundle, Context context, File rootMapFolder,
			int initialZoomLevel) {
		super(context);

		initCommonStuff(context);

		String configPath = OfflineMapUtil.getConfigFilePath(rootMapFolder
				.getAbsolutePath());

		try {
			MapConfigParser configParser = new MapConfigParser(
					rootMapFolder.getAbsolutePath());

			config = configParser.parse(context, new File(configPath));

			if (config != null) {
				tileProvider = new ExternalStorageTileProvider(config);
				int maxZoomLevel = OfflineMapUtil.getMaxZoomLevel(
						config.getImageWidth(), config.getImageHeight());
				int zoomLevel = initialZoomLevel;
				float scale = 1.0f;

				if (bundle != null) {
					if (bundle.containsKey("com.ls.zoomLevel"))
						zoomLevel = bundle.getInt("com.ls.zoomLevel");

					if (bundle.containsKey("com.ls.scale"))
						scale = bundle.getFloat("com.ls.scale");
				}

				if (zoomLevel > maxZoomLevel) {
					grid = new Grid(this, config, tileProvider, maxZoomLevel);
					if (scale == 1.0f) {
						scale = (float) Math.pow(2, zoomLevel - maxZoomLevel);
					}
				} else {
					grid = new Grid(this, config, tileProvider, zoomLevel);
				}

				this.scale = scale;
				grid.setInternalScale(scale);

				initPositionPin();
				restoreMapPosition(bundle);
			}
		} catch (SAXException e) {
			Log.e(TAG, "Exception: " + e);
			e.printStackTrace();
		} catch (IOException e) {
			Log.e(TAG, "Exception: " + e);
			e.printStackTrace();
		}
	}

	/**
	 * Creates instance of map widget.
	 * 
	 * @param bundle
	 *            - bundle that were used to save map widget's state.
	 * @param context
	 *            - Context
	 * @param rootMapFolder
	 *            - folder that contains map resources inside your assets.
	 * @param initialZoomLevel
	 *            - zoom level that will be set in case if bundle doesn't
	 *            contain previously saved state.
	 */
	public MapWidget(Bundle bundle, Context context, String rootMapFolder,
			int initialZoomLevel) {
		super(context);

		initCommonStuff(context);

		String configPath = OfflineMapUtil.getConfigFilePath(rootMapFolder);

		try {
			MapConfigParser configParser = new MapConfigParser(rootMapFolder);

			config = configParser.parse(context, configPath);
			tileProvider = new AssetTileProvider(getContext(), config);

			int maxZoomLevel = OfflineMapUtil.getMaxZoomLevel(
					config.getImageWidth(), config.getImageHeight());
			int zoomLevel = initialZoomLevel;
			float scale = 1.0f;

			if (bundle != null) {
				if (bundle.containsKey("com.ls.zoomLevel"))
					zoomLevel = bundle.getInt("com.ls.zoomLevel");

				if (bundle.containsKey("com.ls.scale"))
					scale = bundle.getFloat("com.ls.scale");
			}

			if (zoomLevel > maxZoomLevel) {
				grid = new Grid(this, config, tileProvider, maxZoomLevel);
				if (scale == 1.0f) {
					scale = (float) Math.pow(2, zoomLevel - maxZoomLevel);
				}
			} else {
				grid = new Grid(this, config, tileProvider, zoomLevel);
			}

			this.scale = scale;
			grid.setInternalScale(scale);

			initPositionPin();
			restoreMapPosition(bundle);
		} catch (SAXException e) {
			Log.e(TAG, "Exception: " + e);
			e.printStackTrace();
		} catch (IOException e) {
			Log.e(TAG, "Exception: " + e);
			e.printStackTrace();
		}
	}

	private void restoreMapPosition(Bundle bundle) {
		if (bundle != null && bundle.containsKey("com.ls.curPosOnMapX")) {
			final int mapX = (int) bundle.getFloat("com.ls.curPosOnMapX");
			final int mapY = (int) bundle.getFloat("com.ls.curPosOnMapY");

			Log.d("MapWidget", "Restored pos: [" + mapX + "," + mapY + "]");

			restoreScrollPosRunnable = new Runnable() {
				public void run() {
					jumpTo(new Point(mapX, mapY));
				};
			};

		} else {
			doCorrectPosition(false, false);
		}
	}

	private void initCommonStuff(Context context) {
		scale = 1.0f;
		mode = Mode.NONE;
		drawingRect = new Rect();
		isAnimationEnabled = true;
		requestCenterMap = false;
		userTouching = false;

		this.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
				LayoutParams.FILL_PARENT));

		setBackgroundDrawable(null);

		this.setClickable(true);
		this.setEnabled(true);
		this.setFocusable(true);

		initializeZoomBtnsController();

		gestureDetector = new GestureDetector(context, new MyGestureDetector());
		decelerateInterpolator = new DecelerateInterpolator(1.5f);

		scroller = new Scroller(context, decelerateInterpolator);

		topmostLayer = new MapLayer(1, this);
		topmostLayer.setVisible(false);

		layers = new ArrayList<MapLayer>();
		layersMap = new HashMap<Long, Layer>();
		mapEventsListeners = new ArrayList<MapEventsListener>();

		paint = new Paint();
		paint.setColor(Color.RED);
		paint.setStyle(Style.STROKE);
		paint.setStrokeWidth(1);

		if (Resources.LOGO != null) {
			logo = BitmapFactory.decodeByteArray(Resources.LOGO, 0,
					Resources.LOGO.length);
		}

		locationProvider = null;
		performAfterTranslate = null;
	}

	private void initPositionPin() {
		BitmapDrawable arrow = new BitmapDrawable(getResources(),
				BitmapFactory.decodeByteArray(Graphics.BLUE_ARROW, 0,
						Graphics.BLUE_ARROW.length));

		BitmapDrawable dot = new BitmapDrawable(getResources(),
				BitmapFactory.decodeByteArray(
				Graphics.BLUE_DOT, 0, Graphics.BLUE_DOT.length));
		PositionMarker pin = new PositionMarker(this, POS_PIN_ID, dot, arrow);

		topmostLayer.addMapObject(pin);
	}

	@Override
	protected void onSizeChanged(int w, int h, int oldw, int oldh) {
		super.onSizeChanged(w, h, oldw, oldh);

		if (w == 0 && h == 0)
			return;

		if (restoreScrollPosRunnable != null) {
			restoreScrollPosRunnable.run();
			restoreScrollPosRunnable = null;
		}
	}

	protected void setTileProvider(TileProvider tileManager) {
		if (grid != null) {
			grid.setTileProvider(tileManager);
		}
	}

	/**
	 * Adds listener for map events.
	 * 
	 * @param listener
	 *            - instance of MapEventListener
	 */
	public void addMapEventsListener(MapEventsListener listener) {
		if (mapEventsListeners == null) {
			mapEventsListeners = new ArrayList<MapEventsListener>();
		}

		mapEventsListeners.add(listener);
	}

	/**
	 * Creates new map layer with a given id.
	 * 
	 * @param theLayerId
	 *            - id of the new layer
	 * @return returns instance of the MapLayer or null if error occured.
	 * @throws IllegalArgumentException
	 *             when layer with the given id exists already.
	 */
	public MapLayer createLayer(long theLayerId) {
		if (this.layersMap.containsKey(theLayerId)) {
			throw new IllegalArgumentException(
					"Attempt to create layer with duplicated ID");
		}

		try {
			MapLayer layer = new MapLayer(theLayerId, this);

			layers.add(layer);
			layersMap.put(theLayerId, layer);

			return layer;
		} catch (Exception e) {
			Log.e("MapWidget", "Exception: " + e);
			return null;
		}
	}

	/**
	 * Removes layer with the given id from the map.
	 * 
	 * @param theLayerId
	 *            the id of previously created layer.
	 */
	public void removeLayer(long theLayerId) {
		Layer layer = layersMap.remove(theLayerId);
		layers.remove(layer);
	}

	/**
	 * Removes all layers from the map.
	 */
	public void removeAllLayers() {
		layers.clear();
		layersMap.clear();
	}

	/**
	 * Centers the map horizontally
	 */
	public void centerMapHorizontally() {
		if (grid.getWidth() > getWidth()) {
			int dx = (getWidth() - grid.getWidth()) / 2;
			scrollBy(-dx, 0);
		}
	}

	/**
	 * Returns map layer by 
Download .txt
gitextract_albf_jio/

├── .gitignore
├── LICENSE
├── README.md
├── bin/
│   ├── mAppWidget-1.4.2-javadoc.jar
│   └── mAppWidget-1.4.2.jar
├── mAppWidget/
│   ├── build.gradle
│   ├── demo1app/
│   │   ├── .gitignore
│   │   ├── build.gradle
│   │   ├── proguard-rules.pro
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── assets/
│   │           │   ├── grid/
│   │           │   │   └── grid.xml
│   │           │   ├── grid2/
│   │           │   │   └── grid.xml
│   │           │   └── map/
│   │           │       └── map.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── ls/
│   │           │           └── demo/
│   │           │               └── demo1/
│   │           │                   ├── BrowseMapActivity.java
│   │           │                   ├── CaptionMapObject.java
│   │           │                   ├── Category.java
│   │           │                   ├── ExBrowseMapActivity.java
│   │           │                   ├── HomeActivity.java
│   │           │                   ├── Location.java
│   │           │                   ├── Model.java
│   │           │                   ├── Sample1Activity.java
│   │           │                   ├── Sample2Activity.java
│   │           │                   ├── model/
│   │           │                   │   ├── MapObjectContainer.java
│   │           │                   │   └── MapObjectModel.java
│   │           │                   └── popup/
│   │           │                       ├── MapPopupBase.java
│   │           │                       └── TextPopup.java
│   │           └── res/
│   │               ├── layout/
│   │               │   ├── home.xml
│   │               │   └── main.xml
│   │               ├── menu/
│   │               │   ├── a1menu.xml
│   │               │   ├── map_menu.xml
│   │               │   └── menu.xml
│   │               └── values/
│   │                   ├── strings.xml
│   │                   ├── styles.xml
│   │                   └── theme.xml
│   ├── demo2app/
│   │   ├── .gitignore
│   │   ├── build.gradle
│   │   ├── proguard-rules.pro
│   │   └── src/
│   │       ├── androidTest/
│   │       │   └── java/
│   │       │       └── com/
│   │       │           └── ls/
│   │       │               └── demo/
│   │       │                   └── demo2/
│   │       │                       └── ApplicationTest.java
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── assets/
│   │           │   └── map/
│   │           │       └── map.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── ls/
│   │           │           └── demo/
│   │           │               └── demo2/
│   │           │                   ├── BrowseMapActivity.java
│   │           │                   ├── model/
│   │           │                   │   ├── MapObjectContainer.java
│   │           │                   │   └── MapObjectModel.java
│   │           │                   └── popup/
│   │           │                       ├── MapPopupBase.java
│   │           │                       └── TextPopup.java
│   │           └── res/
│   │               ├── layout/
│   │               │   ├── activity_main.xml
│   │               │   └── main.xml
│   │               ├── menu/
│   │               │   ├── menu.xml
│   │               │   └── menu_main.xml
│   │               ├── values/
│   │               │   ├── dimens.xml
│   │               │   ├── strings.xml
│   │               │   ├── styles.xml
│   │               │   └── theme.xml
│   │               └── values-w820dp/
│   │                   └── dimens.xml
│   ├── gradle/
│   │   └── wrapper/
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── mappwidgetlib/
│   │   ├── .gitignore
│   │   ├── build.gradle
│   │   ├── proguard-rules.pro
│   │   └── src/
│   │       ├── androidTest/
│   │       │   ├── assets/
│   │       │   │   └── map/
│   │       │   │       └── map.xml
│   │       │   └── java/
│   │       │       └── com/
│   │       │           └── ls/
│   │       │               └── widgets/
│   │       │                   └── map/
│   │       │                       ├── AllTests.java
│   │       │                       ├── CellTest.java
│   │       │                       ├── GridTest.java
│   │       │                       ├── MapLayerTest.java
│   │       │                       ├── MapObjectTest.java
│   │       │                       ├── MapWidgetTest.java
│   │       │                       ├── OfflineMapConfigTest.java
│   │       │                       └── OfflineMapUtilTest.java
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           └── java/
│   │               └── com/
│   │                   └── ls/
│   │                       └── widgets/
│   │                           └── map/
│   │                               ├── MapWidget.java
│   │                               ├── commands/
│   │                               │   ├── GetTileTask.java
│   │                               │   ├── MapCommand.java
│   │                               │   └── MapCommandDelegate.java
│   │                               ├── config/
│   │                               │   ├── GPSConfig.java
│   │                               │   ├── MapConfigParser.java
│   │                               │   ├── MapGraphicsConfig.java
│   │                               │   ├── OfflineMap.java
│   │                               │   └── OfflineMapConfig.java
│   │                               ├── events/
│   │                               │   ├── MapScrolledEvent.java
│   │                               │   ├── MapTouchedEvent.java
│   │                               │   └── ObjectTouchEvent.java
│   │                               ├── interfaces/
│   │                               │   ├── Layer.java
│   │                               │   ├── MapEventsListener.java
│   │                               │   ├── MapLocationListener.java
│   │                               │   ├── OnGridReadyListener.java
│   │                               │   ├── OnLocationChangedListener.java
│   │                               │   ├── OnMapDoubleTapListener.java
│   │                               │   ├── OnMapLongClickListener.java
│   │                               │   ├── OnMapScrollListener.java
│   │                               │   ├── OnMapTilesFinishedLoadingListener.java
│   │                               │   ├── OnMapTouchListener.java
│   │                               │   └── TileManagerDelegate.java
│   │                               ├── location/
│   │                               │   └── PositionMarker.java
│   │                               ├── model/
│   │                               │   ├── Cell.java
│   │                               │   ├── Grid.java
│   │                               │   ├── MapLayer.java
│   │                               │   ├── MapObject.java
│   │                               │   └── MapTouchable.java
│   │                               ├── providers/
│   │                               │   ├── AssetTileProvider.java
│   │                               │   ├── ExternalStorageTileProvider.java
│   │                               │   ├── GPSLocationProvider.java
│   │                               │   └── TileProvider.java
│   │                               └── utils/
│   │                                   ├── GeoUtils.java
│   │                                   ├── Graphics.java
│   │                                   ├── LogUtils.java
│   │                                   ├── MapCalibrationData.java
│   │                                   ├── MathUtils.java
│   │                                   ├── OfflineMapUtil.java
│   │                                   ├── PivotFactory.java
│   │                                   ├── Resources.java
│   │                                   ├── Size.java
│   │                                   └── TransformUtils.java
│   └── settings.gradle
└── slicingtool/
    ├── .classpath
    ├── .project
    ├── .settings/
    │   └── org.eclipse.jdt.core.prefs
    ├── META-INF/
    │   └── MANIFEST.MF
    ├── build.properties
    ├── contexts.xml
    ├── libs/
    │   └── org.eclipse.core.resources.jar
    ├── plugin.xml
    └── src/
        └── com/
            └── ls/
                └── mappwidget/
                    └── slicingtool/
                        ├── Activator.java
                        ├── cutter/
                        │   ├── Constants.java
                        │   ├── Cutter.java
                        │   ├── ImageXML.java
                        │   ├── OnCompliteListener.java
                        │   └── OnProgressUpdateListener.java
                        ├── utils/
                        │   ├── EclipseUtils.java
                        │   ├── FileUtils.java
                        │   └── XMLUtils.java
                        ├── views/
                        │   ├── DirectoryChooser.java
                        │   ├── FileChooser.java
                        │   ├── GPSChooser.java
                        │   ├── MainView.java
                        │   └── RadioGroup.java
                        └── vo/
                            └── PointVO.java
Download .txt
SYMBOL INDEX (809 symbols across 85 files)

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/BrowseMapActivity.java
  class BrowseMapActivity (line 48) | public class BrowseMapActivity
    method onCreate (line 63) | @Override
    method initLayer (line 220) | private void initLayer(Layer theLayer, String theCategoryId)
    method getIcon (line 257) | public Drawable getIcon(String theCatId) throws IOException
    method onCreateOptionsMenu (line 282) | public boolean onCreateOptionsMenu(Menu menu) {
    method onOptionsItemSelected (line 289) | @Override
    method onKeyDown (line 332) | @Override
    method onStop (line 354) | @Override
    method onPause (line 360) | @Override
    method onDestroy (line 367) | @Override

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/CaptionMapObject.java
  class CaptionMapObject (line 29) | public class CaptionMapObject extends MapObject
    method CaptionMapObject (line 35) | public CaptionMapObject(Object id, Drawable drawable, Point position,
    method setCaption (line 49) | public void setCaption(String caption)
    method draw (line 55) | @Override

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Category.java
  class Category (line 19) | public class Category
    method getId (line 28) | public String getId()
    method setId (line 33) | public void setId(String id)
    method getName (line 38) | public String getName()
    method setName (line 43) | public void setName(String name)

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/ExBrowseMapActivity.java
  class ExBrowseMapActivity (line 56) | public class ExBrowseMapActivity
    method onCreate (line 80) | @Override
    method generateRandomMarkers (line 216) | private void generateRandomMarkers() {
    method onCreateOptionsMenu (line 270) | public boolean onCreateOptionsMenu(Menu menu) {
    method onOptionsItemSelected (line 277) | @Override
    method animatePin (line 327) | private void animatePin() {
    method onKeyDown (line 362) | @Override
    method onStop (line 384) | @Override
    method onPause (line 391) | @Override
    method onDestroy (line 398) | @Override
    method onSaveInstanceState (line 406) | @Override

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/HomeActivity.java
  class HomeActivity (line 25) | public class HomeActivity
    method onCreate (line 30) | protected void onCreate(Bundle savedInstanceState)
    method initWidgets (line 39) | private void initWidgets()
    method doOpenExBrowseActivity (line 70) | private void doOpenExBrowseActivity()
    method doOpenSample1 (line 76) | private void doOpenSample1()
    method doOpenSample2 (line 83) | private void doOpenSample2()

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Location.java
  class Location (line 21) | public class Location
    method getId (line 34) | public String getId()
    method setId (line 39) | public void setId(String id)
    method getCategoryId (line 44) | public String getCategoryId()
    method setCategoryId (line 49) | public void setCategoryId(String categoryId)
    method getTitle (line 54) | public String getTitle()
    method setTitle (line 59) | public void setTitle(String title)
    method getPoint (line 64) | public Point getPoint()
    method setPoint (line 69) | public void setPoint(Point point)

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Model.java
  class Model (line 24) | public class Model
    method Model (line 37) | public Model()
    method getCategories (line 44) | public List<Category> getCategories()
    method getLocations (line 50) | public List<Location> getLocations()
    method createCategories (line 57) | private void createCategories()
    method createLocations (line 83) | private void createLocations()

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Sample1Activity.java
  class Sample1Activity (line 45) | public class Sample1Activity
    method onCreate (line 54) | protected void onCreate(Bundle savedInstanceState)
    method onSaveInstanceState (line 160) | @Override
    method onRestoreInstanceState (line 170) | @Override
    method onCreateOptionsMenu (line 178) | @Override
    method onOptionsItemSelected (line 188) | @Override

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Sample2Activity.java
  class Sample2Activity (line 45) | public class Sample2Activity
    method onCreate (line 51) | protected void onCreate(Bundle savedInstanceState)
    method addObjetWhereTouched (line 194) | private Location addObjetWhereTouched(final MapWidget mapWidget, MapTo...
    method onSaveInstanceState (line 211) | @Override

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/model/MapObjectContainer.java
  class MapObjectContainer (line 21) | public class MapObjectContainer
    method MapObjectContainer (line 25) | public MapObjectContainer()
    method addObject (line 31) | public void addObject(MapObjectModel object)
    method removeObject (line 37) | public void removeObject(MapObjectModel object)
    method getObject (line 43) | public MapObjectModel getObject(int index)
    method getObjectById (line 49) | public MapObjectModel getObjectById(int id)
    method size (line 61) | public int size()

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/model/MapObjectModel.java
  class MapObjectModel (line 21) | public class MapObjectModel
    method MapObjectModel (line 29) | public MapObjectModel(int id, Location location, String caption)
    method MapObjectModel (line 36) | public MapObjectModel(int id, int x, int y, String caption)
    method getId (line 44) | public int getId()
    method getX (line 50) | public int getX()
    method getY (line 56) | public int getY()
    method getLocation (line 62) | public Location getLocation()
    method getCaption (line 68) | public String getCaption()

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/popup/MapPopupBase.java
  class MapPopupBase (line 25) | public class MapPopupBase
    method MapPopupBase (line 37) | public MapPopupBase(Context context, ViewGroup parentView)
    method show (line 52) | public void show(ViewGroup view, int theX, int theY)
    method getHeight (line 71) | public int getHeight()
    method getWidth (line 77) | public int getWidth()
    method isVisible (line 83) | public boolean isVisible()
    method hide (line 89) | public void hide()
    method setOnClickListener (line 97) | public void setOnClickListener(View.OnTouchListener listener)

FILE: mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/popup/TextPopup.java
  class TextPopup (line 29) | public class TextPopup
    method TextPopup (line 43) | public TextPopup(Context context, ViewGroup parentView)
    method moveBy (line 67) | public void moveBy(int dx, int dy)
    method setText (line 87) | public void setText(String theText)
    method setIcon (line 98) | public void setIcon(BitmapDrawable theDrawable)
    method removeIcon (line 109) | public void removeIcon()
    method setOnClickListener (line 115) | public void setOnClickListener(View.OnTouchListener listener)

FILE: mAppWidget/demo2app/src/androidTest/java/com/ls/demo/demo2/ApplicationTest.java
  class ApplicationTest (line 25) | public class ApplicationTest extends ApplicationTestCase<Application> {
    method ApplicationTest (line 26) | public ApplicationTest() {

FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/BrowseMapActivity.java
  class BrowseMapActivity (line 57) | public class BrowseMapActivity extends Activity
    method onCreate (line 78) | @Override
    method onSaveInstanceState (line 104) | @Override
    method initTestLocationPoints (line 110) | private void initTestLocationPoints()
    method getNextLocationPoint (line 136) | private Location getNextLocationPoint()
    method initMap (line 148) | private void initMap(Bundle savedInstanceState)
    method initModel (line 185) | private void initModel()
    method initMapObjects (line 204) | private void initMapObjects()
    method addNotScalableMapObject (line 222) | private void addNotScalableMapObject(int x, int y,  Layer layer)
    method addNotScalableMapObject (line 242) | private void addNotScalableMapObject(MapObjectModel objectModel,  Laye...
    method addNotScalableMapObject (line 252) | private void addNotScalableMapObject(Location location, Layer layer) {
    method addScalableMapObject (line 274) | private void addScalableMapObject(int x, int y, Layer layer)
    method initMapListeners (line 289) | private void initMapListeners()
    method onCreateOptionsMenu (line 317) | @Override
    method onOptionsItemSelected (line 326) | @Override
    method handleOnMapScroll (line 363) | private void handleOnMapScroll(MapWidget v, MapScrolledEvent event)
    method onPostZoomIn (line 378) | @Override
    method onPostZoomOut (line 384) | @Override
    method onPreZoomIn (line 390) | @Override
    method onPreZoomOut (line 400) | @Override
    method onTouch (line 412) | @Override
    method showLocationsPopup (line 468) | private void showLocationsPopup(int x, int y, String text)
    method xToScreenCoords (line 504) | private int xToScreenCoords(int mapCoord)
    method yToScreenCoords (line 509) | private int yToScreenCoords(int mapCoord)

FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/model/MapObjectContainer.java
  class MapObjectContainer (line 21) | public class MapObjectContainer
    method MapObjectContainer (line 25) | public MapObjectContainer()
    method addObject (line 31) | public void addObject(MapObjectModel object)
    method removeObject (line 37) | public void removeObject(MapObjectModel object)
    method getObject (line 43) | public MapObjectModel getObject(int index)
    method getObjectById (line 49) | public MapObjectModel getObjectById(int id)
    method size (line 61) | public int size()

FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/model/MapObjectModel.java
  class MapObjectModel (line 21) | public class MapObjectModel
    method MapObjectModel (line 29) | public MapObjectModel(int id, Location location, String caption)
    method MapObjectModel (line 36) | public MapObjectModel(int id, int x, int y, String caption)
    method getId (line 44) | public int getId()
    method getX (line 50) | public int getX()
    method getY (line 56) | public int getY()
    method getLocation (line 62) | public Location getLocation()
    method getCaption (line 68) | public String getCaption()

FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/popup/MapPopupBase.java
  class MapPopupBase (line 25) | public class MapPopupBase
    method MapPopupBase (line 37) | public MapPopupBase(Context context, ViewGroup parentView)
    method show (line 52) | public void show(ViewGroup view, int theX, int theY)
    method getHeight (line 71) | public int getHeight()
    method getWidth (line 77) | public int getWidth()
    method isVisible (line 83) | public boolean isVisible()
    method hide (line 89) | public void hide()
    method setOnClickListener (line 97) | public void setOnClickListener(View.OnTouchListener listener)

FILE: mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/popup/TextPopup.java
  class TextPopup (line 29) | public class TextPopup
    method TextPopup (line 43) | public TextPopup(Context context, ViewGroup parentView)
    method moveBy (line 67) | public void moveBy(int dx, int dy)
    method setText (line 87) | public void setText(String theText)
    method setIcon (line 98) | public void setIcon(BitmapDrawable theDrawable)
    method removeIcon (line 109) | public void removeIcon()
    method setOnClickListener (line 115) | public void setOnClickListener(View.OnTouchListener listener)

FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/AllTests.java
  class AllTests (line 22) | public class AllTests extends TestSuite {
    method suite (line 24) | public static Test suite() {

FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/CellTest.java
  class CellTest (line 31) | public class CellTest extends AndroidTestCase
    method setUp (line 42) | protected void setUp() throws Exception {
    method tearDown (line 50) | protected void tearDown() throws Exception {
    method testRecalculateDrawableRect (line 55) | public void testRecalculateDrawableRect()
    method assertEquals (line 86) | private void assertEquals(Rect r1, Rect r2)
    class CellImpl (line 94) | private static class CellImpl extends Cell
      method CellImpl (line 96) | public CellImpl(Grid parent, AssetTileProvider tileManager, int zoom...
      method recalculateDrawableRect (line 101) | @Override
      method setImage (line 108) | public void setImage(Drawable drawable)
      method getDrawableRect (line 114) | public Rect getDrawableRect()

FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/GridTest.java
  class GridTest (line 31) | public class GridTest extends AndroidTestCase {
    method setUp (line 49) | protected void setUp() throws Exception
    method tearDown (line 61) | protected void tearDown() throws Exception
    method testGetHeight (line 66) | public void testGetHeight()
    method testGetOriginalHeight (line 74) | public void testGetOriginalHeight()
    method testGetOriginalWidth (line 80) | public void testGetOriginalWidth()
    method testGetWidth (line 88) | public void testGetWidth()
    method testGetMaxZoomLevel (line 96) | public void testGetMaxZoomLevel()
    method testGetMinZoomLevel (line 104) | public void testGetMinZoomLevel()
    method testGetColCount (line 112) | public void testGetColCount()
    method testGetRowCount (line 122) | public void testGetRowCount()
    method testGetScale (line 132) | public void testGetScale()
    method testSetSoftScale (line 142) | public void testSetSoftScale()
    class GridToTest (line 165) | private static class GridToTest extends Grid
      method GridToTest (line 167) | public GridToTest(View parent, OfflineMapConfig config, AssetTilePro...
      method getColCountTest (line 173) | public int getColCountTest()
      method getRowCountTest (line 179) | public int getRowCountTest()
    class TestTileManager (line 186) | private class TestTileManager extends AssetTileProvider
      method TestTileManager (line 189) | public TestTileManager(Context context, OfflineMapConfig config) {
      method requestTile (line 194) | @Override

FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapLayerTest.java
  class MapLayerTest (line 38) | public class MapLayerTest extends AndroidTestCase
    method setUp (line 45) | @Override
    method tearDown (line 58) | @Override
    method testAddMapObject (line 66) | public void testAddMapObject()
    method testRemoveMapObject (line 82) | public void testRemoveMapObject()
    method testGetMapObject (line 99) | public void testGetMapObject()
    method testIsVisible (line 126) | public void testIsVisible()
    method testGetMapObjectByIndexInt (line 164) | public void testGetMapObjectByIndexInt()
    method testGetTouched (line 181) | public void testGetTouched()
    method testSetScale (line 194) | public void testSetScale()
    method getTouchedTest2 (line 255) | private void getTouchedTest2(boolean touchable)
    method getTouchedGenerateMapObjects (line 294) | private void getTouchedGenerateMapObjects(boolean touchable,
    class FakeCanvas (line 311) | private static class FakeCanvas extends Canvas
      method FakeCanvas (line 315) | public FakeCanvas()
      method drawBitmap (line 320) | @Override
      method drawBitmap (line 327) | @Override
      method drawBitmap (line 333) | @Override
      method drawBitmap (line 339) | @Override
      method setDrawPerformed (line 346) | public void setDrawPerformed(boolean performed)

FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapObjectTest.java
  class MapObjectTest (line 33) | public class MapObjectTest extends AndroidTestCase
    method setUp (line 46) | protected void setUp() throws Exception
    method tearDown (line 62) | protected void tearDown() throws Exception
    method testMapObjectObjectDrawableIntIntIntIntBooleanBoolean (line 70) | public void testMapObjectObjectDrawableIntIntIntIntBooleanBoolean()
    method testGetDrawable (line 76) | public void testGetDrawable()
    method testSetDrawable (line 82) | public void testSetDrawable()
    method testDraw (line 88) | public void testDraw()
    method testGetId (line 94) | public void testGetId()
    method testIsTouchedIntInt (line 100) | public void testIsTouchedIntInt()
    method testIsTouchedRect (line 106) | public void testIsTouchedRect()
    method testGetXScaled (line 129) | public void testGetXScaled()
    method testGetYScaled (line 135) | public void testGetYScaled()
    method testGetX (line 141) | public void testGetX()
    method testGetY (line 147) | public void testGetY()
    method testIsTouchable (line 153) | public void testIsTouchable()
    method testGetBounds (line 159) | public void testGetBounds()
    method testMoveTo (line 165) | public void testMoveTo()
    method testSetScale (line 171) | public void testSetScale()
    method testSetParent (line 177) | public void testSetParent()
    class FakeMapObject (line 182) | private class FakeMapObject extends MapObject {
      method FakeMapObject (line 184) | public FakeMapObject(Object id, Drawable drawable, int x, int y, int...
      method setNewScale (line 191) | public void setNewScale(float scale)
      method getTouchArea (line 198) | public Rect getTouchArea()

FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapWidgetTest.java
  class MapWidgetTest (line 36) | public class MapWidgetTest
    method setUp (line 41) | @Override
    method tearDown (line 52) | @Override
    method testCreateLayer (line 60) | public void testCreateLayer() {
    method testRemoveLayer (line 86) | public void testRemoveLayer() {
    method testGetLayer (line 110) | public void testGetLayer() {
    method testGetLayerById (line 134) | public void testGetLayerById() {
    method testGetLayerCount (line 151) | public void testGetLayerCount() {
    method testGetMapHeight (line 163) | public void testGetMapHeight() {
    method testGetMapWidth (line 174) | public void testGetMapWidth() {
    method testGetOriginalMapWidth (line 185) | public void testGetOriginalMapWidth() {
    method testGetOriginalMapHeight (line 195) | public void testGetOriginalMapHeight() {
    method testGetConfig (line 205) | public void testGetConfig() {
    method testGetScale (line 215) | public void testGetScale() {
    method testGetZoomLevel (line 259) | public void testGetZoomLevel() {
    method testRemoveAllLayers (line 305) | public void testRemoveAllLayers() {
    method testClearLayers (line 318) | public void testClearLayers() {
    method testSetMinZoomLevel (line 344) | public void testSetMinZoomLevel() {
    method testSetMaxZoomLevel (line 363) | public void testSetMaxZoomLevel() {
    method testSetScale (line 382) | public void testSetScale() {
    method testUseSoftwareZoom (line 417) | public void testUseSoftwareZoom() {
    method testZoomIn (line 437) | public void testZoomIn() {
    method testZoomOut (line 463) | public void testZoomOut() {
    method testAnimatedZoomOut (line 528) | public void testAnimatedZoomOut() {
    method generateMapObjects (line 556) | private MapObject[] generateMapObjects(int count) {
    class TestMapEventsListener (line 568) | private class TestMapEventsListener implements MapEventsListener {
      method TestMapEventsListener (line 576) | public TestMapEventsListener() {
      method onPreZoomIn (line 580) | @Override
      method onPostZoomIn (line 585) | @Override
      method onPreZoomOut (line 590) | @Override
      method onPostZoomOut (line 595) | @Override
      method clearCounters (line 601) | public void clearCounters() {
      method zoomInValid (line 606) | public boolean zoomInValid() {
      method zoomOutValid (line 610) | public boolean zoomOutValid() {
    class TestMapWidget (line 616) | private class TestMapWidget extends MapWidget {
      method TestMapWidget (line 618) | public TestMapWidget(Context context, String rootMapFolder) {
      method TestMapWidget (line 625) | public TestMapWidget(Context context, String rootMapFolder, int init...
      method animateZoomIn (line 634) | @Override
      method animateZoomOut (line 656) | @Override
      method startProcessing (line 678) | public void startProcessing() {
    class TestTileManager (line 684) | private class TestTileManager extends AssetTileProvider {
      method TestTileManager (line 686) | public TestTileManager(Context context, OfflineMapConfig config) {
      method requestTile (line 690) | @Override

FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/OfflineMapConfigTest.java
  class OfflineMapConfigTest (line 23) | public class OfflineMapConfigTest extends AndroidTestCase {
    method setUp (line 34) | protected void setUp() throws Exception
    method tearDown (line 41) | protected void tearDown() throws Exception
    method testDefaults (line 47) | public void testDefaults()
    method testConstructor (line 61) | public void testConstructor()
    method testCopyConstructor (line 71) | public void testCopyConstructor()
    method testFlingEnabledOption (line 106) | public void testFlingEnabledOption()
    method testMaxZoomLevelLimitOption (line 116) | public void testMaxZoomLevelLimitOption()
    method testMinZoomLevelLimitOption (line 137) | public void testMinZoomLevelLimitOption()
    method testPinchZoomEnabledOption (line 158) | public void testPinchZoomEnabledOption()
    method testSoftwareZoomEnabledOption (line 168) | public void testSoftwareZoomEnabledOption()
    method testTouchAreaSizeOption (line 178) | public void testTouchAreaSizeOption()
    method testTrackballScrollStepXOption (line 199) | public void testTrackballScrollStepXOption()
    method testTrackballScrollStepYOption (line 220) | public void testTrackballScrollStepYOption()
    method testZoomBtnsVisibleOption (line 241) | public void testZoomBtnsVisibleOption()

FILE: mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/OfflineMapUtilTest.java
  class OfflineMapUtilTest (line 23) | public class OfflineMapUtilTest extends AndroidTestCase
    method testGetScaledImageSize (line 31) | public void testGetScaledImageSize()
    method testGetMaxZoomLevel (line 41) | public void testGetMaxZoomLevel()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/MapWidget.java
  class MapWidget (line 93) | public class MapWidget extends View implements MapLocationListener {
    type Mode (line 100) | private enum Mode {
    method MapWidget (line 178) | public MapWidget(Context context, String rootMapFolder, int initialZoo...
    method MapWidget (line 193) | public MapWidget(Context context, File rootMapFolder, int initialZoomL...
    method MapWidget (line 205) | public MapWidget(Context context, String rootMapFolder) {
    method MapWidget (line 218) | public MapWidget(Context context, File rootMapFolder) {
    method MapWidget (line 236) | public MapWidget(Bundle bundle, Context context, File rootMapFolder,
    method MapWidget (line 303) | public MapWidget(Bundle bundle, Context context, String rootMapFolder,
    method restoreMapPosition (line 353) | private void restoreMapPosition(Bundle bundle) {
    method initCommonStuff (line 371) | private void initCommonStuff(Context context) {
    method initPositionPin (line 416) | private void initPositionPin() {
    method onSizeChanged (line 429) | @Override
    method setTileProvider (line 442) | protected void setTileProvider(TileProvider tileManager) {
    method addMapEventsListener (line 454) | public void addMapEventsListener(MapEventsListener listener) {
    method createLayer (line 471) | public MapLayer createLayer(long theLayerId) {
    method removeLayer (line 496) | public void removeLayer(long theLayerId) {
    method removeAllLayers (line 504) | public void removeAllLayers() {
    method centerMapHorizontally (line 512) | public void centerMapHorizontally() {
    method getLayer (line 528) | public Layer getLayer(int index) {
    method getLayerById (line 539) | public Layer getLayerById(long id) {
    method getLayerCount (line 548) | public int getLayerCount() {
    method getMapHeight (line 557) | public int getMapHeight() {
    method getMapWidth (line 570) | public int getMapWidth() {
    method getOriginalMapHeight (line 583) | public int getOriginalMapHeight() {
    method getOriginalMapWidth (line 596) | public int getOriginalMapWidth() {
    method getConfig (line 609) | public OfflineMapConfig getConfig() {
    method getScale (line 619) | public float getScale() {
    method getZoomLevel (line 632) | public int getZoomLevel() {
    method onKeyDown (line 648) | @Override
    method onTouchEvent (line 680) | @Override
    method removeMapEventsListener (line 788) | public void removeMapEventsListener(MapEventsListener listener) {
    method removeAllMapEventsListeners (line 797) | public void removeAllMapEventsListeners() {
    method clearLayers (line 808) | public void clearLayers() {
    method setOnMapTouchListener (line 829) | public void setOnMapTouchListener(OnMapTouchListener mapTouchListener) {
    method setOnMapLongClickListener (line 838) | public void setOnMapLongClickListener(OnMapLongClickListener onMapLong...
    method setOnMapTilesFinishLoadingListener (line 851) | public void setOnMapTilesFinishLoadingListener(
    method setOnMapScrolledListener (line 874) | public void setOnMapScrolledListener(OnMapScrollListener mapScrollList...
    method setOnLocationChangedListener (line 884) | public void setOnLocationChangedListener(OnLocationChangedListener lis...
    method setOnLongClickListener (line 896) | @Override
    method setOnDoubleTapListener (line 907) | public void setOnDoubleTapListener(OnMapDoubleTapListener listener)
    method setOnTouchListener (line 918) | @Override
    method setZoomButtonsVisible (line 930) | public void setZoomButtonsVisible(boolean enabled) {
    method setMinZoomLevel (line 956) | public void setMinZoomLevel(int minZoomLevel) {
    method setMaxZoomLevel (line 993) | public void setMaxZoomLevel(int maxZoomLevel) {
    method setScale (line 1036) | public void setScale(float scale) {
    method setUseSoftwareZoom (line 1059) | public void setUseSoftwareZoom(boolean useSoftwareZoom) {
    method setAnimationEnabled (line 1071) | public void setAnimationEnabled(boolean isEnabled) {
    method setTouchAreaSize (line 1081) | public void setTouchAreaSize(int pixels) {
    method zoomIn (line 1091) | public void zoomIn() {
    method setShowMyPosition (line 1130) | public void setShowMyPosition(boolean show) {
    method getMapGraphicsConfig (line 1180) | public MapGraphicsConfig getMapGraphicsConfig() {
    method getGpsConfig (line 1195) | public GPSConfig getGpsConfig() {
    method zoomIn (line 1202) | public void zoomIn(final int pivotX, final int pivotY) {
    method zoomOut (line 1254) | public void zoomOut() {
    method onAnimationEnd (line 1311) | @Override
    method onDraw (line 1333) | @Override
    method drawMissingDataErrorMessage (line 1360) | private void drawMissingDataErrorMessage(Canvas canvas) {
    method onLayout (line 1380) | @Override
    method onMeasure (line 1406) | @Override
    method onScrollChanged (line 1415) | @Override
    method animateZoomIn (line 1426) | protected void animateZoomIn(AnimationListener listener, float pivotX,
    method animateZoomOut (line 1437) | protected void animateZoomOut(AnimationListener listener) {
    method doCorrectPosition (line 1451) | private void doCorrectPosition() {
    method doCorrectPosition (line 1455) | private void doCorrectPosition(boolean force) {
    method doCorrectPosition (line 1459) | private void doCorrectPosition(boolean force, boolean animate) {
    method onPositionCorrected (line 1556) | private void onPositionCorrected() {
    method doZoom (line 1564) | private void doZoom(int zoomLevel, int pivotX, int pivotY) {
    method getZoomInAnimation (line 1639) | private Animation getZoomInAnimation(float pivotX, float pivotY) {
    method getZoomOutAnimation (line 1654) | private Animation getZoomOutAnimation() {
    method getTouchedElementIds (line 1672) | private ArrayList<ObjectTouchEvent> getTouchedElementIds(final int normX,
    method initializeZoomBtnsController (line 1701) | private void initializeZoomBtnsController() {
    method drawLayers (line 1733) | private void drawLayers(Canvas canvas, Rect drawingRect) {
    method setScaleToOtherDrawables (line 1744) | private void setScaleToOtherDrawables(float scale) {
    method translateXToMapCoordinate (line 1755) | private float translateXToMapCoordinate(float x) {
    method translateYToMapCoordinate (line 1765) | private float translateYToMapCoordinate(float y) {
    method updateZoomButtons (line 1775) | private void updateZoomButtons() {
    method startProcessingRequests (line 1812) | protected void startProcessingRequests() {
    method notifyAboutPreZoomIn (line 1819) | private static final void notifyAboutPreZoomIn(
    method notifyAboutPostZoomIn (line 1834) | private static final void notifyAboutPostZoomIn(
    method notifyAboutPreZoomOut (line 1850) | private static final void notifyAboutPreZoomOut(
    method notifyAboutPostZoomOut (line 1866) | private static final void notifyAboutPostZoomOut(
    method onAttachedToWindow (line 1881) | @Override
    method onDetachedFromWindow (line 1892) | @Override
    method computeScroll (line 1908) | @Override
    method onMovePinTo (line 1918) | @Override
    method notifyAboutLocationChanged (line 1934) | private void notifyAboutLocationChanged(Location location) {
    method onChangePinVisibility (line 1945) | @Override
    method jumpToCurrentLocation (line 1954) | public void jumpToCurrentLocation() {
    method scrollToCurrentLocation (line 1971) | public void scrollToCurrentLocation() {
    method jumpTo (line 1993) | public void jumpTo(Location location) {
    method jumpTo (line 2017) | public void jumpTo(Point location) {
    method jumpTo (line 2031) | public void jumpTo(int x, int y) {
    method scrollMapTo (line 2050) | public void scrollMapTo(Location location) {
    method scrollMapTo (line 2072) | public void scrollMapTo(Point location) {
    method scrollMapTo (line 2084) | public void scrollMapTo(int x, int y) {
    class MyGestureDetector (line 2135) | private class MyGestureDetector extends SimpleOnGestureListener {
      method onDoubleTap (line 2137) | @Override
      method onFling (line 2156) | @Override
      method onDown (line 2241) | @Override
      method onScroll (line 2249) | @Override
      method onSingleTapConfirmed (line 2261) | public boolean onSingleTapConfirmed(MotionEvent event) {
      method onLongPress (line 2281) | @Override
    method saveState (line 2300) | public void saveState(Bundle bundle) {
    method centerMap (line 2318) | public void centerMap() {
    method updateMapTouchedEvent (line 2331) | private void updateMapTouchedEvent(MotionEvent event)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/commands/GetTileTask.java
  class GetTileTask (line 33) | public class GetTileTask extends AsyncTask<Integer, Integer, Boolean> {
    method GetTileTask (line 39) | public GetTileTask(InputStream is)
    method getResult (line 45) | public Drawable getResult()
    method closeStream (line 51) | public void closeStream() throws IOException
    method doInBackground (line 56) | @Override

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/commands/MapCommand.java
  class MapCommand (line 21) | public abstract class MapCommand
    method MapCommand (line 27) | public MapCommand(OfflineMapConfig config, MapCommandDelegate delegate)
    method getConfig (line 33) | public OfflineMapConfig getConfig() {
    method onSuccess (line 37) | public void onSuccess(Object data)
    method onError (line 43) | public void onError(Exception e)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/commands/MapCommandDelegate.java
  type MapCommandDelegate (line 19) | public interface MapCommandDelegate
    method onSuccess (line 21) | public void onSuccess(Object data);
    method onError (line 22) | public void onError(Exception e);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/GPSConfig.java
  class GPSConfig (line 26) | public class GPSConfig
    method GPSConfig (line 37) | public GPSConfig()
    method getPassiveMode (line 45) | public boolean getPassiveMode()
    method setPassiveMode (line 56) | public void setPassiveMode(boolean passiveMode)
    method setGeoArea (line 66) | public void setGeoArea(MapCalibrationData geoArea)
    method setGPSUpdateInterval (line 77) | public void setGPSUpdateInterval(int minTime, int minDistance)
    method getMinTime (line 87) | public int getMinTime()
    method getMinDistance (line 97) | public int getMinDistance()
    method getCalibration (line 107) | public MapCalibrationData getCalibration()
    method isMapCalibrated (line 115) | public boolean isMapCalibrated()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/MapConfigParser.java
  class MapConfigParser (line 46) | public class MapConfigParser
    method MapConfigParser (line 58) | public MapConfigParser(String mapRoot)
    method parse (line 63) | public OfflineMapConfig parse(Context context, File configFile) throws...
    method parse (line 91) | public OfflineMapConfig parse(Context context, String configPath) thro...
    method parse (line 115) | private OfflineMapConfig parse(InputStream is) throws ParserConfigurat...

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/MapGraphicsConfig.java
  class MapGraphicsConfig (line 23) | public class MapGraphicsConfig
    method MapGraphicsConfig (line 35) | public MapGraphicsConfig()
    method getDotPointerDrawableId (line 44) | public int getDotPointerDrawableId()
    method setDotPointerDrawableId (line 53) | public void setDotPointerDrawableId(int dotPointerDrawableId)
    method getArrowPointerDrawableId (line 59) | public int getArrowPointerDrawableId()
    method setArrowPointerDrawableId (line 69) | public void setArrowPointerDrawableId(int arrowPointerDrawableId)
    method getAccuracyAreaColor (line 75) | public int getAccuracyAreaColor()
    method setAccuracyAreaColor (line 86) | public void setAccuracyAreaColor(int accuracyAreaColor)
    method getAccuracyAreaBorderColor (line 92) | public int getAccuracyAreaBorderColor()
    method setAccuracyAreaBorderColor (line 102) | public void setAccuracyAreaBorderColor(int accuracyAreaBorderColor)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/OfflineMap.java
  class OfflineMap (line 19) | public class OfflineMap

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/OfflineMapConfig.java
  class OfflineMapConfig (line 21) | public class OfflineMapConfig
    method OfflineMapConfig (line 52) | public OfflineMapConfig(String rootMapFolder, int imageWidth, int imag...
    method OfflineMapConfig (line 78) | public OfflineMapConfig(OfflineMapConfig config)
    method getImageWidth (line 102) | public int getImageWidth()
    method getImageHeight (line 112) | public int getImageHeight()
    method getImageRect (line 118) | public Rect getImageRect()
    method getTileSize (line 128) | public int getTileSize()
    method getOverlap (line 134) | public int getOverlap()
    method getImageFormat (line 140) | public String getImageFormat()
    method isFlingEnabled (line 146) | public boolean isFlingEnabled()
    method setFlingEnabled (line 156) | public void setFlingEnabled(boolean flingEnabled)
    method isMapCenteringEnabled (line 162) | public boolean isMapCenteringEnabled()
    method setMapCenteringEnabled (line 172) | public void setMapCenteringEnabled(boolean enabled)
    method isPinchZoomEnabled (line 178) | public boolean isPinchZoomEnabled()
    method setPinchZoomEnabled (line 188) | public void setPinchZoomEnabled(boolean pinchZoomEnabled)
    method isZoomBtnsVisible (line 194) | public boolean isZoomBtnsVisible()
    method setZoomBtnsVisible (line 204) | public void setZoomBtnsVisible(boolean zoomBtnsVisible)
    method getTrackballScrollStepX (line 210) | public int getTrackballScrollStepX()
    method setTrackballScrollStepX (line 221) | public void setTrackballScrollStepX(int trackballScrollStepX)
    method getTrackballScrollStepY (line 231) | public int getTrackballScrollStepY()
    method setTrackballScrollStepY (line 242) | public void setTrackballScrollStepY(int trackballScrollStepY)
    method getMinZoomLevelLimit (line 252) | public int getMinZoomLevelLimit()
    method setMinZoomLevelLimit (line 263) | public void setMinZoomLevelLimit(int minZoomLevelLimit)
    method getMaxZoomLevelLimit (line 273) | public int getMaxZoomLevelLimit()
    method setMaxZoomLevelLimit (line 284) | public void setMaxZoomLevelLimit(int maxZoomLevelLimit)
    method getMapRootPath (line 294) | public String getMapRootPath()
    method isSoftwareZoomEnabled (line 300) | public boolean isSoftwareZoomEnabled()
    method setSoftwareZoomEnabled (line 310) | public void setSoftwareZoomEnabled(boolean softwareZoomEnabled)
    method getTouchAreaSize (line 316) | public int getTouchAreaSize()
    method setTouchAreaSize (line 327) | public void setTouchAreaSize(int touchAreaSize)
    method getGpsConfig (line 341) | public GPSConfig getGpsConfig()
    method getGraphicsConfig (line 351) | public MapGraphicsConfig getGraphicsConfig()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/events/MapScrolledEvent.java
  class MapScrolledEvent (line 22) | public class MapScrolledEvent
    method MapScrolledEvent (line 28) | public MapScrolledEvent(int originX, int originY)
    method setData (line 34) | public void setData(int dx, int dy, boolean byUser)
    method getDX (line 45) | public int getDX()
    method getDY (line 54) | public int getDY()
    method isByUser (line 62) | public boolean isByUser()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/events/MapTouchedEvent.java
  class MapTouchedEvent (line 26) | public class MapTouchedEvent
    method getScreenX (line 40) | public int getScreenX()
    method setScreenX (line 45) | public void setScreenX(int screenX)
    method getScreenY (line 55) | public int getScreenY()
    method setScreenY (line 60) | public void setScreenY(int screenY)
    method getMapX (line 69) | public int getMapX()
    method setMapX (line 74) | public void setMapX(int mapX)
    method getMapY (line 83) | public int getMapY()
    method setMapY (line 89) | public void setMapY(int mapY)
    method getTouchedObjectIds (line 99) | public ArrayList<ObjectTouchEvent> getTouchedObjectIds()
    method getTouchedObjectEvents (line 113) | public ArrayList<ObjectTouchEvent> getTouchedObjectEvents()
    method setTouchedObjectEvents (line 119) | public void setTouchedObjectEvents(ArrayList<ObjectTouchEvent> touched...

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/events/ObjectTouchEvent.java
  class ObjectTouchEvent (line 22) | public class ObjectTouchEvent
    method ObjectTouchEvent (line 27) | public ObjectTouchEvent(Object id, long layerId)
    method getObjectId (line 37) | public Object getObjectId()
    method setObjectId (line 43) | public void setObjectId(Object objectId)
    method getLayerId (line 53) | public long getLayerId()
    method setLayerId (line 59) | public void setLayerId(int layerId)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/Layer.java
  type Layer (line 21) | public interface Layer
    method addMapObject (line 27) | public void addMapObject(MapObject mapObject);
    method removeMapObject (line 33) | public void removeMapObject(Object id);
    method getMapObject (line 39) | public MapObject getMapObject(Object id);
    method getMapObjectByIndex (line 47) | public MapObject getMapObjectByIndex(int index);
    method getMapObjectCount (line 53) | public int getMapObjectCount();
    method clearAll (line 58) | public void clearAll();
    method isVisible (line 64) | public boolean isVisible();
    method setVisible (line 70) | public void setVisible(boolean visible);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/MapEventsListener.java
  type MapEventsListener (line 19) | public interface MapEventsListener
    method onPreZoomIn (line 24) | public void onPreZoomIn();
    method onPostZoomIn (line 29) | public void onPostZoomIn();
    method onPreZoomOut (line 34) | public void onPreZoomOut();
    method onPostZoomOut (line 39) | public void onPostZoomOut();

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/MapLocationListener.java
  type MapLocationListener (line 21) | public interface MapLocationListener
    method onMovePinTo (line 23) | public void onMovePinTo(Location location);
    method onChangePinVisibility (line 24) | public void onChangePinVisibility(boolean visible);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnGridReadyListener.java
  type OnGridReadyListener (line 19) | public interface OnGridReadyListener
    method onReady (line 21) | public void onReady();

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnLocationChangedListener.java
  type OnLocationChangedListener (line 23) | public interface OnLocationChangedListener
    method onLocationChanged (line 25) | public void onLocationChanged(MapWidget v, Location location);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapDoubleTapListener.java
  type OnMapDoubleTapListener (line 26) | public interface OnMapDoubleTapListener
    method onDoubleTap (line 35) | public boolean onDoubleTap(MapWidget v, MapTouchedEvent event);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapLongClickListener.java
  type OnMapLongClickListener (line 22) | public interface OnMapLongClickListener
    method onLongClick (line 24) | public boolean onLongClick(MapWidget v, MapTouchedEvent e);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapScrollListener.java
  type OnMapScrollListener (line 22) | public interface OnMapScrollListener
    method onScrolledEvent (line 24) | public void onScrolledEvent(MapWidget v, MapScrolledEvent event);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapTilesFinishedLoadingListener.java
  type OnMapTilesFinishedLoadingListener (line 19) | public interface OnMapTilesFinishedLoadingListener
    method onMapTilesFinishedLoading (line 21) | void onMapTilesFinishedLoading();

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapTouchListener.java
  type OnMapTouchListener (line 22) | public interface OnMapTouchListener
    method onTouch (line 24) | public void onTouch(MapWidget v, MapTouchedEvent event);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/TileManagerDelegate.java
  type TileManagerDelegate (line 21) | public interface TileManagerDelegate
    method onTileReady (line 23) | public void onTileReady(int zoomLevel, int col, int row, Drawable draw...
    method onError (line 24) | public void onError(Exception e);

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/location/PositionMarker.java
  class PositionMarker (line 37) | public class PositionMarker extends MapObject
    method PositionMarker (line 58) | public PositionMarker(MapWidget context, Object id, Drawable roundPoin...
    method calculatePixelsInMeter (line 89) | private float calculatePixelsInMeter(MapWidget context)
    method setColor (line 109) | public void setColor(int area, int border)
    method setAccuracy (line 122) | public void setAccuracy(float accuracy)
    method setBearing (line 140) | public void setBearing(float bearing)
    method setDotPointer (line 148) | public void setDotPointer(Drawable dotPointer, Point pivotPoint)
    method setArrowPointer (line 155) | public void setArrowPointer(Drawable arrowPointer, Point pivotPoint)
    method setBearingEnabled (line 166) | public void setBearingEnabled(boolean hasBearing)
    method recalculateBounds (line 191) | @Override
    method getBounds (line 216) | @Override
    method draw (line 243) | @Override
    method getAccuracyDiameter (line 264) | private float getAccuracyDiameter()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/Cell.java
  class Cell (line 34) | public class Cell implements Callback, TileManagerDelegate
    method Cell (line 64) | public Cell(Grid parent, TileProvider tileProvider, int zoomLevel, int...
    method cacheImage (line 92) | public void cacheImage(float dx, float dy)
    method draw (line 100) | public void draw (Canvas canvas, Paint paint, float dx, float dy)
    method setLoadImage (line 121) | public void setLoadImage(boolean loadImage)
    method setScale (line 127) | public void setScale(double scale)
    method freeResources (line 138) | public void freeResources()
    method loadImage (line 146) | private void loadImage(final float dx, final float dy, final boolean i...
    method processNewTile (line 167) | private void processNewTile(final float dx, final float dy, Drawable d...
    method onIsReady (line 197) | private void onIsReady()
    method recalculateDrawableRect (line 204) | protected void recalculateDrawableRect(final float dx, final float dy)
    method invalidateDrawable (line 216) | @Override
    method scheduleDrawable (line 224) | @Override
    method unscheduleDrawable (line 231) | @Override
    method isReady (line 238) | public boolean isReady()
    method setTileProvider (line 244) | public void setTileProvider(TileProvider tileManager)
    method onTileReady (line 250) | @Override
    method onError (line 259) | @Override

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/Grid.java
  class Grid (line 34) | public class Grid
    method Grid (line 85) | public Grid(View parent, OfflineMapConfig config, TileProvider tilePro...
    method calcCellsInScreen (line 119) | private void calcCellsInScreen() {
    method initGrid (line 125) | private void initGrid(int zoomLevel, int tileSize)
    method setTileProvider (line 144) | public void setTileProvider(TileProvider tileManager)
    method draw (line 152) | public void draw(Canvas canvas, Paint paint, Rect drawingRect)
    method getRridWindowBigger (line 191) | private Rect getRridWindowBigger(Rect gridWindow)
    method getHeight (line 218) | public int getHeight()
    method getOriginalHeight (line 224) | public int getOriginalHeight()
    method getOriginalWidth (line 230) | public int getOriginalWidth()
    method getScale (line 235) | public double getScale()
    method getWidth (line 244) | public int getWidth()
    method getZoomLevel (line 250) | public int getZoomLevel()
    method getMaxZoomLevel (line 256) | public int getMaxZoomLevel()
    method getParentView (line 262) | public View getParentView()
    method setLoadTiles (line 268) | public void setLoadTiles(boolean loadTiles)
    method isLoadTiles (line 274) | public boolean isLoadTiles()
    method getMinZoomLevel (line 280) | public int getMinZoomLevel()
    method setSoftScale (line 286) | public void setSoftScale(float newScale)
    method setOnReadyListener (line 299) | public void setOnReadyListener(OnGridReadyListener listener)
    method getColCount (line 306) | protected int getColCount()
    method getRowCount (line 312) | protected int getRowCount()
    method getSoftScale (line 318) | public double getSoftScale()
    method getBottomRightVisibleCell (line 324) | private Point getBottomRightVisibleCell(Rect drawingRect, Point point)
    method getTopLeftVisibleCell (line 347) | private Point getTopLeftVisibleCell(Rect drawingRect, Point point)
    method getGridWindow (line 367) | private synchronized Rect getGridWindow(Rect drawRect)
    method applyScale (line 397) | private void applyScale(double scale)
    method applyLoadTileState (line 409) | private void applyLoadTileState(boolean allowTileLoad)
    method freeResources (line 422) | public void freeResources()
    method onCellReady (line 444) | void onCellReady(Cell cell)
    method setInternalScale (line 457) | public void setInternalScale(float newScale)
    method getIntScale (line 470) | public double getIntScale() {

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/MapLayer.java
  class MapLayer (line 31) | public class MapLayer
    method MapLayer (line 42) | public MapLayer(long theLayerId, MapWidget parent)
    method addMapObject (line 55) | @Override
    method getMapObject (line 80) | @Override
    method getMapObjectByIndex (line 98) | @Override
    method getMapObjectCount (line 105) | @Override
    method removeMapObject (line 112) | @Override
    method getTouched (line 160) | public ArrayList<Object> getTouched(Rect touchRect)
    method isVisible (line 174) | public boolean isVisible()
    method setVisible (line 180) | public void setVisible(boolean visible)
    method setScale (line 186) | public void setScale(float scale)
    method draw (line 197) | public void draw(Canvas canvas, Rect drawingRect)
    method clearAll (line 212) | public void clearAll()
    method equals (line 227) | public boolean equals(Object o)
    method hashCode (line 243) | public int hashCode()
    method getConfig (line 251) | OfflineMapConfig getConfig()
    method invalidate (line 257) | void invalidate(MapObject object)
    method scheduleDrawable (line 264) | public void scheduleDrawable(Drawable who, Runnable what, long when)
    method unscheduleDrawable (line 270) | public void unscheduleDrawable(Drawable who, Runnable what) {
    method invalidateDrawable (line 275) | public void invalidateDrawable(Drawable who) {
    method getId (line 281) | public long getId()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/MapObject.java
  class MapObject (line 30) | public class MapObject
    method MapObject (line 53) | public MapObject(Object id)
    method MapObject (line 66) | public MapObject(Object id, Drawable drawable, int x, int y)
    method MapObject (line 77) | public MapObject(Object id, Drawable drawable, Point position)
    method MapObject (line 91) | public MapObject(Object id, Drawable drawable, int x, int y, int pivot...
    method MapObject (line 103) | public MapObject(Object id, Drawable drawable, Point position, Point p...
    method MapObject (line 116) | public MapObject(Object id, Drawable drawable, int x, int y, boolean i...
    method MapObject (line 128) | public MapObject (Object id, Drawable drawable, Point position, boolea...
    method MapObject (line 141) | public MapObject (Object id, Drawable drawable, Point position, Point ...
    method MapObject (line 155) | public MapObject(Object id, Drawable drawable, int x, int y,  boolean ...
    method MapObject (line 168) | public MapObject(Object id, Drawable drawable, Point position,  boolea...
    method MapObject (line 182) | public MapObject (Object id, Drawable drawable, Point position, Point ...
    method MapObject (line 199) | public MapObject(Object id, Drawable drawable, int x, int y, int pivot...
    method getDrawable (line 221) | public Drawable getDrawable()
    method setDrawable (line 231) | public void setDrawable(Drawable drawable)
    method draw (line 249) | public void draw(Canvas canvas)
    method getId (line 260) | public Object getId()
    method isTouched (line 272) | public boolean isTouched(Rect touchRect)
    method getXScaled (line 281) | public int getXScaled()
    method getYScaled (line 290) | public int getYScaled()
    method getX (line 299) | public int getX()
    method getY (line 308) | public int getY()
    method getPosition (line 317) | public Point getPosition()
    method isTouchable (line 326) | public boolean isTouchable()
    method setPivotPoint (line 336) | public void setPivotPoint(int x, int y)
    method setPivotPoint (line 348) | public void setPivotPoint(Point pivotPoint)
    method getBounds (line 363) | public Rect getBounds()
    method recalculateBounds (line 376) | protected void recalculateBounds()
    method moveTo (line 411) | public void moveTo(int x, int y)
    method moveTo (line 429) | public void moveTo(Location location)
    method equals (line 451) | @Override
    method hashCode (line 465) | @Override
    method invalidateSelf (line 472) | protected void invalidateSelf()
    method setScale (line 482) | void setScale(float scale)
    method setParent (line 493) | void setParent(MapLayer layer)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/MapTouchable.java
  class MapTouchable (line 21) | public class MapTouchable
    method MapTouchable (line 27) | public MapTouchable(Object id, MapObject drawable, Rect rect)
    method getId (line 34) | public Object getId()
    method isTouched (line 39) | public boolean isTouched(int x, int y)
    method isTouched (line 44) | public boolean isTouched(Rect touchRect)
    method getDrawable (line 49) | public MapObject getDrawable()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/providers/AssetTileProvider.java
  class AssetTileProvider (line 28) | public class AssetTileProvider extends TileProvider
    method AssetTileProvider (line 33) | public AssetTileProvider(Context context, OfflineMapConfig config)
    method openTile (line 42) | @Override

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/providers/ExternalStorageTileProvider.java
  class ExternalStorageTileProvider (line 27) | public class ExternalStorageTileProvider extends TileProvider
    method ExternalStorageTileProvider (line 31) | public ExternalStorageTileProvider(OfflineMapConfig config)
    method openTile (line 37) | @Override

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/providers/GPSLocationProvider.java
  class GPSLocationProvider (line 32) | public final class GPSLocationProvider implements LocationListener
    method GPSLocationProvider (line 56) | public GPSLocationProvider(Context context)
    method setMinRefreshTime (line 74) | public void setMinRefreshTime(int refreshRate)
    method setMinRefreshDistance (line 80) | public void setMinRefreshDistance(int minDistance)
    method setMapLocationListener (line 86) | public void setMapLocationListener(MapLocationListener listener)
    method start (line 96) | public void start(boolean passiveMode)
    method stop (line 155) | public void stop()
    method onLocationChanged (line 166) | @Override
    method onProviderDisabled (line 190) | @Override
    method onProviderEnabled (line 198) | @Override
    method onStatusChanged (line 210) | @Override
    method statusToString (line 217) | private String statusToString(int status)
    class MyGPSListener (line 232) | private class MyGPSListener implements GpsStatus.Listener {
      method onGpsStatusChanged (line 233) | public void onGpsStatusChanged(int event) {

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/providers/TileProvider.java
  class TileProvider (line 31) | public abstract class TileProvider
    method TileProvider (line 38) | public TileProvider(OfflineMapConfig config)
    method requestTile (line 44) | public void requestTile(final int zoomLevel, final int col, final int ...
    method openTile (line 97) | protected abstract InputStream openTile(int zoomLevel, final int col, ...
    method startProcessingCommands (line 100) | public void startProcessingCommands()
    method pauseProcessingCommands (line 113) | public void pauseProcessingCommands()
    method stopProcessingCommands (line 118) | public void stopProcessingCommands()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/GeoUtils.java
  class GeoUtils (line 25) | public class GeoUtils
    method translate (line 36) | public static void translate(MapWidget v, int x, int y, Location locat...
    method translate (line 54) | public static void translate(MapWidget v, Point point, Location location)
    method translate (line 73) | public static void translate(MapWidget v, Location location, Point point)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/Graphics.java
  class Graphics (line 19) | public final class Graphics {

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/LogUtils.java
  class LogUtils (line 20) | public class LogUtils {
    method logHeap (line 24) | public static void logHeap(Class clazz)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/MapCalibrationData.java
  class MapCalibrationData (line 23) | public class MapCalibrationData
    method MapCalibrationData (line 33) | public MapCalibrationData(Pair<Point, Location> topLeft, Pair<Point, L...
    method widthInPixels (line 46) | public int widthInPixels()
    method heightInPixels (line 55) | public int heightInPixels()
    method widthInDegrees (line 64) | public double widthInDegrees()
    method heightInDegrees (line 72) | public double heightInDegrees()
    method getWidthInMeters (line 81) | public float getWidthInMeters()
    method getHeightInMeters (line 90) | public float getHeightInMeters()
    method translate (line 102) | public Point translate(final Location location, /*out*/Point position)
    method translate (line 123) | public void translate(Point point, Location location)
    method translate (line 135) | public void translate(int x, int y, Location location)
    method recalculateDistanceInMeters (line 146) | private void recalculateDistanceInMeters()

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/MathUtils.java
  class MathUtils (line 22) | public class MathUtils
    method distance (line 24) | public static double distance(Point start, Point finish)
    method distance (line 30) | public static double distance(float x1, float y1, float x2, float y2)
    method middle (line 36) | public static Point middle(Point first, Point second)
    method middle (line 42) | public static PointF middle(PointF first, PointF second)
    method middle (line 48) | public static PointF middle(float x1, float y1, float x2, float y2)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/OfflineMapUtil.java
  class OfflineMapUtil (line 19) | public class OfflineMapUtil
    method getConfigFilePath (line 24) | public static String getConfigFilePath(String root)
    method getFilesPath (line 38) | public static String getFilesPath(String root)
    method getMaxZoomLevel (line 64) | public static int getMaxZoomLevel(int imageWidth, int imageHeight)
    method getScaledImageSize (line 76) | public static int getScaledImageSize(int maxZoomLevel, int currZoomLev...
    method extractMapName (line 84) | private static String extractMapName(String root)

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/PivotFactory.java
  class PivotFactory (line 22) | public class PivotFactory
    type PivotPosition (line 24) | public enum PivotPosition
    method createPivotPoint (line 31) | public static Point createPivotPoint(Drawable drawable, PivotPosition ...

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/Resources.java
  class Resources (line 19) | public final class Resources

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/Size.java
  class Size (line 19) | public class Size {
    method Size (line 24) | public Size(int width, int height)
    method getWidth (line 30) | public int getWidth() {
    method setWidth (line 34) | public void setWidth(int width) {
    method getHeight (line 38) | public int getHeight() {
    method setHeight (line 42) | public void setHeight(int height) {

FILE: mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/TransformUtils.java
  class TransformUtils (line 22) | public class TransformUtils
    method scaleRect (line 26) | public static Rect scaleRect(Rect coords, float scale, int pivotX, int...

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/Activator.java
  class Activator (line 26) | public class Activator extends AbstractUIPlugin {
    method Activator (line 37) | public Activator() {
    method start (line 44) | public void start(BundleContext context) throws Exception {
    method stop (line 53) | public void stop(BundleContext context) throws Exception {
    method getDefault (line 63) | public static Activator getDefault() {
    method getImageDescriptor (line 74) | public static ImageDescriptor getImageDescriptor(String path) {

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/cutter/Constants.java
  class Constants (line 19) | public class Constants
    class Tag (line 21) | public static class Tag
    class Attr (line 32) | public static class Attr

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/cutter/Cutter.java
  class Cutter (line 30) | public class Cutter
    method Cutter (line 36) | public Cutter(OnProgressUpdateListener listener, OnCompliteListener on...
    method startCuttingAndroid (line 42) | public void startCuttingAndroid(final String inFile, final String outD...
    method createDir (line 86) | private void createDir(File file)
    method imageCut (line 94) | private void imageCut(String inFile, String outDir, int tileSize, Stri...
    method imageResize (line 143) | private boolean imageResize(String outFile, String inFile, int percents)
    method doResize (line 156) | private BufferedImage doResize(BufferedImage originalImage, int type, ...
    method getWidth (line 188) | public int getWidth(String fileName)
    method getMaxSide (line 201) | private int getMaxSide(String fileName)
    method getImage (line 217) | private BufferedImage getImage(String fileName)
    method saveImage (line 232) | private boolean saveImage(String inFile, String formatName, String fil...
    method saveImage (line 248) | private boolean saveImage(BufferedImage image, String formatName, Stri...

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/cutter/ImageXML.java
  class ImageXML (line 26) | public class ImageXML
    method createXML (line 28) | public static void createXML(String fileName, int tileSize, int w, int...
    method addPointAttr (line 57) | private static void addPointAttr(Element pointElement, Document doc, P...
    method addSizeAttr (line 83) | private static void addSizeAttr(Element sizeElement, Document doc, int...
    method addRootAttr (line 94) | private static void addRootAttr(Element rootElement, Document doc, int...

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/cutter/OnCompliteListener.java
  type OnCompliteListener (line 19) | public interface OnCompliteListener
    method onComplite (line 21) | public void onComplite();

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/cutter/OnProgressUpdateListener.java
  type OnProgressUpdateListener (line 20) | public interface OnProgressUpdateListener
    method onProgressUpdate (line 22) | public void onProgressUpdate(int value);

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/utils/EclipseUtils.java
  class EclipseUtils (line 26) | public class EclipseUtils
    method EclipseUtils (line 28) | private EclipseUtils()
    method getCurrentWorkspace (line 32) | public static File getCurrentWorkspace()

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/utils/FileUtils.java
  class FileUtils (line 21) | public class FileUtils
    method deleteDir (line 23) | public static boolean deleteDir(File dir)

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/utils/XMLUtils.java
  class XMLUtils (line 32) | public class XMLUtils
    method createDoc (line 34) | public static Document createDoc()
    method saveDoc (line 50) | public static void saveDoc(Document doc, String fileName)

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/views/DirectoryChooser.java
  class DirectoryChooser (line 31) | public class DirectoryChooser extends Composite
    method DirectoryChooser (line 44) | public DirectoryChooser(Composite parent)
    method createContent (line 50) | public void createContent()
    method setText (line 89) | public void setText(String text)
    method getText (line 94) | public String getText()
    method getTextControl (line 100) | public Text getTextControl()
    method getFile (line 105) | public File getFile()
    method getTitle (line 117) | public String getTitle()
    method setTitle (line 122) | public void setTitle(String title)

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/views/FileChooser.java
  class FileChooser (line 32) | public class FileChooser extends Composite
    method FileChooser (line 50) | public FileChooser(Composite parent, int mode)
    method createContent (line 58) | public void createContent()
    method savePath (line 107) | public static void savePath(Composite composite, String key, String va...
    method openFile (line 113) | public String openFile()
    method saveFile (line 125) | public String saveFile()
    method setText (line 136) | public void setText(String text)
    method getText (line 141) | public String getText()
    method getTextControl (line 147) | public Text getTextControl()
    method getFile (line 152) | public File getFile()
    method getTitle (line 164) | public String getTitle()
    method setTitle (line 169) | public void setTitle(String title)
    class Mode (line 174) | public static class Mode

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/views/GPSChooser.java
  class GPSChooser (line 29) | public class GPSChooser extends Composite
    method GPSChooser (line 41) | public GPSChooser(Composite parent, String title)
    method createContent (line 48) | public void createContent()
    method setActive (line 100) | public void setActive(boolean enabled)
    method getPoint (line 108) | public PointVO getPoint()

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/views/MainView.java
  class MainView (line 47) | public class MainView extends ViewPart
    method MainView (line 81) | public MainView()
    method createPartControl (line 85) | @Override
    method setFocus (line 91) | @Override
    method initWidgets (line 96) | private void initWidgets(final Composite parent)
    method getDir (line 258) | private String getDir(RadioGroup radioGroup)
    method checkDir (line 273) | protected boolean checkDir(Composite parent, String dir, String name)
    method setValue (line 301) | private void setValue(Composite top, final ProgressBar progressBar, fi...
    method setCompliete (line 313) | private void setCompliete(Composite top, final Button runButton, final...
    method fillMapSource (line 325) | private FileChooser fillMapSource(Composite mapSource, Preferences prefs)
    method fillName (line 347) | private Text fillName(Composite parent)
    method fillGroup (line 360) | private void fillGroup(Group group)
    method fillTop (line 375) | private void fillTop(Composite top, ScrolledComposite scrolledComposite)
    method getTiles (line 393) | protected void getTiles(final Composite parent, final Composite banner...
    method loadImage (line 434) | public Image loadImage(Composite composite, String filename)

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/views/RadioGroup.java
  class RadioGroup (line 38) | public class RadioGroup extends Composite
    method RadioGroup (line 66) | public RadioGroup(Composite parent)
    method createContent (line 72) | public void createContent()
    method setDirText (line 168) | public void setDirText(String text)
    method getDirText (line 173) | public String getDirText()
    method getSelectedPath (line 178) | public String getSelectedPath()
    method getSelected (line 190) | public int getSelected()

FILE: slicingtool/src/com/ls/mappwidget/slicingtool/vo/PointVO.java
  class PointVO (line 19) | public class PointVO
    method getX (line 28) | public double getX()
    method setX (line 33) | public void setX(double x)
    method getY (line 38) | public double getY()
    method setY (line 43) | public void setY(double y)
    method getLat (line 48) | public double getLat()
    method setLat (line 53) | public void setLat(double lat)
    method getLon (line 58) | public double getLon()
    method setLon (line 63) | public void setLon(double lon)
    method getTopLeft (line 68) | public int getTopLeft()
    method setTopLeft (line 73) | public void setTopLeft(int topLeft)
Condensed preview — 139 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (509K chars).
[
  {
    "path": ".gitignore",
    "chars": 52,
    "preview": ".gradle\n.idea\nlocal.properties\n*.iml\n.DS_Store\nbuild"
  },
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "\n                                 Apache License\n                           Version 2.0, January 2004\n                  "
  },
  {
    "path": "README.md",
    "chars": 2623,
    "preview": "![mAppWidget](images/app_anim.gif)\n\nMap services are a major growth area for mobile applications. Services like Google m"
  },
  {
    "path": "mAppWidget/build.gradle",
    "chars": 436,
    "preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    r"
  },
  {
    "path": "mAppWidget/demo1app/.gitignore",
    "chars": 7,
    "preview": "/build\n"
  },
  {
    "path": "mAppWidget/demo1app/build.gradle",
    "chars": 620,
    "preview": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion \"23.0.2\"\n\n    defaultC"
  },
  {
    "path": "mAppWidget/demo1app/proguard-rules.pro",
    "chars": 672,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /U"
  },
  {
    "path": "mAppWidget/demo1app/src/main/AndroidManifest.xml",
    "chars": 1379,
    "preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.ls.demo.demo1\">\n\n    <uses-permiss"
  },
  {
    "path": "mAppWidget/demo1app/src/main/assets/grid/grid.xml",
    "chars": 127,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?><Image TileSize=\"256\" Overlap=\"1\" Format=\"png\"><Size Width=\"1600\" Height=\"1600\"/><"
  },
  {
    "path": "mAppWidget/demo1app/src/main/assets/grid2/grid.xml",
    "chars": 127,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?><Image TileSize=\"128\" Overlap=\"1\" Format=\"png\"><Size Width=\"1600\" Height=\"1600\"/><"
  },
  {
    "path": "mAppWidget/demo1app/src/main/assets/map/map.xml",
    "chars": 333,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Image TileSize=\"256\" Overlap=\"1\" Format=\"png\">\n\t<Size Width=\"1918\" Height=\"978\"/"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/BrowseMapActivity.java",
    "chars": 10893,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/CaptionMapObject.java",
    "chars": 1872,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Category.java",
    "chars": 1133,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/ExBrowseMapActivity.java",
    "chars": 12061,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/HomeActivity.java",
    "chars": 2469,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Location.java",
    "chars": 1547,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Model.java",
    "chars": 4081,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Sample1Activity.java",
    "chars": 5695,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/Sample2Activity.java",
    "chars": 7191,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/model/MapObjectContainer.java",
    "chars": 1447,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/model/MapObjectModel.java",
    "chars": 1462,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/popup/MapPopupBase.java",
    "chars": 2561,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/java/com/ls/demo/demo1/popup/TextPopup.java",
    "chars": 3957,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo1app/src/main/res/layout/home.xml",
    "chars": 807,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout\n  xmlns:android=\"http://schemas.android.com/apk/res/android\"\n  andr"
  },
  {
    "path": "mAppWidget/demo1app/src/main/res/layout/main.xml",
    "chars": 341,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    andr"
  },
  {
    "path": "mAppWidget/demo1app/src/main/res/menu/a1menu.xml",
    "chars": 258,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n    <item andr"
  },
  {
    "path": "mAppWidget/demo1app/src/main/res/menu/map_menu.xml",
    "chars": 758,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item andro"
  },
  {
    "path": "mAppWidget/demo1app/src/main/res/menu/menu.xml",
    "chars": 489,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item and"
  },
  {
    "path": "mAppWidget/demo1app/src/main/res/values/strings.xml",
    "chars": 73,
    "preview": "<resources>\n    <string name=\"app_name\">mAppWidget</string>\n</resources>\n"
  },
  {
    "path": "mAppWidget/demo1app/src/main/res/values/styles.xml",
    "chars": 194,
    "preview": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
  },
  {
    "path": "mAppWidget/demo1app/src/main/res/values/theme.xml",
    "chars": 194,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\t<style name=\"Theme.NoBackground\" parent=\"android:Theme\">\n        <it"
  },
  {
    "path": "mAppWidget/demo2app/.gitignore",
    "chars": 7,
    "preview": "/build\n"
  },
  {
    "path": "mAppWidget/demo2app/build.gradle",
    "chars": 620,
    "preview": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion \"23.0.2\"\n\n    defaultC"
  },
  {
    "path": "mAppWidget/demo2app/proguard-rules.pro",
    "chars": 672,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /U"
  },
  {
    "path": "mAppWidget/demo2app/src/androidTest/java/com/ls/demo/demo2/ApplicationTest.java",
    "chars": 1084,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo2app/src/main/AndroidManifest.xml",
    "chars": 689,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package="
  },
  {
    "path": "mAppWidget/demo2app/src/main/assets/map/map.xml",
    "chars": 336,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Image TileSize=\"256\" Overlap=\"1\" Format=\"png\" >\n\t<Size Width=\"1536\" Height=\"768"
  },
  {
    "path": "mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/BrowseMapActivity.java",
    "chars": 16083,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/model/MapObjectContainer.java",
    "chars": 1447,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/model/MapObjectModel.java",
    "chars": 1462,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/popup/MapPopupBase.java",
    "chars": 2561,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo2app/src/main/java/com/ls/demo/demo2/popup/TextPopup.java",
    "chars": 3957,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/layout/activity_main.xml",
    "chars": 621,
    "preview": "<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/t"
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/layout/main.xml",
    "chars": 276,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    an"
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/menu/menu.xml",
    "chars": 489,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu\n  xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item and"
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/menu/menu_main.xml",
    "chars": 361,
    "preview": "<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\""
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/values/dimens.xml",
    "chars": 211,
    "preview": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal"
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/values/strings.xml",
    "chars": 215,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n    <string name=\"app_name\">Demo2</string>\n    <string name=\"hello_w"
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/values/styles.xml",
    "chars": 194,
    "preview": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/values/theme.xml",
    "chars": 194,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\t<style name=\"Theme.NoBackground\" parent=\"android:Theme\">\n        <it"
  },
  {
    "path": "mAppWidget/demo2app/src/main/res/values-w820dp/dimens.xml",
    "chars": 358,
    "preview": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as s"
  },
  {
    "path": "mAppWidget/gradle/wrapper/gradle-wrapper.properties",
    "chars": 232,
    "preview": "#Wed Apr 10 15:27:10 PDT 2013\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
  },
  {
    "path": "mAppWidget/gradle.properties",
    "chars": 855,
    "preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
  },
  {
    "path": "mAppWidget/gradlew",
    "chars": 5080,
    "preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start "
  },
  {
    "path": "mAppWidget/gradlew.bat",
    "chars": 2404,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
  },
  {
    "path": "mAppWidget/mappwidgetlib/.gitignore",
    "chars": 7,
    "preview": "/build\n"
  },
  {
    "path": "mAppWidget/mappwidgetlib/build.gradle",
    "chars": 1167,
    "preview": "apply plugin: 'com.android.library'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion \"23.0.2\"\n\n    defaultConfi"
  },
  {
    "path": "mAppWidget/mappwidgetlib/proguard-rules.pro",
    "chars": 672,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /U"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/assets/map/map.xml",
    "chars": 333,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Image TileSize=\"256\" Overlap=\"1\" Format=\"png\">\n\t<Size Width=\"1918\" Height=\"978\"/"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/AllTests.java",
    "chars": 1277,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/CellTest.java",
    "chars": 3655,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/GridTest.java",
    "chars": 6166,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapLayerTest.java",
    "chars": 8935,
    "preview": "/*************************************************************************\r\n* Copyright (c) 2015 Lemberg Solutions\r\n*\r\n*"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapObjectTest.java",
    "chars": 5001,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/MapWidgetTest.java",
    "chars": 19594,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/OfflineMapConfigTest.java",
    "chars": 6713,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/androidTest/java/com/ls/widgets/map/OfflineMapUtilTest.java",
    "chars": 2175,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/AndroidManifest.xml",
    "chars": 115,
    "preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.ls.widgets.map\">\n</manifest>\n"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/MapWidget.java",
    "chars": 59404,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/commands/GetTileTask.java",
    "chars": 2221,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/commands/MapCommand.java",
    "chars": 1360,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/commands/MapCommandDelegate.java",
    "chars": 887,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/GPSConfig.java",
    "chars": 3590,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/MapConfigParser.java",
    "chars": 7423,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/MapGraphicsConfig.java",
    "chars": 2838,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/OfflineMap.java",
    "chars": 847,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/config/OfflineMapConfig.java",
    "chars": 8140,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/events/MapScrolledEvent.java",
    "chars": 1616,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/events/MapTouchedEvent.java",
    "chars": 3294,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/events/ObjectTouchEvent.java",
    "chars": 1442,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/Layer.java",
    "chars": 1875,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/MapEventsListener.java",
    "chars": 1126,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/MapLocationListener.java",
    "chars": 953,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnGridReadyListener.java",
    "chars": 842,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnLocationChangedListener.java",
    "chars": 963,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapDoubleTapListener.java",
    "chars": 1423,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapLongClickListener.java",
    "chars": 970,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapScrollListener.java",
    "chars": 974,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapTilesFinishedLoadingListener.java",
    "chars": 867,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/OnMapTouchListener.java",
    "chars": 964,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/interfaces/TileManagerDelegate.java",
    "chars": 975,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/location/PositionMarker.java",
    "chars": 8091,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/Cell.java",
    "chars": 6504,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/Grid.java",
    "chars": 10964,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/MapLayer.java",
    "chars": 5915,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/MapObject.java",
    "chars": 14240,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/model/MapTouchable.java",
    "chars": 1406,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/providers/AssetTileProvider.java",
    "chars": 1959,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/providers/ExternalStorageTileProvider.java",
    "chars": 1988,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/providers/GPSLocationProvider.java",
    "chars": 6745,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/providers/TileProvider.java",
    "chars": 3801,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/GeoUtils.java",
    "chars": 3006,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/Graphics.java",
    "chars": 12245,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/LogUtils.java",
    "chars": 2177,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/MapCalibrationData.java",
    "chars": 4584,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/MathUtils.java",
    "chars": 1574,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/OfflineMapUtil.java",
    "chars": 2463,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/PivotFactory.java",
    "chars": 1440,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/Resources.java",
    "chars": 42427,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/Size.java",
    "chars": 1145,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/mappwidgetlib/src/main/java/com/ls/widgets/map/utils/TransformUtils.java",
    "chars": 1275,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "mAppWidget/settings.gradle",
    "chars": 51,
    "preview": "include ':demo1app', ':demo2app', ':mappwidgetlib'\n"
  },
  {
    "path": "slicingtool/.classpath",
    "chars": 442,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<classpath>\n\t<classpathentry kind=\"con\" path=\"org.eclipse.jdt.launching.JRE_CONTA"
  },
  {
    "path": "slicingtool/.project",
    "chars": 662,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<projectDescription>\n\t<name>com.ls.mappwidget.slicingtool</name>\n\t<comment></comm"
  },
  {
    "path": "slicingtool/.settings/org.eclipse.jdt.core.prefs",
    "chars": 658,
    "preview": "eclipse.preferences.version=1\norg.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\norg.eclipse.jdt.core.compi"
  },
  {
    "path": "slicingtool/META-INF/MANIFEST.MF",
    "chars": 469,
    "preview": "Manifest-Version: 1.0\nBundle-ManifestVersion: 2\nBundle-Name: Slicingtool\nBundle-SymbolicName: com.ls.mappwidget.slicingt"
  },
  {
    "path": "slicingtool/build.properties",
    "chars": 211,
    "preview": "source.. = src/\noutput.. = bin/\nbin.includes = plugin.xml,\\\n               META-INF/,\\\n               .,\\\n              "
  },
  {
    "path": "slicingtool/contexts.xml",
    "chars": 528,
    "preview": "<contexts>\n\t<context id=\"viewer\" title=\"mAppWidget\">\n\t\t<description>This is the context help for the sample view with a "
  },
  {
    "path": "slicingtool/plugin.xml",
    "chars": 1106,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?eclipse version=\"3.4\"?>\n<plugin>\n\n   <extension\n         point=\"org.eclipse.ui."
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/Activator.java",
    "chars": 2113,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/cutter/Constants.java",
    "chars": 1544,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/cutter/Cutter.java",
    "chars": 6122,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/cutter/ImageXML.java",
    "chars": 3496,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/cutter/OnCompliteListener.java",
    "chars": 850,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/cutter/OnProgressUpdateListener.java",
    "chars": 873,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/utils/EclipseUtils.java",
    "chars": 1292,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/utils/FileUtils.java",
    "chars": 1136,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/utils/XMLUtils.java",
    "chars": 2023,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/views/DirectoryChooser.java",
    "chars": 2921,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/views/FileChooser.java",
    "chars": 3782,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/views/GPSChooser.java",
    "chars": 3199,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/views/MainView.java",
    "chars": 11659,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/views/RadioGroup.java",
    "chars": 4968,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  },
  {
    "path": "slicingtool/src/com/ls/mappwidget/slicingtool/vo/PointVO.java",
    "chars": 1412,
    "preview": "/*************************************************************************\n* Copyright (c) 2015 Lemberg Solutions\n*\n* Li"
  }
]

// ... and 4 more files (download for full content)

About this extraction

This page contains the full source code of the lemberg/mappwidget GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 139 files (453.0 KB), approximately 137.7k tokens, and a symbol index with 809 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!