Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
61fcbbc3a2
21 changed files with 286 additions and 67 deletions
|
@ -353,15 +353,7 @@ dependencies {
|
|||
compile project(':eclipse-compile:design')
|
||||
compile project(':eclipse-compile:cardview')
|
||||
// compile project(":eclipse-compile:recyclerview")
|
||||
compile fileTree(
|
||||
dir: "libs",
|
||||
include: ["*.jar"],
|
||||
exclude: [
|
||||
"QtAndroid-bundled.jar",
|
||||
"QtAndroidAccessibility-bundled.jar",
|
||||
"OsmAndCore_android.jar",
|
||||
"OsmAndCore_wrapper.jar",
|
||||
"android-support-multidex.jar"])
|
||||
compile fileTree(include: ['*.jar'], exclude: ['QtAndroid-bundled.jar', 'QtAndroidAccessibility-bundled.jar', 'OsmAndCore_android.jar', 'OsmAndCore_wrapper.jar', 'android-support-multidex.jar'], dir: 'libs')
|
||||
// compile "com.github.ksoichiro:android-observablescrollview:1.5.0"
|
||||
// compile "com.android.support:appcompat-v7:22.2.1"
|
||||
// compile "com.github.shell-software:fab:1.0.5"
|
||||
|
@ -371,4 +363,5 @@ dependencies {
|
|||
qtcoredebugCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||
qtcoreCompile "net.osmand:OsmAndCore_androidNativeRelease:0.1-SNAPSHOT@aar"
|
||||
qtcoreCompile "net.osmand:OsmAndCore_android:0.1-SNAPSHOT@aar"
|
||||
compile files('libs/gson-2.5.jar')
|
||||
}
|
||||
|
|
BIN
OsmAnd/libs/gson-2.5.jar
Normal file
BIN
OsmAnd/libs/gson-2.5.jar
Normal file
Binary file not shown.
|
@ -22,28 +22,36 @@
|
|||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
<ImageView
|
||||
android:src="@drawable/widget_time"/>
|
||||
<Spinner android:layout_gravity="fill_horizontal"/>
|
||||
android:id="@+id/calendarImageView"
|
||||
android:src="@drawable/ic_action_data"/>
|
||||
<Spinner
|
||||
android:id="@+id/montReportsSpinner"
|
||||
android:layout_gravity="fill_horizontal"/>
|
||||
<View
|
||||
android:layout_column="1"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
<ImageView
|
||||
android:id="@+id/regionIconImageView"
|
||||
android:src="@drawable/ic_world_globe_dark"
|
||||
android:layout_rowSpan="2"/>
|
||||
<TextView
|
||||
android:text="Report for:"/>
|
||||
<Spinner android:layout_gravity="fill_horizontal"/>
|
||||
<Spinner
|
||||
android:id="@+id/regionReportsSpinner"
|
||||
android:layout_gravity="fill_horizontal"/>
|
||||
<View
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
<ImageView
|
||||
android:src="@drawable/ic_world_globe_dark"
|
||||
android:id="@+id/numberOfContributorsIcon"
|
||||
android:src="@drawable/ic_group"
|
||||
android:layout_rowSpan="2"/>
|
||||
<TextView
|
||||
android:text="Number of contributors"/>
|
||||
<TextView
|
||||
android:id="@+id/contributorsTextView"
|
||||
android:text="65"/>
|
||||
<View
|
||||
android:layout_column="1"
|
||||
|
@ -51,11 +59,13 @@
|
|||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/ic_world_globe_dark"
|
||||
android:id="@+id/numberOfEditsIcon"
|
||||
android:src="@drawable/ic_group"
|
||||
android:layout_rowSpan="2"/>
|
||||
<TextView
|
||||
android:text="Number of edits"/>
|
||||
<TextView
|
||||
android:id="@+id/editsTextView"
|
||||
android:text="1125"/>
|
||||
</GridLayout>
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.search.SearchActivity;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.base.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.ColorDialogs;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
|
|
@ -32,8 +32,8 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
|
|
|
@ -35,8 +35,8 @@ import net.osmand.plus.IconsCache;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.poi.NominatimPoiFilter;
|
||||
import net.osmand.plus.poi.PoiFiltersHelper;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
|
|
|
@ -37,9 +37,9 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.myplaces.FavoritesActivity;
|
||||
|
|
42
OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java
Normal file
42
OsmAnd/src/net/osmand/plus/base/BaseOsmAndFragment.java
Normal file
|
@ -0,0 +1,42 @@
|
|||
package net.osmand.plus.base;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.IdRes;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
||||
/**
|
||||
* Created by GaidamakUA on 1/12/16.
|
||||
*/
|
||||
public class BaseOsmAndFragment extends Fragment {
|
||||
private IconsCache iconsCache;
|
||||
|
||||
protected OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
protected IconsCache getIconsCache() {
|
||||
if (iconsCache == null) {
|
||||
iconsCache = getMyApplication().getIconsCache();
|
||||
}
|
||||
return iconsCache;
|
||||
}
|
||||
|
||||
protected Drawable getPaintedContentIcon(@DrawableRes int id, @ColorInt int color){
|
||||
return getIconsCache().getPaintedContentIcon(id, color);
|
||||
}
|
||||
|
||||
protected Drawable getContentIcon(@DrawableRes int id){
|
||||
return getIconsCache().getContentIcon(id);
|
||||
}
|
||||
|
||||
protected void setThemedDrawable(View parent, @IdRes int viewId, @DrawableRes int iconId) {
|
||||
((ImageView) parent.findViewById(viewId)).setImageDrawable(getContentIcon(iconId));
|
||||
}
|
||||
}
|
|
@ -1,11 +1,12 @@
|
|||
package net.osmand.plus.activities;
|
||||
package net.osmand.plus.base;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public abstract class OsmAndListFragment extends ListFragment {
|
||||
|
||||
@Override
|
|
@ -1,12 +1,9 @@
|
|||
package net.osmand.plus.activities;
|
||||
package net.osmand.plus.base;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import android.graphics.Shader.TileMode;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
@ -15,17 +12,16 @@ import android.widget.ExpandableListAdapter;
|
|||
import android.widget.ExpandableListView;
|
||||
import android.widget.ExpandableListView.OnChildClickListener;
|
||||
|
||||
public abstract class OsmandExpandableListFragment extends Fragment
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
|
||||
public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment
|
||||
implements OnChildClickListener {
|
||||
|
||||
|
||||
protected ExpandableListView listView;
|
||||
protected ExpandableListAdapter adapter;
|
||||
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
|
|
@ -46,7 +46,7 @@ import net.osmand.plus.activities.LocalIndexHelper;
|
|||
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
|
||||
import net.osmand.plus.activities.LocalIndexInfo;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.base.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadActivityType;
|
||||
|
|
|
@ -19,7 +19,7 @@ import android.widget.TextView;
|
|||
import net.osmand.map.OsmandRegions;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.download.DownloadActivity;
|
||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||
import net.osmand.plus.download.DownloadResources;
|
||||
|
|
|
@ -1,12 +1,26 @@
|
|||
package net.osmand.plus.liveupdates;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.liveupdates.network.GetJsonAsyncTask;
|
||||
import net.osmand.plus.liveupdates.network.Protocol;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
|
@ -16,13 +30,107 @@ import net.osmand.plus.R;
|
|||
* Use the {@link ReportsFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class ReportsFragment extends Fragment {
|
||||
public class ReportsFragment extends BaseOsmAndFragment {
|
||||
public static final String TITLE = "Report";
|
||||
public static final String TOTAL_CHANGES_BY_MONTH_URL = "http://builder.osmand.net/reports/total_changes_by_month.php?month=";
|
||||
|
||||
private TextView contributorsTextView;
|
||||
private TextView editsTextView;
|
||||
|
||||
private Spinner montReportsSpinner;
|
||||
private Spinner regionReportsSpinner;
|
||||
private MonthsForReportsAdapter monthsForReportsAdapter;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return 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);
|
||||
monthsForReportsAdapter = new MonthsForReportsAdapter(getActivity());
|
||||
montReportsSpinner.setAdapter(monthsForReportsAdapter);
|
||||
|
||||
regionReportsSpinner = (Spinner) view.findViewById(R.id.regionReportsSpinner);
|
||||
ArrayAdapter<String> regionsForReportsAdapter =
|
||||
new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item,
|
||||
new String[]{"Worldwide"});
|
||||
regionsForReportsAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
regionReportsSpinner.setAdapter(regionsForReportsAdapter);
|
||||
|
||||
setThemedDrawable(view, R.id.calendarImageView, R.drawable.ic_action_data);
|
||||
setThemedDrawable(view, R.id.regionIconImageView, R.drawable.ic_world_globe_dark);
|
||||
setThemedDrawable(view, R.id.numberOfContributorsIcon, R.drawable.ic_group);
|
||||
setThemedDrawable(view, R.id.numberOfEditsIcon, R.drawable.ic_group);
|
||||
|
||||
contributorsTextView = (TextView) view.findViewById(R.id.contributorsTextView);
|
||||
editsTextView = (TextView) view.findViewById(R.id.editsTextView);
|
||||
|
||||
requestAndUpdateUi();
|
||||
|
||||
AdapterView.OnItemSelectedListener onItemSelectedListener = new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
requestAndUpdateUi();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
};
|
||||
montReportsSpinner.setOnItemSelectedListener(onItemSelectedListener);
|
||||
regionReportsSpinner.setOnItemSelectedListener(onItemSelectedListener);
|
||||
return view;
|
||||
}
|
||||
|
||||
private void requestAndUpdateUi() {
|
||||
int monthItemPosition = montReportsSpinner.getSelectedItemPosition();
|
||||
String monthUrlString = monthsForReportsAdapter.getQueryString(monthItemPosition);
|
||||
String regionUrlString = regionReportsSpinner.getSelectedItem().toString();
|
||||
GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse> onResponseListener =
|
||||
new GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse>() {
|
||||
@Override
|
||||
public void onResponse(Protocol.TotalChangesByMonthResponse response) {
|
||||
contributorsTextView.setText(String.valueOf(response.users));
|
||||
editsTextView.setText(String.valueOf(response.changes));
|
||||
}
|
||||
};
|
||||
requestData(monthUrlString, regionUrlString, onResponseListener);
|
||||
}
|
||||
|
||||
private void requestData(String monthUrlString, String regionUrlString,
|
||||
GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse> onResponseListener) {
|
||||
GetJsonAsyncTask<Protocol.TotalChangesByMonthResponse> totalChangesByMontAsyncTask =
|
||||
new GetJsonAsyncTask<>(Protocol.TotalChangesByMonthResponse.class);
|
||||
totalChangesByMontAsyncTask.setOnResponseListener(onResponseListener);
|
||||
totalChangesByMontAsyncTask.execute(TOTAL_CHANGES_BY_MONTH_URL + monthUrlString);
|
||||
}
|
||||
|
||||
private static class MonthsForReportsAdapter extends ArrayAdapter<String> {
|
||||
private static final SimpleDateFormat queryFormat = new SimpleDateFormat("yyyy-MM", Locale.US);
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
private static final SimpleDateFormat humanFormat = new SimpleDateFormat("MMMM yyyy");
|
||||
|
||||
ArrayList<String> queryString = new ArrayList<>();
|
||||
|
||||
public MonthsForReportsAdapter(Context context) {
|
||||
super(context, android.R.layout.simple_spinner_item);
|
||||
Calendar startDate = Calendar.getInstance();
|
||||
startDate.set(Calendar.MONTH, Calendar.JUNE);
|
||||
startDate.set(Calendar.YEAR, 2015);
|
||||
Calendar endDate = Calendar.getInstance();
|
||||
endDate.set(Calendar.DAY_OF_MONTH, endDate.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
endDate.set(Calendar.HOUR_OF_DAY, endDate.getActualMaximum(Calendar.HOUR_OF_DAY));
|
||||
while (startDate.before(endDate)) {
|
||||
queryString.add(queryFormat.format(startDate.getTime()));
|
||||
add(humanFormat.format(startDate.getTime()));
|
||||
startDate.add(Calendar.MONTH, 1);
|
||||
}
|
||||
setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
}
|
||||
|
||||
public String getQueryString(int position) {
|
||||
return queryString.get(position);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package net.osmand.plus.liveupdates.network;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
/**
|
||||
* Created by GaidamakUA on 1/12/16.
|
||||
*/
|
||||
public class GetJsonAsyncTask<Protocol> extends AsyncTask<String, Void, Protocol> {
|
||||
private static final Log LOG = PlatformUtil.getLog(GetJsonAsyncTask.class);
|
||||
private final Class<Protocol> protocolClass;
|
||||
private final Gson gson = new Gson();
|
||||
private OnResponseListener<Protocol> onResponseListener;
|
||||
|
||||
public GetJsonAsyncTask(Class<Protocol> protocolClass) {
|
||||
this.protocolClass = protocolClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Protocol doInBackground(String... params) {
|
||||
StringBuilder response = new StringBuilder();
|
||||
String error = NetworkUtils.sendGetRequest(params[0], null, response);
|
||||
if (error == null) {
|
||||
return gson.fromJson(response.toString(), protocolClass);
|
||||
}
|
||||
LOG.error(error);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Protocol protocol) {
|
||||
if (onResponseListener != null) {
|
||||
onResponseListener.onResponse(protocol);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnResponseListener(OnResponseListener<Protocol> onResponseListener) {
|
||||
this.onResponseListener = onResponseListener;
|
||||
}
|
||||
|
||||
public interface OnResponseListener<Protocol> {
|
||||
void onResponse(Protocol response);
|
||||
}
|
||||
}
|
29
OsmAnd/src/net/osmand/plus/liveupdates/network/Protocol.java
Normal file
29
OsmAnd/src/net/osmand/plus/liveupdates/network/Protocol.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package net.osmand.plus.liveupdates.network;
|
||||
|
||||
/**
|
||||
* Created by GaidamakUA on 1/12/16.
|
||||
*/
|
||||
public final class Protocol {
|
||||
private Protocol(){}
|
||||
|
||||
public static class RankingByMonthResponse {
|
||||
public String month;
|
||||
public RankingByMonth[] rows;
|
||||
}
|
||||
|
||||
// {"rank":"8","countUsers":"713","minChanges":"14","maxChanges":"18","avgChanges":"15.9845722300140252"}
|
||||
public static class RankingByMonth {
|
||||
public int rank;
|
||||
public int countUsers;
|
||||
public int minChanges;
|
||||
public int maxChanges;
|
||||
public float avgChanges;
|
||||
}
|
||||
|
||||
// {"month":"2015-11","users":"28363","changes":"673830"}
|
||||
public static class TotalChangesByMonthResponse {
|
||||
public String month;
|
||||
public int users;
|
||||
public int changes;
|
||||
}
|
||||
}
|
|
@ -51,9 +51,9 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.activities.OsmandBaseExpandableListAdapter;
|
||||
import net.osmand.plus.activities.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.base.OsmandExpandableListFragment;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.download.ui.LocalIndexesFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
@ -1357,4 +1357,4 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
v.findViewById(R.id.check_item).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -41,9 +41,9 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.activities.TrackActivity;
|
||||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.helpers.ColorDialogs;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.graphics.Point;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -28,8 +27,8 @@ import net.osmand.osm.PoiCategory;
|
|||
import net.osmand.osm.PoiFilter;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.osm.edit.OSMSettings;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -39,7 +38,7 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
public class AdvancedEditPoiFragment extends Fragment
|
||||
public class AdvancedEditPoiFragment extends BaseOsmAndFragment
|
||||
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
||||
private static final String TAG = "AdvancedEditPoiFragment";
|
||||
private static final Log LOG = PlatformUtil.getLog(AdvancedEditPoiFragment.class);
|
||||
|
@ -68,16 +67,15 @@ public class AdvancedEditPoiFragment extends Fragment
|
|||
int height = size.y;
|
||||
view.findViewById(R.id.screenFiller).setMinimumHeight(height);
|
||||
|
||||
deleteDrawable = ((OsmandApplication) getActivity().getApplication()).getIconsCache()
|
||||
.getPaintedContentIcon(R.drawable.ic_action_remove_dark,
|
||||
getActivity().getResources().getColor(R.color.dash_search_icon_dark));
|
||||
deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark,
|
||||
getActivity().getResources().getColor(R.color.dash_search_icon_dark));
|
||||
nameTextView = (TextView) view.findViewById(R.id.nameTextView);
|
||||
amenityTagTextView = (TextView) view.findViewById(R.id.amenityTagTextView);
|
||||
amenityTextView = (TextView) view.findViewById(R.id.amenityTextView);
|
||||
LinearLayout editTagsLineaLayout =
|
||||
(LinearLayout) view.findViewById(R.id.editTagsList);
|
||||
|
||||
final MapPoiTypes mapPoiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes();
|
||||
final MapPoiTypes mapPoiTypes = getMyApplication().getPoiTypes();
|
||||
mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData());
|
||||
// It is possible to not restart initialization every time, and probably move initialization to appInit
|
||||
Map<String, PoiType> translatedTypes = getData().getAllTranslatedSubTypes();
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.graphics.Point;
|
|||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -23,9 +22,8 @@ import android.widget.TextView;
|
|||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.osm.edit.OSMSettings;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.osmedit.dialogs.OpeningHoursDaysDialogFragment;
|
||||
import net.osmand.plus.osmedit.dialogs.OpeningHoursHoursDialogFragment;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -36,7 +34,7 @@ import org.apache.commons.logging.Log;
|
|||
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
public class BasicEditPoiFragment extends Fragment
|
||||
public class BasicEditPoiFragment extends BaseOsmAndFragment
|
||||
implements EditPoiDialogFragment.OnFragmentActivatedListener {
|
||||
private static final Log LOG = PlatformUtil.getLog(BasicEditPoiFragment.class);
|
||||
private static final String OPENING_HOURS = "opening_hours";
|
||||
|
@ -63,26 +61,24 @@ public class BasicEditPoiFragment extends Fragment
|
|||
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
|
||||
int iconColor = typedValue.data;
|
||||
|
||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
||||
|
||||
ImageView streetImageView = (ImageView) view.findViewById(R.id.streetImageView);
|
||||
streetImageView.setImageDrawable(
|
||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_street_name, iconColor));
|
||||
getPaintedContentIcon(R.drawable.ic_action_street_name, iconColor));
|
||||
ImageView houseNumberImageView = (ImageView) view.findViewById(R.id.houseNumberImageView);
|
||||
houseNumberImageView.setImageDrawable(
|
||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_building_number, iconColor));
|
||||
getPaintedContentIcon(R.drawable.ic_action_building_number, iconColor));
|
||||
ImageView phoneImageView = (ImageView) view.findViewById(R.id.phoneImageView);
|
||||
phoneImageView.setImageDrawable(
|
||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_call_dark, iconColor));
|
||||
getPaintedContentIcon(R.drawable.ic_action_call_dark, iconColor));
|
||||
ImageView webSiteImageView = (ImageView) view.findViewById(R.id.webSiteImageView);
|
||||
webSiteImageView.setImageDrawable(
|
||||
iconsCache.getPaintedContentIcon(R.drawable.ic_world_globe_dark, iconColor));
|
||||
getPaintedContentIcon(R.drawable.ic_world_globe_dark, iconColor));
|
||||
ImageView descriptionImageView = (ImageView) view.findViewById(R.id.descriptionImageView);
|
||||
descriptionImageView.setImageDrawable(
|
||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_description, iconColor));
|
||||
getPaintedContentIcon(R.drawable.ic_action_description, iconColor));
|
||||
ImageView openingHoursImageView = (ImageView) view.findViewById(R.id.openingHoursImageView);
|
||||
openingHoursImageView.setImageDrawable(
|
||||
iconsCache.getPaintedContentIcon(R.drawable.ic_action_time, iconColor));
|
||||
getPaintedContentIcon(R.drawable.ic_action_time, iconColor));
|
||||
|
||||
streetEditText = (EditText) view.findViewById(R.id.streetEditText);
|
||||
houseNumberEditText = (EditText) view.findViewById(R.id.houseNumberEditText);
|
||||
|
@ -106,10 +102,8 @@ public class BasicEditPoiFragment extends Fragment
|
|||
}
|
||||
});
|
||||
LinearLayout openHoursContainer = (LinearLayout) view.findViewById(R.id.openHoursContainer);
|
||||
Drawable clockDrawable = iconsCache
|
||||
.getPaintedContentIcon(R.drawable.ic_action_time, iconColor);
|
||||
Drawable deleteDrawable = iconsCache
|
||||
.getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);
|
||||
Drawable clockDrawable = getPaintedContentIcon(R.drawable.ic_action_time, iconColor);
|
||||
Drawable deleteDrawable = getPaintedContentIcon(R.drawable.ic_action_remove_dark, iconColor);
|
||||
if (savedInstanceState != null && savedInstanceState.containsKey(OPENING_HOURS)) {
|
||||
mOpeningHoursAdapter = new OpeningHoursAdapter(
|
||||
(OpeningHoursParser.OpeningHours) savedInstanceState.getSerializable(OPENING_HOURS),
|
||||
|
@ -123,10 +117,6 @@ public class BasicEditPoiFragment extends Fragment
|
|||
return view;
|
||||
}
|
||||
|
||||
private OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
protected void addTextWatcher(final String tag, final EditText e) {
|
||||
e.addTextChangedListener(new TextWatcher() {
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ import net.osmand.plus.OsmandSettings;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.ActionBarProgressActivity;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.OsmAndListFragment;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.base.OsmAndListFragment;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.dialogs.ProgressDialogFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
@ -725,4 +725,4 @@ public class OsmEditsFragment extends OsmAndListFragment
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue