diff --git a/build.gradle b/build.gradle index b2746e04..670d9f47 100644 --- a/build.gradle +++ b/build.gradle @@ -16,9 +16,6 @@ apply plugin: 'com.github.ben-manes.versions' repositories { mavenCentral() - maven { - url 'https://raw.github.com/kolavar/android-support-v4-preferencefragment/master/maven-repository/' - } maven { url 'http://jcenter.bintray.com' } @@ -29,7 +26,6 @@ dependencies { compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:design:23.1.0' compile 'com.android.support:appcompat-v7:23.1.0' - compile 'com.android.support:support-v4-preferencefragment:1.0.0@aar' androidTestCompile 'com.squareup.okhttp:mockwebserver:2.4.0' } diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 5d102a70..00000000 --- a/settings.gradle +++ /dev/null @@ -1,2 +0,0 @@ -include ':android-support-v4-preferencefragment' -project(':android-support-v4-preferencefragment').projectDir = new File('libraries/android-support-v4-preferencefragment') diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java index 11f848e7..9a2d0e72 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/LogActivity.java @@ -3,14 +3,12 @@ package com.nutomic.syncthingandroid.activities; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; -import android.support.v4.app.ActivityCompat; +import android.support.v4.view.MenuItemCompat; import android.support.v7.widget.ShareActionProvider; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; - -import android.support.v4.view.MenuItemCompat; import android.widget.ScrollView; import android.widget.TextView; @@ -44,7 +42,7 @@ public class LogActivity extends SyncthingActivity { if (savedInstanceState != null) { mSyncthingLog = savedInstanceState.getBoolean("syncthingLog"); - ActivityCompat.invalidateOptionsMenu(this); + invalidateOptionsMenu(); } mLog = (TextView) findViewById(R.id.log); diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java index 37b37689..555eb5da 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/MainActivity.java @@ -17,7 +17,6 @@ import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; -import android.support.v4.view.GravityCompat; import android.support.v4.view.ViewPager; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; @@ -25,6 +24,7 @@ import android.support.v7.app.ActionBarDrawerToggle; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; +import android.view.Gravity; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MenuItem; @@ -128,10 +128,7 @@ public class MainActivity extends SyncthingActivity PackageManager pm = getPackageManager(); long firstInstallTime = 0; try { - // No info is available on Froyo. - firstInstallTime = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) - ? pm.getPackageInfo(getPackageName(), 0).firstInstallTime - : 0; + firstInstallTime = pm.getPackageInfo(getPackageName(), 0).firstInstallTime; } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "This should never happen", e); } @@ -324,7 +321,7 @@ public class MainActivity extends SyncthingActivity * Closes the drawer. Use when navigating away from activity. */ public void closeDrawer() { - mDrawerLayout.closeDrawer(GravityCompat.START); + mDrawerLayout.closeDrawer(Gravity.LEFT); } /** @@ -333,8 +330,8 @@ public class MainActivity extends SyncthingActivity @Override public boolean onKeyDown(int keyCode, KeyEvent e) { if (keyCode == KeyEvent.KEYCODE_MENU) { - if (!mDrawerLayout.isDrawerOpen(GravityCompat.START)) - mDrawerLayout.openDrawer(GravityCompat.START); + if (!mDrawerLayout.isDrawerOpen(Gravity.LEFT)) + mDrawerLayout.openDrawer(Gravity.RIGHT); else closeDrawer(); diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/RestartActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/RestartActivity.java index 31a018e0..bf8c7578 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/RestartActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/RestartActivity.java @@ -1,6 +1,5 @@ package com.nutomic.syncthingandroid.activities; -import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.Notification; import android.app.NotificationManager; @@ -25,7 +24,6 @@ public class RestartActivity extends SyncthingActivity { public static final int NOTIFICATION_RESTART = 2; @Override - @TargetApi(11) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); diff --git a/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java b/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java index a1129f6f..951d9188 100644 --- a/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java +++ b/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java @@ -1,8 +1,8 @@ package com.nutomic.syncthingandroid.activities; +import android.app.Fragment; +import android.app.FragmentManager; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.fragments.DeviceFragment; @@ -38,7 +38,7 @@ public class SettingsActivity extends SyncthingActivity { setContentView(R.layout.activity_settings); - FragmentManager fm = getSupportFragmentManager(); + FragmentManager fm = getFragmentManager(); if (savedInstanceState != null) { mFragment = fm.getFragment(savedInstanceState, savedInstanceState.getString("fragment_name")); @@ -79,7 +79,7 @@ public class SettingsActivity extends SyncthingActivity { super.onSaveInstanceState(outState); String fragmentClassName = mFragment.getClass().getName(); outState.putString("fragment_name", fragmentClassName); - FragmentManager fm = getSupportFragmentManager(); + FragmentManager fm = getFragmentManager(); fm.putFragment(outState, fragmentClassName, mFragment); } diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java index b4e64483..b7db9be5 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/DeviceFragment.java @@ -1,10 +1,10 @@ package com.nutomic.syncthingandroid.fragments; +import android.app.Fragment; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; import android.support.v7.app.AlertDialog; import android.support.v7.widget.SwitchCompat; import android.text.Editable; diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/FolderFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/FolderFragment.java index e9ce9b98..68e16dd2 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/FolderFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/FolderFragment.java @@ -2,11 +2,11 @@ package com.nutomic.syncthingandroid.fragments; import android.app.Activity; import android.app.AlertDialog; +import android.app.Fragment; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; import android.support.v7.widget.SwitchCompat; import android.text.Editable; import android.text.TextWatcher; @@ -260,7 +260,8 @@ public class FolderFragment extends Fragment addEmptyDeviceListView(); } else { for (RestApi.Device n : devicesList) { - addDeviceViewAndSetListener(n, getLayoutInflater(null)); + + addDeviceViewAndSetListener(n, LayoutInflater.from(getActivity())); } } diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java index d51f5995..d1f73610 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/SettingsFragment.java @@ -9,10 +9,10 @@ import android.os.Bundle; import android.preference.CheckBoxPreference; import android.preference.EditTextPreference; import android.preference.Preference; +import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.support.v4.app.NavUtils; -import android.support.v4.preference.PreferenceFragment; import android.text.InputType; import android.util.Log; import android.view.MenuItem; diff --git a/src/main/java/com/nutomic/syncthingandroid/fragments/dialog/KeepVersionsDialogFragment.java b/src/main/java/com/nutomic/syncthingandroid/fragments/dialog/KeepVersionsDialogFragment.java index e25dfe9b..53a151f5 100644 --- a/src/main/java/com/nutomic/syncthingandroid/fragments/dialog/KeepVersionsDialogFragment.java +++ b/src/main/java/com/nutomic/syncthingandroid/fragments/dialog/KeepVersionsDialogFragment.java @@ -1,10 +1,10 @@ package com.nutomic.syncthingandroid.fragments.dialog; import android.app.Dialog; +import android.app.DialogFragment; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.widget.FrameLayout.LayoutParams; import android.widget.NumberPicker; diff --git a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java index 310dfb2c..c9e23201 100644 --- a/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/syncthing/SyncthingService.java @@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.syncthing; import android.app.Activity; import android.app.AlertDialog; -import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service;