Simplification

This commit is contained in:
M66B 2019-07-01 20:34:02 +02:00
parent 4888ee8482
commit 2699b34bcf
5 changed files with 16 additions and 17 deletions

View File

@ -170,7 +170,7 @@ abstract class ActivityBilling extends ActivityBase implements PurchasesUpdatedL
if (result.getResponseCode() != BillingClient.BillingResponseCode.OK)
Toast.makeText(this, text, Toast.LENGTH_LONG).show();
} else
Helper.view(this, this, getIntentPro());
Helper.view(this, getIntentPro());
}
private void onActivatePro(Intent intent) {

View File

@ -435,11 +435,11 @@ public class ActivitySetup extends ActivityBilling implements FragmentManager.On
}
private void onMenuFAQ() {
Helper.view(this, this, Helper.getIntentFAQ());
Helper.view(this, Helper.getIntentFAQ());
}
private void onMenuPrivacy() {
Helper.view(this, this, Helper.getIntentPrivacy());
Helper.view(this, Helper.getIntentPrivacy());
}
private void onCleanup() {

View File

@ -817,7 +817,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}
private void onMenuFAQ() {
Helper.view(this, this, Helper.getIntentFAQ());
Helper.view(this, Helper.getIntentFAQ());
}
private void onMenuIssue() {
@ -825,7 +825,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}
private void onMenuPrivacy() {
Helper.view(this, this, Helper.getIntentPrivacy());
Helper.view(this, Helper.getIntentPrivacy());
}
private void onMenuAbout() {
@ -844,13 +844,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private void onMenuRate() {
Intent faq = Helper.getIntentFAQ();
if (faq.resolveActivity(getPackageManager()) == null)
Helper.view(this, this, getIntentRate(this));
Helper.view(this, getIntentRate(this));
else
new FragmentDialogRate().show(getSupportFragmentManager(), "rate");
}
private void onMenuOtherApps() {
Helper.view(this, this, getIntentOtherApps());
Helper.view(this, getIntentOtherApps());
}
private void onReset() {
@ -1076,13 +1076,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
.setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Helper.view(getContext(), getActivity(), Helper.getIntentFAQ());
Helper.view(getContext(), Helper.getIntentFAQ());
}
})
.setNegativeButton(R.string.title_no, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Helper.view(getContext(), getActivity(), getIntentRate(getContext()));
Helper.view(getContext(), getIntentRate(getContext()));
}
})
.create();

View File

@ -3497,14 +3497,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
@Override
public void onClick(DialogInterface dialog, int which) {
Uri uri = Uri.parse(etLink.getText().toString());
Helper.view(getContext(), getActivity(), uri, false);
Helper.view(getContext(), uri, false);
}
})
.setNeutralButton(R.string.title_browse, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Uri uri = Uri.parse(etLink.getText().toString());
Helper.view(getContext(), getActivity(), uri, true);
Helper.view(getContext(), uri, true);
}
})
.setNegativeButton(R.string.title_no, null)
@ -3647,7 +3647,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if ("cid".equals(uri.getScheme()) || "data".equals(uri.getScheme()))
return;
Helper.view(getContext(), getActivity(), uri, true);
Helper.view(getContext(), uri, true);
}
});
@ -3663,7 +3663,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if ("cid".equals(uri.getScheme()) || "data".equals(uri.getScheme()))
return false;
Helper.view(getContext(), getActivity(), uri, true);
Helper.view(getContext(), uri, true);
return true;
}

View File

@ -59,7 +59,6 @@ import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.LifecycleOwner;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
@ -180,15 +179,15 @@ public class Helper {
return Intent.createChooser(intent, context.getString(R.string.title_select_app));
}
static void view(Context context, LifecycleOwner owner, Intent intent) {
static void view(Context context, Intent intent) {
Uri uri = intent.getData();
if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme()))
view(context, owner, intent.getData(), false);
view(context, intent.getData(), false);
else
context.startActivity(intent);
}
static void view(Context context, LifecycleOwner owner, Uri uri, boolean browse) {
static void view(Context context, Uri uri, boolean browse) {
Log.i("View=" + uri);
if (!hasCustomTabs(context, uri))