-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12e1984
commit f93c7eb
Showing
42 changed files
with
425 additions
and
342 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,47 @@ | ||
package com.xdag.io | ||
|
||
import io.flutter.embedding.android.FlutterActivity | ||
import android.os.Build | ||
import android.os.Bundle | ||
import androidx.activity.OnBackPressedCallback | ||
import io.flutter.embedding.android.FlutterFragmentActivity | ||
import io.flutter.embedding.engine.FlutterEngine | ||
import io.flutter.plugins.GeneratedPluginRegistrant | ||
|
||
class MainActivity: FlutterFragmentActivity() { | ||
private lateinit var onBackPressedCallback: OnBackPressedCallback | ||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { | ||
GeneratedPluginRegistrant.registerWith(flutterEngine) | ||
} | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
// android 33 | ||
if (Build.VERSION.SDK_INT >= 33) { | ||
onBackPressedCallback = object : OnBackPressedCallback(true) { | ||
override fun handleOnBackPressed() { | ||
// flutter 侧处理返回事件 | ||
flutterEngine!!.navigationChannel.popRoute() | ||
} | ||
} | ||
// 注册 OnBackPressedCallback | ||
val onBackPressedDispatcher = onBackPressedDispatcher | ||
onBackPressedDispatcher.addCallback(this, onBackPressedCallback) | ||
} | ||
} | ||
|
||
override fun onDestroy() { | ||
super.onDestroy() | ||
if (Build.VERSION.SDK_INT >= 33) { | ||
onBackPressedCallback.remove() | ||
} | ||
} | ||
|
||
override fun onBackPressed() { | ||
// super.onBackPressed() | ||
if (Build.VERSION.SDK_INT < 33) { | ||
flutterEngine!!.navigationChannel.popRoute(); | ||
} | ||
} | ||
|
||
|
||
} |
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,15 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="100dp" | ||
android:height="100dp" | ||
android:viewportWidth="1024" | ||
android:viewportHeight="1024"> | ||
<path | ||
android:pathData="M951.9,1023.4a25.6,25.6 0,0 1,-18.1 -7.5L8.5,90.7a25.6,25.6 0,0 1,36.2 -36.2l925.3,925.3a25.6,25.6 0,0 1,-18.1 43.6zM212.5,152.5A466.8,466.8 0,0 1,511.6 44.2a468.2,468.2 0,0 1,360.1 767.5l30.3,30.3A510.9,510.9 0,0 0,182 122z" | ||
android:fillColor="#A7B6C4"/> | ||
<path | ||
android:pathData="M810.2,873.2A468.3,468.3 0,0 1,43.4 512.5a466.7,466.7 0,0 1,107.5 -298.4l-30.4,-30.4a510.9,510.9 0,0 0,720.1 719.9zM375.5,315.5h54.1l50.4,104.4 32.2,32.1c2.3,-5.1 4.8,-10.2 7.4,-15.4L579.3,315.4h90l-92.1,176.8h69v71.9h-21.8l173.1,173.1c112.6,-142.5 102.1,-352.6 -29.2,-481.7a362,362 0,0 0,-481 -28.3z" | ||
android:fillColor="#A7B6C4"/> | ||
<path | ||
android:pathData="M600.7,663.7h-53.2v76.8H468.6v-76.8H370.7v-70.8h97.9v-28.9H370.7v-71.6h58.6L225.6,288.6C113.6,430.7 123.9,640.1 254.4,769.3a363.3,363.3 0,0 0,481 29.1z" | ||
android:fillColor="#A7B6C4"/> | ||
</vector> |
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.