本文整理匯總了Java中com.google.zxing.integration.android.IntentIntegrator.shareText方法的典型用法代碼示例。如果您正苦於以下問題:Java IntentIntegrator.shareText方法的具體用法?Java IntentIntegrator.shareText怎麽用?Java IntentIntegrator.shareText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.zxing.integration.android.IntentIntegrator
的用法示例。
在下文中一共展示了IntentIntegrator.shareText方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showQRCode
import com.google.zxing.integration.android.IntentIntegrator; //導入方法依賴的package包/類
private void showQRCode() {
String mystring = new JSONObject(prefsMap).toString();
Log.d(TAG, "Serialized: " + mystring);
String compressedstring = JoH.compressString(mystring);
Log.d(TAG, "Compressed: " + compressedstring);
IntentIntegrator integrator = new IntentIntegrator(this);
integrator.shareText(qrmarker + compressedstring);
}
示例2: shareConfigurationAsQR
import com.google.zxing.integration.android.IntentIntegrator; //導入方法依賴的package包/類
/**
* Start an intent to share the configuration as QR-Code via Barcode Scanner
*/
private void shareConfigurationAsQR()
{
IntentIntegrator QRIntegrator = new IntentIntegrator(this);
layoutContainer.syncStateFromLayoutToEnigma();
String encoded_state = APP_ID+"/"+layoutContainer.getEnigma().getEncodedState().toString(16);
Log.d(APP_ID, "Sharing configuration to QR: "+encoded_state);
QRIntegrator.shareText(encoded_state);
}
示例3: displayQRCode
import com.google.zxing.integration.android.IntentIntegrator; //導入方法依賴的package包/類
private void displayQRCode ()
{
try
{
if ( getCurrentChatSession() != null
&& getCurrentChatSession().getOtrChatSession() != null)
{
String localFingerprint = getCurrentChatSession().getOtrChatSession().getLocalFingerprint();
if (localFingerprint != null)
{
IntentIntegrator.shareText(this, localFingerprint);
return;
}
}
}
catch (RemoteException re)
{}
//did not work
Toast.makeText(this, "Please start a secure conversation before scanning codes", Toast.LENGTH_LONG).show();
}
示例4: generateSalt
import com.google.zxing.integration.android.IntentIntegrator; //導入方法依賴的package包/類
private void generateSalt() {
final IntentIntegrator qr = new IntentIntegrator(this);
final SecureRandom sr = new SecureRandom();
final byte[] salt = new byte[512];
sr.nextBytes(salt);
final String saltb64 = new String(Base64.encodeBase64(salt)).replaceAll("\\s", "");
setSaltPref(saltb64);
qr.addExtra(Intents.Encode.SHOW_CONTENTS, false);
qr.shareText(saltb64);
}
示例5: generateSalt
import com.google.zxing.integration.android.IntentIntegrator; //導入方法依賴的package包/類
private void generateSalt() {
final IntentIntegrator qr = new IntentIntegrator(getActivity());
final SecureRandom sr = new SecureRandom();
final byte[] salt = new byte[SALT_SIZE_BYTES];
sr.nextBytes(salt);
final String saltb64 = PATTERN_WHITESPACE.matcher(new String(Base64.encodeBase64(salt)))
.replaceAll("");
((Preferences) getFragmentManager().findFragmentById(R.id.preferences))
.setSaltPref(saltb64);
qr.addExtra("SHOW_CONTENTS", false);
qr.shareText(saltb64);
}
示例6: initiateDisplay
import com.google.zxing.integration.android.IntentIntegrator; //導入方法依賴的package包/類
protected void initiateDisplay() {
IntentIntegrator intentIntegrator = getIntentIntegrator();
intentIntegrator.shareText(Base64.encodeBytes(getIdentityKeyToDisplay().serialize()));
}
示例7: onOptionsItemSelected
import com.google.zxing.integration.android.IntentIntegrator; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
return tabManager.onAndroidHome(item);
case R.id.menu_login:
Intent intent = new Intent(this, ConnectionAssistantActivity.class);
lastTab = tabManager.getCurrentTab();
// tabManager.switchToTab(RallyeTabManager.TAB_WAIT_FOR_MODEL);
startActivityForResult(intent, ConnectionAssistantActivity.REQUEST_CODE);
break;
case R.id.menu_logout:
new AlertDialog.Builder(this).setTitle(R.string.logout).setMessage(R.string.are_you_sure).setCancelable(true).setNegativeButton(android.R.string.cancel, null).setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
server.logout();
}
}).create().show();
server.tryLogout();
break;
case R.id.menu_upload_overview:
intent = new Intent(this, UploadOverviewActivity.class);
startActivity(intent);
break;
case R.id.menu_share_barcode:
IntentIntegrator zx = new IntentIntegrator(this);
ObjectMapper mapper = Serialization.getJsonInstance();
try {
zx.shareText(mapper.writeValueAsString(server.exportLogin()));
} catch (JsonProcessingException e) {
Log.e(THIS, "Could not serialize exported Login", e);
Toast.makeText(this, R.string.export_barcode_error, Toast.LENGTH_SHORT).show();
}
break;
// case R.id.menu_reconnect: //there is no more temporary offline, we cannot know if push messages will reach us
// model.reconnect();
// break;
case R.id.menu_settings:
intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
break;
default:
return false;
}
return true;
}