Browse Source

Pro debugging

main
M66B 6 years ago
parent
commit
a7b8fb69ca
8 changed files with 18 additions and 15 deletions
  1. +2
    -3
      app/src/main/java/eu/faircode/email/ActivityBase.java
  2. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  3. +1
    -2
      app/src/main/java/eu/faircode/email/FragmentCompose.java
  4. +1
    -1
      app/src/main/java/eu/faircode/email/FragmentMessage.java
  5. +3
    -4
      app/src/main/java/eu/faircode/email/FragmentMessages.java
  6. +2
    -3
      app/src/main/java/eu/faircode/email/FragmentSetup.java
  7. +7
    -0
      app/src/main/java/eu/faircode/email/Helper.java
  8. +1
    -1
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java

+ 2
- 3
app/src/main/java/eu/faircode/email/ActivityBase.java View File

@ -35,10 +35,9 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
protected void onCreate(Bundle savedInstanceState) {
Log.i(Helper.TAG, "Create " + this.getClass().getName() + " version=" + BuildConfig.VERSION_NAME);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean pro = prefs.getBoolean("pro", false);
String theme = (pro ? prefs.getString("theme", "light") : "light");
String theme = (Helper.isPro(this) ? prefs.getString("theme", "light") : "light");
setTheme("light".equals(theme) ? R.style.AppThemeLight : R.style.AppThemeDark);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
prefs.registerOnSharedPreferenceChangeListener(this);
super.onCreate(savedInstanceState);
}


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -861,7 +861,7 @@ public class FragmentAccount extends FragmentEx {
Helper.setViewsEnabled(view, true);
boolean pro = PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false);
boolean pro = Helper.isPro(getContext());
etSignature.setHint(pro ? R.string.title_optional : R.string.title_pro_feature);
etSignature.setEnabled(pro);
if (pro) {


+ 1
- 2
app/src/main/java/eu/faircode/email/FragmentCompose.java View File

@ -31,7 +31,6 @@ import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.provider.ContactsContract;
import android.provider.OpenableColumns;
import android.text.Html;
@ -713,7 +712,7 @@ public class FragmentCompose extends FragmentEx {
long id = args.getLong("id", -1);
long reference = args.getLong("reference", -1);
long answer = args.getLong("answer", -1);
boolean pro = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pro", false);
boolean pro = Helper.isPro(getContext());
Log.i(Helper.TAG, "Load draft action=" + action + " id=" + id + " reference=" + reference);


+ 1
- 1
app/src/main/java/eu/faircode/email/FragmentMessage.java View File

@ -807,7 +807,7 @@ public class FragmentMessage extends FragmentEx {
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem target) {
if (PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false)) {
if (Helper.isPro(getContext())) {
startActivity(new Intent(getContext(), ActivityCompose.class)
.putExtra("action", "reply")
.putExtra("reference", message.id)


+ 3
- 4
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -508,8 +508,7 @@ public class FragmentMessages extends FragmentEx {
@Override
public void onResume() {
super.onResume();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
grpSupport.setVisibility(prefs.getBoolean("pro", false) ? View.GONE : View.VISIBLE);
grpSupport.setVisibility(Helper.isPro(getContext()) ? View.GONE : View.VISIBLE);
}
@Override
@ -524,7 +523,7 @@ public class FragmentMessages extends FragmentEx {
public boolean onQueryTextSubmit(String query) {
menuSearch.collapseActionView();
if (PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false)) {
if (Helper.isPro(getContext())) {
Intent intent = new Intent();
intent.putExtra("folder", folder);
intent.putExtra("search", query);
@ -583,7 +582,7 @@ public class FragmentMessages extends FragmentEx {
case R.id.menu_sort_on_unread:
case R.id.menu_sort_on_starred:
if (prefs.getBoolean("pro", false)) {
if (Helper.isPro(getContext())) {
prefs.edit().putString("sort", item.getItemId() == R.id.menu_sort_on_unread ? "unread" : "starred").apply();
item.setChecked(true);
loadMessages();


+ 2
- 3
app/src/main/java/eu/faircode/email/FragmentSetup.java View File

@ -203,7 +203,7 @@ public class FragmentSetup extends FragmentEx {
tbDarkTheme.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton button, boolean checked) {
if (prefs.getBoolean("pro", false)) {
if (Helper.isPro(getContext())) {
if (checked != (Boolean) button.getTag()) {
button.setTag(checked);
tbDarkTheme.setChecked(checked);
@ -346,8 +346,7 @@ public class FragmentSetup extends FragmentEx {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_export:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
if (prefs.getBoolean("pro", false))
if (Helper.isPro(getContext()))
startActivityForResult(getIntentExport(), ActivitySetup.REQUEST_EXPORT);
else {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();


+ 7
- 0
app/src/main/java/eu/faircode/email/Helper.java View File

@ -23,6 +23,7 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
@ -273,4 +274,10 @@ public class Helper {
return Integer.toString(responseCode);
}
}
static boolean isPro(Context context) {
if (false && BuildConfig.DEBUG)
return true;
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pro", false);
}
}

+ 1
- 1
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -310,7 +310,7 @@ public class ServiceSynchronize extends LifecycleService {
builder.setLights(0xff00ff00, 1000, 1000);
}
if (prefs.getBoolean("pro", false)) {
if (Helper.isPro(this)) {
DateFormat df = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.SHORT);
StringBuilder sb = new StringBuilder();
for (EntityMessage message : messages) {


Loading…
Cancel
Save