Material theme (2)
This commit is contained in:
parent
6e6a33d053
commit
83c99e01b7
4 changed files with 30 additions and 3 deletions
|
@ -35,6 +35,7 @@ import androidx.appcompat.content.res.AppCompatResources;
|
|||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.ListPopupWindow;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
@ -510,6 +511,20 @@ public class UiUtilities {
|
|||
compoundButton.setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
|
||||
public static void setupToolbarOverflowIcon(Toolbar toolbar, @DrawableRes int iconId, @ColorRes int colorId) {
|
||||
Context ctx = toolbar.getContext();
|
||||
if (ctx != null) {
|
||||
return;
|
||||
}
|
||||
Drawable icon = ContextCompat.getDrawable(ctx, iconId);
|
||||
toolbar.setOverflowIcon(icon);
|
||||
if (icon != null) {
|
||||
int color = ContextCompat.getColor(ctx, colorId);
|
||||
DrawableCompat.setTint(icon.mutate(), color);
|
||||
toolbar.setOverflowIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
public static ViewGroup createSliderView(@NonNull Context ctx, boolean nightMode) {
|
||||
return (ViewGroup) getInflater(ctx, nightMode).inflate(R.layout.slider, null, false);
|
||||
}
|
||||
|
|
|
@ -600,8 +600,9 @@ public class LocalIndexesFragment extends OsmandExpandableListFragment implement
|
|||
ContextMenuItem contextMenuItem = optionsMenuAdapter.getItem(j);
|
||||
if (j + 1 >= max && optionsMenuAdapter.length() > max) {
|
||||
if (split == null) {
|
||||
Drawable icOverflowMenu = getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white);
|
||||
split = menu.addSubMenu(0, 1, j + 1, R.string.shared_string_more_actions);
|
||||
split.setIcon(R.drawable.ic_overflow_menu_white);
|
||||
split.setIcon(icOverflowMenu);
|
||||
split.getItem();
|
||||
MenuItemCompat.setShowAsAction(split.getItem(), MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.view.MenuItem;
|
|||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
|
@ -45,7 +46,8 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
getMyApplication().applyTheme(this);
|
||||
OsmandApplication app = getMyApplication();
|
||||
app.applyTheme(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_livie_updates);
|
||||
|
||||
|
@ -69,6 +71,13 @@ public class OsmLiveActivity extends AbstractDownloadActivity implements Downloa
|
|||
getLastUpdateDateTask = new GetLastUpdateDateTask(this);
|
||||
getLastUpdateDateTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
boolean nightMode = !app.getSettings().isLightContent();
|
||||
int normalTabColor = ContextCompat.getColor(app,
|
||||
nightMode ? R.color.searchbar_tab_inactive_dark : R.color.searchbar_tab_inactive_light);
|
||||
int selectedTabColor = ContextCompat.getColor(app,
|
||||
nightMode ? R.color.text_color_tab_active_dark : R.color.text_color_tab_active_light);
|
||||
tabLayout.setTabTextColors(normalTabColor, selectedTabColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
|
@ -442,8 +443,9 @@ public class WikivoyageArticleDialogFragment extends WikiArticleBaseDialogFragme
|
|||
@Override
|
||||
protected void setupToolbar(Toolbar toolbar) {
|
||||
super.setupToolbar(toolbar);
|
||||
toolbar.setOverflowIcon(getIcon(R.drawable.ic_overflow_menu_white, R.color.icon_color_default_light));
|
||||
|
||||
UiUtilities.setupToolbarOverflowIcon(
|
||||
toolbar, R.drawable.ic_overflow_menu_white, R.color.icon_color_default_light);
|
||||
Menu menu = toolbar.getMenu();
|
||||
MenuItem.OnMenuItemClickListener itemClickListener = new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue