Searching is a pro feature

pull/72/head
M66B 6 years ago
parent 0559a5a9b9
commit aab40f78c0

@ -430,9 +430,15 @@ public class FragmentCompose extends FragmentEx {
private void onMenuEncrypt() { private void onMenuEncrypt() {
Log.i(Helper.TAG, "On encrypt"); Log.i(Helper.TAG, "On encrypt");
if (!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false)) {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
fragmentTransaction.commit();
return;
}
try { try {
if (!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false))
throw new IllegalArgumentException(getString(R.string.title_pro_feature));
if (openPgpConnection == null || !openPgpConnection.isBound()) if (openPgpConnection == null || !openPgpConnection.isBound())
throw new IllegalArgumentException(getString(R.string.title_no_openpgp)); throw new IllegalArgumentException(getString(R.string.title_no_openpgp));

@ -793,10 +793,15 @@ public class FragmentMessage extends FragmentEx {
private void onMenuDecrypt() { private void onMenuDecrypt() {
Log.i(Helper.TAG, "On decrypt"); Log.i(Helper.TAG, "On decrypt");
try {
if (!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false))
throw new IllegalArgumentException(getString(R.string.title_pro_feature));
if (!PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false)) {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
fragmentTransaction.commit();
return;
}
try {
if (openPgpConnection == null || !openPgpConnection.isBound()) if (openPgpConnection == null || !openPgpConnection.isBound())
throw new IllegalArgumentException(getString(R.string.title_no_openpgp)); throw new IllegalArgumentException(getString(R.string.title_no_openpgp));

@ -53,6 +53,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
public class FragmentMessages extends FragmentEx { public class FragmentMessages extends FragmentEx {
private ViewGroup view;
private RecyclerView rvMessage; private RecyclerView rvMessage;
private TextView tvNoEmail; private TextView tvNoEmail;
private ProgressBar pbWait; private ProgressBar pbWait;
@ -87,7 +88,7 @@ public class FragmentMessages extends FragmentEx {
@Override @Override
@Nullable @Nullable
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_messages, container, false); view = (ViewGroup) inflater.inflate(R.layout.fragment_messages, container, false);
setHasOptionsMenu(true); setHasOptionsMenu(true);
@ -302,6 +303,7 @@ public class FragmentMessages extends FragmentEx {
public boolean onQueryTextSubmit(String query) { public boolean onQueryTextSubmit(String query) {
menuSearch.collapseActionView(); menuSearch.collapseActionView();
if (PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean("pro", false)) {
Intent intent = new Intent(); Intent intent = new Intent();
intent.putExtra("folder", folder); intent.putExtra("folder", folder);
intent.putExtra("search", query); intent.putExtra("search", query);
@ -311,6 +313,11 @@ public class FragmentMessages extends FragmentEx {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("search"); fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("search");
fragmentTransaction.commit(); fragmentTransaction.commit();
} else {
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
fragmentTransaction.commit();
}
return true; return true;
} }

Loading…
Cancel
Save