Skip to content

Commit

Permalink
Merge pull request Esri#101 from Esri/dop/analyze-samples
Browse files Browse the repository at this point in the history
Dop/analyze samples
  • Loading branch information
doneill committed Jan 20, 2016
2 parents 5320d2b + a1f416d commit da0806a
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 69 deletions.
5 changes: 3 additions & 2 deletions Nearby/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {

defaultConfig {
applicationId "com.esri.arcgis.android.samples.nearby"
minSdkVersion 15
targetSdkVersion 21
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
Expand All @@ -28,4 +28,5 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}
3 changes: 2 additions & 1 deletion Nearby/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.esri.arcgis.android.samples.nearby.Nearby"
android:configChanges="orientation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@

package com.esri.arcgis.android.samples.nearby;

import android.app.Activity;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RatingBar;
import android.widget.TextView;
Expand Down Expand Up @@ -70,7 +70,7 @@
* Check device settings to make sure that location services are enabled for
* the app.
*/
public class Nearby extends Activity {
public class Nearby extends AppCompatActivity {

private static final String TAG = Nearby.class.getSimpleName();

Expand Down Expand Up @@ -99,10 +99,9 @@ private enum SearchType {
RatingBar mRatingBar;

Locator mLocator;
ArrayList<String> mFindOutFields = new ArrayList<String>();
ArrayList<String> mFindOutFields = new ArrayList<>();

LocationDisplayManager mLDM;
LinearLayout mPlaceLayout;


/**
Expand Down Expand Up @@ -171,8 +170,6 @@ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

mPlaceLayout = (LinearLayout) findViewById(R.id.placeLayout);

mMapView = (MapView) findViewById(R.id.map);
mMapView.setOnStatusChangedListener(statusChangedListener);
mMapView.setOnSingleTapListener(mapTapCallback);
Expand All @@ -192,13 +189,9 @@ public void onCreate(Bundle savedInstanceState) {
mResultsLayer.setSelectionColorWidth(6);
mMapView.addLayer(mResultsLayer);


mCoffeeMapIcon = new PictureMarkerSymbol(getApplicationContext(), this
.getResources().getDrawable(R.drawable.ic_local_cafe_black));
mPizzaMapIcon = new PictureMarkerSymbol(getApplicationContext(), this
.getResources().getDrawable(R.drawable.ic_local_pizza_black));
mBarMapIcon = new PictureMarkerSymbol(getApplicationContext(), this
.getResources().getDrawable(R.drawable.ic_local_drink_black));
mCoffeeMapIcon = new PictureMarkerSymbol(getApplicationContext(), ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_local_cafe_black));
mPizzaMapIcon = new PictureMarkerSymbol(getApplicationContext(), ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_local_pizza_black));
mBarMapIcon = new PictureMarkerSymbol(getApplicationContext(), ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_local_drink_black));

setupLocator();
setupLocationListener();
Expand Down Expand Up @@ -332,8 +325,7 @@ public void onCallback(List<LocatorGeocodeResult> results) {
}
};

try
{
try {
setProgressOnUIThread(true);

// Get the current map extent.
Expand All @@ -356,8 +348,7 @@ public void onCallback(List<LocatorGeocodeResult> results) {

// Call find, passing in the callback above.
mLocator.find(fParams, findCallback);
}
catch (Exception e) {
} catch (Exception e) {
// Update UI and report any errors.
setProgressOnUIThread(false);

Expand Down Expand Up @@ -532,8 +523,7 @@ public void updateContent(Map<String, Object> attributes) {
String phone = attributes.get(getResources().getString(
R.string.result_phone)).toString();
mPhoneTextView.setText(phone);
mPhoneImageView.setImageDrawable(getResources().getDrawable(
R.drawable.ic_action_call));
mPhoneImageView.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.ic_action_call));

Float rating = Float.parseFloat(getRating());
mRatingBar.setRating(rating);
Expand Down
82 changes: 41 additions & 41 deletions Nearby/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
android:layout_height="match_parent"
android:orientation="vertical" >

<com.esri.android.map.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".40"
mapoptions.MapType="Streets" >
</com.esri.android.map.MapView>
<com.esri.android.map.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".45"
mapoptions.MapType="Streets" >
</com.esri.android.map.MapView>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".60"
android:id="@+id/placeLayout"
android:orientation="vertical"
android:padding="@dimen/small_space">
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".55"
android:id="@+id/placeLayout"
android:orientation="vertical"
android:padding="@dimen/small_space">


<ProgressBar
Expand All @@ -30,22 +30,22 @@
/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=""
android:id="@+id/titleTextView"
android:padding="@dimen/small_space"
android:background="@color/ui_highlight" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=""
android:id="@+id/titleTextView"
android:padding="@dimen/small_space"
android:background="@color/ui_highlight" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:id="@+id/addressTextView"
android:padding="@dimen/small_space"
android:textColor="@android:color/secondary_text_dark_nodisable" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=""
android:id="@+id/addressTextView"
android:padding="@dimen/small_space"
android:textColor="@android:color/secondary_text_dark_nodisable" />

<TextView
android:layout_width="wrap_content"
Expand All @@ -67,23 +67,23 @@
android:elevation="3dp"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=""
android:id="@+id/phoneTextView"
android:padding="@dimen/small_space" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=""
android:id="@+id/phoneTextView"
android:padding="@dimen/small_space" />

</LinearLayout>

<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ratingBar"
android:progressTint="@color/ratings"
android:visibility="gone"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ratingBar"
android:progressTint="@color/ratings"
android:visibility="gone"/>

</LinearLayout>


</LinearLayout>
</LinearLayout>
11 changes: 6 additions & 5 deletions Nearby/src/main/res/menu/menu_layout.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">


<item
android:id="@+id/coffee"
android:icon="@drawable/ic_local_cafe_white"
android:showAsAction="always"
app:showAsAction="always"
android:title="@string/menu_coffee"/>

<item
android:id="@+id/pizza"
android:icon="@drawable/ic_local_pizza_white"
android:showAsAction="always"
app:showAsAction="always"
android:title="@string/menu_pizza"/>

<item
android:id="@+id/bar"
android:icon="@drawable/ic_local_drink_white"
android:showAsAction="always"
app:showAsAction="always"
android:title="@string/menu_bar"/>

<item
android:id="@+id/locate"
android:icon="@drawable/ic_action_location_searching"
android:showAsAction="always"
app:showAsAction="always"
android:title="@string/menu_locate"/>

</menu>
8 changes: 8 additions & 0 deletions Nearby/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
</style>

</resources>

0 comments on commit da0806a

Please sign in to comment.