forked from mirror/monocles_chat
move channel discovery choice to ChannelDiscoveryActivity
This commit is contained in:
parent
ac951a3ac3
commit
cafc27d94d
4 changed files with 36 additions and 16 deletions
|
@ -48,6 +48,8 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
||||||
private ActivityChannelDiscoveryBinding binding;
|
private ActivityChannelDiscoveryBinding binding;
|
||||||
private MenuItem mMenuSearchView;
|
private MenuItem mMenuSearchView;
|
||||||
private EditText mSearchEditText;
|
private EditText mSearchEditText;
|
||||||
|
private static String jabberNetwork = "JABBER_NETWORK";
|
||||||
|
private static String localServer = "LOCAL_SERVER";
|
||||||
|
|
||||||
private ChannelDiscoveryService.Method method = ChannelDiscoveryService.Method.LOCAL_SERVER;
|
private ChannelDiscoveryService.Method method = ChannelDiscoveryService.Method.LOCAL_SERVER;
|
||||||
|
|
||||||
|
@ -141,6 +143,24 @@ public class ChannelDiscoveryActivity extends XmppActivity implements MenuItem.O
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case android.R.id.home:
|
||||||
|
finish();
|
||||||
|
break;
|
||||||
|
case R.id.jabber_network:
|
||||||
|
getPreferences().edit().putString("channel_discovery_method", jabberNetwork).apply();
|
||||||
|
recreate();
|
||||||
|
break;
|
||||||
|
case R.id.local_server:
|
||||||
|
getPreferences().edit().putString("channel_discovery_method", localServer).apply();
|
||||||
|
recreate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleLoadingScreen() {
|
private void toggleLoadingScreen() {
|
||||||
adapter.submitList(Collections.emptyList());
|
adapter.submitList(Collections.emptyList());
|
||||||
binding.progressBar.setVisibility(View.VISIBLE);
|
binding.progressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
|
@ -8,6 +8,22 @@
|
||||||
android:title="@string/search"
|
android:title="@string/search"
|
||||||
app:actionLayout="@layout/actionview_search"
|
app:actionLayout="@layout/actionview_search"
|
||||||
app:showAsAction="collapseActionView|always" />
|
app:showAsAction="collapseActionView|always" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/channel_discovery_method"
|
||||||
|
android:orderInCategory="85"
|
||||||
|
android:title="@string/pref_channel_discovery"
|
||||||
|
app:showAsAction="never">
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/jabber_network"
|
||||||
|
android:title="@string/jabber_network" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/local_server"
|
||||||
|
android:title="@string/local_server" />
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/action_settings"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
|
|
|
@ -134,15 +134,6 @@
|
||||||
<item>@string/large</item>
|
<item>@string/large</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="channel_discovery_entries">
|
|
||||||
<item>@string/jabber_network</item>
|
|
||||||
<item>@string/local_server</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="channel_discover_values">
|
|
||||||
<item>JABBER_NETWORK</item>
|
|
||||||
<item>LOCAL_SERVER</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="grace_periods">
|
<string-array name="grace_periods">
|
||||||
<item>@string/gp_disable</item>
|
<item>@string/gp_disable</item>
|
||||||
<item>@string/gp_short</item>
|
<item>@string/gp_short</item>
|
||||||
|
|
|
@ -392,13 +392,6 @@
|
||||||
android:key="use_invidious"
|
android:key="use_invidious"
|
||||||
android:summary="@string/pref_use_invidious_summary"
|
android:summary="@string/pref_use_invidious_summary"
|
||||||
android:title="@string/pref_use_invidious" />
|
android:title="@string/pref_use_invidious" />
|
||||||
<ListPreference
|
|
||||||
android:defaultValue="@string/default_channel_discovery"
|
|
||||||
android:entries="@array/channel_discovery_entries"
|
|
||||||
android:entryValues="@array/channel_discover_values"
|
|
||||||
android:key="channel_discovery_method"
|
|
||||||
android:summary="@string/pref_channel_discovery_summary"
|
|
||||||
android:title="@string/pref_channel_discovery" />
|
|
||||||
<PreferenceCategory android:title="@string/pref_create_backup">
|
<PreferenceCategory android:title="@string/pref_create_backup">
|
||||||
<Preference
|
<Preference
|
||||||
android:key="create_backup"
|
android:key="create_backup"
|
||||||
|
|
Loading…
Add table
Reference in a new issue