Skip to content

Commit

Permalink
modified: src/AndroidManifest.xml
Browse files Browse the repository at this point in the history
	modified:   src/java/com/sharkbyte/qrcodegenerator/MainActivity.java
  • Loading branch information
Sharkbyteprojects committed Sep 9, 2022
1 parent 4d04d03 commit 4ae5d70
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Expand Down
15 changes: 14 additions & 1 deletion src/java/com/sharkbyte/qrcodegenerator/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void errb(String message, String title){
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

binding = ActivityMainBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());

Expand Down Expand Up @@ -145,6 +144,20 @@ public void onClick(View view) {
closeKeyboard();
}
});

/* SHARE */
Intent intent = getIntent();
String action = intent.getAction();
String type = intent.getType();
if (Intent.ACTION_SEND.equals(action) && type != null) {
if ("text/plain".equals(type)) {
String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
if (sharedText != null) {
binding.textArea.setText(sharedText);
}

}
}
qrupdate();
}

Expand Down

0 comments on commit 4ae5d70

Please sign in to comment.