This repository has been archived on 2023-09-03. You can view files and clone it, but cannot push or open issues or pull requests.
FxPix/app/src/main/java/net.crystalyx.sharepixiv/MainActivity.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"));
}
}
}