Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
60ba9914
Unverified
Commit
60ba9914
authored
Jun 16, 2020
by
Rémi Verschelde
Committed by
GitHub
Jun 16, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #39579 from m4gr3d/provide_activity_to_godot_plugin_constructor_master
Clean up the GodotPlugin public API
parents
697897cc
6daf9b78
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
Godot.java
...orm/android/java/lib/src/org/godotengine/godot/Godot.java
+1
-1
GodotPlugin.java
...ava/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
+14
-4
GodotPayment.java
...va/org/godotengine/godot/plugin/payment/GodotPayment.java
+2
-2
No files found.
platform/android/java/lib/src/org/godotengine/godot/Godot.java
View file @
60ba9914
...
...
@@ -262,7 +262,7 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe
// Include the returned non-null views in the Godot view hierarchy.
for
(
GodotPlugin
plugin
:
pluginRegistry
.
getAllPlugins
())
{
View
pluginView
=
plugin
.
onMainCreate
View
(
this
);
View
pluginView
=
plugin
.
onMainCreate
(
this
);
if
(
pluginView
!=
null
)
{
layout
.
addView
(
pluginView
);
}
...
...
platform/android/java/lib/src/org/godotengine/godot/plugin/GodotPlugin.java
View file @
60ba9914
...
...
@@ -35,6 +35,7 @@ import org.godotengine.godot.Godot;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.Surface
;
import
android.view.View
;
...
...
@@ -93,6 +94,14 @@ public abstract class GodotPlugin {
}
/**
* Provides access to the underlying {@link Activity}.
*/
@Nullable
protected
Activity
getActivity
()
{
return
godot
;
}
/**
* Register the plugin with Godot native code.
*
* This method is invoked on the render thread.
...
...
@@ -145,13 +154,14 @@ public abstract class GodotPlugin {
* Invoked once during the Godot Android initialization process after creation of the
* {@link org.godotengine.godot.GodotView} view.
* <p>
* Th
is method should be overridden by descendants of this class that would like to add
*
their view/layout to the Godot view
hierarchy.
* Th
e plugin can return a non-null {@link View} layout in order to add it to the Godot view
* hierarchy.
*
* @return the view to be included; null if no views should be included.
* @see Activity#onCreate(Bundle)
* @return the plugin's view to be included; null if no views should be included.
*/
@Nullable
public
View
onMainCreate
View
(
Activity
activity
)
{
public
View
onMainCreate
(
Activity
activity
)
{
return
null
;
}
...
...
platform/android/java/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
View file @
60ba9914
...
...
@@ -67,7 +67,7 @@ public class GodotPayment extends GodotPlugin implements PurchasesUpdatedListene
super
(
godot
);
billingClient
=
BillingClient
.
newBuilder
(
get
Godot
())
.
newBuilder
(
get
Activity
())
.
enablePendingPurchases
()
.
setListener
(
this
)
.
build
();
...
...
@@ -182,7 +182,7 @@ public class GodotPayment extends GodotPlugin implements PurchasesUpdatedListene
.
setSkuDetails
(
skuDetails
)
.
build
();
BillingResult
result
=
billingClient
.
launchBillingFlow
(
get
Godot
(),
purchaseParams
);
BillingResult
result
=
billingClient
.
launchBillingFlow
(
get
Activity
(),
purchaseParams
);
Dictionary
returnValue
=
new
Dictionary
();
if
(
result
.
getResponseCode
()
==
BillingClient
.
BillingResponseCode
.
OK
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment