Skip to content

Commit 2749868

Browse files
authored
fix for multiple easy access handles (#79)
* fix for multiple easy access handles * issue simulation * detekt ktlint fix * ktlint fix
1 parent 608be32 commit 2749868

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

pluto/src/main/java/com/mocklets/pluto/modules/setup/easyaccess/PopupViewManager.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ internal class PopupViewManager(
134134
}
135135

136136
fun addView(context: Context, windowManager: WindowManager) {
137-
view = context.inflate(R.layout.pluto___layout_popup)
138-
view?.let {
139-
initView(context, it)
140-
if (it.parent == null) {
141-
windowManager.addView(it, layoutParams)
137+
if (view == null) {
138+
view = context.inflate(R.layout.pluto___layout_popup)
139+
view?.let {
140+
initView(context, it)
141+
if (it.parent == null) {
142+
windowManager.addView(it, layoutParams)
143+
}
142144
}
143145
}
144146
}

sample/src/main/AndroidManifest.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
<uses-permission android:name="android.permission.INTERNET" />
66

77
<application
8-
android:name="com.sampleapp.SampleApp"
8+
android:name=".SampleApp"
99
android:allowBackup="true"
1010
android:icon="@drawable/ic_launcher"
1111
android:label="@string/app_name"
1212
android:supportsRtl="true"
1313
android:theme="@style/AppTheme">
14-
<activity android:name="com.sampleapp.MainActivity">
14+
<activity
15+
android:name=".SecondActivity"
16+
android:exported="true" />
17+
<activity android:name=".MainActivity">
1518
<intent-filter>
1619
<action android:name="android.intent.action.MAIN" />
1720

sample/src/main/java/com/sampleapp/MainActivity.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.sampleapp
22

3+
import android.content.Intent
34
import android.os.Bundle
45
import androidx.appcompat.app.AppCompatActivity
56
import androidx.lifecycle.ViewModelProvider
@@ -27,6 +28,7 @@ class MainActivity : AppCompatActivity() {
2728
private fun handleAppPropertiesCTAs() {
2829
binding.appPropertiesCta.setOnClickListener {
2930
saveAppProperties()
31+
startActivity(Intent(this, SecondActivity::class.java))
3032
}
3133
}
3234

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.sampleapp
2+
3+
import android.os.Bundle
4+
import androidx.appcompat.app.AppCompatActivity
5+
6+
class SecondActivity : AppCompatActivity() {
7+
override fun onCreate(savedInstanceState: Bundle?) {
8+
super.onCreate(savedInstanceState)
9+
setContentView(R.layout.activity_second)
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="match_parent"
6+
tools:context=".SecondActivity">
7+
8+
<TextView
9+
android:layout_width="match_parent"
10+
android:layout_height="match_parent"
11+
android:gravity="center"
12+
android:text="I am Second Activity"/>
13+
14+
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)