Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor project structure #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions .classpath

This file was deleted.

67 changes: 65 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Built app files
# Android Tools
# Is generated when importing via Eclipse
project.properties


# Android ###########################
# Source: https://github.com/github/gitignore/blob/master/Android.gitignore

# Built application files
*.apk
*.ap_

# files for the dex VM
Expand All @@ -12,4 +21,58 @@ bin/
gen/

# Local configuration file (sdk path, etc)
local.properties
local.properties

# Eclipse project files
.classpath
.project

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
*.ipr
*.iws
.idea/
gen-external-apklibs



# Maven ###########################
https://github.com/github/gitignore/blob/master/Maven.gitignore

# Maven build folder
target/



# Eclipse ###########################
# Source: https://raw.github.com/github/gitignore/master/Global/Eclipse.gitignore

*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# PDT-specific
.buildpath
33 changes: 0 additions & 33 deletions .project

This file was deleted.

21 changes: 0 additions & 21 deletions AndroidManifest.xml

This file was deleted.

24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Change Log
===============================================================================

Version 0.1.0-SNAPSHOT *(2013-06-07)*
-------------------------------------
* Split the project into a separate library and sample project.
* Add Maven support.
* Successfully tested with Eclipse 4.2.2, IntelliJ 12.1.3, Android Studio 0.1.1.
* Remove project files generated by Eclipse.
* Update .gitignore to exclude IDE noise and generated files.
* Remove .apk from repository.
* Set version tag to `0.1.0-SNAPSHOT`.
* Update `README.md`.
* Add this changelog file.


No official version *(2012-12-03)*
-------------------------------------
* Add support for double tap gesture. Allows to zoom in the map.


No official version *(2011-10-31)*
-------------------------------------
* Original release.
9 changes: 9 additions & 0 deletions MapChangeLibrary/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bricolsoftconsulting.mapchange"
android:versionCode="1"
android:versionName="0.1.0-SNAPSHOT" >

<uses-sdk android:minSdkVersion="7" />

</manifest>
58 changes: 58 additions & 0 deletions MapChangeLibrary/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
~ Copyright 2013 Bricolsoft Consulting

~ 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.bricolsoftconsulting</groupId>
<artifactId>mapchange-library</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>apklib</packaging>
<name>MapChange Library</name>
<url>https://github.com/bricolsoftconsulting/MapChangeLibrary</url>
<description>Google Maps notifications on panning, zooming or both</description>

<parent>
<groupId>com.bricolsoftconsulting</groupId>
<artifactId>mapchange-parent</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>

<build>
<finalName>${project.artifactId}</finalName>

<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android-maven-plugin.version}</version>
<configuration>
<sdk>
<platform>${sdk.platform}</platform>
</sdk>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012 Bricolsoft Consulting
Copyright 2013 Bricolsoft Consulting

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -24,77 +24,77 @@
import com.google.android.maps.MapView;

public class MyMapView extends MapView
{
{
// ------------------------------------------------------------------------
// LISTENER DEFINITIONS
// ------------------------------------------------------------------------

// Change listener
public interface OnChangeListener
{
public void onChange(MapView view, GeoPoint newCenter, GeoPoint oldCenter, int newZoom, int oldZoom);
}

// ------------------------------------------------------------------------
// MEMBERS
// ------------------------------------------------------------------------

private MyMapView mThis;
private long mEventsTimeout = 250L; // Set this variable to your preferred timeout
private boolean mIsTouched = false;
private GeoPoint mLastCenterPosition;
private int mLastZoomLevel;
//private Timer mChangeDelayTimer = new Timer();
private MyMapView.OnChangeListener mChangeListener = null;

// ------------------------------------------------------------------------
// RUNNABLES
// ------------------------------------------------------------------------

private Runnable mOnChangeTask = new Runnable()
{
@Override
public void run()
{
if (mChangeListener != null) mChangeListener.onChange(mThis, getMapCenter(), mLastCenterPosition, getZoomLevel(), mLastZoomLevel);
mLastCenterPosition = getMapCenter();
mLastZoomLevel = getZoomLevel();
mLastZoomLevel = getZoomLevel();
}
};

// ------------------------------------------------------------------------
// CONSTRUCTORS
// ------------------------------------------------------------------------

public MyMapView(Context context, String apiKey)
{
super(context, apiKey);
init();
}

public MyMapView(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}

public MyMapView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
init();
}

private void init()
{
mThis = this;
mLastCenterPosition = this.getMapCenter();
mLastZoomLevel = this.getZoomLevel();
}

// ------------------------------------------------------------------------
// GETTERS / SETTERS
// ------------------------------------------------------------------------

public void setOnChangeListener(MyMapView.OnChangeListener l)
{
mChangeListener = l;
Expand All @@ -103,10 +103,10 @@ public void setOnChangeListener(MyMapView.OnChangeListener l)
// ------------------------------------------------------------------------
// EVENT HANDLERS
// ------------------------------------------------------------------------

@Override
public boolean onTouchEvent(MotionEvent ev)
{
{
// Set touch internal
mIsTouched = (ev.getAction() != MotionEvent.ACTION_UP);

Expand All @@ -117,11 +117,11 @@ public boolean onTouchEvent(MotionEvent ev)
public void computeScroll()
{
super.computeScroll();

// Check for change
if (isSpanChange() || isZoomChange())
{
// If computeScroll called before timer counts down we should drop it and
// If computeScroll called before timer counts down we should drop it and
// start counter over again
resetMapChangeTimer();
}
Expand All @@ -130,25 +130,25 @@ public void computeScroll()
// ------------------------------------------------------------------------
// TIMER RESETS
// ------------------------------------------------------------------------

private void resetMapChangeTimer()
{
MyMapView.this.removeCallbacks(mOnChangeTask);
MyMapView.this.postDelayed(mOnChangeTask, mEventsTimeout);
}

// ------------------------------------------------------------------------
// CHANGE FUNCTIONS
// ------------------------------------------------------------------------

private boolean isSpanChange()
{
return !mIsTouched && !getMapCenter().equals(mLastCenterPosition);
}

private boolean isZoomChange()
{
return (getZoomLevel() != mLastZoomLevel);
}
}

}