Flat style for the styled Session buttons.

Fixed home activity bottom sheet uses wrong colors.
This commit is contained in:
Anton Chekulaev 2020-08-26 22:19:45 +10:00
parent a80adb80f8
commit 2c42bdd1a5
3 changed files with 25 additions and 1 deletions

View File

@ -63,6 +63,9 @@
<item name="android:textAllCaps">false</item>
<item name="android:textSize">@dimen/medium_font_size</item>
<item name="android:fontFamily">sans-serif-medium</item>
<!-- Helps to get rid of nasty elevation. We want a flat style here. -->
<!-- https://stackoverflow.com/a/31003693/3802890 -->
<item name ="android:stateListAnimator">@null</item>
</style>
<style name="Widget.Session.Button.Common.ProminentFilled">

View File

@ -121,6 +121,9 @@ public abstract class BaseActionBarActivity extends AppCompatActivity {
ActivityCompat.startActivity(this, intent, bundle);
}
//TODO AC: I don't think we need this method,
// setting any colors directly will most likely clash with the current theme.
@Deprecated
@TargetApi(VERSION_CODES.LOLLIPOP)
protected void setStatusBarColor(int color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

View File

@ -5,23 +5,41 @@ import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.view.ContextThemeWrapper
import kotlinx.android.synthetic.main.fragment_closed_group_edit_bottom_sheet.*
import kotlinx.android.synthetic.main.fragment_conversation_bottom_sheet.*
import kotlinx.android.synthetic.main.fragment_device_list_bottom_sheet.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.recipients.Recipient
public class ConversationOptionsBottomSheet : BottomSheetDialogFragment() {
//FIXME AC: Supplying a recipient directly into the field from an activity
// is not the best idea. It doesn't survive configuration change.
// We should be dealing with IDs and all sorts of serializable data instead
// if we want to use dialog fragments properly.
lateinit var recipient: Recipient
var onBlockTapped: (() -> Unit)? = null
var onUnblockTapped: (() -> Unit)? = null
var onDeleteTapped: (() -> Unit)? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_conversation_bottom_sheet, container, false)
//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)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (!this::recipient.isInitialized) {
dismiss()
return
}
if (!recipient.isGroupRecipient && !recipient.isLocalNumber) {
unblockTextView.visibility = if (recipient.isBlocked) View.VISIBLE else View.GONE
blockTextView.visibility = if (recipient.isBlocked) View.GONE else View.VISIBLE