Merge pull request #10511 from osmandapp/minor_fixes
Minor UI fixes with voice prompts timetable
This commit is contained in:
commit
5e60fd63a9
3 changed files with 9 additions and 14 deletions
|
@ -56,6 +56,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:letterSpacing="@dimen/description_letter_spacing"
|
||||
android:maxLines="4"
|
||||
android:scrollbars="none"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular" />
|
||||
|
|
|
@ -91,12 +91,10 @@
|
|||
android:layout="@layout/preference_with_descr"
|
||||
android:title="@string/arrival_distance" />
|
||||
|
||||
|
||||
<Preference
|
||||
android:key="voice_prompts_timetable"
|
||||
android:layout="@layout/preference_with_descr"
|
||||
android:persistent="false"
|
||||
android:selectable="false"
|
||||
android:title="@string/voice_prompts_timetable" />
|
||||
|
||||
<Preference
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
@ -43,6 +42,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
|||
public static final String TAG = VoiceAnnouncesFragment.class.getSimpleName();
|
||||
|
||||
private static final String MORE_VALUE = "MORE_VALUE";
|
||||
private static final String VOICE_PROMPTS_TIMETABLE = "voice_prompts_timetable";
|
||||
|
||||
@Override
|
||||
protected void createToolbar(LayoutInflater inflater, View view) {
|
||||
|
@ -109,18 +109,11 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
|||
}
|
||||
|
||||
private void updateVoicePromptsTimes() {
|
||||
Preference pref = findPreference("voice_prompts_timetable");
|
||||
Preference pref = findPreference(VOICE_PROMPTS_TIMETABLE);
|
||||
if (OsmandPlugin.isDevelopment()) {
|
||||
final AnnounceTimeDistances atd = new AnnounceTimeDistances(getSelectedAppMode(), settings);
|
||||
AnnounceTimeDistances atd = new AnnounceTimeDistances(getSelectedAppMode(), settings);
|
||||
pref.setSummary(atd.getTurnsDescription().trim());
|
||||
pref.setEnabled(true);
|
||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
app.showToastMessage(atd.getTurnsDescription().trim());
|
||||
return true;
|
||||
}
|
||||
});
|
||||
pref.setVisible(true);
|
||||
} else {
|
||||
pref.setVisible(false);
|
||||
}
|
||||
|
@ -318,8 +311,11 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
|||
|
||||
@Override
|
||||
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);
|
||||
} else if (VOICE_PROMPTS_TIMETABLE.equals(prefId)) {
|
||||
app.showToastMessage(String.valueOf(preference.getSummary()));
|
||||
}
|
||||
return super.onPreferenceClick(preference);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue