-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated requestFocus implementation, macos: implemented requestFocus …
…and clearFocus WebView methods, implemented workaround for macos #2380
- Loading branch information
1 parent
bd5960d
commit a273635
Showing
21 changed files
with
443 additions
and
23 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
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
107 changes: 107 additions & 0 deletions
107
...rc/main/java/com/pichillilorenzo/flutter_inappwebview_android/types/InAppWebViewRect.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,107 @@ | ||
package com.pichillilorenzo.flutter_inappwebview_android.types; | ||
|
||
import android.graphics.Rect; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class InAppWebViewRect { | ||
private double height; | ||
private double width; | ||
private double x; | ||
private double y; | ||
|
||
public InAppWebViewRect(double height, double width, double x, double y) { | ||
this.height = height; | ||
this.width = width; | ||
this.x = x; | ||
this.y = y; | ||
} | ||
|
||
@Nullable | ||
public static InAppWebViewRect fromMap(@Nullable Map<String, Object> map) { | ||
if (map == null) { | ||
return null; | ||
} | ||
double height = (double) map.get("height"); | ||
double width = (double) map.get("width"); | ||
double x = (double) map.get("x"); | ||
double y = (double) map.get("y"); | ||
return new InAppWebViewRect(height, width, x, y); | ||
} | ||
|
||
public Map<String, Object> toMap() { | ||
Map<String, Object> map = new HashMap<>(); | ||
map.put("height", height); | ||
map.put("width", width); | ||
map.put("x", x); | ||
map.put("y", y); | ||
return map; | ||
} | ||
|
||
public Rect toRect() { | ||
return new Rect((int) x, (int) y, (int) (x + width), (int) (y + height)); | ||
} | ||
|
||
public double getHeight() { | ||
return height; | ||
} | ||
|
||
public void setHeight(double height) { | ||
this.height = height; | ||
} | ||
|
||
public double getWidth() { | ||
return width; | ||
} | ||
|
||
public void setWidth(double width) { | ||
this.width = width; | ||
} | ||
|
||
public double getX() { | ||
return x; | ||
} | ||
|
||
public void setX(double x) { | ||
this.x = x; | ||
} | ||
|
||
public double getY() { | ||
return y; | ||
} | ||
|
||
public void setY(double y) { | ||
this.y = y; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
|
||
InAppWebViewRect that = (InAppWebViewRect) o; | ||
return Double.compare(height, that.height) == 0 && Double.compare(width, that.width) == 0 && Double.compare(x, that.x) == 0 && Double.compare(y, that.y) == 0; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = Double.hashCode(height); | ||
result = 31 * result + Double.hashCode(width); | ||
result = 31 * result + Double.hashCode(x); | ||
result = 31 * result + Double.hashCode(y); | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "InAppWebViewRect{" + | ||
"height=" + height + | ||
", width=" + width + | ||
", x=" + x + | ||
", y=" + y + | ||
'}'; | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.