Skip to content

Commit

Permalink
Cometleonard (#441)
Browse files Browse the repository at this point in the history
* Added a first cut at the comets layer just a clone of the meteors layer
to start with.

* Move all the celestial objects into their own file. Will need to do the
same for other languages.

* Added string resources for two comets.

* Remove a duplicitative method.

* Work in progress on the Comets Layer.

* Checkpointing this as an example of what not to do. Number in Kotlin
doesn't really support many number-like things...so this won't work.
There are good reasons for it, but it's still a pain.

* Added all the structure for the comets layer.

* Added in the data for Comet Leonard and also realized how clunky the
search code is.  Made it so we return no search results when an object
is invisible, but it's still unsatisfactory that it shows in the
autocomplete.

* Crappy comet image #1

* Slightly less crappy comet image.
  • Loading branch information
jaydeetay authored Dec 19, 2021
1 parent 62a6dc8 commit 73d6b22
Show file tree
Hide file tree
Showing 22 changed files with 731 additions and 322 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {

defaultConfig {
applicationId "com.google.android.stardroid"
minSdkVersion 21
minSdkVersion 26
targetSdkVersion 31
versionCode 1530
versionName "1.10.0 - RC1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.google.android.stardroid.control.MagneticDeclinationCalculator;
import com.google.android.stardroid.control.RealMagneticDeclinationCalculator;
import com.google.android.stardroid.control.ZeroMagneticDeclinationCalculator;
import com.google.android.stardroid.layers.CometsLayer;
import com.google.android.stardroid.layers.EclipticLayer;
import com.google.android.stardroid.layers.GridLayer;
import com.google.android.stardroid.layers.HorizonLayer;
Expand Down Expand Up @@ -153,6 +154,7 @@ LayerManager provideLayerManager(
layerManager.addLayer(new ConstellationsLayer(assetManager, resources));
layerManager.addLayer(new SolarSystemLayer(model, resources, preferences));
layerManager.addLayer(new MeteorShowerLayer(model, resources));
layerManager.addLayer(new CometsLayer(model, resources));
layerManager.addLayer(new GridLayer(resources, 24, 9));
layerManager.addLayer(new HorizonLayer(model, resources));
layerManager.addLayer(new EclipticLayer(resources));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ private void doSearchWithIntent(Intent searchIntent) {
} else {
Log.d(TAG, "One result returned.");
final SearchResult result = results.get(0);
activateSearchTarget(result.coords, result.capitalizedName);
activateSearchTarget(result.coords(), result.capitalizedName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
Log.d(TAG, "Many search results Dialog closed with cancel");
} else {
final SearchResult item = multipleSearchResultsAdaptor.getItem(whichButton);
parentActivity.activateSearchTarget(item.coords, item.capitalizedName);
parentActivity.activateSearchTarget(item.coords(), item.capitalizedName);
}
dialog.dismiss();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
((HasComponent<ActivityComponent>) getActivity()).getComponent().inject(this);

return new AlertDialog.Builder(parentActivity)
.setTitle(R.string.no_search_title).setMessage(R.string.no_search_results_text)
.setTitle(R.string.no_search_title).setMessage(R.string.no_search_results_text2)
.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog1, int whichButton) {
Log.d(TAG, "No search results Dialog closed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ abstract class AbstractRenderablesLayer(resources: Resources, private val should
linePrimitives.addAll(renderables.lines)
val names = astroRenderable.names
if (!names.isEmpty()) {
val searchLoc = astroRenderable.searchLocation
for (name in names) {
searchIndex[name.toLowerCase()] = SearchResult(name, searchLoc)
searchIndex[name.toLowerCase()] = SearchResult(name, astroRenderable)
prefixStore.add(name.toLowerCase())
}
}
Expand Down Expand Up @@ -105,9 +104,9 @@ abstract class AbstractRenderablesLayer(resources: Resources, private val should

override fun searchByObjectName(name: String): List<SearchResult> {
Log.d(TAG, "Search planets layer for $name")
val matches: MutableList<SearchResult> = ArrayList()
val matches = ArrayList<SearchResult>()
val searchResult = searchIndex[name.toLowerCase()]
if (searchResult != null) {
if (searchResult != null && searchResult.renderable.isVisible) {
matches.add(searchResult)
}
Log.d(TAG, layerName + " provided " + matches.size + "results for " + name)
Expand All @@ -122,6 +121,6 @@ abstract class AbstractRenderablesLayer(resources: Resources, private val should
}

companion object {
private val TAG = MiscUtil.getTag(AbstractRenderablesLayer::class.java)
val TAG = MiscUtil.getTag(AbstractRenderablesLayer::class.java)
}
}
Loading

0 comments on commit 73d6b22

Please sign in to comment.