Skip to content

Commit

Permalink
Fix crash if query has no search suggestions (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
ning-y committed Aug 13, 2019
1 parent fc09601 commit c62e9de
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# # Builds
build/
app/release/
app/src/main/assets/arm64-v8a
app/src/main/assets/x86
app/src/main/assets/tcl_aux
Expand Down
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Privacy Policy
--------------

Palantir does not collect any of your personal data.
16 changes: 6 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,24 @@ apply plugin: 'com.google.ar.sceneform.plugin'
apply plugin: 'org.ajoberstar.grgit'

android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "io.ningyuan.palantir"

// AR Optional apps must declare minSdkVersion >= 14.
// AR Required apps must declare minSdkVersion >= 24.
minSdkVersion 24
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionName "1.0.0"
ndk {
/*
* Sceneform is available for the following ABIs:
* 'arm64-v8a', 'armeabi-v7a', 'x86_64' and 'x86'.
* Your application should include the ABIs most appropriate to
* minimize APK size. Listing 'arm64-v8a' is recommended.
*
* This sample app includes two ABIs:
* 1. 'arm64-v8a' to run on devices
* 2. 'x86' to run in the Android emulator
*/
abiFilters 'arm64-v8a', 'x86'
abiFilters 'arm64-v8a'
}
externalNativeBuild {
cmake {
Expand Down Expand Up @@ -90,8 +86,8 @@ preBuild.dependsOn fetchStrideSrc
dependencies {
implementation 'ch.acra:acra-dialog:5.4.0'
implementation 'ch.acra:acra-mail:5.4.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.ar.sceneform.ux:sceneform-ux:1.10.0'
implementation 'com.google.ar.sceneform:assets:1.10.0'
implementation 'commons-io:commons-io:2.6'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public PdbTitleSearcher(PdbSearcher pdbSearcher, CursorAdapter adapter, LinkedLi
protected Integer doInBackground(Integer... integers) {
int indexToLoad = integers[0];

if (indexToLoad >= pdbs.size()) {
return indexToLoad + 1; // value doesn't matter, will terminate at onPostExecute
}

try {
pdbs.get(indexToLoad).load();
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ private void deactivate() {
imm.hideSoftInputFromWindow(getWindowToken(), 0);
}

pdbSearcher.makeInvalid();
setVisibility(GONE);
progressBar.setVisibility(GONE);
suggestionAdapter.changeCursor(getEmptyCursor(false));
Expand Down
9 changes: 2 additions & 7 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,11 @@

<string name="ux_model_renderable_not_yet_set">Click on the bottom-right button to import a 3D model</string>

<string name="log_import_failed_io">Failed with IOException: </string>
<string name="log_write_temp_file_done">Done writing cache file from content URI: </string>
<string name="log_write_temp_file_start">Preparing to save cache file from content URI.</string>

<string name="error_import_failed_bad_render">Something went wrong: unable to render the import file.</string>
<string name="error_import_failed_bad_render">Something went wrong: unable to render PDB file.</string>
<string name="error_import_failed_io">Something went wrong: unable to import the requested file.</string>
<string name="error_insufficient_opengl_version">Palantir uses ARCore, which requires OpenGL ES 3.0 or later.</string>
<string name="error_insufficient_sdk_version">Palantir uses ARCore, which requires Android N or later.</string>
<string name="error_no_model_renderable">You must first import a *.glb file!</string>
<string name="error_no_resolvable_activity">Something went wrong: there is no application configured to browse your filesystem.</string>
<string name="error_no_model_renderable">A PDB must be loaded first!</string>

<string name="tcl_script_template">
mol addfile %s \n
Expand Down

0 comments on commit c62e9de

Please sign in to comment.