Bottom sheet styles were actually fixed.

This commit is contained in:
Anton Chekulaev
2020-08-26 22:30:17 +10:00
parent 2c42bdd1a5
commit 88efb2c08c
6 changed files with 8 additions and 26 deletions

View File

@@ -25,11 +25,7 @@ public class ConversationOptionsBottomSheet : BottomSheetDialogFragment() {
var onDeleteTapped: (() -> Unit)? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
//FIXME AC: For some reason this fragment (created from HomeActivity)
// is not using the activity's theme. So we have to enforce it.
return LayoutInflater.from(ContextThemeWrapper(requireContext(), R.style.Theme_Session_DayNight))
.inflate(R.layout.fragment_conversation_bottom_sheet, container, false)
// return inflater.inflate(R.layout.fragment_conversation_bottom_sheet, container, false)
return inflater.inflate(R.layout.fragment_conversation_bottom_sheet, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

View File

@@ -37,7 +37,7 @@ class MultiDeviceRemovalBottomSheet : BottomSheetDialogFragment() {
}
private val explanation by lazy {
if (TextSecurePreferences.getMasterHexEncodedPublicKey(context!!) != null) {
if (TextSecurePreferences.getMasterHexEncodedPublicKey(requireContext()) != null) {
"Youre seeing this because this is a secondary device in a multi-device setup. To improve reliability and stability, weve decided to temporarily disable Sessions multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on $removalDateDescription.\n\nTo read more about this change, visit the Session FAQ at getsession.org/faq."
} else {
"Youre seeing this because you have a secondary device linked to your Session ID. To improve reliability and stability, weve decided to temporarily disable Sessions multi-device functionality. Device linking has been disabled, and existing secondary clients will be erased on $removalDateDescription.\n\nTo read more about this change, visit the Session FAQ at getsession.org/faq"
@@ -49,7 +49,7 @@ class MultiDeviceRemovalBottomSheet : BottomSheetDialogFragment() {
val removalDateStartIndex = explanation.indexOf(removalDateDescription)
val removalDateEndIndex = removalDateStartIndex + removalDateDescription.count()
result.setSpan(StyleSpan(Typeface.BOLD), removalDateStartIndex, removalDateEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, context!!.theme)), removalDateStartIndex, removalDateEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, requireContext().theme)), removalDateStartIndex, removalDateEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
val link = "getsession.org/faq"
val linkStartIndex = explanation.indexOf(link)
val linkEndIndex = linkStartIndex + link.count()
@@ -59,20 +59,15 @@ class MultiDeviceRemovalBottomSheet : BottomSheetDialogFragment() {
try {
onLinkTapped?.invoke()
} catch (e: Exception) {
Toast.makeText(context!!, R.string.invalid_url, Toast.LENGTH_SHORT).show()
Toast.makeText(requireContext(), R.string.invalid_url, Toast.LENGTH_SHORT).show()
}
}
}, linkStartIndex, linkEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result.setSpan(StyleSpan(Typeface.BOLD), linkStartIndex, linkEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, context!!.theme)), linkStartIndex, linkEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result.setSpan(ForegroundColorSpan(resources.getColorWithID(R.color.accent, requireContext().theme)), linkStartIndex, linkEndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
result
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.SessionBottomSheetDialogTheme)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_multi_device_removal_bottom_sheet, container, false)
}

View File

@@ -12,11 +12,6 @@ class OpenGroupSuggestionBottomSheet : BottomSheetDialogFragment() {
var onJoinTapped: (() -> Unit)? = null
var onDismissTapped: (() -> Unit)? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.SessionBottomSheetDialogTheme)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_open_group_suggestion_bottom_sheet, container, false)
}