Rename classes back
This commit is contained in:
parent
be864d7c4f
commit
721829d6ad
9 changed files with 31 additions and 31 deletions
|
@ -101,7 +101,7 @@ public class IconsCache {
|
||||||
long hash = ((long)resId << 31L) + clrId;
|
long hash = ((long)resId << 31L) + clrId;
|
||||||
Drawable d = osmandDrawable.get(hash);
|
Drawable d = osmandDrawable.get(hash);
|
||||||
if (d == null) {
|
if (d == null) {
|
||||||
d = OAResources.getDrawable(resId);
|
d = OsmandResources.getDrawable(resId);
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
d = DrawableCompat.wrap(d);
|
d = DrawableCompat.wrap(d);
|
||||||
d.mutate();
|
d.mutate();
|
||||||
|
@ -118,7 +118,7 @@ public class IconsCache {
|
||||||
long hash = ((long)resId << 31L) + color;
|
long hash = ((long)resId << 31L) + color;
|
||||||
Drawable d = osmandDrawable.get(hash);
|
Drawable d = osmandDrawable.get(hash);
|
||||||
if(d == null) {
|
if(d == null) {
|
||||||
d = OAResources.getDrawable(resId);
|
d = OsmandResources.getDrawable(resId);
|
||||||
if (d != null) {
|
if (d != null) {
|
||||||
d = DrawableCompat.wrap(d);
|
d = DrawableCompat.wrap(d);
|
||||||
d.mutate();
|
d.mutate();
|
||||||
|
@ -130,7 +130,7 @@ public class IconsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getPaintedIcon(String osmandId, @ColorInt int color){
|
public Drawable getPaintedIcon(String osmandId, @ColorInt int color){
|
||||||
int id = OAResources.getDrawableId(osmandId);
|
int id = OsmandResources.getDrawableId(osmandId);
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
return getPaintedOsmandDrawable(id, color);
|
return getPaintedOsmandDrawable(id, color);
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ public class IconsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getIcon(String osmandId, @ColorRes int colorId) {
|
public Drawable getIcon(String osmandId, @ColorRes int colorId) {
|
||||||
int id = OAResources.getDrawableId(osmandId);
|
int id = OsmandResources.getDrawableId(osmandId);
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
return getOsmandDrawable(id, colorId);
|
return getOsmandDrawable(id, colorId);
|
||||||
}
|
}
|
||||||
|
@ -150,8 +150,8 @@ public class IconsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getIcon(String osmandBackgroundId, String osmandId, @ColorRes int colorId) {
|
public Drawable getIcon(String osmandBackgroundId, String osmandId, @ColorRes int colorId) {
|
||||||
int backgroundId = OAResources.getDrawableId(osmandBackgroundId);
|
int backgroundId = OsmandResources.getDrawableId(osmandBackgroundId);
|
||||||
int id = OAResources.getDrawableId(osmandId);
|
int id = OsmandResources.getDrawableId(osmandId);
|
||||||
if (backgroundId != 0 && id != 0) {
|
if (backgroundId != 0 && id != 0) {
|
||||||
Drawable b = getOsmandDrawable(backgroundId, 0);
|
Drawable b = getOsmandDrawable(backgroundId, 0);
|
||||||
Drawable f = getOsmandDrawable(id, colorId);
|
Drawable f = getOsmandDrawable(id, colorId);
|
||||||
|
@ -164,7 +164,7 @@ public class IconsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getThemedIcon(String osmandId) {
|
public Drawable getThemedIcon(String osmandId) {
|
||||||
int id = OAResources.getDrawableId(osmandId);
|
int id = OsmandResources.getDrawableId(osmandId);
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
return getOsmandDrawable(id, R.color.icon_color);
|
return getOsmandDrawable(id, R.color.icon_color);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ public class IconsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getIcon(String osmandId) {
|
public Drawable getIcon(String osmandId) {
|
||||||
int id = OAResources.getDrawableId(osmandId);
|
int id = OsmandResources.getDrawableId(osmandId);
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
return getOsmandDrawable(id, 0);
|
return getOsmandDrawable(id, 0);
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ public class IconsCache {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getIcon(String osmandId, boolean light) {
|
public Drawable getIcon(String osmandId, boolean light) {
|
||||||
int id = OAResources.getDrawableId(osmandId);
|
int id = OsmandResources.getDrawableId(osmandId);
|
||||||
if (id != 0) {
|
if (id != 0) {
|
||||||
return getOsmandDrawable(id, light ? R.color.icon_color : 0);
|
return getOsmandDrawable(id, light ? R.color.icon_color : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@ import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.app.AppCompatDialogFragment;
|
import android.support.v7.app.AppCompatDialogFragment;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
public class InstallOAAppDialog extends AppCompatDialogFragment {
|
public class InstallOsmandAppDialog extends AppCompatDialogFragment {
|
||||||
private static final String TAG = "InstallOAAppDialog";
|
private static final String TAG = "InstallOsmandAppDialog";
|
||||||
private static final String OSMAND_PLUS_PACKAGE_NAME = "net.osmand.plus";
|
private static final String OSMAND_PLUS_PACKAGE_NAME = "net.osmand.plus";
|
||||||
private static final String OSMAND_PACKAGE_NAME = "net.osmand";
|
private static final String OSMAND_PACKAGE_NAME = "net.osmand";
|
||||||
private static boolean wasChecked = false;
|
private static boolean wasChecked = false;
|
||||||
|
@ -69,7 +69,7 @@ public class InstallOAAppDialog extends AppCompatDialogFragment {
|
||||||
wasChecked = true;
|
wasChecked = true;
|
||||||
if (!SampleUtils.isPackageInstalled(OSMAND_PACKAGE_NAME, ctx)
|
if (!SampleUtils.isPackageInstalled(OSMAND_PACKAGE_NAME, ctx)
|
||||||
&& !SampleUtils.isPackageInstalled(OSMAND_PLUS_PACKAGE_NAME, ctx)) {
|
&& !SampleUtils.isPackageInstalled(OSMAND_PLUS_PACKAGE_NAME, ctx)) {
|
||||||
new InstallOAAppDialog().show(manager, TAG);
|
new InstallOsmandAppDialog().show(manager, TAG);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
|
@ -224,7 +224,7 @@ public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
app.getIconsCache().setDisplayDensityFactor(displayDensityFactor);
|
app.getIconsCache().setDisplayDensityFactor(displayDensityFactor);
|
||||||
|
|
||||||
if (!InstallOAAppDialog.showIfNeeded(getSupportFragmentManager(), this)
|
if (!InstallOsmandAppDialog.showIfNeeded(getSupportFragmentManager(), this)
|
||||||
&& externalStoragePermissionGranted) {
|
&& externalStoragePermissionGranted) {
|
||||||
checkMapsInstalled();
|
checkMapsInstalled();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
public class OAResources {
|
public class OsmandResources {
|
||||||
|
|
||||||
private static Resources osmandResources;
|
private static Resources osmandResources;
|
||||||
private static String packageName;
|
private static String packageName;
|
||||||
|
@ -34,7 +34,7 @@ public class OAResources {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (osmandResources != null) {
|
if (osmandResources != null) {
|
||||||
OAResources.packageName = packageName;
|
OsmandResources.packageName = packageName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class SampleApplication extends Application {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
OAResources.init(this);
|
OsmandResources.init(this);
|
||||||
locationProvider = new SampleLocationProvider(this);
|
locationProvider = new SampleLocationProvider(this);
|
||||||
searchUICore = new QuickSearchHelper(this);
|
searchUICore = new QuickSearchHelper(this);
|
||||||
uiHandler = new Handler();
|
uiHandler = new Handler();
|
||||||
|
@ -206,10 +206,10 @@ public class SampleApplication extends Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getString(String osmandId) {
|
public String getString(String osmandId) {
|
||||||
return OAResources.getString(osmandId);
|
return OsmandResources.getString(osmandId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getString(String osmandId, Object... formatArgs) {
|
public String getString(String osmandId, Object... formatArgs) {
|
||||||
return OAResources.getString(osmandId, formatArgs);
|
return OsmandResources.getString(osmandId, formatArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ import android.content.res.TypedArray;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
|
||||||
import net.osmand.core.samples.android.sample1.OAResources;
|
import net.osmand.core.samples.android.sample1.OsmandResources;
|
||||||
import net.osmand.core.samples.android.sample1.R;
|
import net.osmand.core.samples.android.sample1.R;
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +54,6 @@ public class OsmandImageButton extends ImageButton {
|
||||||
}
|
}
|
||||||
|
|
||||||
String osmandSrc = resolvedAttributes.getString(R.styleable.OsmandImageButton_osmandSrc);
|
String osmandSrc = resolvedAttributes.getString(R.styleable.OsmandImageButton_osmandSrc);
|
||||||
target.setImageDrawable(OAResources.getDrawable(osmandSrc));
|
target.setImageDrawable(OsmandResources.getDrawable(osmandSrc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import android.content.res.TypedArray;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import net.osmand.core.samples.android.sample1.OAResources;
|
import net.osmand.core.samples.android.sample1.OsmandResources;
|
||||||
import net.osmand.core.samples.android.sample1.R;
|
import net.osmand.core.samples.android.sample1.R;
|
||||||
|
|
||||||
public class OsmandImageView extends ImageView {
|
public class OsmandImageView extends ImageView {
|
||||||
|
@ -52,6 +52,6 @@ public class OsmandImageView extends ImageView {
|
||||||
}
|
}
|
||||||
|
|
||||||
String osmandSrc = resolvedAttributes.getString(R.styleable.OsmandImageButton_osmandSrc);
|
String osmandSrc = resolvedAttributes.getString(R.styleable.OsmandImageButton_osmandSrc);
|
||||||
target.setImageDrawable(OAResources.getDrawable(osmandSrc));
|
target.setImageDrawable(OsmandResources.getDrawable(osmandSrc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import android.content.res.TypedArray;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.core.samples.android.sample1.OAResources;
|
import net.osmand.core.samples.android.sample1.OsmandResources;
|
||||||
import net.osmand.core.samples.android.sample1.R;
|
import net.osmand.core.samples.android.sample1.R;
|
||||||
|
|
||||||
public class OsmandTextView extends TextView {
|
public class OsmandTextView extends TextView {
|
||||||
|
@ -52,6 +52,6 @@ public class OsmandTextView extends TextView {
|
||||||
}
|
}
|
||||||
|
|
||||||
String osmandText = resolvedAttributes.getString(R.styleable.OsmandTextView_osmandText);
|
String osmandText = resolvedAttributes.getString(R.styleable.OsmandTextView_osmandText);
|
||||||
target.setText(OAResources.getString(osmandText));
|
target.setText(OsmandResources.getString(osmandText));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package net.osmand.core.samples.android.sample1.search;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import net.osmand.binary.BinaryMapIndexReader;
|
import net.osmand.binary.BinaryMapIndexReader;
|
||||||
import net.osmand.core.samples.android.sample1.OAResources;
|
import net.osmand.core.samples.android.sample1.OsmandResources;
|
||||||
import net.osmand.core.samples.android.sample1.R;
|
import net.osmand.core.samples.android.sample1.R;
|
||||||
import net.osmand.core.samples.android.sample1.SampleApplication;
|
import net.osmand.core.samples.android.sample1.SampleApplication;
|
||||||
import net.osmand.core.samples.android.sample1.SampleFormatter;
|
import net.osmand.core.samples.android.sample1.SampleFormatter;
|
||||||
|
@ -202,11 +202,11 @@ public class QuickSearchListItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getPoiTypeIconId(SampleApplication app, AbstractPoiType abstractPoiType) {
|
public static int getPoiTypeIconId(SampleApplication app, AbstractPoiType abstractPoiType) {
|
||||||
int res = OAResources.getDrawableId("mx_" + abstractPoiType.getIconKeyName());
|
int res = OsmandResources.getDrawableId("mx_" + abstractPoiType.getIconKeyName());
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
return res;
|
return res;
|
||||||
} else if (abstractPoiType instanceof PoiType) {
|
} else if (abstractPoiType instanceof PoiType) {
|
||||||
res = OAResources.getDrawableId("mx_" + ((PoiType) abstractPoiType).getOsmTag()
|
res = OsmandResources.getDrawableId("mx_" + ((PoiType) abstractPoiType).getOsmTag()
|
||||||
+ "_" + ((PoiType) abstractPoiType).getOsmValue());
|
+ "_" + ((PoiType) abstractPoiType).getOsmValue());
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
return res;
|
return res;
|
||||||
|
@ -222,9 +222,9 @@ public class QuickSearchListItem {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
|
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
|
||||||
if (st != null) {
|
if (st != null) {
|
||||||
res = OAResources.getDrawableId("mx_" + st.getIconKeyName());
|
res = OsmandResources.getDrawableId("mx_" + st.getIconKeyName());
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
res = OAResources.getDrawableId("mx_" + st.getOsmTag() + "_" + st.getOsmValue());
|
res = OsmandResources.getDrawableId("mx_" + st.getOsmTag() + "_" + st.getOsmValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
@ -234,9 +234,9 @@ public class QuickSearchListItem {
|
||||||
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
|
PoiType st = amenity.getType().getPoiTypeByKeyName(amenity.getSubType());
|
||||||
if (st != null) {
|
if (st != null) {
|
||||||
String id = st.getIconKeyName();
|
String id = st.getIconKeyName();
|
||||||
if (OAResources.getDrawableId("mx_" + id) == 0) {
|
if (OsmandResources.getDrawableId("mx_" + id) == 0) {
|
||||||
id = st.getOsmTag() + "_" + st.getOsmValue();
|
id = st.getOsmTag() + "_" + st.getOsmValue();
|
||||||
if (OAResources.getDrawableId("mx_" + id) != 0) {
|
if (OsmandResources.getDrawableId("mx_" + id) != 0) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue