This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set position by long press | |
mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() { | |
@Override | |
public void onMapLongClick(LatLng latLng) { | |
// First check if myMarker is null | |
if (myManualPositionMarker == null) { | |
// Marker was not set yet. Add marker: | |
myManualPositionMarker = mMap.addMarker(new MarkerOptions() | |
.position(latLng) | |
.title("My positions") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.Manifest; | |
import android.content.DialogInterface; | |
import android.content.pm.PackageManager; | |
import android.location.Location; | |
import android.location.LocationListener; | |
import android.os.Build; | |
import android.support.v4.app.ActivityCompat; | |
import android.support.v4.app.FragmentActivity; | |
import android.os.Bundle; | |
import android.support.v4.content.ContextCompat; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MapLocationActivity extends AppCompatActivity | |
implements OnMapReadyCallback, | |
GoogleApiClient.ConnectionCallbacks, | |
GoogleApiClient.OnConnectionFailedListener, | |
LocationListener { | |
GoogleMap mGoogleMap; | |
SupportMapFragment mapFrag; | |
LocationRequest mLocationRequest; | |
GoogleApiClient mGoogleApiClient; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local targetDevice = ( system.getInfo( "model" ) ) | |
local isTall = ( "iPhone" == system.getInfo( "model" ) ) and ( display.pixelHeight > 960 ) | |
if isTall == false and targetDevice == "iPhone" then | |
application = | |
{ | |
content = | |
{ | |
width = 320, | |
height = 480, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function intersection(p11,p12,p21,p22) | |
local Z = (p12.y-p11.y)*(p21.x-p22.x)-(p21.y-p22.y)*(p12.x-p11.x); | |
local Ca = (p12.y-p11.y)*(p21.x-p11.x)-(p21.y-p11.y)*(p12.x-p11.x); | |
local Cb = (p21.y-p11.y)*(p21.x-p22.x)-(p21.y-p22.y)*(p21.x-p11.x); | |
if Z == 0 and Ca == 0 and Cb == 0 then return nil end | |
if Z == 0 then return nil end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- created with TexturePacker (http://www.codeandweb.com/texturepacker) | |
-- | |
-- {{smartUpdateKey}} | |
-- | |
-- local sheetInfo = require("mysheet") | |
-- local myImageSheet = graphics.newImageSheet( "mysheet.png", sheetInfo:getSheet() ) | |
-- local sprite = display.newSprite( myImageSheet , {frames={sheetInfo:getFrameIndex("sprite")}} ) | |
-- | |
{% load filter %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show rating prompt | |
local function ratingPrompt() | |
local function ask() | |
local function answer(event) | |
if ("clicked" == event.action) then | |
if (event.index == 1) then | |
system.openURL("http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=440754678") | |
data.rated = "yes" | |
writeData() | |
elseif (event.index == 2) then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local zip = require 'plugin.zip' | |
local zipFileName = 'zippedFolder.zip' | |
local function unzipListener( event ) | |
print('unzipping complete') | |
end | |
local unzipOptions = { | |
zipFile = event.response.fileName, | |
zipBaseDir = system.TemporaryDirectory, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------- | |
-- function delegate | |
-- Author: Erin Lin | |
-- www.erinylin.com | |
-- 簡易模擬 C# delegate | |
-- licensed under the MIT license. | |
-- 2015, 02 | |
------------------------------------- | |
--[[ | |
Usage1: |