-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from mitchhentges/three-finger-update
Apply mock on three-finger-tap
- Loading branch information
Showing
5 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
23 changes: 23 additions & 0 deletions
23
app/src/main/java/ca/mitchhentges/positionmock/TouchableMapFragment.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ca.mitchhentges.positionmock; | ||
|
||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import com.google.android.gms.maps.MapFragment; | ||
|
||
/** | ||
* @author cacti | ||
* @since 12/2/2015 | ||
*/ | ||
public class TouchableMapFragment extends MapFragment { | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
View view = super.onCreateView(inflater, container, savedInstanceState); | ||
|
||
TouchableWrapper touchableWrapper = new TouchableWrapper((PositionMockActivity) getActivity()); | ||
touchableWrapper.addView(view); | ||
|
||
return touchableWrapper; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
app/src/main/java/ca/mitchhentges/positionmock/TouchableWrapper.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package ca.mitchhentges.positionmock; | ||
|
||
import android.view.MotionEvent; | ||
import android.widget.FrameLayout; | ||
|
||
/** | ||
* @author cacti | ||
* @since 12/2/2015 | ||
*/ | ||
public class TouchableWrapper extends FrameLayout { | ||
|
||
private final PositionMockActivity activity; | ||
|
||
public TouchableWrapper(PositionMockActivity activity) { | ||
super(activity); | ||
this.activity = activity; | ||
} | ||
|
||
@Override | ||
public boolean onInterceptTouchEvent(MotionEvent event) { | ||
int action = event.getAction(); | ||
if ((action & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_POINTER_DOWN | ||
&& event.getPointerCount() == 3) { | ||
activity.applyMockLocation(); | ||
} | ||
return super.onInterceptTouchEvent(event); | ||
} | ||
} |
This file contains 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