Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

[Corona Native] How can I add methods to CoronaActivity?
Started by yeastudio.net Nov 07 2019 06:55 PM

3 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

yeastudio.net

[GLOBAL: userInfoPane.html]
yeastudio.net
  • Observer

  • 10 posts
  • Corona SDK

I used "public class MainActivity extends CoronaActivity"in 32bit Corona era.

I know it is not recommendation. But it's good and easy.

 

So, now. 64bit Corona era. It doesn't support the method.

I must add a code below.

@Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        if (hasFocus) {
            getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        }
    }

How can I?

 

And...

 

How can I add a code below to CoronaActivity in AndroidManifest.template.xml?

<intent-filter>
      <action android:name="android.intent.action.VIEW"/>
      <category android:name="android.intent.category.DEFAULT"/>
      <category android:name="android.intent.category.BROWSABLE" />
      <data
          android:scheme="myapp" />
</intent-filter>


[TOPIC: post.html]
#2

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 921 posts
  • Corona Staff

I'm not sure what changed. You can still override CoronaActivity, and change manifest to your needs.



[TOPIC: post.html]
#3

yeastudio.net

[GLOBAL: userInfoPane.html]
yeastudio.net
  • Observer

  • 10 posts
  • Corona SDK

But two app icons are created if I add my MainActivity to manifest.

<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|navigation|screenSize|orientation"
android:windowSoftInputMode="stateAlwaysVisible|adjustPan"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
<meta-data android:name="coronaWindowMovesWhenKeyboardAppears" android:value="true"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Because corona generates the manifest default. CoronaActivity is LAUNCHER.

Making LAUNCHER is two, two app icons are made.

So, I can not use my MainActivity extends CoronaActivity.

 

And I can not cast CoronaActivity to MainActivity. It throws Error.

 

And another thing...zip plugin is not working in corona 64bit. (I don't notice it where)

https://marketplace.coronalabs.com/corona-plugins/zip



[TOPIC: post.html]
#4

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Contributor

  • 921 posts
  • Corona Staff

Pretty sure zip works on 64bit. It should. Btw, I recomend creating a new project from template. It has gradle target 'setUpCoronaAppAndPlugins` which will download and setup all the plugins in build.settings. It also overrides the manifest, so make your changes/back up your manifest.

 

To fix two activities, you can delete Corona Activity in your main manifest file by adding something like this to your application node:

 

<activity android:name="com.ansca.corona.CoronaActivity" tools:node="remove" />

it will delete original activity on merge




[topic_controls]
[/topic_controls]