Rename project
This commit is contained in:
parent
5cc152fa30
commit
8022a1f9da
@ -1,10 +1,10 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
namespace "net.crystalyx.sharepixiv"
|
||||
compileSdkVersion 33
|
||||
namespace "net.crystalyx.fxpix"
|
||||
compileSdk 33
|
||||
defaultConfig {
|
||||
applicationId "net.crystalyx.sharepixiv"
|
||||
applicationId "net.crystalyx.fxpix"
|
||||
minSdkVersion 3
|
||||
targetSdkVersion 33
|
||||
versionCode 1
|
||||
|
@ -3,7 +3,7 @@
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application
|
||||
android:icon="@android:drawable/ic_menu_share"
|
||||
android:label="FxPics"
|
||||
android:label="FxPix"
|
||||
android:theme="@android:style/Theme.NoDisplay">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
|
@ -1,27 +0,0 @@
|
||||
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")
|
||||
.replace("twitter", "fxtwitter");
|
||||
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||
sharingIntent.setType("text/plain");
|
||||
sharingIntent.putExtra(Intent.EXTRA_TEXT, ppxivUrl);
|
||||
startActivity(Intent.createChooser(sharingIntent, "Share via"));
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
52
app/src/main/java/net/crystalyx/fxpix/MainActivity.java
Normal file
52
app/src/main/java/net/crystalyx/fxpix/MainActivity.java
Normal file
@ -0,0 +1,52 @@
|
||||
package net.crystalyx.fxpix;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
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)) {
|
||||
URL originalUrl;
|
||||
URL fixedUrl;
|
||||
|
||||
try {
|
||||
originalUrl = new URL(intent.getStringExtra(Intent.EXTRA_TEXT));
|
||||
|
||||
switch (originalUrl.getHost()) {
|
||||
case "twitter.com":
|
||||
case "t.co":
|
||||
case "x.com":
|
||||
fixedUrl = new URL(originalUrl.getProtocol(), "nitter.net", originalUrl.getPort(), originalUrl.getFile());
|
||||
break;
|
||||
case "pixiv.net":
|
||||
fixedUrl = new URL(originalUrl.getProtocol(), "ppxiv.net", originalUrl.getPort(), originalUrl.getFile());
|
||||
break;
|
||||
default:
|
||||
fixedUrl = originalUrl;
|
||||
break;
|
||||
}
|
||||
|
||||
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
|
||||
sharingIntent.setType("text/plain");
|
||||
sharingIntent.putExtra(Intent.EXTRA_TEXT, fixedUrl);
|
||||
startActivity(Intent.createChooser(sharingIntent, "Share via"));
|
||||
} catch (MalformedURLException e) {
|
||||
Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
@ -16,10 +16,10 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
tasks.register('clean', Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.deprecation = true
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
// Boilerplate from https://transang.me/create-a-minimal-android-boilerplate-from-scratch/
|
||||
rootProject.name = 'SharePixiv'
|
||||
rootProject.name = 'FxPix'
|
||||
include ':app'
|
||||
|
Reference in New Issue
Block a user