Skip to content

Commit

Permalink
create tile layer first page help menus support for dark mode (preloa…
Browse files Browse the repository at this point in the history
…ded etc)
  • Loading branch information
jclark118 committed Jun 29, 2023
1 parent 6ca4a8c commit 1fb3ad7
Show file tree
Hide file tree
Showing 7 changed files with 24,003 additions and 4 deletions.
23,974 changes: 23,974 additions & 0 deletions get-pip2.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
Expand Down Expand Up @@ -221,7 +222,15 @@ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AppCompatAlertDialogStyle);
builder.setTitle(fragment.getString(R.string.example_url_header));
ArrayAdapter<String> adapter = new ArrayAdapter<>(
context, android.R.layout.select_dialog_item);
context, android.R.layout.select_dialog_item){
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView text1 = (TextView) view.findViewById(android.R.id.text1);
text1.setTextColor(context.getResources().getColor(R.color.textPrimaryColor, context.getTheme()));
return view;
}
};

SampleDownloader sampleDownloader = new SampleDownloader(fragment.getActivity(), adapter);
adapter.add(activity.getString(R.string.fetching_examples));
Expand All @@ -242,7 +251,7 @@ public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
// URL help menu
TextView urlHelpText = (TextView) alertView.findViewById(R.id.url_help);
urlHelpText.setOnClickListener((View view) -> {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AppCompatAlertDialogStyle);
builder.setTitle(fragment.getString(R.string.map_tile_url_header));
builder.setMessage(fragment.getString(R.string.url_template_message));
final AlertDialog urlDialog = builder.create();
Expand Down Expand Up @@ -329,7 +338,7 @@ private void showSavedUrls() {
ArrayList<SavedUrl> urlList = model.getSavedUrlObjectList();
SavedUrlAdapter adapter = new SavedUrlAdapter(context, urlList);
listView.setAdapter(adapter);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.AppCompatAlertDialogStyle);
builder.setTitle("Saved Tile URLs");
builder.setView(view);
AlertDialog ad = builder.show();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package mil.nga.mapcache.wizards.createtile;

import android.content.Context;
import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -52,10 +53,13 @@ public View getView(int position, @Nullable View convertView, @NonNull ViewGroup
// Icon
ImageView urlIcon = (ImageView)listItem.findViewById(R.id.url_icon);
urlIcon.setImageResource(savedUrl.getmIcon());
// Setting a color filter to help tint the icon to deal with light/dark mode instead of making new icons
// urlIcon.setColorFilter(mContext.getResources().getColor(R.color.iconTint, getContext().getTheme()));

// Url text
TextView urlText = (TextView)listItem.findViewById(R.id.saved_url);
urlText.setText(savedUrl.getmUrl());
urlText.setTextColor(mContext.getResources().getColor(R.color.textPrimaryColor, getContext().getTheme()));

return listItem;
}
Expand Down
4 changes: 3 additions & 1 deletion mapcache/src/main/res/layout/layout_saved_url.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<LinearLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
Expand All @@ -11,6 +11,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/colored_layers"/>
<!-- add a color tint to deal with light/dark mode-->
<!-- app:tint="@color/iconTint"-->

<TextView
android:id="@+id/saved_url"
Expand Down
4 changes: 4 additions & 0 deletions mapcache/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@
<!-- Text inputs -->
<color name="mtrl_textinput_default_box_stroke_color" tools:override="true">@color/white50</color>

<!-- Tint for icons to help them switch between dark and light mode -->
<color name="iconTint">@color/darkIconTint</color>


</resources>
2 changes: 2 additions & 0 deletions mapcache/src/main/res/values/color.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@
<color name="white50">#80FFFFFF</color>
<color name="white75">#BFFFFFFF</color>
<color name="black75">#5A5A5A</color>
<color name="darkIconTint">#7EFFFFFF</color>
<color name="lightIconTint">#05FFFFFF</color>

<color name="nga_accent_muted_dark">#1E5659</color>
<color name="nga_primary_extra_light">#62B0DD</color>
Expand Down
4 changes: 4 additions & 0 deletions mapcache/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@
<!-- Text inputs -->
<color name="mtrl_textinput_default_box_stroke_color" tools:override="true">@color/black50</color>

<!-- Tint for icons to help them switch between dark and light mode -->
<color name="iconTint">@color/lightIconTint</color>


</resources>

0 comments on commit 1fb3ad7

Please sign in to comment.