1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-27 06:41:15 +00:00

Removed unused compatibility code.

This commit is contained in:
Felix Ableitner 2016-01-23 17:04:02 +01:00
parent 9c830c1545
commit 34fead0623
2 changed files with 4 additions and 17 deletions

View file

@ -1,6 +1,5 @@
package com.nutomic.syncthingandroid.test; package com.nutomic.syncthingandroid.test;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
@ -92,7 +91,6 @@ public class MockRestApi extends RestApi {
} }
@Override @Override
@TargetApi(11)
public void copyDeviceId(String id) { public void copyDeviceId(String id) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View file

@ -1,13 +1,10 @@
package com.nutomic.syncthingandroid.syncthing; package com.nutomic.syncthingandroid.syncthing;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
@ -1028,19 +1025,11 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
* *
* @param id The device ID to copy. * @param id The device ID to copy.
*/ */
@TargetApi(11)
public void copyDeviceId(String id) { public void copyDeviceId(String id) {
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
android.text.ClipboardManager clipboard = (android.text.ClipboardManager)
mContext.getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(id);
} else {
ClipboardManager clipboard = (ClipboardManager) ClipboardManager clipboard = (ClipboardManager)
mContext.getSystemService(Context.CLIPBOARD_SERVICE); mContext.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(mContext.getString(R.string.device_id), id); ClipData clip = ClipData.newPlainText(mContext.getString(R.string.device_id), id);
clipboard.setPrimaryClip(clip); clipboard.setPrimaryClip(clip);
}
Toast.makeText(mContext, R.string.device_id_copied_to_clipboard, Toast.LENGTH_SHORT) Toast.makeText(mContext, R.string.device_id_copied_to_clipboard, Toast.LENGTH_SHORT)
.show(); .show();
} }