This commit is contained in:
Ryan ZHAO 2021-05-13 16:20:55 +10:00
parent 7b8a025947
commit 1d5f7957ab
2 changed files with 24 additions and 43 deletions

View File

@ -172,9 +172,6 @@
<activity <activity
android:name="org.thoughtcrime.securesms.loki.activities.ChatSettingsActivity" android:name="org.thoughtcrime.securesms.loki.activities.ChatSettingsActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name="org.thoughtcrime.securesms.loki.activities.LinkedDevicesActivity"
android:screenOrientation="portrait" />
<!-- Session --> <!-- Session -->
<activity <activity
android:name="org.thoughtcrime.securesms.ShareActivity" android:name="org.thoughtcrime.securesms.ShareActivity"
@ -224,24 +221,6 @@
android:resource="@mipmap/ic_launcher" /> android:resource="@mipmap/ic_launcher" />
</activity-alias> </activity-alias>
<activity
android:name="org.thoughtcrime.securesms.stickers.StickerPackPreviewActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask"
android:noHistory="true"
android:theme="@style/Theme.TextSecure.DayNight.NoActionBar"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="addstickers"
android:scheme="sgnl" />
</intent-filter>
</activity>
<activity <activity
android:name="org.thoughtcrime.securesms.conversation.ConversationActivity" android:name="org.thoughtcrime.securesms.conversation.ConversationActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
@ -278,23 +257,11 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/NoAnimation.Theme.AppCompat.Light.DarkActionBar" /> android:theme="@style/NoAnimation.Theme.AppCompat.Light.DarkActionBar" />
<activity
android:name="org.thoughtcrime.securesms.PassphraseCreateActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:label="@string/AndroidManifest__create_passphrase"
android:launchMode="singleTask"
android:theme="@style/Theme.Session.DayNight.NoActionBar"
android:windowSoftInputMode="stateUnchanged" />
<activity <activity
android:name="org.thoughtcrime.securesms.PassphrasePromptActivity" android:name="org.thoughtcrime.securesms.PassphrasePromptActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/Theme.Session.DayNight.NoActionBar"/> android:theme="@style/Theme.Session.DayNight.NoActionBar"/>
<activity
android:name="org.thoughtcrime.securesms.PushContactSelectionActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:label="@string/AndroidManifest__select_contacts"
android:windowSoftInputMode="stateHidden" />
<activity <activity
android:name="org.thoughtcrime.securesms.giph.ui.GiphyActivity" android:name="org.thoughtcrime.securesms.giph.ui.GiphyActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"

View File

@ -9,6 +9,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import android.widget.Toast import android.widget.Toast
import kotlinx.android.synthetic.main.fragment_user_details_bottom_sheet.* import kotlinx.android.synthetic.main.fragment_user_details_bottom_sheet.*
@ -36,6 +37,7 @@ public class UserDetailsBottomSheet : BottomSheetDialogFragment() {
nameTextViewContainer.setOnClickListener { nameTextViewContainer.setOnClickListener {
nameTextViewContainer.visibility = View.INVISIBLE nameTextViewContainer.visibility = View.INVISIBLE
nameEditContainer.visibility = View.VISIBLE nameEditContainer.visibility = View.VISIBLE
nameEditText.text = null
nameEditText.requestFocus() nameEditText.requestFocus()
showSoftKeyboard() showSoftKeyboard()
} }
@ -44,9 +46,30 @@ public class UserDetailsBottomSheet : BottomSheetDialogFragment() {
hideSoftKeyboard() hideSoftKeyboard()
nameTextViewContainer.visibility = View.VISIBLE nameTextViewContainer.visibility = View.VISIBLE
nameEditContainer.visibility = View.INVISIBLE nameEditContainer.visibility = View.INVISIBLE
nameEditText.text = null
} }
btnSaveNickNameEdit.setOnClickListener { btnSaveNickNameEdit.setOnClickListener {
saveNickName(recipient)
}
nameEditText.setOnEditorActionListener { _, actionId, _ ->
when (actionId) {
EditorInfo.IME_ACTION_DONE -> {
saveNickName(recipient)
return@setOnEditorActionListener true
}
else -> return@setOnEditorActionListener false
}
}
nameTextView.text = SSKEnvironment.shared.profileManager.getDisplayName(requireContext(), recipient) ?: "Anonymous"
publicKeyTextView.text = publicKey
copyButton.setOnClickListener {
val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("Session ID", publicKey)
clipboard.setPrimaryClip(clip)
Toast.makeText(requireContext(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
}
}
fun saveNickName(recipient: Recipient) {
nameEditText.clearFocus() nameEditText.clearFocus()
hideSoftKeyboard() hideSoftKeyboard()
nameTextViewContainer.visibility = View.VISIBLE nameTextViewContainer.visibility = View.VISIBLE
@ -58,15 +81,6 @@ public class UserDetailsBottomSheet : BottomSheetDialogFragment() {
SSKEnvironment.shared.profileManager.setDisplayName(requireContext(), recipient, newNickName) SSKEnvironment.shared.profileManager.setDisplayName(requireContext(), recipient, newNickName)
nameTextView.text = SSKEnvironment.shared.profileManager.getDisplayName(requireContext(), recipient) ?: "Anonymous" nameTextView.text = SSKEnvironment.shared.profileManager.getDisplayName(requireContext(), recipient) ?: "Anonymous"
} }
nameTextView.text = SSKEnvironment.shared.profileManager.getDisplayName(requireContext(), recipient) ?: "Anonymous"
publicKeyTextView.text = publicKey
copyButton.setOnClickListener {
val clipboard = requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText("Session ID", publicKey)
clipboard.setPrimaryClip(clip)
Toast.makeText(requireContext(), R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
}
}
@SuppressLint("ServiceCast") @SuppressLint("ServiceCast")
fun showSoftKeyboard() { fun showSoftKeyboard() {