Code cleaning

This commit is contained in:
Thomas 2020-02-18 12:25:20 +01:00
parent e7d19348a1
commit 59f0da81b4
26 changed files with 703 additions and 567 deletions

View File

@ -2,13 +2,13 @@ package app.fedilab.nitterizeme;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/**
* Instrumented test, which will execute on an Android device.

View File

@ -2,6 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="app.fedilab.nitterizeme">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="false"
@ -9,8 +10,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning">
<activity
@ -25,268 +26,337 @@
<activity
android:name=".TransformActivity"
android:theme="@style/Theme.AppCompat.Translucent"
android:noHistory="true">
android:noHistory="true"
android:theme="@style/Theme.AppCompat.Translucent">
<!-- The app should handle these domains, more can be added here -->
<!-- SHORTENED URLs -->
<!-- t.co -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="t.co"
android:pathPattern=".*"/>
<data android:scheme="http"
android:pathPattern=".*"
android:scheme="https" />
<data
android:host="t.co"
android:pathPattern=".*"/>
android:pathPattern=".*"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="t.co" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="t.co"
android:mimeType="text/plain" />
</intent-filter>
<!-- nyti.ms -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="nyti.ms"
android:pathPattern=".*"/>
<data android:scheme="http"
android:pathPattern=".*"
android:scheme="https" />
<data
android:host="nyti.ms"
android:pathPattern=".*"/>
android:pathPattern=".*"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="nyti.ms" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="nyti.ms"
android:mimeType="text/plain" />
</intent-filter>
<!-- bit.ly -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="bit.ly"
android:pathPattern=".*"/>
<data android:scheme="http"
android:pathPattern=".*"
android:scheme="https" />
<data
android:host="bit.ly"
android:pathPattern=".*"/>
android:pathPattern=".*"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="bit.ly" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="bit.ly"
android:mimeType="text/plain" />
</intent-filter>
<!-- tinyurl.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="tinyurl.com"
android:pathPattern=".*"/>
<data android:scheme="http"
android:pathPattern=".*"
android:scheme="https" />
<data
android:host="tinyurl.com"
android:pathPattern=".*"/>
android:pathPattern=".*"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="tinyurl.com" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="tinyurl.com"
android:mimeType="text/plain" />
</intent-filter>
<!-- goo.gl -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="goo.gl"
android:pathPattern=".*"/>
<data android:scheme="http"
android:pathPattern=".*"
android:scheme="https" />
<data
android:host="goo.gl"
android:pathPattern=".*"/>
android:pathPattern=".*"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="goo.gl" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="goo.gl"
android:mimeType="text/plain" />
</intent-filter>
<!-- TWITTER URLs -->
<!-- mobile.twitter.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="mobile.twitter.com"
android:pathPattern=".*"/>
<data android:scheme="http"
android:pathPattern=".*"
android:scheme="https" />
<data
android:host="mobile.twitter.com"
android:pathPattern=".*"/>
android:pathPattern=".*"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="mobile.twitter.com" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="mobile.twitter.com"
android:mimeType="text/plain" />
</intent-filter>
<!-- www.twitter.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="www.twitter.com"
android:pathPattern=".*"/>
<data android:scheme="http"
android:pathPattern=".*"
android:scheme="https" />
<data
android:host="www.twitter.com"
android:pathPattern=".*"/>
android:pathPattern=".*"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="www.twitter.com" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="www.twitter.com"
android:mimeType="text/plain" />
</intent-filter>
<!-- twitter.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="twitter.com"
android:pathPattern=".*"/>
<data android:scheme="http"
android:pathPattern=".*"
android:scheme="https" />
<data
android:host="twitter.com"
android:pathPattern=".*"/>
android:pathPattern=".*"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
<data
android:mimeType="text/plain"
android:host="twitter.com" />
android:host="twitter.com"
android:mimeType="text/plain" />
</intent-filter>
<!-- YOUTUBE URLs -->
<!-- www.youtube.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="www.youtube.com" />
<data android:scheme="http"
android:host="www.youtube.com" />
<data
android:host="www.youtube.com"
android:scheme="https" />
<data
android:host="www.youtube.com"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="www.youtube.com" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="www.youtube.com"
android:mimeType="text/plain" />
</intent-filter>
<!-- m.youtube.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="m.youtube.com" />
<data android:scheme="http"
android:host="m.youtube.com" />
<data
android:host="m.youtube.com"
android:scheme="https" />
<data
android:host="m.youtube.com"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="m.youtube.com" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="m.youtube.com"
android:mimeType="text/plain" />
</intent-filter>
<!-- youtube.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="youtube.com" />
<data android:scheme="http"
android:host="youtube.com" />
<data
android:host="youtube.com"
android:scheme="https" />
<data
android:host="youtube.com"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="youtube.com" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="youtube.com"
android:mimeType="text/plain" />
</intent-filter>
<!-- youtu.be -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="youtu.be" />
<data android:scheme="http"
android:host="youtu.be" />
<data
android:host="youtu.be"
android:scheme="https" />
<data
android:host="youtu.be"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="youtu.be" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="youtu.be"
android:mimeType="text/plain" />
</intent-filter>
<!-- youtube-nocookie.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="youtube-nocookie.com" />
<data android:scheme="http"
android:host="youtube-nocookie.com" />
<data
android:host="youtube-nocookie.com"
android:scheme="https" />
<data
android:host="youtube-nocookie.com"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:host="youtube-nocookie.com" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="youtube-nocookie.com"
android:mimeType="text/plain" />
</intent-filter>
<!-- MAPS URLs -->
<!-- /maps/ -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
<data
android:host="*"
android:pathPattern="/maps/place/.*"
android:host="*" />
<data android:scheme="http"
android:scheme="https" />
<data
android:host="*"
android:pathPattern="/maps/place/.*"
android:host="*" />
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"
android:pathPattern="/maps/place/.*"
android:host="*" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="*"
android:mimeType="text/plain"
android:pathPattern="/maps/place/.*" />
</intent-filter>
</activity>
<activity
android:name=".AboutActivity"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:theme="@style/AppTheme"/>
android:label="@string/app_name"
android:theme="@style/AppTheme" />
</application>
</manifest>

View File

@ -30,11 +30,9 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
public class AboutActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -45,17 +43,18 @@ public class AboutActivity extends AppCompatActivity {
PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
String version = pInfo.versionName;
about_version.setText(getResources().getString(R.string.about_vesrion, version));
} catch (PackageManager.NameNotFoundException ignored) {}
} catch (PackageManager.NameNotFoundException ignored) {
}
setTitle(R.string.about_the_app);
if( getSupportActionBar() != null) {
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
//Developer click for Mastodon account
TextView developer_mastodon = findViewById(R.id.developer_mastodon);
SpannableString content = new SpannableString(developer_mastodon.getText().toString());
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AboutActivity.this,R.color.colorAccent)), 0, content.length(), 0);
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AboutActivity.this, R.color.colorAccent)), 0, content.length(), 0);
developer_mastodon.setText(content);
developer_mastodon.setOnClickListener(v -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://toot.fedilab.app/@fedilab"));
@ -112,7 +111,7 @@ public class AboutActivity extends AppCompatActivity {
TextView license = findViewById(R.id.license);
content = new SpannableString(license.getText().toString());
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AboutActivity.this,R.color.colorAccent)), 0, content.length(), 0);
content.setSpan(new ForegroundColorSpan(ContextCompat.getColor(AboutActivity.this, R.color.colorAccent)), 0, content.length(), 0);
content.setSpan(new UnderlineSpan(), 0, content.length(), 0);
license.setText(content);
license.setOnClickListener(v -> {

View File

@ -27,7 +27,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
@ -57,7 +56,7 @@ public class AppInfoAdapter extends RecyclerView.Adapter {
AppInfo appInfo = appInfos.get(viewHolder.getAdapterPosition());
Context context = holder.itemView.getContext();
holder.domain.setText(appInfo.getDomain());
if( appInfo.getApplicationInfo() != null ) {
if (appInfo.getApplicationInfo() != null) {
Drawable icon = appInfo.getApplicationInfo().loadIcon(context.getPackageManager());
try {
holder.app_icon.setImageDrawable(icon);
@ -65,10 +64,10 @@ public class AppInfoAdapter extends RecyclerView.Adapter {
holder.app_icon.setImageResource(R.drawable.ic_android);
}
holder.information.setText(appInfo.getApplicationInfo().packageName);
if( appInfo.getApplicationInfo().packageName.compareTo(BuildConfig.APPLICATION_ID) == 0 ) {
if (appInfo.getApplicationInfo().packageName.compareTo(BuildConfig.APPLICATION_ID) == 0) {
holder.valid.setImageResource(R.drawable.ic_check);
holder.valid.setContentDescription(context.getString(R.string.valid));
}else {
} else {
holder.valid.setImageResource(R.drawable.ic_error);
holder.valid.setContentDescription(context.getString(R.string.error));
}
@ -78,7 +77,7 @@ public class AppInfoAdapter extends RecyclerView.Adapter {
intent.setData(uri);
context.startActivity(intent);
});
}else{
} else {
holder.information.setText(R.string.no_apps);
holder.app_icon.setImageResource(R.drawable.ic_android);
holder.valid.setContentDescription(context.getString(R.string.warning));
@ -86,8 +85,8 @@ public class AppInfoAdapter extends RecyclerView.Adapter {
holder.main_container.setOnClickListener(v -> {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("nitterizeme","test");
String url = "https://"+appInfo.getDomain();
intent.putExtra("nitterizeme", "test");
String url = "https://" + appInfo.getDomain();
intent.setData(Uri.parse(url));
context.startActivity(intent);
});

View File

@ -13,6 +13,7 @@ package app.fedilab.nitterizeme;
*
* You should have received a copy of the GNU General Public License along with NitterizeMe; if not,
* see <http://www.gnu.org/licenses>. */
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -22,14 +23,6 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SwitchCompat;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.provider.Settings;
import android.view.Menu;
import android.view.MenuItem;
@ -39,43 +32,40 @@ import android.widget.CheckBox;
import android.widget.ImageButton;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SwitchCompat;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;
public class MainActivity extends AppCompatActivity {
public static final String APP_PREFS = "app_prefs";
@SuppressWarnings("unused")
public static String TAG = "NitterizeMe";
public static String SET_NITTER_HOST = "set_nitter_host";
public static String DEFAULT_NITTER_HOST = "nitter.net";
public static String SET_INVIDIOUS_HOST = "set_invidious_host";
public static String DEFAULT_INVIDIOUS_HOST = "invidio.us";
public static String SET_INVIDIOUS_ENABLED = "set_invidious_enabled";
public static String SET_NITTER_ENABLED = "set_nitter_enabled";
public static String SET_OSM_ENABLED = "set_osm_enabled";
public static String SET_OSM_HOST = "set_osm_host";
public static String DEFAULT_OSM_HOST = "www.openstreetmap.org";
public static String SET_GEO_URIS = "set_geo_uris";
public static final String APP_PREFS = "app_prefs";
private AppInfoAdapter appInfoAdapter;
private RecyclerView list_apps;
private String[] domains;
public static String SET_NITTER_HOST = "set_nitter_host";
public static String DEFAULT_NITTER_HOST = "nitter.net";
public static String SET_INVIDIOUS_HOST = "set_invidious_host";
public static String DEFAULT_INVIDIOUS_HOST = "invidio.us";
public static String SET_INVIDIOUS_ENABLED = "set_invidious_enabled";
public static String SET_NITTER_ENABLED = "set_nitter_enabled";
public static String SET_OSM_ENABLED = "set_osm_enabled";
public static String SET_OSM_HOST = "set_osm_host";
public static String DEFAULT_OSM_HOST = "www.openstreetmap.org";
public static String SET_GEO_URIS = "set_geo_uris";
//Supported domains
public static String[] twitter_domains = {
"twitter.com",
"mobile.twitter.com",
"www.twitter.com",
};
public static String[] youtube_domains = {
"www.youtube.com",
"youtube.com",
@ -83,7 +73,6 @@ public class MainActivity extends AppCompatActivity {
"youtu.be",
"youtube-nocookie.com"
};
public static String[] shortener_domains = {
"t.co",
"nyti.ms",
@ -91,6 +80,9 @@ public class MainActivity extends AppCompatActivity {
"tinyurl.com",
"goo.gl",
};
private AppInfoAdapter appInfoAdapter;
private RecyclerView list_apps;
private String[] domains;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -101,17 +93,17 @@ public class MainActivity extends AppCompatActivity {
Objects.requireNonNull(getSupportActionBar()).setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
domains = new String[twitter_domains.length+youtube_domains.length+shortener_domains.length];
domains = new String[twitter_domains.length + youtube_domains.length + shortener_domains.length];
int i = 0;
for(String host: twitter_domains){
for (String host : twitter_domains) {
domains[i] = host;
i++;
}
for(String host: youtube_domains){
for (String host : youtube_domains) {
domains[i] = host;
i++;
}
for(String host: shortener_domains){
for (String host : shortener_domains) {
domains[i] = host;
i++;
}
@ -156,13 +148,13 @@ public class MainActivity extends AppCompatActivity {
editor.apply();
});
if(nitterHost!=null) {
if (nitterHost != null) {
nitter_instance.setText(nitterHost);
}
if(invidiousHost!=null) {
if (invidiousHost != null) {
invidious_instance.setText(invidiousHost);
}
if(osmHost!=null) {
if (osmHost != null) {
osm_instance.setText(osmHost);
}
button_save.setOnClickListener(v -> {
@ -197,20 +189,20 @@ public class MainActivity extends AppCompatActivity {
ImageButton buttonExpand = findViewById(R.id.button_expand);
buttonExpand.setOnClickListener(v -> {
if( list_apps.getVisibility() == View.VISIBLE){
if (list_apps.getVisibility() == View.VISIBLE) {
list_apps.setVisibility(View.GONE);
buttonExpand.setContentDescription(getString(R.string.display_supported_links));
}else{
} else {
list_apps.setVisibility(View.VISIBLE);
buttonExpand.setContentDescription(getString(R.string.hide_supported_links));
}
});
ArrayList<AppInfo> appInfos = new ArrayList<>();
for(String domain: domains) {
for (String domain : domains) {
AppInfo appInfo = new AppInfo();
appInfo.setDomain(domain);
appInfo.setApplicationInfo(getDefaultApp("https://"+domain));
appInfo.setApplicationInfo(getDefaultApp("https://" + domain));
appInfos.add(appInfo);
}
@ -221,10 +213,10 @@ public class MainActivity extends AppCompatActivity {
editor.apply();
TextInputLayout osm_instance_container = findViewById(R.id.osm_instance_container);
TextView osm_indications = findViewById(R.id.osm_indications);
if( isChecked){
if (isChecked) {
osm_instance_container.setVisibility(View.GONE);
osm_indications.setText(R.string.redirect_gm_to_geo_uri);
}else{
} else {
osm_instance_container.setVisibility(View.VISIBLE);
osm_indications.setText(R.string.redirect_gm_to_osm);
}
@ -241,6 +233,7 @@ public class MainActivity extends AppCompatActivity {
/**
* Allow to get info about application that opens the link by default
*
* @param url String url for test
* @return ApplicationInfo info about the application
*/
@ -277,7 +270,7 @@ public class MainActivity extends AppCompatActivity {
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
startActivity(intent);
return true;
}else if(id == android.R.id.home){
} else if (id == android.R.id.home) {
finish();
}
@ -285,14 +278,14 @@ public class MainActivity extends AppCompatActivity {
}
@Override
protected void onResume(){
protected void onResume() {
super.onResume();
if( list_apps != null) {
if (list_apps != null) {
ArrayList<AppInfo> appInfos = new ArrayList<>();
for(String domain: domains) {
for (String domain : domains) {
AppInfo appInfo = new AppInfo();
appInfo.setDomain(domain);
appInfo.setApplicationInfo(getDefaultApp("https://"+domain));
appInfo.setApplicationInfo(getDefaultApp("https://" + domain));
appInfos.add(appInfo);
}
appInfoAdapter = new AppInfoAdapter(appInfos);

View File

@ -13,6 +13,7 @@ package app.fedilab.nitterizeme;
*
* You should have received a copy of the GNU General Public License along with NitterizeMe; if not,
* see <http://www.gnu.org/licenses>. */
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
@ -32,7 +33,6 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import java.net.MalformedURLException;
@ -54,27 +54,28 @@ import static app.fedilab.nitterizeme.MainActivity.youtube_domains;
public class TransformActivity extends Activity {
private Thread thread;
private ArrayList<String> notShortnedURLDialog;
final Pattern youtubePattern = Pattern.compile("(www\\.|m\\.)?(youtube\\.com|youtu\\.be|youtube-nocookie\\.com)/(((?!([\"'<])).)*)");
final Pattern nitterPattern = Pattern.compile("(mobile\\.|www\\.)?twitter.com([\\w-/]+)");
final Pattern maps = Pattern.compile("/maps/place/[^@]+@([\\d.,z]{3,}).*");
final Pattern extractPlace = Pattern.compile("/maps/place/(((?!/data).)*)");
final Pattern extractPlace = Pattern.compile("/maps/place/(((?!/data).)*)");
private Thread thread;
private ArrayList<String> notShortnedURLDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sharedpreferences = getSharedPreferences(MainActivity.APP_PREFS, Context.MODE_PRIVATE);
Intent intent = getIntent();
if( intent != null && intent.getStringExtra("nitterizeme") != null ) {
if (intent != null && intent.getStringExtra("nitterizeme") != null) {
finish();
return;
}
notShortnedURLDialog = new ArrayList<>();
assert intent != null;
//Dealing with URLs
if( Objects.requireNonNull(intent.getAction()).equals(Intent.ACTION_VIEW)){
if (Objects.requireNonNull(intent.getAction()).equals(Intent.ACTION_VIEW)) {
String url = Objects.requireNonNull(intent.getData()).toString();
String url = Objects.requireNonNull(intent.getData()).toString();
URL url_;
String host = null;
try {
@ -84,7 +85,7 @@ public class TransformActivity extends Activity {
e.printStackTrace();
}
//Shortened URLs
if( Arrays.asList(shortener_domains).contains(host)) {
if (Arrays.asList(shortener_domains).contains(host)) {
AlertDialog.Builder unshortenAlertBuilder = new AlertDialog.Builder(TransformActivity.this);
unshortenAlertBuilder.setTitle(R.string.shortened_detected);
@ -92,27 +93,27 @@ public class TransformActivity extends Activity {
unshortenAlertBuilder.setView(view);
unshortenAlertBuilder.setIcon(R.mipmap.ic_launcher);
unshortenAlertBuilder.setPositiveButton(R.string.open, (dialog, id) -> {
if( notShortnedURLDialog.size() > 0){
if (notShortnedURLDialog.size() > 0) {
URL url_1;
String realHost = null;
try {
url_1 = new URL(notShortnedURLDialog.get(notShortnedURLDialog.size()-1));
url_1 = new URL(notShortnedURLDialog.get(notShortnedURLDialog.size() - 1));
realHost = url_1.getHost();
} catch (MalformedURLException e) {
e.printStackTrace();
}
if( Arrays.asList(twitter_domains).contains(realHost)) {
if (Arrays.asList(twitter_domains).contains(realHost)) {
boolean nitter_enabled = sharedpreferences.getBoolean(SET_NITTER_ENABLED, true);
if(nitter_enabled) {
if (nitter_enabled) {
Intent delegate = new Intent(Intent.ACTION_VIEW);
String transformedURL = transformUrl(url);
if( transformedURL != null) {
if (transformedURL != null) {
delegate.setData(Uri.parse(transformUrl(url)));
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (delegate.resolveActivity(getPackageManager()) != null) {
startActivity(delegate);
}
}else{
} else {
forwardToBrowser(intent);
}
} else {
@ -120,18 +121,18 @@ public class TransformActivity extends Activity {
}
}
//Maps URLs (containing /maps/place like Google Maps links)
else if( url.contains("/maps/place")) {
else if (url.contains("/maps/place")) {
boolean osm_enabled = sharedpreferences.getBoolean(MainActivity.SET_OSM_ENABLED, true);
if(osm_enabled) {
if (osm_enabled) {
Intent delegate = new Intent(Intent.ACTION_VIEW);
String transformedURL = transformUrl(url);
if( transformedURL != null) {
if (transformedURL != null) {
delegate.setData(Uri.parse(transformUrl(url)));
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (delegate.resolveActivity(getPackageManager()) != null) {
startActivity(delegate);
}
}else {
} else {
forwardToBrowser(intent);
}
} else {
@ -139,26 +140,26 @@ public class TransformActivity extends Activity {
}
}
//YouTube URLs
else if(Arrays.asList(youtube_domains).contains(realHost)){ //Youtube URL
else if (Arrays.asList(youtube_domains).contains(realHost)) { //Youtube URL
boolean invidious_enabled = sharedpreferences.getBoolean(SET_INVIDIOUS_ENABLED, true);
if( invidious_enabled) {
if (invidious_enabled) {
Intent delegate = new Intent(Intent.ACTION_VIEW);
String transformedURL = transformUrl(url);
if( transformedURL != null) {
if (transformedURL != null) {
delegate.setData(Uri.parse(transformUrl(url)));
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (delegate.resolveActivity(getPackageManager()) != null) {
startActivity(delegate);
}
}else {
} else {
forwardToBrowser(intent);
}
}else{
} else {
forwardToBrowser(intent);
}
}else {
} else {
Intent delegate = new Intent(Intent.ACTION_VIEW);
delegate.setData(Uri.parse(notShortnedURLDialog.get(notShortnedURLDialog.size()-1)));
delegate.setData(Uri.parse(notShortnedURLDialog.get(notShortnedURLDialog.size() - 1)));
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (delegate.resolveActivity(getPackageManager()) != null) {
startActivity(delegate);
@ -186,12 +187,12 @@ public class TransformActivity extends Activity {
Runnable myRunnable = () -> {
positiveButton.setEnabled(true);
StringBuilder message;
if( notShortnedURLDialog.size() <= 1 ) {
if (notShortnedURLDialog.size() <= 1) {
message = new StringBuilder(getString(R.string.the_app_failed_shortened));
}else {
} else {
message = new StringBuilder(getString(R.string.try_to_redirect, notShortnedURLDialog.get(0), notShortnedURLDialog.get(1)));
if( notShortnedURLDialog.size() > 2 ){
for(int i=2 ; i < notShortnedURLDialog.size(); i++){
if (notShortnedURLDialog.size() > 2) {
for (int i = 2; i < notShortnedURLDialog.size(); i++) {
message.append("\n\n").append(getString(R.string.try_to_redirect_again, notShortnedURLDialog.get(i)));
}
}
@ -208,18 +209,18 @@ public class TransformActivity extends Activity {
thread.start();
}
//Twitter URLs
else if( Arrays.asList(twitter_domains).contains(host)) {
else if (Arrays.asList(twitter_domains).contains(host)) {
boolean nitter_enabled = sharedpreferences.getBoolean(SET_NITTER_ENABLED, true);
if(nitter_enabled) {
if (nitter_enabled) {
Intent delegate = new Intent(Intent.ACTION_VIEW);
String transformedURL = transformUrl(url);
if( transformedURL != null) {
if (transformedURL != null) {
delegate.setData(Uri.parse(transformUrl(url)));
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (delegate.resolveActivity(getPackageManager()) != null) {
startActivity(delegate);
}
}else{
} else {
forwardToBrowser(intent);
}
} else {
@ -227,18 +228,18 @@ public class TransformActivity extends Activity {
}
}
//Maps URLs (containing /maps/place like Google Maps links)
else if( url.contains("/maps/place")) {
else if (url.contains("/maps/place")) {
boolean osm_enabled = sharedpreferences.getBoolean(MainActivity.SET_OSM_ENABLED, true);
if(osm_enabled) {
if (osm_enabled) {
Intent delegate = new Intent(Intent.ACTION_VIEW);
String transformedURL = transformUrl(url);
if( transformedURL != null) {
if (transformedURL != null) {
delegate.setData(Uri.parse(transformUrl(url)));
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (delegate.resolveActivity(getPackageManager()) != null) {
startActivity(delegate);
}
}else {
} else {
forwardToBrowser(intent);
}
} else {
@ -246,35 +247,35 @@ public class TransformActivity extends Activity {
}
}
//YouTube URLs
else if(Arrays.asList(youtube_domains).contains(host)){ //Youtube URL
else if (Arrays.asList(youtube_domains).contains(host)) { //Youtube URL
boolean invidious_enabled = sharedpreferences.getBoolean(SET_INVIDIOUS_ENABLED, true);
if( invidious_enabled) {
if (invidious_enabled) {
Intent delegate = new Intent(Intent.ACTION_VIEW);
String transformedURL = transformUrl(url);
if( transformedURL != null) {
if (transformedURL != null) {
delegate.setData(Uri.parse(transformUrl(url)));
delegate.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (delegate.resolveActivity(getPackageManager()) != null) {
startActivity(delegate);
}
}else {
} else {
forwardToBrowser(intent);
}
}else{
} else {
forwardToBrowser(intent);
}
}
}
//It's a sharing intent
else if( Objects.requireNonNull(intent.getAction()).equals(Intent.ACTION_SEND)){
else if (Objects.requireNonNull(intent.getAction()).equals(Intent.ACTION_SEND)) {
share(intent.getStringExtra(Intent.EXTRA_TEXT));
}
}
@Override
protected void onDestroy(){
if( thread != null && thread.isAlive()){
protected void onDestroy() {
if (thread != null && thread.isAlive()) {
thread.interrupt();
}
super.onDestroy();
@ -282,6 +283,7 @@ public class TransformActivity extends Activity {
/**
* Forward the intent to a browser
*
* @param i original intent
*/
private void forwardToBrowser(Intent i) {
@ -314,6 +316,7 @@ public class TransformActivity extends Activity {
/**
* Transform the URL to a Nitter, Invidious or OSM ones
*
* @param url String original URL
* @return String transformed URL
*/
@ -329,9 +332,9 @@ public class TransformActivity extends Activity {
} catch (MalformedURLException e) {
e.printStackTrace();
}
if(Arrays.asList(twitter_domains).contains(host)) {
if (Arrays.asList(twitter_domains).contains(host)) {
boolean nitter_enabled = sharedpreferences.getBoolean(SET_NITTER_ENABLED, true);
if(nitter_enabled) {
if (nitter_enabled) {
Matcher matcher = nitterPattern.matcher(url);
while (matcher.find()) {
final String nitter_directory = matcher.group(2);
@ -342,46 +345,46 @@ public class TransformActivity extends Activity {
} else {
return url;
}
}else if( url.contains("/maps/place")) {
} else if (url.contains("/maps/place")) {
boolean osm_enabled = sharedpreferences.getBoolean(MainActivity.SET_OSM_ENABLED, true);
if(osm_enabled) {
if (osm_enabled) {
Matcher matcher = maps.matcher(url);
while (matcher.find()) {
final String localization = matcher.group(1);
assert localization != null;
String[] data = localization.split(",");
if( data.length > 2 ){
if (data.length > 2) {
String zoom;
String[] details = data[2].split("\\.");
if( details.length > 0 ) {
if (details.length > 0) {
zoom = details[0];
}else {
} else {
zoom = data[2];
}
String osmHost = sharedpreferences.getString(MainActivity.SET_OSM_HOST, MainActivity.DEFAULT_OSM_HOST).toLowerCase();
boolean geo_uri_enabled = sharedpreferences.getBoolean(MainActivity.SET_GEO_URIS, false);
if(! geo_uri_enabled) {
if (!geo_uri_enabled) {
newUrl = "https://" + osmHost + "/#map=" + zoom + "/" + data[0] + "/" + data[1];
}else{
newUrl = "geo:0,0?q="+data[0]+","+data[1]+",z="+zoom;
} else {
newUrl = "geo:0,0?q=" + data[0] + "," + data[1] + ",z=" + zoom;
}
}
}
if( newUrl == null && url.contains("/data=")) {
if (newUrl == null && url.contains("/data=")) {
matcher = extractPlace.matcher(url);
while (matcher.find()) {
final String search = matcher.group(1);
newUrl = "geo:0,0?q="+search;
newUrl = "geo:0,0?q=" + search;
}
}
return newUrl;
} else {
return url;
}
}else if(Arrays.asList(youtube_domains).contains(host)){ //Youtube URL
} else if (Arrays.asList(youtube_domains).contains(host)) { //Youtube URL
boolean invidious_enabled = sharedpreferences.getBoolean(SET_INVIDIOUS_ENABLED, true);
if( invidious_enabled) {
if (invidious_enabled) {
Matcher matcher = youtubePattern.matcher(url);
while (matcher.find()) {
final String youtubeId = matcher.group(3);
@ -393,7 +396,7 @@ public class TransformActivity extends Activity {
}
}
return newUrl;
}else{
} else {
return url;
}
}
@ -403,6 +406,7 @@ public class TransformActivity extends Activity {
/**
* Transform URL inside the shared content without modifying the whole content
*
* @param extraText String the new extra text
*/
private void share(String extraText) {
@ -432,7 +436,7 @@ public class TransformActivity extends Activity {
e.printStackTrace();
}
String newUrl = null;
if( url == null){
if (url == null) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, extraText);
@ -441,9 +445,9 @@ public class TransformActivity extends Activity {
return;
}
if( Arrays.asList(twitter_domains).contains(host) ) {
if (Arrays.asList(twitter_domains).contains(host)) {
boolean nitter_enabled = sharedpreferences.getBoolean(SET_NITTER_ENABLED, true);
if(nitter_enabled) {
if (nitter_enabled) {
Matcher matcher = nitterPattern.matcher(url);
while (matcher.find()) {
final String nitter_directory = matcher.group(2);
@ -451,30 +455,30 @@ public class TransformActivity extends Activity {
newUrl = "https://" + nitterHost + nitter_directory;
}
}
}else if( url.contains("/maps/place/")) {
} else if (url.contains("/maps/place/")) {
boolean osm_enabled = sharedpreferences.getBoolean(MainActivity.SET_OSM_ENABLED, true);
if(osm_enabled) {
if (osm_enabled) {
Matcher matcher = maps.matcher(url);
while (matcher.find()) {
final String localization = matcher.group(1);
assert localization != null;
String[] data = localization.split(",");
if( data.length > 2 ){
if (data.length > 2) {
String zoom;
String[] details = data[2].split("\\.");
if( details.length > 0 ) {
if (details.length > 0) {
zoom = details[0];
}else {
} else {
zoom = data[2];
}
String osmHost = sharedpreferences.getString(MainActivity.SET_OSM_HOST, MainActivity.DEFAULT_OSM_HOST).toLowerCase();
newUrl = "https://"+osmHost+"/#map="+zoom+"/"+data[0]+"/"+data[1];
newUrl = "https://" + osmHost + "/#map=" + zoom + "/" + data[0] + "/" + data[1];
}
}
}
}else if(Arrays.asList(youtube_domains).contains(host)){ //Youtube URL
} else if (Arrays.asList(youtube_domains).contains(host)) { //Youtube URL
boolean invidious_enabled = sharedpreferences.getBoolean(SET_INVIDIOUS_ENABLED, true);
if( invidious_enabled) {
if (invidious_enabled) {
Matcher matcher = youtubePattern.matcher(url);
while (matcher.find()) {
final String youtubeId = matcher.group(3);
@ -486,8 +490,7 @@ public class TransformActivity extends Activity {
}
}
}
}
else if(Arrays.asList(shortener_domains).contains(host)) {
} else if (Arrays.asList(shortener_domains).contains(host)) {
String finalUrl = url;
String finalExtraText = extraText;
Thread thread = new Thread() {
@ -499,7 +502,7 @@ public class TransformActivity extends Activity {
URL url_;
String host = null;
try {
url_ = new URL(notShortnedURLDialog.get(notShortnedURLDialog.size()-1));
url_ = new URL(notShortnedURLDialog.get(notShortnedURLDialog.size() - 1));
host = url_.getHost();
} catch (MalformedURLException e) {
e.printStackTrace();
@ -508,9 +511,9 @@ public class TransformActivity extends Activity {
boolean nitter_enabled = sharedpreferences.getBoolean(SET_NITTER_ENABLED, true);
boolean invidious_enabled = sharedpreferences.getBoolean(SET_INVIDIOUS_ENABLED, true);
boolean osm_enabled = sharedpreferences.getBoolean(MainActivity.SET_OSM_ENABLED, true);
if(nitter_enabled && Arrays.asList(twitter_domains).contains(host)) {
Matcher matcher = nitterPattern.matcher(notShortnedURLDialog.get(notShortnedURLDialog.size()-1));
String newUrlFinal = notShortnedURLDialog.get(notShortnedURLDialog.size()-1);
if (nitter_enabled && Arrays.asList(twitter_domains).contains(host)) {
Matcher matcher = nitterPattern.matcher(notShortnedURLDialog.get(notShortnedURLDialog.size() - 1));
String newUrlFinal = notShortnedURLDialog.get(notShortnedURLDialog.size() - 1);
while (matcher.find()) {
final String nitter_directory = matcher.group(2);
String nitterHost = sharedpreferences.getString(MainActivity.SET_NITTER_HOST, MainActivity.DEFAULT_NITTER_HOST).toLowerCase();
@ -522,9 +525,9 @@ public class TransformActivity extends Activity {
sendIntent.putExtra(Intent.EXTRA_TEXT, newExtraText);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}else if( invidious_enabled && Arrays.asList(youtube_domains).contains(host)) {
Matcher matcher = youtubePattern.matcher(notShortnedURLDialog.get(notShortnedURLDialog.size()-1));
String newUrlFinal = notShortnedURLDialog.get(notShortnedURLDialog.size()-1);
} else if (invidious_enabled && Arrays.asList(youtube_domains).contains(host)) {
Matcher matcher = youtubePattern.matcher(notShortnedURLDialog.get(notShortnedURLDialog.size() - 1));
String newUrlFinal = notShortnedURLDialog.get(notShortnedURLDialog.size() - 1);
while (matcher.find()) {
final String youtubeId = matcher.group(3);
String invidiousHost = sharedpreferences.getString(MainActivity.SET_INVIDIOUS_HOST, MainActivity.DEFAULT_INVIDIOUS_HOST).toLowerCase();
@ -540,23 +543,23 @@ public class TransformActivity extends Activity {
sendIntent.putExtra(Intent.EXTRA_TEXT, newExtraText);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}else if( osm_enabled && notShortnedURLDialog.get(notShortnedURLDialog.size()-1).contains("/maps/place/")) {
String newUrlFinal = notShortnedURLDialog.get(notShortnedURLDialog.size()-1);
Matcher matcher = maps.matcher(notShortnedURLDialog.get(notShortnedURLDialog.size()-1));
} else if (osm_enabled && notShortnedURLDialog.get(notShortnedURLDialog.size() - 1).contains("/maps/place/")) {
String newUrlFinal = notShortnedURLDialog.get(notShortnedURLDialog.size() - 1);
Matcher matcher = maps.matcher(notShortnedURLDialog.get(notShortnedURLDialog.size() - 1));
while (matcher.find()) {
final String localization = matcher.group(1);
assert localization != null;
String[] data = localization.split(",");
if( data.length > 2 ){
if (data.length > 2) {
String zoom;
String[] details = data[2].split("\\.");
if( details.length > 0 ) {
if (details.length > 0) {
zoom = details[0];
}else {
} else {
zoom = data[2];
}
String osmHost = sharedpreferences.getString(MainActivity.SET_OSM_HOST, MainActivity.DEFAULT_OSM_HOST).toLowerCase();
newUrlFinal = "https://"+osmHost+"/#map="+zoom+"/"+data[0]+"/"+data[1];
newUrlFinal = "https://" + osmHost + "/#map=" + zoom + "/" + data[0] + "/" + data[1];
}
}
String newExtraText = finalExtraText.replaceAll(Pattern.quote(finalUrl), Matcher.quoteReplacement(newUrlFinal));
@ -565,8 +568,8 @@ public class TransformActivity extends Activity {
sendIntent.putExtra(Intent.EXTRA_TEXT, newExtraText);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}else{
String newExtraText = finalExtraText.replaceAll(Pattern.quote(finalUrl), Matcher.quoteReplacement(notShortnedURLDialog.get(notShortnedURLDialog.size()-1)));
} else {
String newExtraText = finalExtraText.replaceAll(Pattern.quote(finalUrl), Matcher.quoteReplacement(notShortnedURLDialog.get(notShortnedURLDialog.size() - 1)));
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, newExtraText);
@ -578,7 +581,7 @@ public class TransformActivity extends Activity {
thread.start();
return;
}
if( newUrl != null) {
if (newUrl != null) {
extraText = extraText.replaceAll(Pattern.quote(url), Matcher.quoteReplacement(newUrl));
}
Intent sendIntent = new Intent();

View File

@ -36,16 +36,17 @@ class Utils {
/**
* Returns the unshortened URL
* @param urls ArrayList<String> URL to check
*
* @param urls ArrayList<String> URL to check
*/
static void checkUrl(ArrayList<String> urls){
static void checkUrl(ArrayList<String> urls) {
URL url;
String newURL = null;
String comingURl;
try {
comingURl = urls.get(urls.size()-1);
comingURl = urls.get(urls.size() - 1);
if( comingURl.startsWith("http://")){
if (comingURl.startsWith("http://")) {
comingURl = comingURl.replace("http://", "https://");
}
url = new URL(comingURl);
@ -53,7 +54,7 @@ class Utils {
httpsURLConnection.setRequestProperty("http.keepAlive", "false");
httpsURLConnection.setInstanceFollowRedirects(false);
httpsURLConnection.setRequestMethod("HEAD");
if( httpsURLConnection.getResponseCode() == 301) {
if (httpsURLConnection.getResponseCode() == 301) {
Map<String, List<String>> map = httpsURLConnection.getHeaderFields();
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
if (entry.toString().toLowerCase().startsWith("location")) {
@ -66,12 +67,12 @@ class Utils {
}
}
httpsURLConnection.getInputStream().close();
if (newURL != null && newURL.compareTo(comingURl)!=0){
if (newURL != null && newURL.compareTo(comingURl) != 0) {
URL redirectURL = new URL(newURL);
String host = redirectURL.getHost();
String protocol = redirectURL.getProtocol();
if( protocol != null && host != null){
if( Arrays.asList(shortener_domains).contains(host)) {
if (protocol != null && host != null) {
if (Arrays.asList(shortener_domains).contains(host)) {
checkUrl(urls);
}
}

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#78909C"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#78909C"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z" />
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#388E3C"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#388E3C"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M9,16.17L4.83,12l-1.42,1.41L9,19 21,7l-1.41,-1.41z" />
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#E64A19"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#E64A19"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z" />
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,8l-6,6 1.41,1.41L12,10.83l4.59,4.58L18,14z" />
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M16.59,8.59L12,13.17 7.41,8.59 6,10l6,6 6,-6z" />
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z" />
</vector>

View File

@ -3,55 +3,56 @@
android:height="108dp"
android:viewportWidth="461.9709"
android:viewportHeight="461.9709">
<group android:translateX="85.464615"
android:translateY="85.464615">
<path
android:pathData="m225.488,243.526l-28.999,0c0,-21.664 0.127,-24.35 0.127,-38.663L196.617,58.066l28.871,26.326z"
android:strokeWidth="0.26458332"
android:fillColor="#fe1f17"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="m196.49,243.526 l-54.216,-68.404 18.2,-15.716 36.143,45.456c0,11.176 -0.127,18.188 -0.127,38.663z"
android:strokeWidth="0.22750032"
android:fillColor="#cf0601"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="m68.91,58.019l28.999,-0c-0,21.664 -0.127,24.35 -0.127,38.663L97.782,243.479l-28.871,-0z"
android:strokeWidth="0.26458332"
android:fillColor="#1da1f2"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="m134.425,113.04 l19.502,-15.28 0.048,51.744 -50.231,-12.423 19.502,-15.28c7.634,-6.107 6.069,-4.756 11.18,-8.76z"
android:strokeWidth="0.17480077"
android:fillColor="#0b6daa"
android:fillAlpha="1"/>
<path
android:pathData="m97.909,58.019 l54.216,68.403 -18.2,15.716 -36.143,-45.456c0,-11.176 0.127,-18.188 0.127,-38.663z"
android:strokeWidth="0.22750032"
android:fillColor="#0b6daa"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="m97.909,58.018c-12.376,-8.427 -37.795,-7.915 -45.772,-17.703 -1.389,2.391 -2.19,5.168 -2.19,8.131 0,5.612 4.459,12.438 8.802,15.336 -2.654,-0.082 -5.147,-0.811 -7.326,-2.023 -0.002,0.068 -0.002,0.134 -0.002,0.207 0,7.834 5.576,14.375 12.978,15.858 -1.359,0.371 -2.79,0.569 -4.266,0.569 -1.041,0 -2.055,-0.102 -3.04,-0.292 2.059,6.428 3.488,10.036 15.112,11.236"
android:fillColor="#1da1f2"
android:strokeColor="#00000000"
android:fillType="nonZero"
android:fillAlpha="1"/>
<path
android:pathData="m156.399,187.204 l-19.502,15.28 -0.048,-51.744 50.231,12.424 -19.502,15.28c-7.634,6.107 -6.069,4.756 -11.18,8.76z"
android:strokeAlpha="1"
android:strokeWidth="1.47500002"
android:fillColor="#cf0601"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
<path
android:pathData="M196.617,115.009L196.617,58.066l28.871,26.192z"
android:strokeWidth="0.26458332"
android:fillColor="#ffffff"
android:strokeColor="#00000000"
android:fillAlpha="1"/>
</group>
<group
android:translateX="85.464615"
android:translateY="85.464615">
<path
android:fillAlpha="1"
android:fillColor="#fe1f17"
android:pathData="m225.488,243.526l-28.999,0c0,-21.664 0.127,-24.35 0.127,-38.663L196.617,58.066l28.871,26.326z"
android:strokeWidth="0.26458332"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#cf0601"
android:pathData="m196.49,243.526 l-54.216,-68.404 18.2,-15.716 36.143,45.456c0,11.176 -0.127,18.188 -0.127,38.663z"
android:strokeWidth="0.22750032"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#1da1f2"
android:pathData="m68.91,58.019l28.999,-0c-0,21.664 -0.127,24.35 -0.127,38.663L97.782,243.479l-28.871,-0z"
android:strokeWidth="0.26458332"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#0b6daa"
android:pathData="m134.425,113.04 l19.502,-15.28 0.048,51.744 -50.231,-12.423 19.502,-15.28c7.634,-6.107 6.069,-4.756 11.18,-8.76z"
android:strokeWidth="0.17480077" />
<path
android:fillAlpha="1"
android:fillColor="#0b6daa"
android:pathData="m97.909,58.019 l54.216,68.403 -18.2,15.716 -36.143,-45.456c0,-11.176 0.127,-18.188 0.127,-38.663z"
android:strokeWidth="0.22750032"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#1da1f2"
android:fillType="nonZero"
android:pathData="m97.909,58.018c-12.376,-8.427 -37.795,-7.915 -45.772,-17.703 -1.389,2.391 -2.19,5.168 -2.19,8.131 0,5.612 4.459,12.438 8.802,15.336 -2.654,-0.082 -5.147,-0.811 -7.326,-2.023 -0.002,0.068 -0.002,0.134 -0.002,0.207 0,7.834 5.576,14.375 12.978,15.858 -1.359,0.371 -2.79,0.569 -4.266,0.569 -1.041,0 -2.055,-0.102 -3.04,-0.292 2.059,6.428 3.488,10.036 15.112,11.236"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#cf0601"
android:pathData="m156.399,187.204 l-19.502,15.28 -0.048,-51.744 50.231,12.424 -19.502,15.28c-7.634,6.107 -6.069,4.756 -11.18,8.76z"
android:strokeWidth="1.47500002"
android:strokeAlpha="1"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#ffffff"
android:pathData="M196.617,115.009L196.617,58.066l28.871,26.192z"
android:strokeWidth="0.26458332"
android:strokeColor="#00000000" />
</group>
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z" />
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0 -0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6 -0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5 -0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4 0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8 2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6 0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5,0.5 0,0 0,0.5 0.4h3.8a0.5,0.5 0,0 0,0.5 -0.4l0.3,-2.6a5.6,5.6 0,0 0,1.7 -0.9l2.4,1a0.4,0.4 0,0 0,0.5 -0.2l2,-3.4c0.1,-0.2 0,-0.4 -0.2,-0.6ZM12,15.6A3.6,3.6 0,1 1,15.6 12,3.6 3.6,0 0,1 12,15.6Z" />
</vector>

View File

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FBC02D"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M1,21h22L12,2 1,21zM13,18h-2v-2h2v2zM13,14h-2v-4h2v4z"/>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#FBC02D"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M1,21h22L12,2 1,21zM13,18h-2v-2h2v2zM13,14h-2v-4h2v4z" />
</vector>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
/* Copyright 2020 Thomas Schneider
*
* This file is a part of NitterizeMe
@ -17,69 +16,73 @@
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_layout"
android:scrollbars="none"
android:layout_margin="@dimen/fab_margin"
android:scrollbars="none"
tools:context=".AboutActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_marginTop="10dp"
android:textSize="20sp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="@string/app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_marginTop="10dp"
android:id="@+id/about_version"
android:textSize="16sp"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_margin="5dp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:text="@string/app_name"
android:textSize="20sp" />
<TextView
android:id="@+id/about_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:textSize="16sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:gravity="center"
android:text="@string/developer"
/>
android:textStyle="bold" />
<!-- Developer info -->
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp">
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<LinearLayout
android:padding="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal"
android:baselineAligned="false">
android:padding="5dp">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
tools:ignore="UseCompoundDrawables">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="tom79"
android:textSize="16sp"
tools:ignore="HardcodedText" />
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
@ -89,45 +92,50 @@
<LinearLayout
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical">
<TextView
android:textSize="16sp"
android:id="@+id/developer_mastodon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="\@fedilab@toot.fedilab.org"
android:textSize="16sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<LinearLayout
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:textSize="16sp"
android:id="@+id/framagit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Framagit"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:ignore="HardcodedText" />
<TextView
android:textSize="16sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/github"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Github"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:ignore="HardcodedText" />
<TextView
android:textSize="16sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/codeberg"
android:text="Codeberg"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Codeberg"
android:textSize="16sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
@ -138,38 +146,39 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/Donate"/>
android:text="@string/Donate" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal">
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:textColor="@android:color/white"
android:layout_marginTop="10dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Paypal"
android:id="@+id/donate_paypal"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
tools:ignore="HardcodedText"
/>
<Button
android:id="@+id/donate_paypal"
style="@style/Widget.AppCompat.Button.Colored"
android:textColor="@android:color/white"
android:layout_marginTop="10dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Liberapay"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="Paypal"
android:textColor="@android:color/white"
tools:ignore="HardcodedText" />
<Button
android:id="@+id/donate_liberapay"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="Liberapay"
android:textColor="@android:color/white"
tools:ignore="HardcodedText" />
</LinearLayout>
@ -181,104 +190,105 @@
tools:ignore="HardcodedText" />
<Button
android:id="@+id/how_to"
style="@style/Widget.AppCompat.Button.Colored"
android:textColor="@android:color/white"
android:layout_marginTop="10dp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/how_to"
android:paddingRight="30dp"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:paddingLeft="30dp"
android:id="@+id/how_to"
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="20dp"
/>
android:paddingStart="30dp"
android:paddingLeft="30dp"
android:paddingEnd="30dp"
android:paddingRight="30dp"
android:text="@string/how_to"
android:textColor="@android:color/white" />
<!-- About the app -->
<TextView
android:layout_margin="10dp"
android:textStyle="bold"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center"
android:text="@string/about_the_app"
/>
android:textSize="16sp"
android:textStyle="bold" />
<!-- Code info -->
<LinearLayout
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/source_code"
/>
android:text="@string/source_code" />
<TextView
android:layout_marginStart="5dp"
android:id="@+id/source_code"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_weight="3"
android:autoLink="web"
android:text="https://framagit.org/tom79/nitterizeme"
tools:ignore="HardcodedText"
android:layout_marginLeft="5dp" />
tools:ignore="HardcodedText" />
</LinearLayout>
<!-- Support info -->
<LinearLayout
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/issue_tracker"
/>
android:text="@string/issue_tracker" />
<TextView
android:layout_marginStart="5dp"
android:id="@+id/issue_tracker"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_weight="3"
android:autoLink="web"
android:text="https://framagit.org/tom79/nitterizeme/issues"
tools:ignore="HardcodedText"
android:layout_marginLeft="5dp" />
tools:ignore="HardcodedText" />
</LinearLayout>
<!-- License info -->
<LinearLayout
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/license"
/>
android:text="@string/license" />
<TextView
android:layout_marginStart="5dp"
android:id="@+id/license"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_weight="3"
android:text="GPL3"
tools:ignore="HardcodedText"
android:layout_marginLeft="5dp" />
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
/* Copyright 2020 Thomas Schneider
*
* This file is a part of NitterizeMe

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<?xml version="1.0" encoding="utf-8"?><!--
/* Copyright 2020 Thomas Schneider
*
* This file is a part of NitterizeMe
@ -21,49 +20,51 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="@layout/activity_main"
android:scrollbars="none"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/fab_margin"
android:animateLayoutChanges="true"
>
android:animateLayoutChanges="true">
<TextView
android:id="@+id/introduction"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/nitter_indications"
android:layout_marginTop="30dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/introduction"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/nitter_indications"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="@string/redirect_twitter_to_nitter"
/>
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/introduction" />
<LinearLayout
android:id="@+id/nitter_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/nitter_indications"
android:orientation="horizontal">
app:layout_constraintTop_toBottomOf="@+id/nitter_indications">
<com.google.android.material.textfield.TextInputLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
>
android:layout_weight="1">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/nitter_instance"
android:layout_width="match_parent"
@ -72,37 +73,40 @@
android:inputType="textUri"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.SwitchCompat
android:layout_margin="5dp"
android:layout_gravity="center"
android:id="@+id/enable_nitter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/enable_nitter"/>
android:layout_gravity="center"
android:layout_margin="5dp" />
</LinearLayout>
<TextView
android:id="@+id/invidious_indications"
android:layout_marginTop="30dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="@string/redirect_youtube_to_invidious"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/nitter_container"
android:text="@string/redirect_youtube_to_invidious"
/>
app:layout_constraintTop_toBottomOf="@+id/nitter_container" />
<LinearLayout
android:id="@+id/invidious_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/invidious_indications"
android:orientation="horizontal">
app:layout_constraintTop_toBottomOf="@+id/invidious_indications">
<com.google.android.material.textfield.TextInputLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_weight="1">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/invidious_instance"
android:layout_width="match_parent"
@ -111,44 +115,47 @@
android:inputType="textUri"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.SwitchCompat
android:layout_margin="5dp"
android:layout_gravity="center"
android:id="@+id/enable_invidious"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/enable_invidious"/>
android:layout_gravity="center"
android:layout_margin="5dp" />
</LinearLayout>
<TextView
android:id="@+id/osm_indications"
android:layout_marginTop="30dp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:text="@string/redirect_gm_to_osm"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/invidious_container"
android:text="@string/redirect_gm_to_osm"
/>
app:layout_constraintTop_toBottomOf="@+id/invidious_container" />
<LinearLayout
android:layout_marginTop="5dp"
android:id="@+id/osm_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/osm_indications"
android:orientation="horizontal">
app:layout_constraintTop_toBottomOf="@+id/osm_indications">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/osm_instance_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/osm_instance"
android:layout_width="match_parent"
@ -157,82 +164,83 @@
android:inputType="textUri"
android:maxLines="1" />
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:text="@string/use_geo_uri"
android:layout_gravity="center"
android:id="@+id/enable_geo_uris"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/enable_geo_uris"/>
android:layout_gravity="center"
android:text="@string/use_geo_uri" />
</LinearLayout>
<androidx.appcompat.widget.SwitchCompat
android:layout_margin="5dp"
android:layout_gravity="center"
android:id="@+id/enable_osm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/enable_osm"/>
android:layout_gravity="center"
android:layout_margin="5dp" />
</LinearLayout>
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:textColor="@android:color/white"
android:id="@+id/configure"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:drawableStart="@drawable/ic_settings"
android:drawableLeft="@drawable/ic_settings"
android:drawablePadding="5dp"
android:drawablePadding="5dp"
android:text="@string/configure"
android:textColor="@android:color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/button_save"
app:layout_constraintTop_toBottomOf="@+id/osm_container"
android:text="@string/configure"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
app:layout_constraintTop_toBottomOf="@+id/osm_container" />
<Button
style="@style/Widget.AppCompat.Button.Colored"
android:textColor="@android:color/white"
android:drawableStart="@drawable/ic_save"
android:drawableLeft="@drawable/ic_save"
android:drawablePadding="5dp"
android:id="@+id/button_save"
android:layout_marginTop="20dp"
app:layout_constraintLeft_toRightOf="@+id/configure"
app:layout_constraintRight_toRightOf="@+id/button_expand"
app:layout_constraintTop_toBottomOf="@+id/osm_container"
android:text="@string/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageButton
style="@style/Widget.AppCompat.Button.Colored"
android:textColor="@android:color/white"
android:drawableStart="@drawable/ic_save"
android:drawableLeft="@drawable/ic_save"
android:drawablePadding="5dp"
android:id="@+id/button_expand"
android:layout_marginTop="20dp"
app:layout_constraintLeft_toRightOf="@+id/button_save"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/osm_container"
android:src="@drawable/ic_expand_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/display_supported_links" />
android:layout_marginTop="20dp"
android:drawableStart="@drawable/ic_save"
android:drawableLeft="@drawable/ic_save"
android:drawablePadding="5dp"
android:text="@string/save"
android:textColor="@android:color/white"
app:layout_constraintLeft_toRightOf="@+id/configure"
app:layout_constraintRight_toRightOf="@+id/button_expand"
app:layout_constraintTop_toBottomOf="@+id/osm_container" />
<ImageButton
android:id="@+id/button_expand"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:contentDescription="@string/display_supported_links"
android:drawableStart="@drawable/ic_save"
android:drawableLeft="@drawable/ic_save"
android:drawablePadding="5dp"
android:src="@drawable/ic_expand_more"
android:textColor="@android:color/white"
app:layout_constraintLeft_toRightOf="@+id/button_save"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/osm_container" />
<androidx.recyclerview.widget.RecyclerView
android:visibility="gone"
android:id="@+id/list_apps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_save"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="20dp"
android:id="@+id/list_apps"
/>
app:layout_constraintTop_toBottomOf="@+id/button_save" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -1,34 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal" android:layout_width="match_parent"
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/fab_margin"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginTop="5dp"
android:layout_height="wrap_content">
android:layout_marginEnd="@dimen/fab_margin"
android:orientation="horizontal">
<ImageView
android:id="@+id/app_icon"
android:layout_width="30dp"
android:layout_height="30dp"
android:id="@+id/app_icon"
android:contentDescription="@string/icon_of_the_app" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/fab_margin"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:textStyle="bold"
android:id="@+id/domain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/domain"/>
android:textStyle="bold" />
<TextView
android:id="@+id/information"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/information"/>
android:layout_height="wrap_content" />
</LinearLayout>
<ImageView
android:id="@+id/valid"
android:layout_width="30dp"

View File

@ -1,30 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:padding="@dimen/fab_margin"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:padding="@dimen/fab_margin">
<RelativeLayout
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:layout_width="wrap_content"
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
<TextView
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/loading"
android:text="@string/resolving_shortened"/>
android:layout_centerInParent="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/loading"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="@string/resolving_shortened" />
</RelativeLayout>
<TextView
android:id="@+id/indications"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/indications"
android:visibility="gone"/>
android:visibility="gone" />
</RelativeLayout>

View File

@ -4,8 +4,8 @@
tools:context="app.fedilab.nitterizeme.MainActivity">
<item
android:id="@+id/action_about"
android:orderInCategory="100"
android:icon="@drawable/ic_info_outline"
android:orderInCategory="100"
android:title="@string/action_about"
app:showAsAction="ifRoom" />
</menu>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -2,7 +2,7 @@ package app.fedilab.nitterizeme;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
/**
* Example local unit test, which will execute on the development machine (host).