@Override public View onCreateView( LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.certify_key_fragment, null); mCertifyKeySpinner = (CertifyKeySpinner) view.findViewById(R.id.certify_key_spinner); mUploadKeyCheckbox = (CheckBox) view.findViewById(R.id.sign_key_upload_checkbox); mUserIds = (ListView) view.findViewById(R.id.view_key_user_ids); // make certify image gray, like action icons ImageView vActionCertifyImage = (ImageView) view.findViewById(R.id.certify_key_action_certify_image); vActionCertifyImage.setColorFilter( FormattingUtils.getColorFromAttr(getActivity(), R.attr.colorTertiaryText), PorterDuff.Mode.SRC_IN); View vCertifyButton = view.findViewById(R.id.certify_key_certify_button); vCertifyButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { long selectedKeyId = mCertifyKeySpinner.getSelectedKeyId(); if (selectedKeyId == Constants.key.none) { Notify.create( getActivity(), getString(R.string.select_key_to_certify), Notify.Style.ERROR) .show(); } else { cryptoOperation(new CryptoInputParcel(new Date())); } } }); // If this is a debug build, don't upload by default if (Constants.DEBUG) { mUploadKeyCheckbox.setChecked(false); } return view; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup superContainer, Bundle savedInstanceState) { View root = super.onCreateView(inflater, superContainer, savedInstanceState); View view = inflater.inflate(R.layout.view_key_adv_share_fragment, getContainer()); ProviderHelper providerHelper = new ProviderHelper(ViewKeyAdvShareFragment.this.getActivity()); mNfcHelper = new NfcHelper(getActivity(), providerHelper); mFingerprintView = (TextView) view.findViewById(R.id.view_key_fingerprint); mQrCode = (ImageView) view.findViewById(R.id.view_key_qr_code); mQrCodeLayout = (CardView) view.findViewById(R.id.view_key_qr_code_layout); mQrCodeLayout.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { showQrCodeDialog(); } }); View vFingerprintShareButton = view.findViewById(R.id.view_key_action_fingerprint_share); View vFingerprintClipboardButton = view.findViewById(R.id.view_key_action_fingerprint_clipboard); View vKeyShareButton = view.findViewById(R.id.view_key_action_key_share); View vKeySafeButton = view.findViewById(R.id.view_key_action_key_export); View vKeyNfcButton = view.findViewById(R.id.view_key_action_key_nfc); View vKeyClipboardButton = view.findViewById(R.id.view_key_action_key_clipboard); ImageButton vKeySafeSlingerButton = (ImageButton) view.findViewById(R.id.view_key_action_key_safeslinger); View vKeyUploadButton = view.findViewById(R.id.view_key_action_upload); vKeySafeSlingerButton.setColorFilter( FormattingUtils.getColorFromAttr(getActivity(), R.attr.colorTertiaryText), PorterDuff.Mode.SRC_IN); vFingerprintShareButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { share(true, false); } }); vFingerprintClipboardButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { share(true, true); } }); vKeyShareButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { share(false, false); } }); vKeySafeButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { exportToFile(); } }); vKeyClipboardButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { share(false, true); } }); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { vKeyNfcButton.setVisibility(View.VISIBLE); vKeyNfcButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mNfcHelper.invokeNfcBeam(); } }); } else { vKeyNfcButton.setVisibility(View.GONE); } vKeySafeSlingerButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startSafeSlinger(mDataUri); } }); vKeyUploadButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { uploadToKeyserver(); } }); return root; }