|
|
@ -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,44 +176,40 @@ 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) {
|
|
|
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
|
|
|
setMenuItemKeepOpen(item);
|
|
|
|
item.setActionView(new View(requireContext()));
|
|
|
|
/* Todo: Toggle security provider */
|
|
|
|
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean onMenuItemActionExpand(MenuItem item) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean onMenuItemActionCollapse(MenuItem item) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
editor.apply();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
popupMenu.show();
|
|
|
|
popupMenu.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setMenuItemKeepOpen(MenuItem item) {
|
|
|
|
|
|
|
|
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
|
|
|
|
|
|
|
item.setActionView(new View(requireContext()));
|
|
|
|
|
|
|
|
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean onMenuItemActionExpand(MenuItem item) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean onMenuItemActionCollapse(MenuItem item) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onDestroyView() {
|
|
|
|
public void onDestroyView() {
|
|
|
|
super.onDestroyView();
|
|
|
|
super.onDestroyView();
|
|
|
|