Merge pull request #10511 from osmandapp/minor_fixes

Minor UI fixes with voice prompts timetable
This commit is contained in:
vshcherb 2021-01-02 17:47:37 +01:00 committed by GitHub
commit 5e60fd63a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 14 deletions

View file

@ -56,6 +56,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:letterSpacing="@dimen/description_letter_spacing" android:letterSpacing="@dimen/description_letter_spacing"
android:maxLines="4" android:maxLines="4"
android:scrollbars="none"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" /> osmand:typeface="@string/font_roboto_regular" />

View file

@ -91,12 +91,10 @@
android:layout="@layout/preference_with_descr" android:layout="@layout/preference_with_descr"
android:title="@string/arrival_distance" /> android:title="@string/arrival_distance" />
<Preference <Preference
android:key="voice_prompts_timetable" android:key="voice_prompts_timetable"
android:layout="@layout/preference_with_descr" android:layout="@layout/preference_with_descr"
android:persistent="false" android:persistent="false"
android:selectable="false"
android:title="@string/voice_prompts_timetable" /> android:title="@string/voice_prompts_timetable" />
<Preference <Preference

View file

@ -9,7 +9,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
@ -43,6 +42,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
public static final String TAG = VoiceAnnouncesFragment.class.getSimpleName(); public static final String TAG = VoiceAnnouncesFragment.class.getSimpleName();
private static final String MORE_VALUE = "MORE_VALUE"; private static final String MORE_VALUE = "MORE_VALUE";
private static final String VOICE_PROMPTS_TIMETABLE = "voice_prompts_timetable";
@Override @Override
protected void createToolbar(LayoutInflater inflater, View view) { protected void createToolbar(LayoutInflater inflater, View view) {
@ -109,18 +109,11 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
} }
private void updateVoicePromptsTimes() { private void updateVoicePromptsTimes() {
Preference pref = findPreference("voice_prompts_timetable"); Preference pref = findPreference(VOICE_PROMPTS_TIMETABLE);
if (OsmandPlugin.isDevelopment()) { if (OsmandPlugin.isDevelopment()) {
final AnnounceTimeDistances atd = new AnnounceTimeDistances(getSelectedAppMode(), settings); AnnounceTimeDistances atd = new AnnounceTimeDistances(getSelectedAppMode(), settings);
pref.setSummary(atd.getTurnsDescription().trim()); pref.setSummary(atd.getTurnsDescription().trim());
pref.setEnabled(true); pref.setVisible(true);
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
app.showToastMessage(atd.getTurnsDescription().trim());
return true;
}
});
} else { } else {
pref.setVisible(false); pref.setVisible(false);
} }
@ -318,8 +311,11 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
if (settings.SPEED_CAMERAS_UNINSTALLED.getId().equals(preference.getKey())) { String prefId = preference.getKey();
if (settings.SPEED_CAMERAS_UNINSTALLED.getId().equals(prefId)) {
SpeedCamerasBottomSheet.showInstance(requireActivity().getSupportFragmentManager(), this); SpeedCamerasBottomSheet.showInstance(requireActivity().getSupportFragmentManager(), this);
} else if (VOICE_PROMPTS_TIMETABLE.equals(prefId)) {
app.showToastMessage(String.valueOf(preference.getSummary()));
} }
return super.onPreferenceClick(preference); return super.onPreferenceClick(preference);
} }