ning-y / Palantir

An Android application visualising proteins in augmented reality!
https://play.google.com/store/apps/details?id=io.ningyuan.palantir
MIT License
4 stars 4 forks source link

Submitting a search query should not take the current query as PDB ID #25

Open ning-y opened 5 years ago

ning-y commented 5 years ago

The current behaviour of the 'enter' key when focus is within the EditText of SearchView is to attempt to render a protein with PDB ID of the EditText's current content. For example, if a user enters 'cro dimer' into the EditText and hits 'enter' on the soft keyboard, Palantir will attempt to render the protein with the PDB ID 'cro dimer'---which clearly does not exist. This behaviour is unintuitive.

Instead, the 'enter' should execute a text search, then render the first result of said text search. Palantir should only take the search query as PDB ID when it is in the form of a PDB ID. That is,

  1. If search query matches regex \d[A-Za-z]{3}, then try to render the protein with PDB ID equal the search query.
  2. Otherwise, do a text search. If there are results, render the first hit. Otherwise, show an error in the status line.