Remove unnecessary code from toolbar, boolean exit number setting
This commit is contained in:
parent
4f35297d73
commit
9f40195d76
2 changed files with 29 additions and 44 deletions
|
@ -5,10 +5,10 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="0dp"
|
android:padding="0dp"
|
||||||
osmand:contentInsetLeft="0dp"
|
|
||||||
osmand:contentInsetStart="0dp"
|
|
||||||
osmand:contentInsetRight="0dp"
|
|
||||||
osmand:contentInsetEnd="0dp"
|
osmand:contentInsetEnd="0dp"
|
||||||
|
osmand:contentInsetLeft="0dp"
|
||||||
|
osmand:contentInsetRight="0dp"
|
||||||
|
osmand:contentInsetStart="0dp"
|
||||||
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -20,9 +20,9 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="@dimen/toolbar_height"
|
|
||||||
android:background="?attr/card_and_list_background_basic"
|
android:background="?attr/card_and_list_background_basic"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="@dimen/toolbar_height"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
|
@ -31,22 +31,22 @@
|
||||||
android:layout_width="@dimen/toolbar_height"
|
android:layout_width="@dimen/toolbar_height"
|
||||||
android:layout_height="@dimen/toolbar_height"
|
android:layout_height="@dimen/toolbar_height"
|
||||||
android:contentDescription="@string/access_shared_string_navigate_up"
|
android:contentDescription="@string/access_shared_string_navigate_up"
|
||||||
osmand:srcCompat="@drawable/ic_arrow_back"
|
android:tint="?attr/default_icon_color"
|
||||||
android:tint="?attr/default_icon_color" />
|
osmand:srcCompat="@drawable/ic_arrow_back" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginLeft="@dimen/content_padding"
|
|
||||||
android:layout_marginRight="@dimen/content_padding"
|
|
||||||
android:layout_marginStart="@dimen/content_padding"
|
android:layout_marginStart="@dimen/content_padding"
|
||||||
|
android:layout_marginLeft="@dimen/content_padding"
|
||||||
android:layout_marginEnd="@dimen/content_padding"
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
android:paddingTop="@dimen/content_padding_half"
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
android:paddingBottom="@dimen/content_padding_half"
|
android:layout_weight="1"
|
||||||
android:background="?attr/card_and_list_background_basic"
|
android:background="?attr/card_and_list_background_basic"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:paddingTop="@dimen/content_padding_half"
|
||||||
|
android:paddingBottom="@dimen/content_padding_half">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/toolbar_title"
|
android:id="@+id/toolbar_title"
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/toolbar_icon"
|
android:id="@+id/toolbar_icon_container"
|
||||||
layout="@layout/profile_button_small"
|
layout="@layout/profile_button_small"
|
||||||
android:layout_width="@dimen/list_header_height"
|
android:layout_width="@dimen/list_header_height"
|
||||||
android:layout_height="@dimen/list_header_height"
|
android:layout_height="@dimen/list_header_height"
|
||||||
|
|
|
@ -8,20 +8,16 @@ import android.media.AudioManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageButton;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
import androidx.preference.Preference;
|
import androidx.preference.Preference;
|
||||||
import androidx.preference.PreferenceViewHolder;
|
import androidx.preference.PreferenceViewHolder;
|
||||||
import androidx.preference.SwitchPreferenceCompat;
|
import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
@ -53,31 +49,9 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void createToolbar(LayoutInflater inflater, View view) {
|
protected void createToolbar(LayoutInflater inflater, View view) {
|
||||||
AppBarLayout appbar = view.findViewById(R.id.appbar);
|
super.createToolbar(inflater, view);
|
||||||
View toolbar = UiUtilities.getInflater(getContext(), isNightMode()).inflate(R.layout.profile_preference_toolbar_with_switch, appbar, false);
|
|
||||||
|
|
||||||
View iconToolbarContainer = toolbar.findViewById(R.id.toolbar_icon);
|
view.findViewById(R.id.toolbar_switch_container).setOnClickListener(new View.OnClickListener() {
|
||||||
ImageView icon = iconToolbarContainer.findViewById(R.id.profile_icon);
|
|
||||||
icon.setImageResource(R.drawable.ic_action_help_online);
|
|
||||||
icon.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (getContext() != null) {
|
|
||||||
WikipediaDialogFragment.showFullArticle(getContext(), Uri.parse(OSMAND_VOICE_NAVIGATION_URL), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ImageButton backButton = toolbar.findViewById(R.id.close_button);
|
|
||||||
backButton.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
FragmentActivity fragmentActivity = getActivity();
|
|
||||||
if (fragmentActivity != null) {
|
|
||||||
fragmentActivity.onBackPressed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
toolbar.findViewById(R.id.toolbar_switch_container).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
ApplicationMode selectedMode = getSelectedAppMode();
|
ApplicationMode selectedMode = getSelectedAppMode();
|
||||||
|
@ -89,14 +63,25 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment implements OnPr
|
||||||
updateMenu();
|
updateMenu();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title);
|
|
||||||
toolbarTitle.setText(getString(R.string.voice_announces));
|
|
||||||
appbar.addView(toolbar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateToolbar() {
|
protected void updateToolbar() {
|
||||||
super.updateToolbar();
|
super.updateToolbar();
|
||||||
|
View view = getView();
|
||||||
|
final boolean nightMode = !settings.isLightContentForMode(getSelectedAppMode());
|
||||||
|
int iconColor = getResources().getColor(nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light);
|
||||||
|
ImageView profileIcon = (ImageView) view.findViewById(R.id.profile_icon);
|
||||||
|
profileIcon.setImageResource(R.drawable.ic_action_help_online);
|
||||||
|
profileIcon.setColorFilter(iconColor);
|
||||||
|
profileIcon.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (getContext() != null) {
|
||||||
|
WikipediaDialogFragment.showFullArticle(getContext(), Uri.parse(OSMAND_VOICE_NAVIGATION_URL), nightMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
updateToolbarSwitch();
|
updateToolbarSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue