Add simple sharing to the app
This commit is contained in:
parent
7d4c8ea7b8
commit
d0e9beef14
|
@ -33,6 +33,13 @@
|
|||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND"/>
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
<data android:mimeType="image/*"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".eu.stuifzand.micropub.auth.WebSigninActivity" />
|
||||
<activity android:name=".eu.stuifzand.micropub.auth.AuthenticationActivity" />
|
||||
|
|
|
@ -23,6 +23,7 @@ import android.widget.Toast;
|
|||
import java.io.IOException;
|
||||
|
||||
import eu.stuifzand.micropub.databinding.ActivityMainBinding;
|
||||
import okhttp3.HttpUrl;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
|
@ -37,6 +38,19 @@ public class MainActivity extends AppCompatActivity {
|
|||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
String urlOrNote = intent.getStringExtra(Intent.EXTRA_TEXT);
|
||||
if (urlOrNote != null) {
|
||||
HttpUrl url = HttpUrl.parse(urlOrNote);
|
||||
if (url != null) {
|
||||
model.inReplyTo.set(urlOrNote);
|
||||
} else {
|
||||
model.content.set(urlOrNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
// fab.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user