@hanwha-ss1/plugin 0.3.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@
12
12
  <application>
13
13
  <activity
14
14
  android:theme="@style/AppTheme.NoActionBar"
15
- android:name="com.openbrowser.WebViewActivity"
15
+ android:name=".WebViewActivity"
16
16
  android:exported="false" />
17
17
  </application>
18
18
 
@@ -108,10 +108,11 @@ public class LinkerPlugin extends Plugin{
108
108
  @PluginMethod
109
109
  public void open(PluginCall call) {
110
110
  String url = call.getString("url");
111
- boolean isExternal = call.getBoolean("ext");
111
+ boolean isExternal = Boolean.TRUE.equals(call.getBoolean("ext"));
112
+ boolean hasClose = Boolean.TRUE.equals(call.getBoolean("isCloseBtn"));
112
113
  if(openBrowserImplementation == null) {
113
114
  openBrowserImplementation = new OpenBrowser();
114
115
  }
115
- openBrowserImplementation.open(getActivity(), url, isExternal);
116
+ openBrowserImplementation.open(getActivity(), url, isExternal, hasClose);
116
117
  }
117
118
  }
@@ -5,6 +5,8 @@ import android.content.Intent;
5
5
  import android.net.Uri;
6
6
  import android.util.Log;
7
7
 
8
+ import androidx.appcompat.app.AppCompatActivity;
9
+
8
10
  public class OpenBrowser {
9
11
 
10
12
  public String echo(String value) {
@@ -19,7 +21,7 @@ public class OpenBrowser {
19
21
  * @param url
20
22
  * @param isExternal
21
23
  */
22
- public void open(Activity activity, String url, boolean isExternal) {
24
+ public void open(AppCompatActivity activity, String url, boolean isExternal, boolean hasClose) {
23
25
  if(activity != null && url != null && !url.isEmpty()) {
24
26
  Intent intent;
25
27
  if(isExternal) {
@@ -27,6 +29,7 @@ public class OpenBrowser {
27
29
  } else {
28
30
  intent = new Intent(activity, WebViewActivity.class);
29
31
  intent.putExtra("url", url);
32
+ intent.putExtra("hasClose", hasClose);
30
33
  }
31
34
  activity.startActivity(intent);
32
35
  }
@@ -23,10 +23,11 @@ public class OpenBrowserPlugin extends Plugin {
23
23
  @PluginMethod
24
24
  public void open(PluginCall call) {
25
25
  String url = call.getString("url");
26
- boolean isExternal = call.getBoolean("ext");
26
+ boolean isExternal = Boolean.TRUE.equals(call.getBoolean("ext"));
27
+ boolean hasClose = Boolean.TRUE.equals(call.getBoolean("isCloseBtn"));
27
28
  if(implementation == null) {
28
29
  implementation = new OpenBrowser();
29
30
  }
30
- implementation.open(getActivity(), url, isExternal);
31
+ implementation.open(getActivity(), url, isExternal, hasClose);
31
32
  }
32
33
  }
@@ -12,23 +12,34 @@ import androidx.appcompat.app.AppCompatActivity;
12
12
  public class WebViewActivity extends AppCompatActivity {
13
13
 
14
14
  private WebView webView;
15
- private ImageView ivClose;
16
15
 
17
16
  @Override
18
17
  protected void onCreate(Bundle savedInstanceState) {
19
18
  super.onCreate(savedInstanceState);
20
19
  setContentView(R.layout.activity_webview);
21
20
 
22
- initLayout();
23
21
 
24
22
  String url = getIntent().getStringExtra("url");
23
+ boolean hasClose = getIntent().getBooleanExtra("hasClose", true);
24
+
25
+ initLayout(hasClose);
25
26
 
26
27
  openUrl(url);
27
28
  }
28
29
 
29
- private void initLayout() {
30
+ private void initLayout(boolean hasClose) {
30
31
  webView = findViewById(R.id.webView);
31
- ivClose = findViewById(R.id.ivClose);
32
+
33
+ if(hasClose) {
34
+ findViewById(R.id.ivClose).setOnClickListener(new View.OnClickListener() {
35
+ @Override
36
+ public void onClick(View v) {
37
+ WebViewActivity.this.finish();
38
+ }
39
+ });
40
+ } else {
41
+ findViewById(R.id.layoutTitle).setVisibility(View.GONE);
42
+ }
32
43
 
33
44
  webView.getSettings().setJavaScriptEnabled(true);
34
45
  webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
@@ -47,13 +58,6 @@ public class WebViewActivity extends AppCompatActivity {
47
58
  return super.shouldOverrideUrlLoading(view, url);
48
59
  }
49
60
  });
50
-
51
- ivClose.setOnClickListener(new View.OnClickListener() {
52
- @Override
53
- public void onClick(View v) {
54
- WebViewActivity.this.finish();
55
- }
56
- });
57
61
  }
58
62
 
59
63
  private void openUrl(String url) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanwha-ss1/plugin",
3
- "version": "0.3.8",
3
+ "version": "0.4.0",
4
4
  "description": "Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",