|
|
@ -48,6 +48,7 @@ import java.net.URLEncoder;
|
|
|
|
|
|
|
|
|
|
|
|
import app.fedilab.android.BaseMainActivity;
|
|
|
|
import app.fedilab.android.BaseMainActivity;
|
|
|
|
import app.fedilab.android.R;
|
|
|
|
import app.fedilab.android.R;
|
|
|
|
|
|
|
|
import app.fedilab.android.activities.ProxyActivity;
|
|
|
|
import app.fedilab.android.activities.WebviewConnectActivity;
|
|
|
|
import app.fedilab.android.activities.WebviewConnectActivity;
|
|
|
|
import app.fedilab.android.client.entities.Account;
|
|
|
|
import app.fedilab.android.client.entities.Account;
|
|
|
|
import app.fedilab.android.client.entities.InstanceSocial;
|
|
|
|
import app.fedilab.android.client.entities.InstanceSocial;
|
|
|
@ -175,29 +176,20 @@ public class FragmentLoginMain extends Fragment {
|
|
|
|
PopupMenu popupMenu = new PopupMenu(new ContextThemeWrapper(requireActivity(), Helper.popupStyle()), binding.menuIcon);
|
|
|
|
PopupMenu popupMenu = new PopupMenu(new ContextThemeWrapper(requireActivity(), Helper.popupStyle()), binding.menuIcon);
|
|
|
|
MenuInflater menuInflater = popupMenu.getMenuInflater();
|
|
|
|
MenuInflater menuInflater = popupMenu.getMenuInflater();
|
|
|
|
menuInflater.inflate(R.menu.main_login, popupMenu.getMenu());
|
|
|
|
menuInflater.inflate(R.menu.main_login, popupMenu.getMenu());
|
|
|
|
|
|
|
|
MenuItem customTabItem = popupMenu.getMenu().findItem(R.id.action_custom_tabs);
|
|
|
|
|
|
|
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
|
|
|
|
|
|
|
|
boolean embedded_browser = sharedpreferences.getBoolean(getString(R.string.SET_EMBEDDED_BROWSER), true);
|
|
|
|
|
|
|
|
customTabItem.setChecked(!embedded_browser);
|
|
|
|
popupMenu.setOnMenuItemClickListener(item -> {
|
|
|
|
popupMenu.setOnMenuItemClickListener(item -> {
|
|
|
|
int itemId = item.getItemId();
|
|
|
|
int itemId = item.getItemId();
|
|
|
|
if (itemId == R.id.action_about) {
|
|
|
|
if (itemId == R.id.action_proxy) {
|
|
|
|
/* Todo: Open about page */
|
|
|
|
Intent intent = new Intent(requireActivity(), ProxyActivity.class);
|
|
|
|
} else if (itemId == R.id.action_privacy) {
|
|
|
|
startActivity(intent);
|
|
|
|
/* Todo: Open privacy page */
|
|
|
|
|
|
|
|
} else if (itemId == R.id.action_proxy) {
|
|
|
|
|
|
|
|
/* Todo: Open proxy settings */
|
|
|
|
|
|
|
|
} else if (itemId == R.id.action_custom_tabs) {
|
|
|
|
} else if (itemId == R.id.action_custom_tabs) {
|
|
|
|
setMenuItemKeepOpen(item);
|
|
|
|
boolean checked = !embedded_browser;
|
|
|
|
/* Todo: Toggle custom tabs */
|
|
|
|
item.setChecked(!item.isChecked());
|
|
|
|
} else if (itemId == R.id.action_import_data) {
|
|
|
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
|
|
|
/* Todo: Import data */
|
|
|
|
editor.putBoolean(getString(R.string.SET_EMBEDDED_BROWSER), checked);
|
|
|
|
} else if (itemId == R.id.action_provider) {
|
|
|
|
|
|
|
|
setMenuItemKeepOpen(item);
|
|
|
|
|
|
|
|
/* Todo: Toggle security provider */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
popupMenu.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setMenuItemKeepOpen(MenuItem item) {
|
|
|
|
|
|
|
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
|
|
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
|
|
|
item.setActionView(new View(requireContext()));
|
|
|
|
item.setActionView(new View(requireContext()));
|
|
|
|
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
|
|
|
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
|
|
@ -211,6 +203,11 @@ public class FragmentLoginMain extends Fragment {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
editor.apply();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
popupMenu.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|