List of usage examples for android.os UserManager get
@UnsupportedAppUsage public static UserManager get(Context context)
From source file:com.android.tv.settings.about.AboutFragment.java
@Override public void onCreate(Bundle savedInstanceState) { mUm = UserManager.get(getActivity()); super.onCreate(savedInstanceState); }
From source file:com.android.settingslib.drawer.SettingsDrawerActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); long startTime = System.currentTimeMillis(); TypedArray theme = getTheme().obtainStyledAttributes(android.R.styleable.Theme); if (!theme.getBoolean(android.R.styleable.Theme_windowNoTitle, false)) { getWindow().addFlags(LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().addFlags(LayoutParams.FLAG_TRANSLUCENT_STATUS); requestWindowFeature(Window.FEATURE_NO_TITLE); }//from w ww.ja va2s . c om super.setContentView(R.layout.settings_with_drawer); mContentHeaderContainer = (FrameLayout) findViewById(R.id.content_header_container); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); if (mDrawerLayout == null) { return; } Toolbar toolbar = (Toolbar) findViewById(R.id.action_bar); if (theme.getBoolean(android.R.styleable.Theme_windowNoTitle, false)) { toolbar.setVisibility(View.GONE); mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); mDrawerLayout = null; return; } getDashboardCategories(); setActionBar(toolbar); mDrawerAdapter = new SettingsDrawerAdapter(this); ListView listView = (ListView) findViewById(R.id.left_drawer); listView.setAdapter(mDrawerAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(android.widget.AdapterView<?> parent, View view, int position, long id) { onTileClicked(mDrawerAdapter.getTile(position)); } }); mUserManager = UserManager.get(this); if (DEBUG_TIMING) Log.d(TAG, "onCreate took " + (System.currentTimeMillis() - startTime) + " ms"); }
From source file:com.jedi.setupwizard.ui.SetupWizardActivity.java
private void finishSetup() { if (mSetupComplete) return;//w ww . jav a 2 s. c o m 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); } }
From source file:com.android.settings.HWSettings.java
@Override public boolean onPreferenceStartFragment(PreferenceFragment caller, Preference pref) { // Override the fragment title for Wallpaper settings int titleRes = pref.getTitleRes(); if (pref.getFragment().equals(WallpaperTypeSettings.class.getName())) { titleRes = R.string.wallpaper_settings_fragment_title; } else if (pref.getFragment().equals(OwnerInfoSettings.class.getName()) && UserHandle.myUserId() != UserHandle.USER_OWNER) { if (UserManager.get(this).isLinkedUser()) { titleRes = R.string.profile_info_settings_title; } else {/*from w w w . j a va 2s . c o m*/ titleRes = R.string.user_info_settings_title; } } startPreferencePanel(pref.getFragment(), pref.getExtras(), titleRes, pref.getTitle(), null, 0); return true; }