mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
02c3e30180
commit
d4a9e8acb8
|
@ -19,6 +19,7 @@ package eu.faircode.email;
|
||||||
Copyright 2018-2021 by Marcel Bokhorst (M66B)
|
Copyright 2018-2021 by Marcel Bokhorst (M66B)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
@ -292,10 +293,11 @@ public class FragmentPro extends FragmentBase implements SharedPreferences.OnSha
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMenuResponse() {
|
private void onMenuResponse() {
|
||||||
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_response, null);
|
final Context context = getContext();
|
||||||
|
final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_response, null);
|
||||||
final EditText etResponse = dview.findViewById(R.id.etResponse);
|
final EditText etResponse = dview.findViewById(R.id.etResponse);
|
||||||
|
|
||||||
new AlertDialog.Builder(getContext())
|
new AlertDialog.Builder(context)
|
||||||
.setView(dview)
|
.setView(dview)
|
||||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -305,13 +307,13 @@ public class FragmentPro extends FragmentBase implements SharedPreferences.OnSha
|
||||||
int q = response.indexOf("?response=");
|
int q = response.indexOf("?response=");
|
||||||
if (q > 0)
|
if (q > 0)
|
||||||
response = response.substring(q + 10);
|
response = response.substring(q + 10);
|
||||||
if (ActivityBilling.activatePro(getContext(), response))
|
if (ActivityBilling.activatePro(context, response))
|
||||||
ToastEx.makeText(getContext(), R.string.title_pro_valid, Toast.LENGTH_LONG).show();
|
ToastEx.makeText(context, R.string.title_pro_valid, Toast.LENGTH_LONG).show();
|
||||||
else
|
else
|
||||||
ToastEx.makeText(getContext(), R.string.title_pro_invalid, Toast.LENGTH_LONG).show();
|
ToastEx.makeText(context, R.string.title_pro_invalid, Toast.LENGTH_LONG).show();
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
ToastEx.makeText(getContext(), Log.formatThrowable(ex), Toast.LENGTH_LONG).show();
|
ToastEx.makeText(context, Log.formatThrowable(ex), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue