Always show QR code in UserInfoFragment
This commit is contained in:
parent
0ccfd100d3
commit
858a2ac636
2 changed files with 4 additions and 9 deletions
|
@ -103,7 +103,6 @@ class ContactsFragment extends ListFragment with OnClickListener {
|
||||||
UserInfoFragment.ExtraAddress, ChatService.newCrypto(getActivity).localAddress.toString)
|
UserInfoFragment.ExtraAddress, ChatService.newCrypto(getActivity).localAddress.toString)
|
||||||
bundle.putString(
|
bundle.putString(
|
||||||
UserInfoFragment.ExtraUserName, prefs.getString(SettingsInterface.KeyUserName, ""))
|
UserInfoFragment.ExtraUserName, prefs.getString(SettingsInterface.KeyUserName, ""))
|
||||||
bundle.putBoolean(UserInfoFragment.ExtraShowQr, true)
|
|
||||||
fragment.setArguments(bundle)
|
fragment.setArguments(bundle)
|
||||||
fragment.show(getFragmentManager, "dialog")
|
fragment.show(getFragmentManager, "dialog")
|
||||||
true
|
true
|
||||||
|
|
|
@ -17,7 +17,6 @@ import com.nutomic.ensichat.util.IdenticonGenerator
|
||||||
object UserInfoFragment {
|
object UserInfoFragment {
|
||||||
val ExtraAddress = "address"
|
val ExtraAddress = "address"
|
||||||
val ExtraUserName = "user_name"
|
val ExtraUserName = "user_name"
|
||||||
val ExtraShowQr = "show_qr"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +28,6 @@ class UserInfoFragment extends DialogFragment with OnClickListener {
|
||||||
|
|
||||||
private lazy val address = new Address(getArguments.getString(UserInfoFragment.ExtraAddress))
|
private lazy val address = new Address(getArguments.getString(UserInfoFragment.ExtraAddress))
|
||||||
private lazy val userName = getArguments.getString(UserInfoFragment.ExtraUserName)
|
private lazy val userName = getArguments.getString(UserInfoFragment.ExtraUserName)
|
||||||
private lazy val showQr = getArguments.getBoolean(UserInfoFragment.ExtraShowQr)
|
|
||||||
|
|
||||||
override def onCreateDialog(savedInstanceState: Bundle): Dialog = {
|
override def onCreateDialog(savedInstanceState: Bundle): Dialog = {
|
||||||
val view = LayoutInflater.from(getActivity).inflate(R.layout.fragment_identicon, null)
|
val view = LayoutInflater.from(getActivity).inflate(R.layout.fragment_identicon, null)
|
||||||
|
@ -42,12 +40,10 @@ class UserInfoFragment extends DialogFragment with OnClickListener {
|
||||||
addressTextView.setText(getString(R.string.address_colon, address.toString()))
|
addressTextView.setText(getString(R.string.address_colon, address.toString()))
|
||||||
addressTextView.setOnClickListener(this)
|
addressTextView.setOnClickListener(this)
|
||||||
|
|
||||||
if (showQr) {
|
val matrix = new QRCodeWriter().encode(address.toString(), BarcodeFormat.QR_CODE, 150, 150)
|
||||||
val matrix = new QRCodeWriter().encode(address.toString(), BarcodeFormat.QR_CODE, 150, 150)
|
view.findViewById(R.id.qr_code)
|
||||||
view.findViewById(R.id.qr_code)
|
.asInstanceOf[ImageView]
|
||||||
.asInstanceOf[ImageView]
|
.setImageBitmap(renderMatrix(matrix))
|
||||||
.setImageBitmap(renderMatrix(matrix))
|
|
||||||
}
|
|
||||||
|
|
||||||
new AlertDialog.Builder(getActivity)
|
new AlertDialog.Builder(getActivity)
|
||||||
.setTitle(userName)
|
.setTitle(userName)
|
||||||
|
|
Reference in a new issue