@@ -4,6 +4,7 @@
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
@@ -92,20 +93,23 @@ private void calculate(){
y1 = Double.parseDouble(sy1);
y2 = Double.parseDouble(sy2);

Log.d("Distance Form", String.valueOf(x1));
Log.d("Distance Form", String.valueOf(y1));
Log.d("Distance Form", String.valueOf(x2));
Log.d("Distance Form", String.valueOf(y2));

double x = x2 - x1;
double y = y2 - y1;

discrim = Math.pow(x,2) + Math.pow(y,2);

if(discrim >= 0){
distance = Math.sqrt(discrim);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
String numDec = sharedPreferences.getString("example_list","4");
Log.d("Dec Preference", numDec);
textView.setText(String.format("%." + numDec + "f", distance));
//textView.setText(String.valueOf(distance));

}
else{
distance = Math.sqrt(discrim);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
String numDec = sharedPreferences.getString("example_list","");
textView.setText(String.format("%."+numDec+"f",distance));
}


}
@@ -20,12 +20,14 @@
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:inputType="numberDecimal|numberSigned"
android:ems="3"
android:id="@+id/editX1"
android:nextFocusDown="@id/editY1"
android:layout_alignBottom="@+id/textView2"
android:layout_toRightOf="@+id/textView2"
android:layout_toEndOf="@+id/textView2" />
android:layout_toEndOf="@+id/textView2"
android:textIsSelectable="false" />

<TextView
android:layout_width="wrap_content"
@@ -40,7 +42,7 @@
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:inputType="numberDecimal|numberSigned"
android:ems="3"
android:id="@+id/editY1"
android:layout_alignTop="@+id/editX1"
@@ -70,7 +72,7 @@
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:inputType="numberDecimal|numberSigned"
android:ems="3"
android:id="@+id/editX2"
android:layout_alignBottom="@+id/textView5"
@@ -90,7 +92,7 @@
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:inputType="numberDecimal|numberSigned"
android:ems="3"
android:id="@+id/editY2"
android:layout_alignBottom="@+id/textView6"
@@ -1,6 +1,4 @@
<RelativeLayout
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent">
<GridView
@@ -17,17 +15,16 @@
android:paddingRight="3dp"
android:paddingBottom="2dp"
android:layout_alignParentTop="true"
android:layout_above="@+id/adView"
android:drawSelectorOnTop="true">
</GridView>

<com.google.android.gms.ads.AdView
<!--<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</com.google.android.gms.ads.AdView>-->
</RelativeLayout>
@@ -1,15 +1,29 @@
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/AppTheme">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" />

android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="@+id/adView" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
<!-- The navigation drawer -->
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"