當前位置: 首頁>>代碼示例>>Java>>正文


Java IntentResult.getContents方法代碼示例

本文整理匯總了Java中com.google.zxing.integration.android.IntentResult.getContents方法的典型用法代碼示例。如果您正苦於以下問題:Java IntentResult.getContents方法的具體用法?Java IntentResult.getContents怎麽用?Java IntentResult.getContents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.zxing.integration.android.IntentResult的用法示例。


在下文中一共展示了IntentResult.getContents方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {

        if (requestCode == IntentIntegrator.REQUEST_CODE) {
            // 掃描二維碼回傳值
            IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
            String ewmString = result.getContents();

            Intent mintent = new Intent(MainActivity.this, QuickWebLoader.class);
            QuickBean bean = new QuickBean(ewmString);
            mintent.putExtra("bean", bean);
            startActivity(mintent);
        }
    }
}
 
開發者ID:quickhybrid,項目名稱:quickhybrid-android,代碼行數:17,代碼來源:MainActivity.java

示例2: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
/**
 * This method handles the results of the scan
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if(result != null){
        if(result.getContents()==null){
            Toast.makeText(this, getResources().getText(R.string.error_canceled_scan), Toast.LENGTH_LONG).show();
        } else {
            qrcode = result.getContents();
            if(!qrcode.equals("")){
                mTextMessage.setText(qrcode);
                action_navigation.setVisibility(View.VISIBLE);
                addToDatabase(mTextMessage.getText().toString());
                //Automatic Clipboard if activated
                SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
                String auto_scan = prefs.getString("pref_auto_clipboard", "");
                if(auto_scan.equals("true")){
                    copyToClipboard(mTextMessage, qrcode, activity);
                }
            }

        }
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
開發者ID:Fr4gorSoftware,項目名稱:SecScanQR,代碼行數:29,代碼來源:MainActivity.java

示例3: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult result = IntentIntegrator.parseActivityResult( requestCode, resultCode, data);
    if (result != null) {

        if ( result.getContents() == null) {
            this.scan = null;
            long newInstance = Calendar.getInstance().getTimeInMillis();
            if ( newInstance - this.startScannerTime < 1000 * this.timeOutSecond ) {
                this.onCanceled();
            } else {
                this.onTimeOut();
            }
        } else {
            this.scan = new Scan( result.getContents() );
            ScanDao scanDao = new ScanDao( this );
            scanDao.register( this.scan);
            this.onScanReaderResult( this.scan );
        }
    }
}
 
開發者ID:tec-ustp,項目名稱:SIIEScanner,代碼行數:22,代碼來源:BaseActivity.java

示例4: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if(result != null) {
        if(result.getContents() != null) {
            QRReadTask task = new QRReadTask();
            task.execute(result.getContents());
            if (EssensbonUtils.isAutoFadeEnabled()) {
                final Handler handler = new Handler();
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        integrator.initiateScan();
                    }
                }, EssensbonUtils.getFadeTime()*1000);
            }
        }
    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
開發者ID:LCA311,項目名稱:leoapp-sources,代碼行數:22,代碼來源:EssensbonActivity.java

示例5: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    IntentResult intentResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if(intentResult!= null){
        if(intentResult.getContents()==null){

            Toast.makeText(this,"Scanning Stopped", Toast.LENGTH_LONG).show();

        }else
        {
            Toast.makeText(this, intentResult.getContents(), Toast.LENGTH_SHORT).show();
        }
    }else
    {
        super.onActivityResult(requestCode, resultCode, data);
    }

}
 
開發者ID:NikhilBhutani,項目名稱:Android-Snippets,代碼行數:20,代碼來源:MainActivity.java

示例6: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
	if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
		IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
		if (scanResult != null && scanResult.getFormatName() != null) {
			String data = scanResult.getContents();
			XmppUri uri = new XmppUri(data);
			if (xmppConnectionServiceBound) {
				verifyWithUri(uri);
				finish();
			} else {
				this.mPendingUri = uri;
			}
		} else {
			finish();
		}
	}
	super.onActivityResult(requestCode, requestCode, intent);
}
 
開發者ID:syntafin,項目名稱:TenguChat,代碼行數:20,代碼來源:VerifyOTRActivity.java

示例7: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
    if(result != null) {
        if(result.getContents() == null) {
            Log.d("MainActivity", "Cancelled scan");
            Toast.makeText(this, "Cancelled", Toast.LENGTH_LONG).show();
        } else {
            Log.d("MainActivity", "Scanned");
            Toast.makeText(this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
        }
    } else {

        // This is important, otherwise the result will not be passed to the fragment
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
開發者ID:NikhilBhutani,項目名稱:Android-Snippets,代碼行數:18,代碼來源:MainActivity.java

示例8: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) 
{
  IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
  if (scanResult != null && scanResult.getContents() != null) 
  {
  	String url = scanResult.getContents();
  	try
  	{
  		new URL(url);
  		urlEditText.setText(url);
  	}
  	catch(MalformedURLException e)
  	{
  		AlertDialog alertDialog = createAlertDialog(this, "Not an URL", "The read QRCode does not represent a valid URL.", null, 1, "Ok", null, null);
  		alertDialog.show();
  	}
  }
}
 
開發者ID:judax,項目名稱:OculusMobileSDKHeadTrackingXWalkViewExtension,代碼行數:20,代碼來源:OculusMobileSDKHeadTrackingURLEntryActivity.java

示例9: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
	if ((requestCode & 0xFFFF) == IntentIntegrator.REQUEST_CODE) {
		IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
		if (scanResult != null && scanResult.getFormatName() != null) {
			String data = scanResult.getContents();
			Invite invite = new Invite(data);
			if (xmppConnectionServiceBound) {
				invite.invite();
			} else if (invite.getJid() != null) {
				this.mPendingInvite = invite;
			} else {
				this.mPendingInvite = null;
			}
		}
	}
	super.onActivityResult(requestCode, requestCode, intent);
}
 
開發者ID:xavierle,項目名稱:messengerxmpp,代碼行數:19,代碼來源:StartConversationActivity.java

示例10: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
/**
 * Receives value of scanned QR code and sets it as device ID.
 */
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (scanResult != null) {
        String deviceId = scanResult.getContents();
        if (!isBlank(deviceId)) {
            Log.i("Main", "qrcode text = " + deviceId);
            importDeviceId(deviceId);
            return;
        }
    }

    if (resultCode == Activity.RESULT_OK) {
        Uri fileUri = intent.getData();
        doUpload(indexBrowser.getFolder(), indexBrowser.getCurrentPath(), Arrays.asList(fileUri));
    }
}
 
開發者ID:davide-imbriaco,項目名稱:a-sync-browser,代碼行數:21,代碼來源:MainActivity.java

示例11: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
  IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

  if ((scanResult != null) && (scanResult.getContents() != null)) {
    String data = scanResult.getContents();

    if (data.equals(Base64.encodeBytes(getIdentityKeyToCompare().serialize()))) {
      Dialogs.showInfoDialog(this, getVerifiedTitle(), getVerifiedMessage());
    } else {
      Dialogs.showAlertDialog(this, getNotVerifiedTitle(), getNotVerifiedMessage());
    }
  } else {
    Toast.makeText(this, R.string.KeyScanningActivity_no_scanned_key_found_exclamation,
                   Toast.LENGTH_LONG).show();
  }
}
 
開發者ID:redcracker,項目名稱:TextSecure,代碼行數:18,代碼來源:KeyScanningActivity.java

示例12: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;
    }
    if (requestCode ==  IntentIntegrator.REQUEST_CODE) {
        IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
        if(result != null) {
            if(result.getContents() == null) {
                Toast.makeText(this, "掃碼取消!", Toast.LENGTH_SHORT).show();
            } else {
                mInputTextTV.setText(result.getContents());
            }
        }
    }
}
 
開發者ID:pili-engineering,項目名稱:PLDroidMediaStreaming,代碼行數:17,代碼來源:MainActivity.java

示例13: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
/**
 * Gets called when the QR code was read is provided by zxing
 */
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    // Cancel if activity result is not a QR code scan result
    IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
    if (result == null) {
        super.onActivityResult(requestCode, resultCode, intent);
        return;
    }

    // User cancelled QR code scanning?
    if (result.getContents() == null) {
        Toast.makeText(getActivity(), R.string.canceled_toast, Toast.LENGTH_LONG).show();
        return;
    }

    qrData = result.getContents();
    tryHandleQRData();
}
 
開發者ID:timberdoodle,項目名稱:TimberdoodleApp,代碼行數:21,代碼來源:ScanGroupKeyFragment.java

示例14: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);

    if (scanningResult != null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(Main_screen.this);
        String scanContent = scanningResult.getContents();
        String scanFormat = scanningResult.getFormatName();

        builder.setTitle("Инфо о продукте.")
                .setMessage("FORMAT: " + scanFormat + "\n" + "CONTENT: " + scanContent)
                .setPositiveButton("ОК", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });
        builder.show();

    } else {
        Toast toast = Toast.makeText(getApplicationContext(),
                "No scan data received!", Toast.LENGTH_SHORT);
        toast.show();

    }


}
 
開發者ID:tarasM,項目名稱:Bozon.kg_App,代碼行數:27,代碼來源:Main_screen.java

示例15: onActivityResult

import com.google.zxing.integration.android.IntentResult; //導入方法依賴的package包/類
/**
 * Handle Activity Results
 * @param requestCode requestCode
 * @param resultCode resultCode (RESULT_SETTINGS is defined at the top)
 * @param data data
 */
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	super.onActivityResult(requestCode, resultCode, data);
	switch (requestCode) {
		//Come back from Settings
		case RESULT_SETTINGS:
		{
			applyPreferenceChanges();
			break;
		}
		// Receive from QR
		case IntentIntegrator.REQUEST_CODE:
			IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
			if (scanResult != null) {
				String content = scanResult.getContents();
				if(content == null) Log.e(APP_ID, "Error! Received nothing from QR-Code!");
				else {
					Log.d(APP_ID, "Received " + content + " from QR-Code!");
					restoreStateFromCode(content);
				}
			}
	}
}
 
開發者ID:vanitasvitae,項目名稱:EnigmAndroid,代碼行數:29,代碼來源:MainActivity.java


注:本文中的com.google.zxing.integration.android.IntentResult.getContents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。