Skip to content

Commit

Permalink
left->start
Browse files Browse the repository at this point in the history
  • Loading branch information
lizongying committed Apr 27, 2024
1 parent 5aa08f5 commit fe888c3
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
Binary file modified app/src/main/cpp/arm64-v8a/libnative.so
Binary file not shown.
Binary file modified app/src/main/cpp/armeabi-v7a/libnative.so
Binary file not shown.
6 changes: 3 additions & 3 deletions app/src/main/java/com/lizongying/mytv/ChannelFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.marginRight
import androidx.core.view.marginEnd
import androidx.core.view.marginTop
import androidx.fragment.app.Fragment
import com.lizongying.mytv.databinding.ChannelBinding
Expand Down Expand Up @@ -40,7 +40,7 @@ class ChannelFragment : Fragment() {
((Resources.getSystem().displayMetrics.widthPixels - height * ratio) / 2).toInt()
val originalLayoutParams =
binding.channel.layoutParams as ViewGroup.MarginLayoutParams
originalLayoutParams.rightMargin += x
originalLayoutParams.marginEnd += x
binding.channel.layoutParams = originalLayoutParams
}

Expand All @@ -57,7 +57,7 @@ class ChannelFragment : Fragment() {
binding.channel.layoutParams.height = application.px2Px(binding.channel.layoutParams.height)
val layoutParams = binding.channel.layoutParams as ViewGroup.MarginLayoutParams
layoutParams.topMargin = application.px2Px(binding.channel.marginTop)
layoutParams.rightMargin = application.px2Px(binding.channel.marginRight)
layoutParams.marginEnd = application.px2Px(binding.channel.marginEnd)
binding.channel.layoutParams = layoutParams
binding.content.textSize = application.px2PxFont(binding.content.textSize)

Expand Down
6 changes: 1 addition & 5 deletions app/src/main/java/com/lizongying/mytv/ErrorFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.marginLeft
import androidx.core.view.marginStart
import androidx.core.view.marginTop
import androidx.fragment.app.Fragment
import com.lizongying.mytv.databinding.ErrorBinding
Expand All @@ -24,10 +24,6 @@ class ErrorFragment : Fragment() {
binding.logo.layoutParams.width = application.px2Px(binding.logo.layoutParams.width)
binding.logo.layoutParams.height = application.px2Px(binding.logo.layoutParams.height)

val layoutParamsMain = binding.main.layoutParams as ViewGroup.MarginLayoutParams
layoutParamsMain.leftMargin = application.px2Px(binding.main.marginLeft)
binding.main.layoutParams = layoutParamsMain

val layoutParams = binding.msg.layoutParams as ViewGroup.MarginLayoutParams
layoutParams.topMargin = application.px2Px(binding.msg.marginTop)
binding.msg.layoutParams = layoutParams
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/lizongying/mytv/InfoFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.marginBottom
import androidx.core.view.marginLeft
import androidx.core.view.marginStart
import androidx.core.view.marginTop
import androidx.core.view.setPadding
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -54,7 +54,7 @@ class InfoFragment : Fragment() {
binding.main.setPadding(application.px2Px(binding.main.paddingTop))

val layoutParamsMain = binding.main.layoutParams as ViewGroup.MarginLayoutParams
layoutParamsMain.leftMargin = application.px2Px(binding.main.marginLeft)
layoutParamsMain.marginStart = application.px2Px(binding.main.marginStart)
binding.main.layoutParams = layoutParamsMain

val layoutParamsDesc = binding.desc.layoutParams as ViewGroup.MarginLayoutParams
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/java/com/lizongying/mytv/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.view.marginBottom
import androidx.core.view.marginLeft
import androidx.core.view.marginStart
import androidx.core.view.marginTop
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
Expand Down Expand Up @@ -61,8 +61,8 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
((Resources.getSystem().displayMetrics.widthPixels - height * ratio) / 2).toInt()
val originalLayoutParams =
binding.scroll.layoutParams as ViewGroup.MarginLayoutParams
originalLayoutParams.leftMargin += x
originalLayoutParams.rightMargin += x
originalLayoutParams.marginStart += x
originalLayoutParams.marginEnd += x
binding.scroll.layoutParams = originalLayoutParams

Log.i(
Expand Down Expand Up @@ -166,7 +166,7 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
itemBinding.header.layoutParams as ViewGroup.MarginLayoutParams
layoutParamsHeader.topMargin = application.px2Px(itemBinding.header.marginTop)
layoutParamsHeader.bottomMargin = application.px2Px(itemBinding.header.marginBottom)
layoutParamsHeader.leftMargin = application.px2Px(itemBinding.header.marginLeft)
layoutParamsHeader.marginStart = application.px2Px(itemBinding.header.marginStart)
itemBinding.header.layoutParams = layoutParamsHeader
itemBinding.header.textSize = application.px2PxFont(itemBinding.header.textSize)

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/lizongying/mytv/TimeFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.os.Handler
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.marginRight
import androidx.core.view.marginEnd
import androidx.core.view.marginTop
import androidx.fragment.app.Fragment
import com.lizongying.mytv.Utils.getDateFormat
Expand Down Expand Up @@ -36,7 +36,7 @@ class TimeFragment : Fragment() {
val x =
((Resources.getSystem().displayMetrics.widthPixels - height * ratio) / 2).toInt()
val originalLayoutParams = binding.time.layoutParams as ViewGroup.MarginLayoutParams
originalLayoutParams.rightMargin += x
originalLayoutParams.marginEnd += x
binding.time.layoutParams = originalLayoutParams
}

Expand All @@ -52,7 +52,7 @@ class TimeFragment : Fragment() {
binding.time.layoutParams.height = application.px2Px(binding.time.layoutParams.height)
val layoutParams = binding.time.layoutParams as ViewGroup.MarginLayoutParams
layoutParams.topMargin = application.px2Px(binding.time.marginTop)
layoutParams.rightMargin = application.px2Px(binding.time.marginRight)
layoutParams.marginEnd = application.px2Px(binding.time.marginEnd)
binding.time.layoutParams = layoutParams
binding.content.textSize = application.px2PxFont(binding.content.textSize)

Expand Down

0 comments on commit fe888c3

Please sign in to comment.