Projects >> WebView-MultiTouch-Polyfill >>42cc0759551890453b7211e5201a154601ece4f0

Chunk
Conflicting content
	 * @param cordova
	 * @param view
	 */
<<<<<<< HEAD
	public PhonegapWebClient(DroidGap cordova, WebView view) {
		super(cordova);
		wmp = new WebClient();

		if (view == null)
			cordova.init();		// Trigger initialisation of WebView and other dependent objects
=======
	public PhonegapWebClient(CordovaInterface cordova, CordovaWebView view) {
		super(cordova, view);
		wmp = new WebClient(view);
>>>>>>> 03e504ab7aafc43399700314a8c85a3b42cee80f
	}

	@Override
Solution content
	 * @param cordova
	 * @param view
	 */
	public PhonegapWebClient(CordovaInterface cordova, CordovaWebView view) {
		super(cordova, view);
		wmp = new WebClient(view);
	}

	@Override
File
PhonegapWebClient.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method invocation
Method signature
Chunk
Conflicting content
	/** @see setPolyFillAllTouches() */
	protected Boolean polyfillAllTouches = true;

<<<<<<< HEAD
	/** currently unused, just for documentation purposes */
	protected int moveThreshold = 1;
=======
	/** obsolete? */
	//protected int moveThreshold = 1;
>>>>>>> 03e504ab7aafc43399700314a8c85a3b42cee80f

	/** The number of touches already working out-of-the-box (we'll assume at least one for all devices) */
	protected int maxNativeTouches = 1;
Solution content
	/** @see setPolyFillAllTouches() */
	protected Boolean polyfillAllTouches = true;

	/** obsolete? */
	//protected int moveThreshold = 1;

	/** The number of touches already working out-of-the-box (we'll assume at least one for all devices) */
	protected int maxNativeTouches = 1;
File
WebClient.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
<<<<<<< HEAD
	private WebView view;

	/**
	 * Set internal variables required for any further actions
	 */
	private void init(WebView view) {
		if (!this.isInitialised)
		{
			/**
			 * store internal reference to the webview object, so other functions in this class have access to it
			 *
			 * TODO Find a smarter way to do this or just live with it (feels quirky though)
			 * @see http://stackoverflow.com/questions/11174693/android-accessing-involving-objects-members-context-from-webviewclient-as
			 */
			this.view = view;
			moveBuffer = new StringBuilder();
		}
	}

	/**
	 * TODO Clarify: What did we need this for again? Not sure if its needed at all.
	 *
	 * @param view
	 * @param url
	 * @return
	 */
=======
	 * Constructor 
	 * Enables Javascript2Java an vice versa. 
	 * Provides a javascript Object "wmpjs".
	 * @param view
	 */
	public WebClient(WebView view){
		super();
		if (Build.VERSION.SDK_INT <= 10) {
			this.view = view;			
			this.view.getSettings().setJavaScriptEnabled(true);
			this.view.addJavascriptInterface(this.new jsInterface(), "wmpjs");
			this.view.setWebViewClient(this);			
		}
	}
	
>>>>>>> 03e504ab7aafc43399700314a8c85a3b42cee80f
	@Override
	public boolean shouldOverrideUrlLoading(WebView view, String url) {
//		android.util.Log.v("console", "OVERRIDEURLLOADING to " + url);
Solution content
	private WebView view;

	/**
	 * Constructor 
	 * Enables Javascript2Java an vice versa. 
	 * Provides a javascript Object "wmpjs".
	 * @param view
	 */
	public WebClient(WebView view){
		super();
		if (Build.VERSION.SDK_INT <= 10) {
			this.view = view;			
			this.view.getSettings().setJavaScriptEnabled(true);
			this.view.addJavascriptInterface(this.new jsInterface(), "wmpjs");
			this.view.setWebViewClient(this);			
		}
	}
	
	@Override
	public boolean shouldOverrideUrlLoading(WebView view, String url) {
//		android.util.Log.v("console", "OVERRIDEURLLOADING to " + url);
File
WebClient.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
	{
//		android.util.Log.v("console", "pagefinished_" + url);
		if (Build.VERSION.SDK_INT <= 10) {
<<<<<<< HEAD
			init(view);	// ensure internal object variables are initialised
=======
			//this.view = view;
>>>>>>> 03e504ab7aafc43399700314a8c85a3b42cee80f
			injectWMPJs();
			view.setOnTouchListener(new View.OnTouchListener() {
				public boolean onTouch(View arg0, MotionEvent arg1) {
Solution content
	{
//		android.util.Log.v("console", "pagefinished_" + url);
		if (Build.VERSION.SDK_INT <= 10) {
			//this.view = view;
			injectWMPJs();
			view.setOnTouchListener(new View.OnTouchListener() {
				public boolean onTouch(View arg0, MotionEvent arg1) {
File
WebClient.java
Developer's decision
Version 2
Kind of conflict
Comment
Method invocation
Chunk
Conflicting content
	class jsInterface{		
		/** Version **/
	 * 
	 * @author fastr
	 *

		return "";
	}
<<<<<<< HEAD
=======


	/**
	 * Taken with a lot of appreciation from
	 * http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-3-understanding-touch-events/1775
	 *
	 * @param event
	 * @return String Some information on the MotionEvent
	 */
	private String dumpEvent(MotionEvent event) {

		String names[] = {"DOWN", "UP", "MOVE", "CANCEL", "OUTSIDE",
			"POINTER_DOWN", "POINTER_UP", "7?", "8?", "9?"};
		StringBuilder sb = new StringBuilder();
		int action = event.getAction();
		int actionCode = action & MotionEvent.ACTION_MASK;

		if (actionCode == MotionEvent.ACTION_POINTER_DOWN
				|| actionCode == MotionEvent.ACTION_POINTER_UP
				|| actionCode == MotionEvent.ACTION_DOWN
				|| actionCode == MotionEvent.ACTION_UP) {
			sb.append("FINGER ").append(
					(action >> MotionEvent.ACTION_POINTER_ID_SHIFT) + 1);
			sb.append(": ");
		}

		sb.append("ACTION_").append(names[actionCode]);
		sb.append(" [");
	 */
		for (int i = 0; i < event.getPointerCount(); i++) {
			sb.append("#").append(i);
			sb.append("(pid_").append(event.getPointerId(i));
			sb.append(")=").append((int) event.getX(i));
			sb.append(",").append((int) event.getY(i));
			if (i + 1 < event.getPointerCount()) {
				sb.append("; ");
			}
		}
		sb.append("]");
		return sb.toString();
	}

	/**
	 * This nested class provides getter and setter for the javascript Interface to WebClient.
	 * Issue: https://github.com/Philzen/WebView-MultiTouch-Polyfill/issues/1 
	 * Fell free to implement wanted Bridge functionality.
		public String getVersion(){
			return WebClient.VERSION;
		}		
		/** PolyfillAllTouches **/
		public void setPolyfillAllTouches(boolean value){
			WebClient.this.setPolyfillAllTouches(value);
		}
		public boolean getPolyfillAllTouches(){
			return WebClient.this.getPolyfillAllTouches();
		}
		
		/** PolyfillAllTouches **/
		public void setMaxNativeTouches(int value){
			if (value > 0){
				WebClient.this.maxNativeTouches = value;
			}
		}
		public int getMaxNativeTouches(){
			return WebClient.this.maxNativeTouches;
		}
		
		/** isJsInjected **/
		public boolean isJsInjected(){
			return WebClient.this.isJsInjected;
		}

		/** return JSON String of the current configuration.
		 *  You have to JSON.parse it on javascript-side
		 */
		public String getConfig(){		
			String str = 
					"{" +
					"\"VERSION\":"				+"\""+WebClient.VERSION+ "\""+		"," +
					"\"polyfillAllTouches\":" 	+WebClient.this.polyfillAllTouches+ "," +	
					"\"maxNativeTouches\":" 	+WebClient.this.maxNativeTouches+ 	"," +	
					"\"isJsInjected\":" 		+WebClient.this.isJsInjected+ 		
					"}";
			return str;			
		}
	}
>>>>>>> 03e504ab7aafc43399700314a8c85a3b42cee80f
}
Solution content
		}
		sb.append("]");
		return sb.toString();
	}

	/**

		return "";
	}


	/**
	 * Taken with a lot of appreciation from
	 * http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-3-understanding-touch-events/1775
	 *
	 * @param event
	 * @return String Some information on the MotionEvent
	 */
	private String dumpEvent(MotionEvent event) {

		String names[] = {"DOWN", "UP", "MOVE", "CANCEL", "OUTSIDE",
			"POINTER_DOWN", "POINTER_UP", "7?", "8?", "9?"};
		StringBuilder sb = new StringBuilder();
		int action = event.getAction();
		int actionCode = action & MotionEvent.ACTION_MASK;

		if (actionCode == MotionEvent.ACTION_POINTER_DOWN
				|| actionCode == MotionEvent.ACTION_POINTER_UP
				|| actionCode == MotionEvent.ACTION_DOWN
				|| actionCode == MotionEvent.ACTION_UP) {
			sb.append("FINGER ").append(
					(action >> MotionEvent.ACTION_POINTER_ID_SHIFT) + 1);
			sb.append(": ");
		}

		sb.append("ACTION_").append(names[actionCode]);
		sb.append(" [");
		for (int i = 0; i < event.getPointerCount(); i++) {
			sb.append("#").append(i);
			sb.append("(pid_").append(event.getPointerId(i));
			sb.append(")=").append((int) event.getX(i));
			sb.append(",").append((int) event.getY(i));
			if (i + 1 < event.getPointerCount()) {
				sb.append("; ");
			}
	 * This nested class provides getter and setter for the javascript Interface to WebClient.
	 * Issue: https://github.com/Philzen/WebView-MultiTouch-Polyfill/issues/1 
	 * Fell free to implement wanted Bridge functionality.
	 * 
	 * @author fastr
	 *
	 */
	class jsInterface{		
		/** Version **/
		public String getVersion(){
			return WebClient.VERSION;
		}		
		/** PolyfillAllTouches **/
		public void setPolyfillAllTouches(boolean value){
			WebClient.this.setPolyfillAllTouches(value);
		}
		public boolean getPolyfillAllTouches(){
			return WebClient.this.getPolyfillAllTouches();
		}
		
		/** PolyfillAllTouches **/
		public void setMaxNativeTouches(int value){
			if (value > 0){
				WebClient.this.maxNativeTouches = value;
			}
		}
		public int getMaxNativeTouches(){
			return WebClient.this.maxNativeTouches;
		}
		
		/** isJsInjected **/
		public boolean isJsInjected(){
			return WebClient.this.isJsInjected;
		}

		/** return JSON String of the current configuration.
		 *  You have to JSON.parse it on javascript-side
		 */
		public String getConfig(){		
			String str = 
					"{" +
					"\"VERSION\":"				+"\""+WebClient.VERSION+ "\""+		"," +
					"\"polyfillAllTouches\":" 	+WebClient.this.polyfillAllTouches+ "," +	
					"\"maxNativeTouches\":" 	+WebClient.this.maxNativeTouches+ 	"," +	
					"\"isJsInjected\":" 		+WebClient.this.isJsInjected+ 		
					"}";
			return str;			
		}
	}
}
File
WebClient.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Comment
Method declaration