Skip to content

Commit 9c5c4d6

Browse files
committed
Fix demo compile problem, Remove outdate information
1 parent 2ac1d53 commit 9c5c4d6

28 files changed

+72
-114
lines changed

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/AbstractTouchEventHandler.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
import java.util.List;
1010

1111
/**
12-
* Created by 张宇 on 2017/9/19.
13-
* E-mail: zhangyu4@yy.com
14-
* YY: 909017428
12+
* @author YvesCheung
13+
* 2017/9/19
1514
* <p>
1615
* 基本触摸事件处理骨架 绑定指定类型的{@link TouchViewHolder} viewHolder和 {@link TouchEventHandler} nextHandler
1716
*/

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/AttachToViewTouchEventHandler.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
import android.view.View;
66

77
/**
8-
* Created by 张宇 on 2017/9/6.
9-
* E-mail: zhangyu4@yy.com
10-
* YY: 909017428
8+
* @author YvesCheung
9+
* 2017/9/6
1110
* <p>
1211
* 处理要依附在View上的触摸事件,可以判断事件是否发生在View上,并根据View的位置纠正点击事件的x y坐标。
1312
*/

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/InterceptClickHandler.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
import android.view.ViewGroup;
88

99
/**
10-
* Created by 张宇 on 2017/9/6.
11-
* E-mail: zhangyu4@yy.com
12-
* YY: 909017428
10+
* @author YvesCheung
11+
* 2017/9/6
1312
* <p>
1413
* 你可以实现一个子类继承于{@link InterceptClickHandler},然后拦截所有clickable或longClickable的View的触摸事件。
1514
* 注意这个Handler只会"拦截"点击事件,但不会处理点击事件,也就是不会触摸onClickListener之类的响应。

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/TouchEventBus.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
import java.util.List;
1515

1616
/**
17-
* Created by 张宇 on 2017/9/1.
18-
* E-mail: zhangyu4@yy.com
19-
* YY: 909017428
17+
* @author YvesCheung
18+
* 2017/9/1
2019
* <p>
2120
* 开播端直播间的触摸消息总线,负责把消息按顺序分发给TouchEventHandler
2221
*/

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/TouchEventHandler.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
import java.util.List;
88

99
/**
10-
* Created by 张宇 on 2017/9/4.
11-
* E-mail: zhangyu4@yy.com
12-
* YY: 909017428
10+
* @author YvesCheung
11+
* 2017/9/4
1312
*
1413
* <h1>触摸处理器</h1>
1514
* <p>所有需要触摸事件的业务都应该是一个独立的{@link TouchEventHandler}。比如上下滑切换直播间是一个Handler,

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/TouchEventHandlerContainer.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
import java.util.Map;
1111

1212
/**
13-
* Created by 张宇 on 2017/9/5.
14-
* E-mail: zhangyu4@yy.com
15-
* YY: 909017428
13+
* @author YvesCheung
14+
* 2017/9/5
1615
* <p>
1716
* 用于对{@link TouchEventHandler}根据 {@link TouchEventHandler#nextHandler()}来进行排序
1817
*/

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/TouchEventHandlerUtil.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
import static android.view.MotionEvent.ACTION_UP;
2323

2424
/**
25-
* Created by 张宇 on 2017/9/6.
26-
* E-mail: zhangyu4@yy.com
27-
* YY: 909017428
25+
* @author YvesCheung
26+
* 2017/9/6
2827
*/
2928
@SuppressWarnings("WeakerAccess")
3029
public class TouchEventHandlerUtil {

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/TouchTimer.java

-17
This file was deleted.

toucheventbus/src/main/java/mobile/yy/com/toucheventbus/TouchViewHolder.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
import java.util.Set;
77

88
/**
9-
* Created by 张宇 on 2017/9/8.
10-
* E-mail: zhangyu4@yy.com
11-
* YY: 909017428
9+
* @author YvesCheung
10+
* 2017/9/8
1211
*/
1312
public class TouchViewHolder<VIEW> {
14-
private Set<VIEW> set = new HashSet<>();
13+
private final Set<VIEW> set = new HashSet<>();
1514

1615
@NonNull
1716
Set<VIEW> getView() {

touchsample/src/main/java/mobile/yy/com/touchsample/App.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ import android.app.Application
44
import mobile.yy.com.touchsample.inject.Injector
55

66
/**
7-
* Created by 张宇 on 2018/4/25.
8-
* E-mail: zhangyu4@yy.com
9-
* YY: 909017428
7+
* @author YvesCheung
8+
* 2018/4/25
109
*/
1110
class App : Application() {
1211

touchsample/src/main/java/mobile/yy/com/touchsample/inject/Injector.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import mobile.yy.com.touchsample.presenter.MainTabPresenter
66
import mobile.yy.com.touchsample.presenter.SubTabPresenter
77

88
/**
9-
* Created by 张宇 on 2018/4/25.
10-
* E-mail: zhangyu4@yy.com
11-
* YY: 909017428
9+
* @author YvesCheung
10+
* 2018/4/25
1211
*/
1312
class Injector {
1413

touchsample/src/main/java/mobile/yy/com/touchsample/model/Tab.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ package mobile.yy.com.touchsample.model
33
import androidx.annotation.ColorInt
44

55
/**
6-
* Created by 张宇 on 2018/4/25.
7-
* E-mail: zhangyu4@yy.com
8-
* YY: 909017428
6+
* @author YvesCheung
7+
* 2018/4/25
98
*/
109
data class MainTab(
1110
val bizId: Int,

touchsample/src/main/java/mobile/yy/com/touchsample/model/TabRepo.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import io.reactivex.Single
66
import java.util.*
77

88
/**
9-
* Created by 张宇 on 2018/4/25.
10-
* E-mail: zhangyu4@yy.com
11-
* YY: 909017428
9+
* @author YvesCheung
10+
* 2018/4/25
1211
*/
1312
@Suppress("MemberVisibilityCanBePrivate")
1413
class TabRepo {

touchsample/src/main/java/mobile/yy/com/touchsample/presenter/MainPagePresenter.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import mobile.yy.com.touchsample.model.MainTab
55
import mobile.yy.com.touchsample.model.TabRepo
66

77
/**
8-
* Created by 张宇 on 2018/4/25.
9-
* E-mail: zhangyu4@yy.com
10-
* YY: 909017428
8+
* @author YvesCheung
9+
* 2018/4/25
1110
*/
1211
class MainPagePresenter(private val repo: TabRepo) {
1312

touchsample/src/main/java/mobile/yy/com/touchsample/presenter/MainTabPresenter.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ package mobile.yy.com.touchsample.presenter
33
import mobile.yy.com.touchsample.model.TabRepo
44

55
/**
6-
* Created by 张宇 on 2018/4/25.
7-
* E-mail: zhangyu4@yy.com
8-
* YY: 909017428
6+
* @author YvesCheung
7+
* 2018/4/25
98
*/
109
class MainTabPresenter(private val bizId: Int, private val repo: TabRepo) {
1110

touchsample/src/main/java/mobile/yy/com/touchsample/presenter/SubTabPresenter.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import io.reactivex.subjects.BehaviorSubject
55
import mobile.yy.com.touchsample.model.TabRepo
66

77
/**
8-
* Created by 张宇 on 2018/4/25.
9-
* E-mail: zhangyu4@yy.com
10-
* YY: 909017428
8+
* @author YvesCheung
9+
* 2018/4/25
1110
*/
1211
class SubTabPresenter(subTabBiz: Int, repo: TabRepo) {
1312

touchsample/src/main/java/mobile/yy/com/touchsample/touch/BackgroundImageTouchHandler.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import mobile.yy.com.toucheventbus.TouchEventHandlerUtil.removePointers
88
import mobile.yy.com.toucheventbus.TouchViewHolder
99

1010
/**
11-
* Created by 张宇 on 2018/4/25.
12-
* E-mail: zhangyu4@yy.com
13-
* YY: 909017428
11+
* @author YvesCheung
12+
* 2018/4/25
1413
*
1514
* 双指左右滑动的时候,使背景图的ViewPager发生滑动。
1615
* 1,在onTouch方法中判断是否双指滑动,双指的话就给背景图dispatch触摸。如果不是双指的move,就不处理。

touchsample/src/main/java/mobile/yy/com/touchsample/touch/MenuTouchHandler.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ import mobile.yy.com.toucheventbus.TouchViewHolder
88
import mobile.yy.com.touchsample.ui.FakeMenu
99

1010
/**
11-
* Created by 张宇 on 2018/4/26.
12-
* E-mail: zhangyu4@yy.com
13-
* YY: 909017428
11+
* @author YvesCheung
12+
* 2018/4/26
1413
*/
1514
class MenuTouchHandler : AbstractTouchEventHandler<FakeMenu>() {
1615

touchsample/src/main/java/mobile/yy/com/touchsample/touch/SlidingTabTouchHandler.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import com.gxz.PagerSlidingTabStrip
55
import mobile.yy.com.toucheventbus.AttachToViewTouchEventHandler
66

77
/**
8-
* Created by 张宇 on 2018/4/25.
9-
* E-mail: zhangyu4@yy.com
10-
* YY: 909017428
8+
* @author YvesCheung
9+
* 2018/4/25
1110
*
1211
* PagerSlidingTabStrip的点击事件
1312
*/

touchsample/src/main/java/mobile/yy/com/touchsample/touch/TabTouchHandler.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import android.view.MotionEvent
55
import mobile.yy.com.toucheventbus.AttachToViewTouchEventHandler
66

77
/**
8-
* Created by 张宇 on 2018/4/25.
9-
* E-mail: zhangyu4@yy.com
10-
* YY: 909017428
8+
* @author YvesCheung
9+
* 2018/4/25
1110
*/
1211
class TabTouchHandler : AttachToViewTouchEventHandler<ViewPager>() {
1312

touchsample/src/main/java/mobile/yy/com/touchsample/touch/ZoomTextTouchHandler.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ import mobile.yy.com.toucheventbus.TouchEventHandlerUtil.spacing
66
import mobile.yy.com.touchsample.ui.ZoomUi
77

88
/**
9-
* Created by 张宇 on 2018/4/26.
10-
* E-mail: zhangyu4@yy.com
11-
* YY: 909017428
9+
* @author YvesCheung
10+
* 2018/4/26
1211
*
1312
* 双指缩放字体的触摸处理
1413
*/

touchsample/src/main/java/mobile/yy/com/touchsample/ui/BackgroundFragment.kt

+8-9
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,21 @@ import mobile.yy.com.touchsample.R
1515
import mobile.yy.com.touchsample.touch.BackgroundImageTouchHandler
1616

1717
/**
18-
* Created by 张宇 on 2018/4/25.
19-
* E-mail: zhangyu4@yy.com
20-
* YY: 909017428
18+
* @author YvesCheung
19+
* 2018/4/25
2120
*/
2221
class BackgroundFragment : Fragment() {
2322

2423
private lateinit var viewPager: ViewPager
2524

2625
@SuppressLint("InflateParams")
27-
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
28-
return ViewPager(context).also { viewPager = it }
26+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
27+
return ViewPager(inflater.context).also { viewPager = it }
2928
}
3029

31-
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
30+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
3231
super.onViewCreated(view, savedInstanceState)
33-
viewPager.adapter = BackgroundAdapter(context)
32+
viewPager.adapter = BackgroundAdapter(view.context)
3433
TouchEventBus.of(BackgroundImageTouchHandler::class.java).attach(viewPager)
3534
}
3635

@@ -61,13 +60,13 @@ class BackgroundAdapter(private val context: Context) : PagerAdapter() {
6160
return imageView
6261
}
6362

64-
override fun destroyItem(container: ViewGroup, position: Int, imageView: Any?) {
63+
override fun destroyItem(container: ViewGroup, position: Int, imageView: Any) {
6564
if (imageView is View) {
6665
container.removeView(imageView)
6766
}
6867
}
6968

70-
override fun isViewFromObject(view: View?, imageView: Any?) = view == imageView
69+
override fun isViewFromObject(view: View, imageView: Any) = view == imageView
7170

7271
override fun getCount() = gallery.size
7372
}

touchsample/src/main/java/mobile/yy/com/touchsample/ui/FakeMenu.kt

+8-11
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,25 @@ import android.graphics.Typeface
77
import android.os.Build
88
import android.util.AttributeSet
99
import android.view.Gravity
10-
import android.widget.TextView
10+
import androidx.appcompat.widget.AppCompatTextView
1111
import mobile.yy.com.toucheventbus.TouchEventBus
1212
import mobile.yy.com.touchsample.R
1313
import mobile.yy.com.touchsample.touch.MenuTouchHandler
1414

1515
/**
16-
* Created by 张宇 on 2018/4/26.
17-
* E-mail: zhangyu4@yy.com
18-
* YY: 909017428
16+
* @author YvesCheung
17+
* 2018/4/26
1918
*/
20-
class FakeMenu : TextView {
19+
class FakeMenu @JvmOverloads constructor(
20+
context: Context,
21+
attrs: AttributeSet? = null,
22+
defStyleAttr: Int = 0
23+
) : AppCompatTextView(context, attrs, defStyleAttr) {
2124

2225
companion object {
2326
const val DEFAULT_VELOCITY = 6f
2427
}
2528

26-
constructor(context: Context) : super(context)
27-
28-
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
29-
30-
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
31-
3229
init {
3330
text = "PANEL"
3431
setTextColor(Color.parseColor("#ff3399"))

touchsample/src/main/java/mobile/yy/com/touchsample/ui/MainActivity.kt

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package mobile.yy.com.touchsample.ui
22

3+
import android.annotation.SuppressLint
34
import android.os.Bundle
45
import androidx.fragment.app.FragmentManager
56
import androidx.fragment.app.FragmentPagerAdapter
@@ -17,6 +18,7 @@ class MainActivity : AppCompatActivity() {
1718

1819
private val presenter by lazy { App.injector.getMainPagePresenter() }
1920

21+
@SuppressLint("CheckResult")
2022
override fun onCreate(savedInstanceState: Bundle?) {
2123
super.onCreate(savedInstanceState)
2224
setContentView(R.layout.activity_main)

touchsample/src/main/java/mobile/yy/com/touchsample/ui/MainTabFragment.kt

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ import mobile.yy.com.touchsample.model.SubTab
1414
import mobile.yy.com.touchsample.util.OnVisibleChangeFragment
1515

1616
/**
17-
* Created by 张宇 on 2018/4/25.
18-
* E-mail: zhangyu4@yy.com
19-
* YY: 909017428
17+
* @author YvesCheung
18+
* 2018/4/25
2019
*/
2120
class MainTabFragment : OnVisibleChangeFragment() {
2221

@@ -38,13 +37,13 @@ class MainTabFragment : OnVisibleChangeFragment() {
3837

3938
@SuppressLint("InflateParams")
4039
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
41-
bizId = arguments.getInt("bizId", bizId)
40+
bizId = arguments?.getInt("bizId", bizId) ?: 0
4241
return inflater.inflate(R.layout.fragment_main_tab, null).apply {
4342
setBackgroundColor(mainTab.backgroundColor)
4443
}
4544
}
4645

47-
override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
46+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
4847
super.onViewCreated(view, savedInstanceState)
4948
subViewPager.adapter = mAdapter
5049
subTabStrip.setViewPager(subViewPager)

0 commit comments

Comments
 (0)