Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-07-22 20:09:07 +02:00
commit a8f2233031
4 changed files with 83 additions and 49 deletions

View file

@ -13,7 +13,7 @@ import java.util.List;
public class GPXDatabase {
private static final String DB_NAME = "gpx_database";
private static final int DB_VERSION = 4;
private static final int DB_VERSION = 5;
private static final String GPX_TABLE_NAME = "gpxTable";
private static final String GPX_COL_NAME = "fileName";
private static final String GPX_COL_DIR = "fileDir";
@ -183,11 +183,43 @@ public class GPXDatabase {
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_TYPE + " int");
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_INTERVAL + " double");
}
if (oldVersion < 3) {
List<GpxDataItem> items = getItems();
for (GpxDataItem item : items) {
updateLastModifiedTime(item);
if (oldVersion < 5) {
boolean colorColumnExists = false;
boolean fileLastModifiedTimeColumnExists = false;
boolean splitTypeColumnExists = false;
boolean splitIntervalColumnExists = false;
SQLiteCursor cursor = db.rawQuery("PRAGMA table_info(" + GPX_TABLE_NAME + ")", null);
if (cursor.moveToFirst()) {
do {
String columnName = cursor.getString(1);
if (!colorColumnExists && columnName.equals(GPX_COL_COLOR)) {
colorColumnExists = true;
} else if (!fileLastModifiedTimeColumnExists && columnName.equals(GPX_COL_FILE_LAST_MODIFIED_TIME)) {
fileLastModifiedTimeColumnExists = true;
} else if (!splitTypeColumnExists && columnName.equals(GPX_COL_SPLIT_TYPE)) {
splitTypeColumnExists = true;
} else if (!splitIntervalColumnExists && columnName.equals(GPX_COL_SPLIT_INTERVAL)) {
splitIntervalColumnExists = true;
}
} while (cursor.moveToNext());
}
cursor.close();
if (!colorColumnExists) {
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_COLOR + " TEXT");
}
if (!fileLastModifiedTimeColumnExists) {
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_FILE_LAST_MODIFIED_TIME + " long");
List<GpxDataItem> items = getItems();
for (GpxDataItem item : items) {
updateLastModifiedTime(item);
}
}
if (!splitTypeColumnExists) {
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_TYPE + " int");
}
if (!splitIntervalColumnExists) {
db.execSQL("ALTER TABLE " + GPX_TABLE_NAME + " ADD " + GPX_COL_SPLIT_INTERVAL + " double");
}
}
}

View file

@ -162,47 +162,49 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppList
}
public void updateSubscriptionHeader() {
View subscriptionBanner = subscriptionHeader.findViewById(R.id.subscription_banner);
View subscriptionInfo = subscriptionHeader.findViewById(R.id.subscription_info);
if (getSettings().LIVE_UPDATES_PURCHASED.get()) {
ImageView statusIcon = (ImageView) subscriptionHeader.findViewById(R.id.statusIcon);
TextView statusTextView = (TextView) subscriptionHeader.findViewById(R.id.statusTextView);
TextView regionNameTextView = (TextView) subscriptionHeader.findViewById(R.id.regionTextView);
statusTextView.setText(getString(R.string.osm_live_active));
statusIcon.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_done));
if (getActivity() instanceof OsmLiveActivity) {
View subscriptionBanner = subscriptionHeader.findViewById(R.id.subscription_banner);
View subscriptionInfo = subscriptionHeader.findViewById(R.id.subscription_info);
if (getSettings().LIVE_UPDATES_PURCHASED.get()) {
ImageView statusIcon = (ImageView) subscriptionHeader.findViewById(R.id.statusIcon);
TextView statusTextView = (TextView) subscriptionHeader.findViewById(R.id.statusTextView);
TextView regionNameTextView = (TextView) subscriptionHeader.findViewById(R.id.regionTextView);
statusTextView.setText(getString(R.string.osm_live_active));
statusIcon.setImageDrawable(getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_done));
String countryName = getSettings().BILLING_USER_COUNTRY.get();
if (Algorithms.isEmpty(countryName)) {
WorldRegion world = getMyApplication().getRegions().getWorldRegion();
countryName = world.getLocaleName();
String countryName = getSettings().BILLING_USER_COUNTRY.get();
if (Algorithms.isEmpty(countryName)) {
WorldRegion world = getMyApplication().getRegions().getWorldRegion();
countryName = world.getLocaleName();
}
regionNameTextView.setText(countryName);
subscriptionBanner.setVisibility(View.GONE);
subscriptionInfo.setVisibility(View.VISIBLE);
} else {
Button readMoreBtn = (Button) subscriptionHeader.findViewById(R.id.read_more_button);
readMoreBtn.setEnabled(!processing);
readMoreBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("https://osmand.net/osm_live.php");
Intent goToOsmLive = new Intent(Intent.ACTION_VIEW, uri);
startActivity(goToOsmLive);
}
});
Button subscriptionButton = (Button) subscriptionHeader.findViewById(R.id.subscription_button);
subscriptionButton.setEnabled(!processing);
subscriptionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
}
});
subscriptionBanner.setVisibility(View.VISIBLE);
subscriptionInfo.setVisibility(View.GONE);
}
regionNameTextView.setText(countryName);
subscriptionBanner.setVisibility(View.GONE);
subscriptionInfo.setVisibility(View.VISIBLE);
} else {
Button readMoreBtn = (Button) subscriptionHeader.findViewById(R.id.read_more_button);
readMoreBtn.setEnabled(!processing);
readMoreBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse("https://osmand.net/osm_live.php");
Intent goToOsmLive = new Intent(Intent.ACTION_VIEW, uri);
startActivity(goToOsmLive);
}
});
Button subscriptionButton = (Button) subscriptionHeader.findViewById(R.id.subscription_button);
subscriptionButton.setEnabled(!processing);
subscriptionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SubscriptionFragment subscriptionFragment = new SubscriptionFragment();
subscriptionFragment.show(getChildFragmentManager(), SubscriptionFragment.TAG);
}
});
subscriptionBanner.setVisibility(View.VISIBLE);
subscriptionInfo.setVisibility(View.GONE);
}
}

View file

@ -165,7 +165,7 @@ public class DashTrackFragment extends DashBaseFragment {
info.subfolder = "";
info.file = f;
View v = inflater.inflate(R.layout.dash_gpx_track_item, null, false);
AvailableGPXFragment.udpateGpxInfoView(v, info, app, true);
AvailableGPXFragment.updateGpxInfoView(v, info, app, true);
v.setOnClickListener(new View.OnClickListener() {
@Override
@ -257,7 +257,7 @@ public class DashTrackFragment extends DashBaseFragment {
AvailableGPXFragment.GpxInfo info = new AvailableGPXFragment.GpxInfo();
info.subfolder = "";
info.file = f;
AvailableGPXFragment.udpateGpxInfoView(pView, info, app, true);
AvailableGPXFragment.updateGpxInfoView(pView, info, app, true);
updateShowOnMap(app, f, v, showOnMap);
}
});

View file

@ -1048,7 +1048,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
LayoutInflater inflater = getActivity().getLayoutInflater();
v = inflater.inflate(R.layout.dash_gpx_track_item, parent, false);
}
udpateGpxInfoView(v, child, app, false);
updateGpxInfoView(v, child, app, false);
ImageView icon = (ImageView) v.findViewById(R.id.icon);
ImageButton options = (ImageButton) v.findViewById(R.id.options);
@ -1752,7 +1752,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
}
}
public static void udpateGpxInfoView(View v, GpxInfo child, OsmandApplication app, boolean isDashItem) {
public static void updateGpxInfoView(View v, GpxInfo child, OsmandApplication app, boolean isDashItem) {
TextView viewName = ((TextView) v.findViewById(R.id.name));
if (!isDashItem) {
v.findViewById(R.id.divider_list).setVisibility(View.VISIBLE);