Add colors for wikivoyage ui; create base class for wikivoyage fragments
This commit is contained in:
parent
8f2067074a
commit
d91bed744f
5 changed files with 72 additions and 54 deletions
|
@ -142,6 +142,8 @@
|
|||
<color name="status_bar_dim_light">#8a4e00</color>
|
||||
<color name="status_bar_dim_dark">#13171a</color>
|
||||
<color name="status_bar_coordinate_input_dark">#0d0f0f</color>
|
||||
<color name="status_bar_wikivoyage_light">#f2f2f2</color>
|
||||
<color name="status_bar_wikivoyage_dark">#222526</color>
|
||||
|
||||
|
||||
<color name="color_transparent">#0000</color>
|
||||
|
@ -384,4 +386,15 @@
|
|||
|
||||
<color name="grid_menu_icon_dark">#808080</color>
|
||||
|
||||
<color name="wikivoyage_bg_light">#f0f0f0</color>
|
||||
<color name="wikivoyage_bg_dark">#17191a</color>
|
||||
<color name="wikivoyage_card_bg_light">#ffffff</color>
|
||||
<color name="wikivoyage_card_bg_dark">#222526</color>
|
||||
<color name="wikivoyage_card_divider_light">#f0f0f0</color>
|
||||
<color name="wikivoyage_card_divider_dark">#2d3133</color>
|
||||
<color name="wikivoyage_active_light">#237bff</color>
|
||||
<color name="wikivoyage_active_dark">#d28521</color>
|
||||
<color name="wikivoyage_app_bar_light">#f2f2f2</color>
|
||||
<color name="wikivoyage_app_bar_dark">#222526</color>
|
||||
|
||||
</resources>
|
|
@ -5,19 +5,16 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.data.WikivoyageArticle;
|
||||
import net.osmand.plus.wikivoyage.data.WikivoyageSearchResult;
|
||||
|
||||
public class WikivoyageArticleDialogFragment extends BaseOsmAndDialogFragment {
|
||||
public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragment {
|
||||
|
||||
public static final String TAG = "WikivoyageArticleDialogFragment";
|
||||
|
||||
|
@ -26,24 +23,12 @@ public class WikivoyageArticleDialogFragment extends BaseOsmAndDialogFragment {
|
|||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
final int themeRes = isNightMode(false) ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
final View mainView = inflate(R.layout.fragment_wikivoyage_article_dialog, container);
|
||||
|
||||
final View mainView = LayoutInflater.from(new ContextThemeWrapper(app, themeRes))
|
||||
.inflate(R.layout.fragment_wikivoyage_article_dialog, container, false);
|
||||
|
||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
setupToolbar((Toolbar) mainView.findViewById(R.id.toolbar));
|
||||
|
||||
WikivoyageSearchResult searchResult = (WikivoyageSearchResult) getArguments().getParcelable(SEARCH_RESULT_KEY);
|
||||
WikivoyageArticle article = app.getWikivoyageDbHelper()
|
||||
WikivoyageArticle article = getMyApplication().getWikivoyageDbHelper()
|
||||
.getArticle(searchResult.getCityId(), searchResult.getLang().get(0));
|
||||
|
||||
WebView contentWebView = (WebView) mainView.findViewById(R.id.content_web_view);
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package net.osmand.plus.wikivoyage;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
|
||||
public class WikivoyageBaseDialogFragment extends BaseOsmAndDialogFragment {
|
||||
|
||||
protected boolean nightMode;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
nightMode = isNightMode(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Drawable getContentIcon(int id) {
|
||||
return getIcon(id, R.color.icon_color);
|
||||
}
|
||||
|
||||
protected View inflate(@LayoutRes int layoutId, @Nullable ViewGroup container) {
|
||||
int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
return LayoutInflater.from(new ContextThemeWrapper(getContext(), themeRes))
|
||||
.inflate(layoutId, container, false);
|
||||
}
|
||||
|
||||
protected void setupToolbar(Toolbar toolbar) {
|
||||
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -5,39 +5,24 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.search.WikivoyageSearchDialogFragment;
|
||||
|
||||
public class WikivoyageExploreDialogFragment extends BaseOsmAndDialogFragment {
|
||||
public class WikivoyageExploreDialogFragment extends WikivoyageBaseDialogFragment {
|
||||
|
||||
public static final String TAG = "WikivoyageExploreDialogFragment";
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
final int themeRes = isNightMode(false) ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
final View mainView = inflate(R.layout.fragment_wikivoyage_explore_dialog, container);
|
||||
|
||||
final View mainView = LayoutInflater.from(new ContextThemeWrapper(app, themeRes))
|
||||
.inflate(R.layout.fragment_wikivoyage_explore_dialog, container, false);
|
||||
|
||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
setupToolbar((Toolbar) mainView.findViewById(R.id.toolbar));
|
||||
|
||||
((ImageView) mainView.findViewById(R.id.search_icon))
|
||||
.setImageDrawable(getContentIcon(R.drawable.ic_action_search_dark));
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.support.v7.widget.Toolbar;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -18,15 +17,14 @@ import android.widget.ImageButton;
|
|||
import android.widget.ProgressBar;
|
||||
|
||||
import net.osmand.ResultMatcher;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.WikivoyageArticleDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.WikivoyageBaseDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.data.WikivoyageSearchResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class WikivoyageSearchDialogFragment extends BaseOsmAndDialogFragment {
|
||||
public class WikivoyageSearchDialogFragment extends WikivoyageBaseDialogFragment {
|
||||
|
||||
public static final String TAG = "WikivoyageSearchDialogFragment";
|
||||
|
||||
|
@ -45,22 +43,12 @@ public class WikivoyageSearchDialogFragment extends BaseOsmAndDialogFragment {
|
|||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
final OsmandApplication app = getMyApplication();
|
||||
searchHelper = new WikivoyageSearchHelper(app);
|
||||
final int themeRes = isNightMode(false) ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
searchHelper = new WikivoyageSearchHelper(getMyApplication());
|
||||
|
||||
final View mainView = LayoutInflater.from(new ContextThemeWrapper(app, themeRes))
|
||||
.inflate(R.layout.fragment_wikivoyage_search_dialog, container, false);
|
||||
final View mainView = inflate(R.layout.fragment_wikivoyage_search_dialog, container);
|
||||
|
||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
setupToolbar(toolbar);
|
||||
|
||||
searchEt = (EditText) toolbar.findViewById(R.id.searchEditText);
|
||||
searchEt.setHint(R.string.shared_string_search);
|
||||
|
|
Loading…
Reference in a new issue