Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
106a257654
4 changed files with 258 additions and 237 deletions
|
@ -1,91 +1,97 @@
|
|||
<LinearLayout
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:context="net.osmand.plus.liveupdates.ReportsFragment" >
|
||||
tools:context="net.osmand.plus.liveupdates.ReportsFragment">
|
||||
|
||||
<include layout="@layout/card_top_divider" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<include layout="@layout/card_top_divider"/>
|
||||
|
||||
<GridLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:columnCount="2" >
|
||||
android:columnCount="2">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_columnSpan="2"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="48dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/select_month_and_country"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
|
||||
<net.osmand.plus.widgets.ButtonEx
|
||||
android:id="@+id/show_all"
|
||||
style="@style/DashboardGeneralButton"
|
||||
android:text="@string/shared_string_all"
|
||||
osmand:textAllCapsCompat="true"
|
||||
osmand:typeface="@string/font_roboto_medium" />
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_height="1dp"
|
||||
android:layout_columnSpan="2"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/calendarImageView"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:src="@drawable/ic_action_data" />
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_data"/>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/montReportsSpinner"
|
||||
android:layout_gravity="fill_horizontal|fill_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="56dp"
|
||||
android:gravity="center_vertical" />
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
<View
|
||||
android:layout_height="1dp"
|
||||
android:layout_column="1"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/regionIconImageView"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:src="@drawable/ic_world_globe_dark" />
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:paddingTop="4dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_world_globe_dark"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/reportsButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="4dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/reports_for"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size" />
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text1"
|
||||
|
@ -93,36 +99,41 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_horizontal"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="Worldwide" />
|
||||
tools:text="Worldwide"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_to_hide"
|
||||
android:layout_height="1dp"
|
||||
android:layout_columnSpan="2"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"
|
||||
android:layout_columnSpan="2" />
|
||||
android:layout_height="9dp"
|
||||
android:layout_columnSpan="2"
|
||||
android:indeterminate="true"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/numberOfContributorsIcon"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:src="@drawable/ic_group" />
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_group"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/numberOfContributorsLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberOfContributorsTitle"
|
||||
|
@ -130,36 +141,35 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/number_of_contributors"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size" />
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contributorsTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_height="1dp"
|
||||
android:layout_column="1"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/numberOfEditsIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:src="@drawable/ic_world_globe_dark" />
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_world_globe_dark"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/numberOfEditsLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberOfEditsTitle"
|
||||
|
@ -167,84 +177,87 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@string/number_of_edits"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size" />
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/editsTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="0"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/donationsIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:src="@drawable/ic_action_message" />
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_message"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/donationsLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/donationsTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/donations"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size" />
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/donationsTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="-"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_height="1dp"
|
||||
android:layout_column="1"
|
||||
android:background="?attr/dashboard_divider" />
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/numberOfRecipientsIcon"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:src="@drawable/ic_group" />
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_group"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/numberOfRecipientsLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="fill_vertical"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/numberOfRecipientsTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/numberOfRecipientsTitle"
|
||||
android:text="@string/number_of_recipients"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size" />
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recipientsTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="-"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/card_bottom_divider" />
|
||||
</GridLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<include layout="@layout/card_bottom_divider"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
|
@ -4,6 +4,7 @@ import android.app.AlarmManager;
|
|||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -67,10 +68,9 @@ public class LiveUpdatesHelper {
|
|||
}
|
||||
|
||||
public static String getNameToDisplay(LocalIndexInfo child, OsmandActionBarActivity activity) {
|
||||
String mapName = FileNameTranslationHelper.getFileName(activity,
|
||||
return FileNameTranslationHelper.getFileName(activity,
|
||||
activity.getMyApplication().getResourceManager().getOsmandRegions(),
|
||||
child.getFileName());
|
||||
return mapName;
|
||||
}
|
||||
|
||||
public static String formatDateTime(Context ctx, long dateTime) {
|
||||
|
@ -79,7 +79,8 @@ public class LiveUpdatesHelper {
|
|||
return dateFormat.format(dateTime) + " " + timeFormat.format(dateTime);
|
||||
}
|
||||
|
||||
public static PendingIntent getPendingIntent(Context context, LocalIndexInfo localIndexInfo) {
|
||||
public static PendingIntent getPendingIntent(@NonNull Context context,
|
||||
@NonNull LocalIndexInfo localIndexInfo) {
|
||||
Intent intent = new Intent(context, LiveUpdatesAlarmReceiver.class);
|
||||
final File file = new File(localIndexInfo.getFileName());
|
||||
final String fileName = Algorithms.getFileNameWithoutExtension(file);
|
||||
|
@ -118,7 +119,7 @@ public class LiveUpdatesHelper {
|
|||
return calendar.getTimeInMillis();
|
||||
}
|
||||
|
||||
public static enum TimeOfDay {
|
||||
public enum TimeOfDay {
|
||||
MORNING(R.string.morning),
|
||||
NIGHT(R.string.night);
|
||||
private final int localizedId;
|
||||
|
@ -138,7 +139,7 @@ public class LiveUpdatesHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static enum UpdateFrequency {
|
||||
public enum UpdateFrequency {
|
||||
HOURLY(R.string.hourly, AlarmManager.INTERVAL_HOUR),
|
||||
DAILY(R.string.daily, AlarmManager.INTERVAL_DAY),
|
||||
WEEKLY(R.string.weekly, AlarmManager.INTERVAL_DAY * 7);
|
||||
|
@ -160,6 +161,6 @@ public class LiveUpdatesHelper {
|
|||
|
||||
public static void runLiveUpdate(Context context, final LocalIndexInfo info, boolean forceUpdate) {
|
||||
final String fnExt = Algorithms.getFileNameWithoutExtension(new File(info.getFileName()));
|
||||
new PerformLiveUpdateAsyncTask(context, info, forceUpdate).execute(new String[]{fnExt});
|
||||
new PerformLiveUpdateAsyncTask(context, info, forceUpdate).execute(fnExt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.app.PendingIntent;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -29,11 +30,14 @@ public class PerformLiveUpdateAsyncTask
|
|||
extends AsyncTask<String, Object, IncrementalChangesManager.IncrementalUpdateList> {
|
||||
private final static Log LOG = PlatformUtil.getLog(PerformLiveUpdateAsyncTask.class);
|
||||
|
||||
@NonNull
|
||||
private final Context context;
|
||||
@NonNull
|
||||
private final LocalIndexInfo localIndexInfo;
|
||||
private final boolean forceUpdate;
|
||||
|
||||
public PerformLiveUpdateAsyncTask(Context context, LocalIndexInfo localIndexInfo,
|
||||
public PerformLiveUpdateAsyncTask(@NonNull Context context,
|
||||
@NonNull LocalIndexInfo localIndexInfo,
|
||||
boolean forceUpdate) {
|
||||
this.context = context;
|
||||
this.localIndexInfo = localIndexInfo;
|
||||
|
@ -127,8 +131,9 @@ public class PerformLiveUpdateAsyncTask
|
|||
}
|
||||
}
|
||||
|
||||
public static void tryRescheduleDownload(Context context, OsmandSettings settings,
|
||||
LocalIndexInfo localIndexInfo) {
|
||||
public static void tryRescheduleDownload(@NonNull Context context,
|
||||
@NonNull OsmandSettings settings,
|
||||
@NonNull LocalIndexInfo localIndexInfo) {
|
||||
final OsmandSettings.CommonPreference<Integer> updateFrequencyPreference =
|
||||
preferenceUpdateFrequency(localIndexInfo, settings);
|
||||
final Integer frequencyOrdinal = updateFrequencyPreference.get();
|
||||
|
|
|
@ -1,18 +1,5 @@
|
|||
package net.osmand.plus.liveupdates;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment.CountryItem;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -37,6 +24,19 @@ import android.widget.TextView;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.liveupdates.CountrySelectionFragment.CountryItem;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ReportsFragment extends BaseOsmAndFragment implements CountrySelectionFragment.OnFragmentInteractionListener {
|
||||
public static final String TITLE = "Report";
|
||||
public static final String DOMAIN = "http://download.osmand.net/";
|
||||
|
@ -72,14 +72,12 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
|||
private TextView numberOfRecipientsTitle;
|
||||
private TextView donationsTitle;
|
||||
private ProgressBar progressBar;
|
||||
private View dividerToHide;
|
||||
|
||||
private int inactiveColor;
|
||||
private int textColorPrimary;
|
||||
private int textColorSecondary;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
@ -120,7 +118,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
|||
}
|
||||
};
|
||||
view.findViewById(R.id.numberOfContributorsLayout).setOnClickListener(listener);
|
||||
view.findViewById(R.id.numberOfEditsLayout).setOnClickListener(listener);;
|
||||
view.findViewById(R.id.numberOfEditsLayout).setOnClickListener(listener);
|
||||
|
||||
countrySelectionFragment.initCountries(getMyApplication());
|
||||
selectedCountryItem = countrySelectionFragment.getCountryItems().get(0);
|
||||
|
@ -154,6 +152,8 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
|||
donationsTextView = (TextView) view.findViewById(R.id.donationsTextView);
|
||||
recipientsTextView = (TextView) view.findViewById(R.id.recipientsTextView);
|
||||
|
||||
dividerToHide = view.findViewById(R.id.divider_to_hide);
|
||||
|
||||
requestAndUpdateUi();
|
||||
|
||||
AdapterView.OnItemSelectedListener onItemSelectedListener = new AdapterView.OnItemSelectedListener() {
|
||||
|
@ -352,6 +352,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
|||
donationsTitle.setTextColor(inactiveColor);
|
||||
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
dividerToHide.setVisibility(View.GONE);
|
||||
|
||||
contributorsTextView.setTextColor(inactiveColor);
|
||||
donationsTextView.setTextColor(inactiveColor);
|
||||
|
@ -370,7 +371,8 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
|
|||
numberOfRecipientsTitle.setTextColor(textColorSecondary);
|
||||
donationsTitle.setTextColor(textColorSecondary);
|
||||
|
||||
progressBar.setVisibility(View.INVISIBLE);
|
||||
progressBar.setVisibility(View.GONE);
|
||||
dividerToHide.setVisibility(View.VISIBLE);
|
||||
|
||||
contributorsTextView.setTextColor(textColorPrimary);
|
||||
editsTextView.setTextColor(textColorPrimary);
|
||||
|
|
Loading…
Reference in a new issue