24 lines
825 B
Java
24 lines
825 B
Java
package net.crystalyx.sharepixiv;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
|
|
public class MainActivity extends Activity {
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
|
|
Intent intent = getIntent();
|
|
String type = intent.getType();
|
|
|
|
if (Intent.ACTION_SEND.equals(intent.getAction()) && "text/plain".equals(type)) {
|
|
String ppxivUrl = intent.getStringExtra(Intent.EXTRA_TEXT).replace("pixiv", "ppxiv");
|
|
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
|
sharingIntent.setType("text/plain");
|
|
sharingIntent.putExtra(Intent.EXTRA_TEXT, ppxivUrl);
|
|
startActivity(Intent.createChooser(sharingIntent, "Share via"));
|
|
}
|
|
}
|
|
}
|