Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-03-05 19:34:39 +01:00
commit b3319401c8
6 changed files with 318 additions and 182 deletions

View file

@ -34,6 +34,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:gravity="center" android:gravity="center"
android:textColor="@color/color_white" android:textColor="@color/color_white"
android:textSize="12sp" android:textSize="12sp"
@ -44,7 +45,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:gravity="center" android:gravity="center"
android:textColor="@color/color_white" android:textColor="@color/color_white"

View file

@ -14,77 +14,109 @@
<include layout="@layout/card_top_divider"/> <include layout="@layout/card_top_divider"/>
<android.support.v7.widget.GridLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/bg_color" android:background="?attr/bg_color"
osmand:columnCount="2"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
osmand:layout_columnSpan="2"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="48dp" android:minHeight="48dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:layout_width="wrap_content" 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_marginLeft="16dp"
android:layout_weight="1" android:layout_weight="1"
android:text="@string/select_month_and_country" android:text="@string/select_month_and_country"
android:textColor="?android:textColorPrimary"/> android:textColor="?android:textColorPrimary"/>
<net.osmand.plus.widgets.ButtonEx <net.osmand.plus.widgets.ButtonEx
android:id="@+id/show_all" android:id="@+id/show_all"
style="@style/DashboardGeneralButton" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:text="@string/shared_string_all" android:text="@string/shared_string_all"
android:textColor="?attr/contextMenuButtonColor"
osmand:textAllCapsCompat="true" osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/> osmand:typeface="@string/font_roboto_medium"/>
</LinearLayout> </LinearLayout>
<View <View
android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
osmand:layout_columnSpan="2"
android:background="?attr/dashboard_divider"/> android:background="?attr/dashboard_divider"/>
<LinearLayout
android:id="@+id/monthButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:minHeight="60dp"
android:clickable="true"
android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/calendarImageView" android:id="@+id/calendarImageView"
android:layout_width="56dp" android:layout_width="56dp"
android:layout_height="60dp" android:layout_height="56dp"
android:scaleType="center" android:scaleType="center"
android:src="@drawable/ic_action_data"/> android:src="@drawable/ic_action_data"/>
<Spinner <Spinner
android:id="@+id/montReportsSpinner" android:id="@+id/monthReportsSpinner"
osmand:layout_gravity="fill_horizontal|fill_vertical" android:layout_width="0dp"
android:layout_marginRight="56dp" android:layout_height="match_parent"
android:gravity="center_vertical"/> android:layout_weight="1"
android:layout_marginLeft="-8dp"
<View android:layout_marginRight="16dp"
android:layout_height="1dp" android:clickable="false"
osmand:layout_column="1" android:background="@null"/>
android:background="?attr/dashboard_divider"/>
<ImageView <ImageView
android:id="@+id/regionIconImageView" android:id="@+id/monthDropDownIcon"
android:layout_width="56dp" android:layout_width="wrap_content"
android:layout_height="56dp" android:layout_height="match_parent"
android:paddingTop="4dp" android:layout_marginRight="16dp"
android:scaleType="center" android:src="@drawable/ic_action_arrow_drop_down"/>
android:src="@drawable/ic_world_globe_dark"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"/>
<LinearLayout <LinearLayout
android:id="@+id/reportsButton" android:id="@+id/reportsButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
osmand:layout_gravity="fill_vertical" android:background="?attr/selectableItemBackground"
android:gravity="center" android:gravity="center_vertical"
android:orientation="vertical" android:minHeight="60dp"
android:paddingTop="4dp"> android:clickable="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/regionIconImageView"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:src="@drawable/ic_world_globe_dark"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="16dp"
android:orientation="vertical">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
@ -99,15 +131,24 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal" android:layout_gravity="fill_horizontal"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
tools:text="Worldwide"/> tools:text="Worldwide"/>
</LinearLayout> </LinearLayout>
<ImageView
android:id="@+id/countryDropDownIcon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="16dp"
android:src="@drawable/ic_action_arrow_drop_down"/>
</LinearLayout>
<View <View
android:id="@+id/divider_to_hide" android:id="@+id/divider_to_hide"
android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
osmand:layout_columnSpan="2"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:background="?attr/dashboard_divider"/> android:background="?attr/dashboard_divider"/>
<ProgressBar <ProgressBar
@ -115,25 +156,29 @@
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="9dp" android:layout_height="9dp"
osmand:layout_columnSpan="2"
android:indeterminate="true"/> android:indeterminate="true"/>
<ImageView
android:id="@+id/numberOfContributorsIcon"
android:layout_width="56dp"
android:layout_height="56dp"
android:paddingBottom="4dp"
android:scaleType="center"
android:src="@drawable/ic_group"/>
<LinearLayout <LinearLayout
android:id="@+id/numberOfContributorsLayout" android:id="@+id/numberOfContributorsLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
osmand:layout_gravity="fill_vertical" android:gravity="center_vertical"
android:gravity="center" android:minHeight="60dp"
android:orientation="vertical" android:background="?attr/selectableItemBackground"
android:paddingBottom="4dp"> android:orientation="horizontal">
<ImageView
android:id="@+id/numberOfContributorsIcon"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:src="@drawable/ic_group"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/numberOfContributorsTitle" android:id="@+id/numberOfContributorsTitle"
@ -148,27 +193,38 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="0" android:text="0"
android:textSize="@dimen/default_list_text_size"
android:textColor="?android:textColorPrimary"/> android:textColor="?android:textColorPrimary"/>
</LinearLayout> </LinearLayout>
<View </LinearLayout>
android:layout_height="1dp"
osmand:layout_column="1"
android:background="?attr/dashboard_divider"/>
<ImageView <View
android:id="@+id/numberOfEditsIcon" android:layout_width="match_parent"
android:layout_width="56dp" android:layout_height="1dp"
android:layout_height="60dp" android:layout_marginLeft="56dp"
android:scaleType="center" android:background="?attr/dashboard_divider"/>
android:src="@drawable/ic_map"/>
<LinearLayout <LinearLayout
android:id="@+id/numberOfEditsLayout" android:id="@+id/numberOfEditsLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
osmand:layout_gravity="fill_vertical" android:gravity="center_vertical"
android:gravity="center" android:minHeight="60dp"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:id="@+id/numberOfEditsIcon"
android:layout_width="56dp"
android:layout_height="56dp"
android:scaleType="center"
android:src="@drawable/ic_map"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
@ -184,13 +240,29 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="0" android:text="0"
android:textSize="@dimen/default_list_text_size"
android:textColor="?android:textColorPrimary"/> android:textColor="?android:textColorPrimary"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="60dp"
android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/donationsIcon" android:id="@+id/donationsIcon"
android:layout_width="56dp" android:layout_width="56dp"
android:layout_height="60dp" android:layout_height="56dp"
android:scaleType="center" android:scaleType="center"
android:src="@drawable/ic_action_bitcoin"/> android:src="@drawable/ic_action_bitcoin"/>
@ -198,8 +270,7 @@
android:id="@+id/donationsLayout" android:id="@+id/donationsLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
osmand:layout_gravity="fill_vertical" android:layout_marginRight="16dp"
android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
@ -215,14 +286,25 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="-" android:text="-"
android:textSize="@dimen/default_list_text_size"
android:textColor="?android:textColorPrimary"/> android:textColor="?android:textColorPrimary"/>
</LinearLayout> </LinearLayout>
</LinearLayout>
<View <View
android:layout_width="match_parent"
android:layout_height="1dp" android:layout_height="1dp"
osmand:layout_column="1" android:layout_marginLeft="56dp"
android:background="?attr/dashboard_divider"/> android:background="?attr/dashboard_divider"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="60dp"
android:orientation="horizontal">
<ImageView <ImageView
android:id="@+id/numberOfRecipientsIcon" android:id="@+id/numberOfRecipientsIcon"
android:layout_width="56dp" android:layout_width="56dp"
@ -234,8 +316,7 @@
android:id="@+id/numberOfRecipientsLayout" android:id="@+id/numberOfRecipientsLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
osmand:layout_gravity="fill_vertical" android:layout_marginRight="16dp"
android:gravity="center"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
@ -251,10 +332,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="-" android:text="-"
android:textSize="@dimen/default_list_text_size"
android:textColor="?android:textColorPrimary"/> android:textColor="?android:textColorPrimary"/>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.GridLayout> </LinearLayout>
</LinearLayout>
<include layout="@layout/card_bottom_divider"/> <include layout="@layout/card_bottom_divider"/>

View file

@ -30,12 +30,6 @@
app:typeface="@string/font_roboto_regular"/> app:typeface="@string/font_roboto_regular"/>
</LinearLayout> </LinearLayout>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/progress"
android:indeterminate="true"/>
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -51,6 +45,13 @@
<include layout="@layout/card_bottom_divider"/> <include layout="@layout/card_bottom_divider"/>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="9dp"
android:id="@+id/progress"
android:indeterminate="true"/>
</FrameLayout> </FrameLayout>
</LinearLayout> </LinearLayout>

View file

@ -22,7 +22,6 @@ import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.download.AbstractDownloadActivity; import net.osmand.plus.download.AbstractDownloadActivity;
import net.osmand.plus.download.DownloadActivity; import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay; import net.osmand.plus.liveupdates.LiveUpdatesHelper.TimeOfDay;
@ -41,6 +40,7 @@ import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceDownloadViaWiFi;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceForLocalIndex;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceTimeOfDayToUpdate;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceUpdateFrequency;
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate; import static net.osmand.plus.liveupdates.LiveUpdatesHelper.runLiveUpdate;
@ -78,7 +78,15 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
String lastCheckString = formatDateTime(getActivity(), lastCheck != DEFAULT_LAST_CHECK String lastCheckString = formatDateTime(getActivity(), lastCheck != DEFAULT_LAST_CHECK
? lastCheck : timestamp); ? lastCheck : timestamp);
lastMapChangeTextView.setText(getString(R.string.last_map_change, lastUpdateDate)); lastMapChangeTextView.setText(getString(R.string.last_map_change, lastUpdateDate));
OsmandSettings.CommonPreference<Boolean> preference = preferenceLiveUpdatesOn(localIndexInfo,
getSettings());
if (preference.get()) {
lastUpdateTextView.setText(getString(R.string.last_update, lastCheckString)); lastUpdateTextView.setText(getString(R.string.last_update, lastCheckString));
} else {
lastUpdateTextView.setVisibility(View.GONE);
}
final OsmandSettings.CommonPreference<Boolean> liveUpdatePreference = final OsmandSettings.CommonPreference<Boolean> liveUpdatePreference =
preferenceForLocalIndex(localIndexInfo, getSettings()); preferenceForLocalIndex(localIndexInfo, getSettings());
@ -98,7 +106,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
for (int i = 0; i < timeOfDays.length; i++) { for (int i = 0; i < timeOfDays.length; i++) {
timeOfDaysStrings[i] = getString(timeOfDays[i].getLocalizedId()); timeOfDaysStrings[i] = getString(timeOfDays[i].getLocalizedId());
} }
updateTimesOfDaySpinner.setAdapter(new ArrayAdapter<String>(getActivity(), updateTimesOfDaySpinner.setAdapter(new ArrayAdapter<>(getActivity(),
R.layout.action_spinner_item, timeOfDaysStrings)); R.layout.action_spinner_item, timeOfDaysStrings));
updateTimesOfDaySpinner.setSelection(timeOfDayPreference.get()); updateTimesOfDaySpinner.setSelection(timeOfDayPreference.get());
@ -109,7 +117,7 @@ public class LiveUpdatesSettingsDialogFragment extends DialogFragment {
} }
refreshTimeOfDayLayout(UpdateFrequency.values()[updateFrequencyPreference.get()], updateTimesOfDayLayout); refreshTimeOfDayLayout(UpdateFrequency.values()[updateFrequencyPreference.get()], updateTimesOfDayLayout);
updateFrequencySpinner.setAdapter(new ArrayAdapter<String>(getActivity(), updateFrequencySpinner.setAdapter(new ArrayAdapter<>(getActivity(),
R.layout.action_spinner_item, updateFrequenciesStrings)); R.layout.action_spinner_item, updateFrequenciesStrings));
updateFrequencySpinner.setSelection(updateFrequencyPreference.get()); updateFrequencySpinner.setSelection(updateFrequencyPreference.get());
updateFrequencySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { updateFrequencySpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

View file

@ -11,6 +11,7 @@ import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt; import android.support.annotation.ColorInt;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -24,6 +25,7 @@ import android.widget.TextView;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil; import net.osmand.PlatformUtil;
import net.osmand.osm.io.NetworkUtils; import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -55,7 +57,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
private TextView donationsTextView; private TextView donationsTextView;
private TextView recipientsTextView; private TextView recipientsTextView;
private Spinner montReportsSpinner; private Spinner monthReportsSpinner;
private MonthsForReportsAdapter monthsForReportsAdapter; private MonthsForReportsAdapter monthsForReportsAdapter;
private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment(); private CountrySelectionFragment countrySelectionFragment = new CountrySelectionFragment();
@ -82,9 +84,25 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_reports, container, false); View view = inflater.inflate(R.layout.fragment_reports, container, false);
montReportsSpinner = (Spinner) view.findViewById(R.id.montReportsSpinner); monthReportsSpinner = (Spinner) view.findViewById(R.id.monthReportsSpinner);
final View monthButton = view.findViewById(R.id.monthButton);
monthReportsSpinner.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
event.offsetLocation(AndroidUtils.dpToPx(getActivity(), 48f), 0);
monthButton.onTouchEvent(event);
return true;
}
});
monthsForReportsAdapter = new MonthsForReportsAdapter(getActivity()); monthsForReportsAdapter = new MonthsForReportsAdapter(getActivity());
montReportsSpinner.setAdapter(monthsForReportsAdapter); monthReportsSpinner.setAdapter(monthsForReportsAdapter);
monthButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
monthReportsSpinner.performClick();
}
});
view.findViewById(R.id.show_all).setOnClickListener(new OnClickListener() { view.findViewById(R.id.show_all).setOnClickListener(new OnClickListener() {
@ -105,7 +123,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
OnClickListener listener = new View.OnClickListener() { OnClickListener listener = new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
int monthItemPosition = montReportsSpinner.getSelectedItemPosition(); int monthItemPosition = monthReportsSpinner.getSelectedItemPosition();
String monthUrlString = monthsForReportsAdapter.getQueryString(monthItemPosition); String monthUrlString = monthsForReportsAdapter.getQueryString(monthItemPosition);
String countryUrlString = selectedCountryItem.getDownloadName(); String countryUrlString = selectedCountryItem.getDownloadName();
if (countryUrlString.length() > 0) { if (countryUrlString.length() > 0) {
@ -128,7 +146,9 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
countryNameTextView.setText(selectedCountryItem.getLocalName()); countryNameTextView.setText(selectedCountryItem.getLocalName());
setThemedDrawable(view, R.id.calendarImageView, R.drawable.ic_action_data); setThemedDrawable(view, R.id.calendarImageView, R.drawable.ic_action_data);
setThemedDrawable(view, R.id.monthDropDownIcon, R.drawable.ic_action_arrow_drop_down);
setThemedDrawable(view, R.id.regionIconImageView, R.drawable.ic_world_globe_dark); setThemedDrawable(view, R.id.regionIconImageView, R.drawable.ic_world_globe_dark);
setThemedDrawable(view, R.id.countryDropDownIcon, R.drawable.ic_action_arrow_drop_down);
numberOfContributorsIcon = (ImageView) view.findViewById(R.id.numberOfContributorsIcon); numberOfContributorsIcon = (ImageView) view.findViewById(R.id.numberOfContributorsIcon);
numberOfEditsIcon = (ImageView) view.findViewById(R.id.numberOfEditsIcon); numberOfEditsIcon = (ImageView) view.findViewById(R.id.numberOfEditsIcon);
@ -167,7 +187,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
} }
}; };
montReportsSpinner.setOnItemSelectedListener(onItemSelectedListener); monthReportsSpinner.setOnItemSelectedListener(onItemSelectedListener);
inactiveColor = getColorFromAttr(R.attr.plugin_details_install_header_bg); inactiveColor = getColorFromAttr(R.attr.plugin_details_install_header_bg);
textColorPrimary = getColorFromAttr(android.R.attr.textColorPrimary); textColorPrimary = getColorFromAttr(android.R.attr.textColorPrimary);
@ -177,7 +197,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
} }
public void requestAndUpdateUi() { public void requestAndUpdateUi() {
int monthItemPosition = montReportsSpinner.getSelectedItemPosition(); int monthItemPosition = monthReportsSpinner.getSelectedItemPosition();
String monthUrlString = monthsForReportsAdapter.getQueryString(monthItemPosition); String monthUrlString = monthsForReportsAdapter.getQueryString(monthItemPosition);
String countryUrlString = selectedCountryItem.getDownloadName(); String countryUrlString = selectedCountryItem.getDownloadName();
@ -260,7 +280,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
private static class MonthsForReportsAdapter extends ArrayAdapter<String> { private static class MonthsForReportsAdapter extends ArrayAdapter<String> {
private static final SimpleDateFormat queryFormat = new SimpleDateFormat("yyyy-MM", Locale.US); private static final SimpleDateFormat queryFormat = new SimpleDateFormat("yyyy-MM", Locale.US);
@SuppressLint("SimpleDateFormat") @SuppressLint("SimpleDateFormat")
private static final SimpleDateFormat humanFormat = new SimpleDateFormat("MMMM yyyy"); private static final SimpleDateFormat humanFormat = new SimpleDateFormat("LLLL yyyy");
ArrayList<String> queryString = new ArrayList<>(); ArrayList<String> queryString = new ArrayList<>();

View file

@ -32,6 +32,7 @@ import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.AdapterView; import android.widget.AdapterView;
@ -165,9 +166,11 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout); final TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tab_layout);
tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
// tabLayout.setupWithViewPager(viewPager);
// Hack due to bug in design support library v22.2.1 // Hack due to bug in design support library v22.2.1
// https://code.google.com/p/android/issues/detail?id=180462 // https://code.google.com/p/android/issues/detail?id=180462
// TODO remove in new version // TODO remove in new version
if (Build.VERSION.SDK_INT >= 11) {
if (ViewCompat.isLaidOut(tabLayout)) { if (ViewCompat.isLaidOut(tabLayout)) {
tabLayout.setupWithViewPager(viewPager); tabLayout.setupWithViewPager(viewPager);
} else { } else {
@ -180,6 +183,26 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
} }
}); });
} }
} else {
ViewTreeObserver vto = view.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
ViewTreeObserver obs = view.getViewTreeObserver();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
obs.removeOnGlobalLayoutListener(this);
} else {
obs.removeGlobalOnLayoutListener(this);
}
if (getActivity() != null) {
tabLayout.setupWithViewPager(viewPager);
}
}
});
}
ImageButton onlineDocumentationButton = ImageButton onlineDocumentationButton =
(ImageButton) view.findViewById(R.id.onlineDocumentationButton); (ImageButton) view.findViewById(R.id.onlineDocumentationButton);
@ -346,9 +369,9 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
} else { } else {
new SaveWithAdvancedTagsDialogFragment().show(getChildFragmentManager(), "dialog"); new SaveWithAdvancedTagsDialogFragment().show(getChildFragmentManager(), "dialog");
} }
} else if(editPoiData.getPoiCategory() == getMyApplication().getPoiTypes().getOtherPoiCategory()) { } else if (editPoiData.getPoiCategory() == getMyApplication().getPoiTypes().getOtherPoiCategory()) {
poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type)); poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type));
} else if(editPoiData.getPoiTypeDefined() == null) { } else if (editPoiData.getPoiTypeDefined() == null) {
poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type_only_from_list)); poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type_only_from_list));
} else { } else {
save(); save();
@ -372,7 +395,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
node.putTag(editPoiData.getPoiCategory().getDefaultTag(), tag.getValue()); node.putTag(editPoiData.getPoiCategory().getDefaultTag(), tag.getValue());
} }
if(offlineEdit && !Algorithms.isEmpty(tag.getValue())) { if (offlineEdit && !Algorithms.isEmpty(tag.getValue())) {
node.putTag(tag.getKey(), tag.getValue()); node.putTag(tag.getKey(), tag.getValue());
} }
} else if (!Algorithms.isEmpty(tag.getKey()) && !Algorithms.isEmpty(tag.getValue())) { } else if (!Algorithms.isEmpty(tag.getKey()) && !Algorithms.isEmpty(tag.getValue())) {
@ -460,7 +483,7 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
@Override @Override
protected void onPostExecute(Node result) { protected void onPostExecute(Node result) {
progress.dismiss(); progress.dismiss();
if(postExecute != null) { if (postExecute != null) {
postExecute.processResult(result); postExecute.processResult(result);
} }
} }
@ -476,9 +499,9 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
private void setAdapterForPoiTypeEditText() { private void setAdapterForPoiTypeEditText() {
final Map<String, PoiType> subCategories = new LinkedHashMap<>(); final Map<String, PoiType> subCategories = new LinkedHashMap<>();
PoiCategory ct = editPoiData.getPoiCategory(); PoiCategory ct = editPoiData.getPoiCategory();
if(ct != null) { if (ct != null) {
for (PoiType s : ct.getPoiTypes()) { for (PoiType s : ct.getPoiTypes()) {
if(!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) { if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) {
addMapEntryAdapter(subCategories, s.getTranslation(), s); addMapEntryAdapter(subCategories, s.getTranslation(), s);
addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s); addMapEntryAdapter(subCategories, s.getKeyName().replace('_', ' '), s);
} }