1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 22:31:16 +00:00

Merge pull request #484 from syncthing/remove-compat

Remove unneeded compatibility classes, functions, library
This commit is contained in:
Zillode 2015-11-10 23:03:29 +01:00
commit e8a0ad30b8
11 changed files with 17 additions and 30 deletions

View file

@ -16,9 +16,6 @@ apply plugin: 'com.github.ben-manes.versions'
repositories { repositories {
mavenCentral() mavenCentral()
maven {
url 'https://raw.github.com/kolavar/android-support-v4-preferencefragment/master/maven-repository/'
}
maven { maven {
url 'http://jcenter.bintray.com' url 'http://jcenter.bintray.com'
} }
@ -29,7 +26,6 @@ dependencies {
compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0' compile 'com.android.support:design:23.1.0'
compile 'com.android.support:appcompat-v7: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' androidTestCompile 'com.squareup.okhttp:mockwebserver:2.4.0'
} }

View file

@ -1,2 +0,0 @@
include ':android-support-v4-preferencefragment'
project(':android-support-v4-preferencefragment').projectDir = new File('libraries/android-support-v4-preferencefragment')

View file

@ -3,14 +3,12 @@ package com.nutomic.syncthingandroid.activities;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.ActivityCompat; import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.ShareActionProvider; import android.support.v7.widget.ShareActionProvider;
import android.util.Log; import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.support.v4.view.MenuItemCompat;
import android.widget.ScrollView; import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
@ -44,7 +42,7 @@ public class LogActivity extends SyncthingActivity {
if (savedInstanceState != null) { if (savedInstanceState != null) {
mSyncthingLog = savedInstanceState.getBoolean("syncthingLog"); mSyncthingLog = savedInstanceState.getBoolean("syncthingLog");
ActivityCompat.invalidateOptionsMenu(this); invalidateOptionsMenu();
} }
mLog = (TextView) findViewById(R.id.log); mLog = (TextView) findViewById(R.id.log);

View file

@ -17,7 +17,6 @@ import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
@ -25,6 +24,7 @@ import android.support.v7.app.ActionBarDrawerToggle;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MenuItem; import android.view.MenuItem;
@ -128,10 +128,7 @@ public class MainActivity extends SyncthingActivity
PackageManager pm = getPackageManager(); PackageManager pm = getPackageManager();
long firstInstallTime = 0; long firstInstallTime = 0;
try { try {
// No info is available on Froyo. firstInstallTime = pm.getPackageInfo(getPackageName(), 0).firstInstallTime;
firstInstallTime = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
? pm.getPackageInfo(getPackageName(), 0).firstInstallTime
: 0;
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "This should never happen", 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. * Closes the drawer. Use when navigating away from activity.
*/ */
public void closeDrawer() { public void closeDrawer() {
mDrawerLayout.closeDrawer(GravityCompat.START); mDrawerLayout.closeDrawer(Gravity.LEFT);
} }
/** /**
@ -333,8 +330,8 @@ public class MainActivity extends SyncthingActivity
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent e) { public boolean onKeyDown(int keyCode, KeyEvent e) {
if (keyCode == KeyEvent.KEYCODE_MENU) { if (keyCode == KeyEvent.KEYCODE_MENU) {
if (!mDrawerLayout.isDrawerOpen(GravityCompat.START)) if (!mDrawerLayout.isDrawerOpen(Gravity.LEFT))
mDrawerLayout.openDrawer(GravityCompat.START); mDrawerLayout.openDrawer(Gravity.RIGHT);
else else
closeDrawer(); closeDrawer();

View file

@ -1,6 +1,5 @@
package com.nutomic.syncthingandroid.activities; package com.nutomic.syncthingandroid.activities;
import android.annotation.TargetApi;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
@ -25,7 +24,6 @@ public class RestartActivity extends SyncthingActivity {
public static final int NOTIFICATION_RESTART = 2; public static final int NOTIFICATION_RESTART = 2;
@Override @Override
@TargetApi(11)
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -1,8 +1,8 @@
package com.nutomic.syncthingandroid.activities; package com.nutomic.syncthingandroid.activities;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle; 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.R;
import com.nutomic.syncthingandroid.fragments.DeviceFragment; import com.nutomic.syncthingandroid.fragments.DeviceFragment;
@ -38,7 +38,7 @@ public class SettingsActivity extends SyncthingActivity {
setContentView(R.layout.activity_settings); setContentView(R.layout.activity_settings);
FragmentManager fm = getSupportFragmentManager(); FragmentManager fm = getFragmentManager();
if (savedInstanceState != null) { if (savedInstanceState != null) {
mFragment = fm.getFragment(savedInstanceState, mFragment = fm.getFragment(savedInstanceState,
savedInstanceState.getString("fragment_name")); savedInstanceState.getString("fragment_name"));
@ -79,7 +79,7 @@ public class SettingsActivity extends SyncthingActivity {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
String fragmentClassName = mFragment.getClass().getName(); String fragmentClassName = mFragment.getClass().getName();
outState.putString("fragment_name", fragmentClassName); outState.putString("fragment_name", fragmentClassName);
FragmentManager fm = getSupportFragmentManager(); FragmentManager fm = getFragmentManager();
fm.putFragment(outState, fragmentClassName, mFragment); fm.putFragment(outState, fragmentClassName, mFragment);
} }

View file

@ -1,10 +1,10 @@
package com.nutomic.syncthingandroid.fragments; package com.nutomic.syncthingandroid.fragments;
import android.app.Fragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.widget.SwitchCompat; import android.support.v7.widget.SwitchCompat;
import android.text.Editable; import android.text.Editable;

View file

@ -2,11 +2,11 @@ package com.nutomic.syncthingandroid.fragments;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Fragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.SwitchCompat; import android.support.v7.widget.SwitchCompat;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
@ -260,7 +260,8 @@ public class FolderFragment extends Fragment
addEmptyDeviceListView(); addEmptyDeviceListView();
} else { } else {
for (RestApi.Device n : devicesList) { for (RestApi.Device n : devicesList) {
addDeviceViewAndSetListener(n, getLayoutInflater(null));
addDeviceViewAndSetListener(n, LayoutInflater.from(getActivity()));
} }
} }

View file

@ -9,10 +9,10 @@ import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.support.v4.app.NavUtils; import android.support.v4.app.NavUtils;
import android.support.v4.preference.PreferenceFragment;
import android.text.InputType; import android.text.InputType;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;

View file

@ -1,10 +1,10 @@
package com.nutomic.syncthingandroid.fragments.dialog; package com.nutomic.syncthingandroid.fragments.dialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.widget.FrameLayout.LayoutParams; import android.widget.FrameLayout.LayoutParams;
import android.widget.NumberPicker; import android.widget.NumberPicker;

View file

@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.syncthing;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.Service; import android.app.Service;