Android Open Source - Galaxy-Torch Clipboard Manager Wrapper






From Project

Back to project page Galaxy-Torch.

License

The source code is released under:

Copyright (c) 2012 Santoso Wijaya Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...

If you think the Android project Galaxy-Torch listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.swijaya.galaxytorch.util;
//  w w w . ja v  a  2  s. c  o m
import android.annotation.SuppressLint;
import android.content.Context;
import com.swijaya.galaxytorch.R;

public class ClipboardManagerWrapper {

    @SuppressLint("NewApi")
    @SuppressWarnings("deprecation")
    public static void copyToClipboard(Context context, String text) {
        int sdk = android.os.Build.VERSION.SDK_INT;
        if (sdk < android.os.Build.VERSION_CODES.HONEYCOMB) {
            android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context
                    .getSystemService(context.CLIPBOARD_SERVICE);
            clipboard.setText(text);
        } else {
            android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context
                    .getSystemService(context.CLIPBOARD_SERVICE);
            android.content.ClipData clip = android.content.ClipData
                    .newPlainText(
                            context.getResources().getString(
                                    R.string.label_donate_address), text);
            clipboard.setPrimaryClip(clip);
        }
    }

}




Java Source Code List

com.swijaya.galaxytorch.BitcoinDonateActivity.java
com.swijaya.galaxytorch.CameraDevice.java
com.swijaya.galaxytorch.DefaultTorch.java
com.swijaya.galaxytorch.GalaxyTorchActivity.java
com.swijaya.galaxytorch.GalaxyTorchService.java
com.swijaya.galaxytorch.GalaxyTorchSettings.java
com.swijaya.galaxytorch.GalaxyTorchWidgetProvider.java
com.swijaya.galaxytorch.util.ClipboardManagerWrapper.java