1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-23 12:51:16 +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; ClipboardManager clipboard = (ClipboardManager)
if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) { mContext.getSystemService(Context.CLIPBOARD_SERVICE);
android.text.ClipboardManager clipboard = (android.text.ClipboardManager) ClipData clip = ClipData.newPlainText(mContext.getString(R.string.device_id), id);
mContext.getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(clip);
clipboard.setText(id);
} else {
ClipboardManager clipboard = (ClipboardManager)
mContext.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(mContext.getString(R.string.device_id), id);
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();
} }