Commit 71f4f203 authored by Craig Earley's avatar Craig Earley
Browse files

updates to an AppCompat theme, side effect is breaking Instant Run for now

parent 01bde041
......@@ -63,10 +63,12 @@ android {
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-base:17.0.0'
implementation 'com.google.android.gms:play-services-basement:17.0.0'
implementation 'androidx.preference:preference:1.0.0'
}
productFlavors {
}
}
dependencies {
implementation files('libs/jsoup-1.9.2.jar')
implementation 'com.android.support:appcompat-v7'
}
\ No newline at end of file
......@@ -38,7 +38,7 @@
<activity
android:name=".SensorScanActivity"
android:label="Scan for devices"
android:theme="@android:style/Theme.Holo">
android:theme="@style/Theme.AppCompat">
</activity>
<activity
android:name=".DatabaseActionsActivity"
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
public class AboutFragment extends Fragment {
......
......@@ -3,7 +3,6 @@ package fieldscience.cs.earlham.edu.fieldday;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
......@@ -19,7 +18,6 @@ import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import androidx.core.app.ActivityCompat;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
......@@ -35,18 +33,22 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Map;
public class BenchSampleActivity extends Activity {
public class BenchSampleActivity extends AppCompatActivity {
private static final String TAG = BenchSampleActivity.class.getSimpleName();
public static final String REMOTE_DB = "Remote DB Connected";
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.ContentValues;
......@@ -25,6 +23,9 @@ import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
......@@ -37,7 +38,7 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
public class DatabaseActionsActivity extends Activity {
public class DatabaseActionsActivity extends AppCompatActivity {
private static final String DB_DRIVER = "org.postgresql.Driver";
private static final String[] uploadTables = {"fieldday_spot", "fieldday_reading", "fieldday_streaming"};
......@@ -411,7 +412,7 @@ public class DatabaseActionsActivity extends Activity {
DatabaseActionsActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Dialog d = new AlertDialog.Builder(DatabaseActionsActivity.this)
Dialog d = new androidx.appcompat.app.AlertDialog.Builder(DatabaseActionsActivity.this)
.setTitle("Here are the trips I've discovered. Select your trip.")
.setNegativeButton("No trip!", null)
.setItems(tripArray, new DialogInterface.OnClickListener() {
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import androidx.annotation.NonNull;
import android.util.Log;
import android.view.Gravity;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.drive.Drive;
public abstract class GoogleDriveConnect extends Activity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
public abstract class GoogleDriveConnect extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
private GoogleApiClient googleApiClient;
protected static final int REQUEST_CODE_RESOLUTION = 1;
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
......@@ -12,6 +11,8 @@ import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.drive.Drive;
import com.google.android.gms.drive.DriveApi;
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
public class LabNotebookFragment extends Fragment {
public LabNotebookFragment() {
......
package fieldscience.cs.earlham.edu.fieldday;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
......@@ -13,10 +9,15 @@ import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import androidx.core.app.ActivityCompat;
import android.view.View;
public class MainScreenActivity extends Activity {
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
public class MainScreenActivity extends AppCompatActivity {
FragmentManager fragman;
Fragment frag;
String tripName;
......@@ -33,7 +34,7 @@ public class MainScreenActivity extends Activity {
setContentView(R.layout.activity_mainscreen_frame);
context = this;
fragman = getFragmentManager();
fragman = getSupportFragmentManager();
frag = fragman.findFragmentById(R.id.mainButtonContainer);
// Check if fragment is null, and if it is, create a MainScreen fragment
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
public class MainScreenFragment extends Fragment {
public MainScreenFragment () {
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.pdf.PdfRenderer;
......@@ -9,13 +8,15 @@ import android.os.ParcelFileDescriptor;
import android.util.Log;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatActivity;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Objects;
public class MyDocumentViewer extends Activity {
public class MyDocumentViewer extends AppCompatActivity {
File fileToOpen;
private ImageView docImageView;
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
......@@ -18,6 +16,9 @@ import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
......@@ -34,7 +35,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class MyDocumentsActivity extends Activity {
public class MyDocumentsActivity extends AppCompatActivity {
public static final String directory = Environment.getExternalStorageDirectory().toString() +
File.separator + "FieldDay";
......@@ -109,7 +110,7 @@ public class MyDocumentsActivity extends Activity {
public void signInToHost() {
AlertDialog.Builder builder = new AlertDialog.Builder(MyDocumentsActivity.this);
androidx.appcompat.app.AlertDialog.Builder builder = new androidx.appcompat.app.AlertDialog.Builder(MyDocumentsActivity.this);
LayoutInflater layoutInflater = this.getLayoutInflater();
final View dialog = layoutInflater.inflate(R.layout.alert_dialog_sigin, null);
final EditText host = (EditText) dialog.findViewById(R.id.fileHost);
......@@ -202,7 +203,7 @@ public class MyDocumentsActivity extends Activity {
MyDocumentsActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(MyDocumentsActivity.this);
AlertDialog.Builder builder = new androidx.appcompat.app.AlertDialog.Builder(MyDocumentsActivity.this);
final String[] fileArray = dirList.toArray(new String[0]);
builder.setTitle("Select files to download");
......
package fieldscience.cs.earlham.edu.fieldday;
import android.app.Activity;
import android.app.Fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
public class SampleButtonsFragment extends Fragment {
public SampleButtonsFragment() {
......
......@@ -2,7 +2,6 @@ package fieldscience.cs.earlham.edu.fieldday;
import android.Manifest;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
......@@ -29,7 +28,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import androidx.core.app.ActivityCompat;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
......@@ -49,13 +47,17 @@ import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class SensorSampleActivity extends Activity {
public class SensorSampleActivity extends AppCompatActivity {
public LocationManager locationManager;
public LocationListener locationListener;
......@@ -233,7 +235,7 @@ public class SensorSampleActivity extends Activity {
t.setGravity(Gravity.CENTER, 0, 0);
t.show();
} else if (!db.addSpot(tripName, site, sector, spot)) {
Dialog d = new AlertDialog.Builder(SensorSampleActivity.this)
Dialog d = new androidx.appcompat.app.AlertDialog.Builder(SensorSampleActivity.this)
.setTitle("Are you sure?")
.setMessage("There's already a spot with this trip, site, and sector. Make sure you are at the same geolocation that is " +
"associated with this spot.")
......@@ -322,7 +324,7 @@ public class SensorSampleActivity extends Activity {
final EditText name = (EditText) dialog.findViewById(R.id.pictureName);
if (resultCode != Activity.RESULT_CANCELED) {
Dialog d = new AlertDialog.Builder(SensorSampleActivity.this)
Dialog d = new androidx.appcompat.app.AlertDialog.Builder(SensorSampleActivity.this)
.setTitle("Picture Name")
.setView(dialog)
.setNegativeButton("Discard Picture", null)
......@@ -735,7 +737,7 @@ public class SensorSampleActivity extends Activity {
}
});
Dialog d = new AlertDialog.Builder(SensorSampleActivity.this)
Dialog d = new androidx.appcompat.app.AlertDialog.Builder(SensorSampleActivity.this)
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
......
......@@ -26,6 +26,8 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.view.MenuItemCompat;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
......@@ -66,7 +68,7 @@ public class SensorScanActivity extends ListActivity {
if (!scanning) {
menu.findItem(R.id.menu_stop).setVisible(false);
menu.findItem(R.id.menu_scan).setVisible(true);
menu.findItem(R.id.menu_refresh).setActionView(null);
MenuItemCompat.setActionView(menu.findItem(R.id.menu_refresh), null);
} else {
menu.findItem(R.id.menu_stop).setVisible(true);
menu.findItem(R.id.menu_scan).setVisible(false);
......
......@@ -5,14 +5,14 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Build;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import androidx.preference.CheckBoxPreference;
import androidx.preference.EditTextPreference;
import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceManager;
public class SettingsFragment extends PreferenceFragment {
public class SettingsFragment extends PreferenceFragmentCompat {
static String shortDeviceID = (Build.SERIAL).substring((Build.SERIAL).length()-4);
private CheckBoxPreference writeWithoutGPS;
......@@ -73,6 +73,12 @@ import android.preference.PreferenceManager;
Preference buildInfo = findPreference(getString(R.string.build_info));
buildInfo.setSummary(BuildConfig.VERSION_NAME);
}
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
}
public static SharedPreferences getSettings(final ContextWrapper context) {
return PreferenceManager.getDefaultSharedPreferences(context);
}
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
......@@ -152,7 +153,7 @@
android:background="@null"
android:layout_height="wrap_content"
android:contentDescription="@string/export"
android:src="@drawable/export_button"
app:srcCompat="@drawable/export_button"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
......@@ -162,7 +163,7 @@
android:id="@+id/streamButton"
android:background="@null"
android:contentDescription="@string/stream"
android:src="@drawable/stream_button"
app:srcCompat="@drawable/stream_button"
android:layout_alignParentBottom="true"
android:layout_toStartOf="@+id/sector" />
......@@ -172,7 +173,7 @@
android:id="@+id/sampleButton"
android:background="@null"
android:contentDescription="@string/sample"
android:src="@drawable/sample_button"
app:srcCompat="@drawable/sample_button"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/exportDbButton"
android:layout_marginStart="23dp" />
......
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
......@@ -14,7 +15,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="activityStart"
android:src="@drawable/about_icon"
app:srcCompat="@drawable/about_icon"
android:background="@null"
android:contentDescription="@string/aboutButtonMain"/>
<ImageButton
......@@ -25,7 +26,7 @@
android:background="@null"
android:onClick="activityStart"
android:contentDescription="@string/takeSampleButton"
android:src="@drawable/sampling_icon"/>
app:srcCompat="@drawable/sampling_icon"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
......@@ -38,7 +39,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="activityStart"
android:src="@drawable/settings_icon"
app:srcCompat="@drawable/settings_icon"
android:background="@null"
android:contentDescription="@string/settingsButtonMain"/>
<ImageButton
......@@ -48,7 +49,7 @@
android:background="@null"
android:onClick="activityStart"
android:contentDescription="@string/labNotebookButtonMain"
android:src="@drawable/lab_notebook_icon"/>
app:srcCompat="@drawable/lab_notebook_icon"/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
......@@ -16,7 +17,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButtonBuiltIn"
android:src="@drawable/builtin_sensors_icon"
app:srcCompat="@drawable/builtin_sensors_icon"
android:contentDescription="@string/builtinSensors"
android:background="@null"
android:onClick="startSampleActivity" />
......@@ -25,7 +26,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButtonBluetooth"
android:src="@drawable/bluetooth_devices"
app:srcCompat="@drawable/bluetooth_devices"
android:contentDescription="@string/bluetoothSensor"
android:background="@null"
android:onClick="startSampleActivity"/>
......@@ -41,7 +42,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButtonDbActions"
android:src="@drawable/database_actions_icon"
app:srcCompat="@drawable/database_actions_icon"
android:contentDescription="@string/databaseActions"
android:background="@null"
android:onClick="startSampleActivity" />
......@@ -49,7 +50,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:src="@drawable/bench_icon"
app:srcCompat="@drawable/bench_icon"
android:background="@null"
android:contentDescription="@string/benchSample"
android:id="@+id/imageButtonBenchSample"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
......@@ -186,7 +187,7 @@
android:id="@+id/streamButton"
android:background="@null"
android:contentDescription="@string/stream"
android:src="@drawable/stream_button"
app:srcCompat="@drawable/stream_button"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/interval" />
......@@ -196,7 +197,7 @@
android:id="@+id/sampleButton"
android:background="@null"
android:contentDescription="@string/sample"
android:src="@drawable/sample_button"
app:srcCompat="@drawable/sample_button"
android:layout_below="@+id/addNotesButton"
android:layout_toEndOf="@+id/streamButton" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment