List of usage examples for android.app AppGlobals getInitialApplication
@UnsupportedAppUsage public static Application getInitialApplication()
From source file:com.cyanogenmod.account.ui.SetupWizardActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.setup_main); ((CMAccount) AppGlobals.getInitialApplication()).disableStatusBar(); mSharedPreferences = getSharedPreferences(CMAccount.SETTINGS_PREFERENCES, Context.MODE_PRIVATE); mSetupData = (AbstractSetupData) getLastNonConfigurationInstance(); if (mSetupData == null) { mSetupData = new CMSetupWizardData(this); }//w ww.j av a2 s .c o m if (savedInstanceState != null) { mSetupData.load(savedInstanceState.getBundle("data")); } else { mSharedPreferences.edit().putBoolean(KEY_SIM_MISSING_SHOWN, false).commit(); } mSetupData.registerListener(this); mPagerAdapter = new CMPagerAdapter(getFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setPageTransformer(true, new DepthPageTransformer()); mViewPager.setAdapter(mPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { if (position < mPageList.size()) { onPageLoaded(mPageList.get(position)); } } }); onPageTreeChanged(); removeUnNeededPages(); }
From source file:com.jedi.setupwizard.ui.SetupWizardActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.setup_main); ((SetupWizard) AppGlobals.getInitialApplication()).disableStatusBar(); mSharedPreferences = getSharedPreferences(SetupWizard.SETTINGS_PREFERENCES, Context.MODE_PRIVATE); mSetupData = (AbstractSetupData) getLastNonConfigurationInstance(); if (mSetupData == null) { mSetupData = new SetupWizardData(this); }//from w w w. jav a 2 s . com if (savedInstanceState != null) { mSetupData.load(savedInstanceState.getBundle("data")); } else { mSharedPreferences.edit().putBoolean(KEY_SIM_MISSING_SHOWN, false).commit(); } mNextButton = (Button) findViewById(R.id.next_button); mPrevButton = (Button) findViewById(R.id.prev_button); mSetupData.registerListener(this); mPagerAdapter = new PagerAdapter(getFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setPageTransformer(true, new DepthPageTransformer()); mViewPager.setAdapter(mPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { if (position < mPageList.size()) { onPageLoaded(mPageList.get(position)); } } }); mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { doNext(); } }); mPrevButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { doPrevious(); } }); final EnableAccessibilityController acc = new EnableAccessibilityController(this); mViewPager.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return acc.onInterceptTouchEvent(event); } }); onPageTreeChanged(); removeUnNeededPages(); }
From source file:com.cyanogenmod.account.ui.SetupWizardActivity.java
private void finishSetup() { Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1); ((CMAccount) AppGlobals.getInitialApplication()).enableStatusBar(); Intent intent = new Intent("android.intent.action.MAIN"); intent.addCategory("android.intent.category.HOME"); disableSetupWizards(intent);//from w w w . j a v a2 s .c o m intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | intent.getFlags()); startActivity(intent); finish(); }
From source file:com.jedi.setupwizard.ui.SetupWizardActivity.java
private void finishSetup() { if (mSetupComplete) return;/*from w w w. j a v a 2 s .c om*/ mSetupComplete = true; boolean applyingDefaultTheme = handleDefaultThemeSetup(); Settings.Global.putInt(getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1); Settings.Secure.putInt(getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 1); UserManager.get(this).setUserName(UserHandle.myUserId(), getString(com.android.internal.R.string.owner_name)); ((SetupWizard) AppGlobals.getInitialApplication()).enableStatusBar(); if (!applyingDefaultTheme) { finalizeSetup(); } else { showDialog(DIALOG_FINISHING); } }