mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-20 21:40:15 -07:00
- Fixed improper tab init phase by allowing them to be fully inflated before changing their properties.
This commit is contained in:
parent
c3bfe0cd4a
commit
74633d3aa0
2 changed files with 20 additions and 4 deletions
|
|
@ -220,7 +220,7 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
||||||
File lastCrashFile = Tools.lastFileModified(Tools.DIR_HOME_CRASH);
|
File lastCrashFile = Tools.lastFileModified(Tools.DIR_HOME_CRASH);
|
||||||
if(CrashFragment.isNewCrash(lastCrashFile) || !mCrashView.getLastCrash().isEmpty()){
|
if(CrashFragment.isNewCrash(lastCrashFile) || !mCrashView.getLastCrash().isEmpty()){
|
||||||
mCrashView.resetCrashLog = false;
|
mCrashView.resetCrashLog = false;
|
||||||
selectTabPage(2);
|
initTabs(2);
|
||||||
|
|
||||||
} /*else throw new Exception();*/
|
} /*else throw new Exception();*/
|
||||||
} catch(Throwable e) {
|
} catch(Throwable e) {
|
||||||
|
|
@ -236,5 +236,5 @@ public abstract class BaseLauncherActivity extends BaseActivity {
|
||||||
return super.onTouchEvent(event);
|
return super.onTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void selectTabPage(int pageIndex);
|
protected abstract void initTabs(int pageIndex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import android.animation.ValueAnimator;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
import android.support.design.widget.VerticalTabLayout.ViewPagerAdapter;
|
import android.support.design.widget.VerticalTabLayout.ViewPagerAdapter;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
|
@ -91,6 +93,7 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
||||||
Tabs[2] = findViewById(R.id.btnTab3);
|
Tabs[2] = findViewById(R.id.btnTab3);
|
||||||
Tabs[3] = findViewById(R.id.btnTab4);
|
Tabs[3] = findViewById(R.id.btnTab4);
|
||||||
|
|
||||||
|
|
||||||
pickAccount();
|
pickAccount();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -191,11 +194,13 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
||||||
mPlayButton = (Button) findViewById(R.id.launchermainPlayButton);
|
mPlayButton = (Button) findViewById(R.id.launchermainPlayButton);
|
||||||
|
|
||||||
statusIsLaunching(false);
|
statusIsLaunching(false);
|
||||||
|
|
||||||
|
initTabs(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void selectTabPage(int pageIndex){
|
private void selectTabPage(int pageIndex){
|
||||||
viewPager.setCurrentItem(pageIndex);
|
viewPager.setCurrentItem(pageIndex);
|
||||||
setTabActive(pageIndex);
|
setTabActive(pageIndex);
|
||||||
}
|
}
|
||||||
|
|
@ -246,5 +251,16 @@ public class PojavLauncherActivity extends BaseLauncherActivity
|
||||||
animation.start();
|
animation.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void initTabs(int activeTab){
|
||||||
|
final Handler handler = new Handler(Looper.getMainLooper());
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//Do something after 100ms
|
||||||
|
selectTabPage(activeTab);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue