mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-30 14:10:46 +00:00
Clean
This commit is contained in:
parent
23770f79a9
commit
9dee062976
@ -25,7 +25,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
android:textSize="@dimen/medium_font_size"
|
android:textSize="@dimen/medium_font_size"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
@ -37,7 +37,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
android:hint="Enter a display name" />
|
android:hint="Enter a display name" />
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
android:textSize="@dimen/medium_font_size"
|
android:textSize="@dimen/medium_font_size"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
@ -37,7 +37,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
android:text="05987d601943c267879be41830888066c6a024cbdc9a548d06813924bf3372ea78" />
|
android:text="05987d601943c267879be41830888066c6a024cbdc9a548d06813924bf3372ea78" />
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
android:hint="Enter your seed" />
|
android:hint="Enter your seed" />
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
android:id="@+id/profilePictureView"
|
android:id="@+id/profilePictureView"
|
||||||
android:layout_width="@dimen/large_profile_picture_size"
|
android:layout_width="@dimen/large_profile_picture_size"
|
||||||
android:layout_height="@dimen/large_profile_picture_size"
|
android:layout_height="@dimen/large_profile_picture_size"
|
||||||
android:layout_marginTop="@dimen/large_spacing" />
|
android:layout_marginTop="@dimen/medium_spacing" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/displayNameTextView"
|
android:id="@+id/displayNameTextView"
|
||||||
|
@ -12,17 +12,17 @@
|
|||||||
android:id="@+id/chatURLEditText"
|
android:id="@+id/chatURLEditText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:hint="https://chat.lokinet.org" />
|
android:hint="https://chat.lokinet.org" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:textSize="@dimen/small_font_size"
|
android:textSize="@dimen/small_font_size"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
|
@ -12,17 +12,17 @@
|
|||||||
android:id="@+id/publicKeyEditText"
|
android:id="@+id/publicKeyEditText"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:hint="Enter Session ID of recipient" />
|
android:hint="Enter Session ID of recipient" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:textSize="@dimen/small_font_size"
|
android:textSize="@dimen/small_font_size"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:alpha="0.6"
|
android:alpha="0.6"
|
||||||
@ -33,17 +33,17 @@
|
|||||||
android:id="@+id/separatorView"
|
android:id="@+id/separatorView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing" />
|
android:layout_marginRight="@dimen/large_spacing" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/publicKeyTextView"
|
android:id="@+id/publicKeyTextView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:textSize="@dimen/medium_font_size"
|
android:textSize="@dimen/medium_font_size"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:fontFamily="@font/space_mono_regular"
|
android:fontFamily="@font/space_mono_regular"
|
||||||
@ -53,9 +53,9 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/large_spacing"
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="@dimen/medium_spacing"
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:textSize="@dimen/massive_font_size"
|
android:textSize="@dimen/massive_font_size"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
@ -38,8 +38,8 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/qrCodeImageView"
|
android:id="@+id/qrCodeImageView"
|
||||||
android:layout_width="320dp"
|
android:layout_width="280dp"
|
||||||
android:layout_height="320dp" />
|
android:layout_height="280dp" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@ -47,12 +47,11 @@
|
|||||||
android:id="@+id/explanationTextView"
|
android:id="@+id/explanationTextView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
android:layout_marginLeft="@dimen/large_spacing"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginRight="@dimen/very_large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:textSize="@dimen/medium_font_size"
|
android:textSize="@dimen/medium_font_size"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:fontFamily="@font/space_mono_regular"
|
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:text="This is your unique public QR code. Other users may scan this in order to begin a conversation with you." />
|
android:text="This is your unique public QR code. Other users may scan this in order to begin a conversation with you." />
|
||||||
|
|
||||||
|
@ -23,11 +23,6 @@ class DisplayNameActivity : BaseActionBarActivity() {
|
|||||||
registerButton.setOnClickListener { register() }
|
registerButton.setOnClickListener { register() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
displayNameEditText.requestFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun register() {
|
private fun register() {
|
||||||
val displayName = displayNameEditText.text.toString().trim()
|
val displayName = displayNameEditText.text.toString().trim()
|
||||||
if (displayName.isEmpty()) {
|
if (displayName.isEmpty()) {
|
||||||
|
@ -121,7 +121,7 @@ class ViewMyQRCodeFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
val size = toPx(240, resources)
|
val size = toPx(280, resources)
|
||||||
val qrCode = QRCodeUtilities.encode(hexEncodedPublicKey, size)
|
val qrCode = QRCodeUtilities.encode(hexEncodedPublicKey, size)
|
||||||
qrCodeImageView.setImageBitmap(qrCode)
|
qrCodeImageView.setImageBitmap(qrCode)
|
||||||
val explanation = SpannableStringBuilder("This is your unique public QR code. Other users may scan this in order to begin a conversation with you.")
|
val explanation = SpannableStringBuilder("This is your unique public QR code. Other users may scan this in order to begin a conversation with you.")
|
||||||
@ -137,7 +137,7 @@ class ViewMyQRCodeFragment : Fragment() {
|
|||||||
val file = File(directory, fileName)
|
val file = File(directory, fileName)
|
||||||
file.createNewFile()
|
file.createNewFile()
|
||||||
val fos = FileOutputStream(file)
|
val fos = FileOutputStream(file)
|
||||||
val size = toPx(240, resources)
|
val size = toPx(280, resources)
|
||||||
val qrCode = QRCodeUtilities.encode(hexEncodedPublicKey, size, false)
|
val qrCode = QRCodeUtilities.encode(hexEncodedPublicKey, size, false)
|
||||||
qrCode.compress(Bitmap.CompressFormat.PNG, 100, fos)
|
qrCode.compress(Bitmap.CompressFormat.PNG, 100, fos)
|
||||||
fos.flush()
|
fos.flush()
|
||||||
|
@ -7,6 +7,7 @@ import android.content.Intent
|
|||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
import android.text.Spannable
|
import android.text.Spannable
|
||||||
import android.text.SpannableStringBuilder
|
import android.text.SpannableStringBuilder
|
||||||
import android.text.style.StyleSpan
|
import android.text.style.StyleSpan
|
||||||
@ -87,7 +88,32 @@ class RegisterActivity : BaseActionBarActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePublicKeyTextView() {
|
private fun updatePublicKeyTextView() {
|
||||||
publicKeyTextView.text = keyPair!!.hexEncodedPublicKey
|
val hexEncodedPublicKey = keyPair!!.hexEncodedPublicKey
|
||||||
|
val characterCount = hexEncodedPublicKey.count()
|
||||||
|
var count = 0
|
||||||
|
val limit = 40
|
||||||
|
fun animate() {
|
||||||
|
val numberOfIndexesToShuffle = (0 until (40 - count)).random()
|
||||||
|
val indexesToShuffle = (0 until characterCount).shuffled().subList(0, numberOfIndexesToShuffle)
|
||||||
|
var mangledHexEncodedPublicKey = hexEncodedPublicKey
|
||||||
|
for (index in indexesToShuffle) {
|
||||||
|
try {
|
||||||
|
mangledHexEncodedPublicKey = mangledHexEncodedPublicKey.substring(0, index) + "0123456789abcdef________________".random() + mangledHexEncodedPublicKey.substring(index + 1, mangledHexEncodedPublicKey.count())
|
||||||
|
} catch (exception: Exception) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count += 1
|
||||||
|
if (count < limit) {
|
||||||
|
publicKeyTextView.text = mangledHexEncodedPublicKey
|
||||||
|
Handler().postDelayed({
|
||||||
|
animate()
|
||||||
|
}, 40)
|
||||||
|
} else {
|
||||||
|
publicKeyTextView.text = hexEncodedPublicKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
animate()
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
@ -44,11 +44,6 @@ class RestoreActivity : BaseActionBarActivity() {
|
|||||||
termsButton.text = termsExplanation
|
termsButton.text = termsExplanation
|
||||||
termsButton.setOnClickListener { showTerms() }
|
termsButton.setOnClickListener { showTerms() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
mnemonicEditText.requestFocus()
|
|
||||||
}
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region General
|
// region General
|
||||||
|
Loading…
x
Reference in New Issue
Block a user