Skip to content

Commit

Permalink
一些view空指针解决
Browse files Browse the repository at this point in the history
  • Loading branch information
running-libo committed Jun 25, 2021
1 parent d7dbf39 commit 8725875
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 103 deletions.
15 changes: 4 additions & 11 deletions app/src/main/java/com/bytedance/tiktok/activity/FocusActivity.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.bytedance.tiktok.activity

import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import butterknife.BindView
import com.androidkun.xtablayout.XTabLayout
import com.bytedance.tiktok.R
import com.bytedance.tiktok.base.BaseActivity
import com.bytedance.tiktok.base.CommPagerAdapter
import com.bytedance.tiktok.fragment.FansFragment
import kotlinx.android.synthetic.main.activity_focus.*
import java.util.*

/**
Expand All @@ -16,11 +14,6 @@ import java.util.*
* description 粉丝关注人页面
*/
class FocusActivity : BaseActivity() {
@BindView(R.id.tablayout)
var tabLayout: XTabLayout? = null

@BindView(R.id.viewpager)
var viewPager: ViewPager? = null

private val fragments = ArrayList<Fragment>()
private var pagerAdapter: CommPagerAdapter? = null
Expand All @@ -33,10 +26,10 @@ class FocusActivity : BaseActivity() {
override fun init() {
for (i in titles.indices) {
fragments.add(FansFragment())
tabLayout!!.addTab(tabLayout!!.newTab().setText(titles[i]))
tablayout!!.addTab(tablayout!!.newTab().setText(titles[i]))
}
pagerAdapter = CommPagerAdapter(supportFragmentManager, fragments, titles)
viewPager!!.adapter = pagerAdapter
tabLayout!!.setupWithViewPager(viewPager)
viewpager!!.adapter = pagerAdapter
tablayout!!.setupWithViewPager(viewpager)
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package com.bytedance.tiktok.activity

import android.view.View
import android.widget.ImageView
import butterknife.BindView
import com.bytedance.tiktok.R
import com.bytedance.tiktok.base.BaseActivity
import kotlinx.android.synthetic.main.activity_show_image.*

class ShowImageActivity : BaseActivity() {
@JvmField
@BindView(R.id.iv_head)
var ivHead: ImageView? = null

override fun setLayoutId(): Int {
return R.layout.activity_show_image
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/bytedance/tiktok/application/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,5 @@ class App : Application() {
DoraemonKit.install(this, "pId")

BlockCanary.install(this, AppBlockCanaryContext()).start()

Thread.setDefaultUncaughtExceptionHandler(MyExceptionHandler())
}
}

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_show_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
android:background="@color/color_bg_theme">

<com.bytedance.tiktok.view.SquareWidthImageView
android:id="@+id/iv_head"
android:id="@+id/ivHead"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
Expand Down

0 comments on commit 8725875

Please sign in to comment.