mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-26 09:48:46 +00:00
Fixed accessibility services crash
This commit is contained in:
parent
26021a18c7
commit
70651b96d0
2 changed files with 58 additions and 13 deletions
|
@ -79,7 +79,7 @@
|
||||||
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
|
<action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter android:label="@string/app_name">
|
<!-- intent-filter android:label="@string/app_name">
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
android:host="www.netguard.me"
|
android:host="www.netguard.me"
|
||||||
android:pathPrefix="/"
|
android:pathPrefix="/"
|
||||||
android:scheme="https" />
|
android:scheme="https" />
|
||||||
</intent-filter>
|
</intent-filter-->
|
||||||
|
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.app.shortcuts"
|
android:name="android.app.shortcuts"
|
||||||
|
|
|
@ -21,6 +21,8 @@ package eu.faircode.netguard;
|
||||||
|
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
@ -95,21 +97,64 @@ public class ActivityPro extends AppCompatActivity {
|
||||||
TextView tvDev1Title = findViewById(R.id.tvDev1Title);
|
TextView tvDev1Title = findViewById(R.id.tvDev1Title);
|
||||||
TextView tvDev2Title = findViewById(R.id.tvDev2Title);
|
TextView tvDev2Title = findViewById(R.id.tvDev2Title);
|
||||||
|
|
||||||
Linkify.TransformFilter filter = new Linkify.TransformFilter() {
|
tvLogTitle.setPaintFlags(tvLogTitle.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
tvFilterTitle.setPaintFlags(tvLogTitle.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
tvNotifyTitle.setPaintFlags(tvLogTitle.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
tvSpeedTitle.setPaintFlags(tvLogTitle.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
tvThemeTitle.setPaintFlags(tvLogTitle.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
tvAllTitle.setPaintFlags(tvLogTitle.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
tvDev1Title.setPaintFlags(tvLogTitle.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
tvDev2Title.setPaintFlags(tvLogTitle.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||||
|
|
||||||
|
View.OnClickListener listener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public String transformUrl(Matcher match, String url) {
|
public void onClick(View view) {
|
||||||
return "";
|
String sku;
|
||||||
|
switch (view.getId()) {
|
||||||
|
case R.id.tvLogTitle:
|
||||||
|
sku = SKU_LOG;
|
||||||
|
break;
|
||||||
|
case R.id.tvFilterTitle:
|
||||||
|
sku = SKU_FILTER;
|
||||||
|
break;
|
||||||
|
case R.id.tvNotifyTitle:
|
||||||
|
sku = SKU_NOTIFY;
|
||||||
|
break;
|
||||||
|
case R.id.tvSpeedTitle:
|
||||||
|
sku = SKU_SPEED;
|
||||||
|
break;
|
||||||
|
case R.id.tvThemeTitle:
|
||||||
|
sku = SKU_THEME;
|
||||||
|
break;
|
||||||
|
case R.id.tvAllTitle:
|
||||||
|
sku = SKU_PRO1;
|
||||||
|
break;
|
||||||
|
case R.id.tvDev1Title:
|
||||||
|
sku = SKU_SUPPORT1;
|
||||||
|
break;
|
||||||
|
case R.id.tvDev2Title:
|
||||||
|
sku = SKU_SUPPORT2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sku = SKU_PRO1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
intent.setData(Uri.parse("http://www.netguard.me/#" + sku));
|
||||||
|
if (intent.resolveActivity(getPackageManager()) != null)
|
||||||
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Linkify.addLinks(tvLogTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_LOG, null, filter);
|
tvLogTitle.setOnClickListener(listener);
|
||||||
Linkify.addLinks(tvFilterTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_FILTER, null, filter);
|
tvFilterTitle.setOnClickListener(listener);
|
||||||
Linkify.addLinks(tvNotifyTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_NOTIFY, null, filter);
|
tvNotifyTitle.setOnClickListener(listener);
|
||||||
Linkify.addLinks(tvSpeedTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_SPEED, null, filter);
|
tvSpeedTitle.setOnClickListener(listener);
|
||||||
Linkify.addLinks(tvThemeTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_THEME, null, filter);
|
tvThemeTitle.setOnClickListener(listener);
|
||||||
Linkify.addLinks(tvAllTitle, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_PRO1, null, filter);
|
tvAllTitle.setOnClickListener(listener);
|
||||||
Linkify.addLinks(tvDev1Title, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_SUPPORT1, null, filter);
|
tvDev1Title.setOnClickListener(listener);
|
||||||
Linkify.addLinks(tvDev2Title, Pattern.compile(".*"), "http://www.netguard.me/#" + SKU_SUPPORT2, null, filter);
|
tvDev2Title.setOnClickListener(listener);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
iab = new IAB(new IAB.Delegate() {
|
iab = new IAB(new IAB.Delegate() {
|
||||||
|
|
Loading…
Reference in a new issue