mirror of
https://github.com/yuliskov/SmartTube.git
synced 2025-08-06 11:59:40 +08:00
refactor
This commit is contained in:
@ -60,8 +60,8 @@ android {
|
|||||||
applicationId "com.liskovsoft.smarttubetv"
|
applicationId "com.liskovsoft.smarttubetv"
|
||||||
minSdkVersion project.properties.minSdkVersion
|
minSdkVersion project.properties.minSdkVersion
|
||||||
targetSdkVersion project.properties.targetSdkVersion
|
targetSdkVersion project.properties.targetSdkVersion
|
||||||
versionCode 1933
|
versionCode 1934
|
||||||
versionName "27.43"
|
versionName "27.44"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
|
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class BrowseSectionFragmentFactory extends BrowseSupportFragment.Fragment
|
|||||||
private int mFragmentType = BrowseSection.TYPE_GRID;
|
private int mFragmentType = BrowseSection.TYPE_GRID;
|
||||||
private int mSelectedItemIndex = -1;
|
private int mSelectedItemIndex = -1;
|
||||||
private Video mSelectedItem;
|
private Video mSelectedItem;
|
||||||
private Runnable mRunListeners;
|
private Runnable mOnSectionSelected;
|
||||||
|
|
||||||
public interface OnSectionSelectedListener {
|
public interface OnSectionSelectedListener {
|
||||||
void onSectionSelected(Row row);
|
void onSectionSelected(Row row);
|
||||||
@ -144,8 +144,9 @@ public class BrowseSectionFragmentFactory extends BrowseSupportFragment.Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
|
Utils.removeCallbacks(mOnSectionSelected);
|
||||||
mCurrentFragment = null;
|
mCurrentFragment = null;
|
||||||
mRunListeners = null;
|
mOnSectionSelected = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentFragmentItemIndex() {
|
public int getCurrentFragmentItemIndex() {
|
||||||
@ -201,16 +202,16 @@ public class BrowseSectionFragmentFactory extends BrowseSupportFragment.Fragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void runListeners(Row row) {
|
private void runListeners(Row row) {
|
||||||
Utils.removeCallbacks(mRunListeners);
|
Utils.removeCallbacks(mOnSectionSelected);
|
||||||
|
|
||||||
// give a chance to clear pending updates
|
// give a chance to clear pending updates
|
||||||
mRunListeners = () -> {
|
mOnSectionSelected = () -> {
|
||||||
if (mSectionSelectedListener != null) {
|
if (mSectionSelectedListener != null) {
|
||||||
mSectionSelectedListener.onSectionSelected(row);
|
mSectionSelectedListener.onSectionSelected(row);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Wait till the main fragment changed
|
// Wait till the main fragment changed
|
||||||
Utils.postDelayed(mRunListeners, 100);
|
Utils.postDelayed(mOnSectionSelected, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user