mirror of
https://github.com/bspeice/itcs4180
synced 2024-12-04 13:18:16 -05:00
FoundActivity now loads Webview
This commit is contained in:
parent
e29d802998
commit
f3582b1815
@ -39,7 +39,7 @@ public class FoundActivity extends Activity {
|
|||||||
tryMoreButton = (Button)findViewById(R.id.tryMoreButton);
|
tryMoreButton = (Button)findViewById(R.id.tryMoreButton);
|
||||||
|
|
||||||
restLocation = (RestLocation)(getIntent().getSerializableExtra("restLocation"));
|
restLocation = (RestLocation)(getIntent().getSerializableExtra("restLocation"));
|
||||||
//moreInfoWebView.loadUrl(restLocation.getKey());
|
moreInfoWebView.loadData(restLocation.getKey(), "text/html", "UTF-8");
|
||||||
|
|
||||||
tryMoreButton.setOnClickListener(new OnClickListener(){
|
tryMoreButton.setOnClickListener(new OnClickListener(){
|
||||||
|
|
||||||
@ -50,9 +50,6 @@ public class FoundActivity extends Activity {
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO
|
|
||||||
//Add found location to database
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +12,7 @@ import java.util.List;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.StrictMode;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -99,15 +100,6 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
|
|
||||||
new LocationClient.VerifyAsync(this) {
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(String result) {
|
|
||||||
super.onPostExecute(result);
|
|
||||||
key = result;
|
|
||||||
Toast.makeText(getApplicationContext(), key, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}.execute("1", "Belk Tower");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,6 +11,7 @@ import java.net.URL;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import edu.uncc.scavenger.database.LocationDatabaseHelper;
|
import edu.uncc.scavenger.database.LocationDatabaseHelper;
|
||||||
|
import edu.uncc.scavenger.rest.LocationClient;
|
||||||
import edu.uncc.scavenger.rest.RestLocation;
|
import edu.uncc.scavenger.rest.RestLocation;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
@ -41,6 +42,7 @@ public class SearchActivity extends Activity {
|
|||||||
TextView locationText, riddleView;
|
TextView locationText, riddleView;
|
||||||
Intent intent;
|
Intent intent;
|
||||||
RestLocation restLocation;
|
RestLocation restLocation;
|
||||||
|
String key;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -171,23 +173,32 @@ public class SearchActivity extends Activity {
|
|||||||
if (resultCode == RESULT_OK)
|
if (resultCode == RESULT_OK)
|
||||||
{
|
{
|
||||||
String contents = data.getStringExtra("SCAN_RESULT");
|
String contents = data.getStringExtra("SCAN_RESULT");
|
||||||
if(contents.equals(restLocation.getName()))
|
new LocationClient.VerifyAsync(this) {
|
||||||
{
|
@Override
|
||||||
//Add found to the database
|
protected void onPostExecute(String result) {
|
||||||
/*List locations = LocationDatabaseHelper.getInstance(this).fetchAll();
|
super.onPostExecute(result);
|
||||||
if (locations != null && locations.size() > 0)
|
key = result;
|
||||||
{
|
Toast.makeText(getApplicationContext(), key, Toast.LENGTH_SHORT).show();
|
||||||
locations.get(restLocation.getId()-1);
|
if(key!= null)
|
||||||
}*/
|
{
|
||||||
intent = new Intent(SearchActivity.this, FoundActivity.class);
|
//Add found to the database
|
||||||
intent.putExtra("restLocation", restLocation);
|
/*List locations = LocationDatabaseHelper.getInstance(this).fetchAll();
|
||||||
startActivity(intent);
|
if (locations != null && locations.size() > 0)
|
||||||
finish();
|
{
|
||||||
}
|
locations.get(restLocation.getId()-1);
|
||||||
else
|
}*/
|
||||||
{
|
restLocation.setKey(key);
|
||||||
Toast.makeText(SearchActivity.this, "Incorrect place found: "+contents, Toast.LENGTH_SHORT).show();
|
intent = new Intent(SearchActivity.this, FoundActivity.class);
|
||||||
}
|
intent.putExtra("restLocation", restLocation);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Toast.makeText(SearchActivity.this, "Incorrect place found", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.execute(restLocation.getName(), contents);
|
||||||
}
|
}
|
||||||
else if (resultCode == RESULT_CANCELED)
|
else if (resultCode == RESULT_CANCELED)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user