List of usage examples for android.view Window FEATURE_PROGRESS
int FEATURE_PROGRESS
To view the source code for android.view Window FEATURE_PROGRESS.
Click Source Link
From source file:android.support.v7.internal.widget.ActionBarOverlayLayout.java
@Override public void initFeature(int windowFeature) { pullChildren();/*w ww .j a v a 2 s . co m*/ switch (windowFeature) { case Window.FEATURE_PROGRESS: mDecorToolbar.initProgress(); break; case Window.FEATURE_INDETERMINATE_PROGRESS: mDecorToolbar.initIndeterminateProgress(); break; case Window.FEATURE_ACTION_BAR_OVERLAY: setOverlayMode(true); break; } }
From source file:com.andrewshu.android.reddit.comments.CommentsListActivity.java
void enableLoadingScreen() { if (Util.isLightTheme(mSettings.getTheme())) { findViewById(R.id.loading_light).setVisibility(View.VISIBLE); findViewById(R.id.loading_dark).setVisibility(View.GONE); } else {/* w w w . ja v a 2s. co m*/ findViewById(R.id.loading_light).setVisibility(View.GONE); findViewById(R.id.loading_dark).setVisibility(View.VISIBLE); } if (mCommentsAdapter != null) mCommentsAdapter.mIsLoading = true; getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_START); }
From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java
private void showProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) { final int features = mFeatures;//getLocalFeatures(); if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 && spinnyProgressBar.getVisibility() == View.INVISIBLE) { spinnyProgressBar.setVisibility(View.VISIBLE); }//w w w . j ava 2 s . c o m // Only show the progress bars if the primary progress is not complete if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 && horizontalProgressBar.getProgress() < 10000) { horizontalProgressBar.setVisibility(View.VISIBLE); } }
From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java
private void hideProgressBars(IcsProgressBar horizontalProgressBar, IcsProgressBar spinnyProgressBar) { final int features = mFeatures;//getLocalFeatures(); Animation anim = AnimationUtils.loadAnimation(mActivity, android.R.anim.fade_out); anim.setDuration(1000);/* w w w . ja va 2s .co m*/ if ((features & (1 << Window.FEATURE_INDETERMINATE_PROGRESS)) != 0 && spinnyProgressBar.getVisibility() == View.VISIBLE) { spinnyProgressBar.startAnimation(anim); spinnyProgressBar.setVisibility(View.INVISIBLE); } if ((features & (1 << Window.FEATURE_PROGRESS)) != 0 && horizontalProgressBar.getVisibility() == View.VISIBLE) { horizontalProgressBar.startAnimation(anim); horizontalProgressBar.setVisibility(View.INVISIBLE); } }
From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java
private void enableLoadingScreen() { if (Util.isLightTheme(mSettings.getTheme())) { findViewById(R.id.loading_light).setVisibility(View.VISIBLE); findViewById(R.id.loading_dark).setVisibility(View.GONE); } else {//from www .j a v a2s . co m findViewById(R.id.loading_light).setVisibility(View.GONE); findViewById(R.id.loading_dark).setVisibility(View.VISIBLE); } synchronized (THREAD_ADAPTER_LOCK) { if (mThreadsAdapter != null) mThreadsAdapter.mIsLoading = true; } getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_START); }
From source file:com.andrewshu.android.reddit.threads.ThreadsListActivity.java
private void disableLoadingScreen() { resetUI(mThreadsAdapter); getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_END); }
From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java
@Override public boolean requestFeature(int featureId) { if (DEBUG)//from w ww . j a va 2 s.c o m Log.d(TAG, "[requestFeature] featureId: " + featureId); if (mContentParent != null) { throw new AndroidRuntimeException("requestFeature() must be called before adding content"); } switch (featureId) { case Window.FEATURE_ACTION_BAR: case Window.FEATURE_ACTION_BAR_OVERLAY: case Window.FEATURE_ACTION_MODE_OVERLAY: case Window.FEATURE_INDETERMINATE_PROGRESS: case Window.FEATURE_NO_TITLE: case Window.FEATURE_PROGRESS: mFeatures |= (1 << featureId); return true; default: return false; } }
From source file:com.actionbarsherlock.internal.ActionBarSherlockCompat.java
private void installDecor() { if (DEBUG)// www.j ava2s. c o m Log.d(TAG, "[installDecor]"); if (mDecor == null) { mDecor = (ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content); } if (mContentParent == null) { //Since we are not operating at the window level we need to take //into account the fact that the true decor may have already been //initialized and had content attached to it. If that is the case, //copy over its children to our new content container. List<View> views = null; if (mDecor.getChildCount() > 0) { views = new ArrayList<View>(1); //Usually there's only one child for (int i = 0, children = mDecor.getChildCount(); i < children; i++) { View child = mDecor.getChildAt(0); mDecor.removeView(child); views.add(child); } } mContentParent = generateLayout(); //Copy over the old children. See above for explanation. if (views != null) { for (View child : views) { mContentParent.addView(child); } } mTitleView = (TextView) mDecor.findViewById(android.R.id.title); if (mTitleView != null) { if (hasFeature(Window.FEATURE_NO_TITLE)) { mTitleView.setVisibility(View.GONE); if (mContentParent instanceof FrameLayout) { ((FrameLayout) mContentParent).setForeground(null); } } else { mTitleView.setText(mTitle); } } else { wActionBar = (ActionBarView) mDecor.findViewById(R.id.abs__action_bar); if (wActionBar != null) { wActionBar.setWindowCallback(this); if (wActionBar.getTitle() == null) { wActionBar.setWindowTitle(mActivity.getTitle()); } if (hasFeature(Window.FEATURE_PROGRESS)) { wActionBar.initProgress(); } if (hasFeature(Window.FEATURE_INDETERMINATE_PROGRESS)) { wActionBar.initIndeterminateProgress(); } //Since we don't require onCreate dispatching, parse for uiOptions here int uiOptions = loadUiOptionsFromManifest(mActivity); if (uiOptions != 0) { mUiOptions = uiOptions; } boolean splitActionBar = false; final boolean splitWhenNarrow = (mUiOptions & ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW) != 0; if (splitWhenNarrow) { splitActionBar = getResources_getBoolean(mActivity, R.bool.abs__split_action_bar_is_narrow); } else { splitActionBar = mActivity.getTheme().obtainStyledAttributes(R.styleable.SherlockTheme) .getBoolean(R.styleable.SherlockTheme_windowSplitActionBar, false); } final ActionBarContainer splitView = (ActionBarContainer) mDecor .findViewById(R.id.abs__split_action_bar); if (splitView != null) { wActionBar.setSplitView(splitView); wActionBar.setSplitActionBar(splitActionBar); wActionBar.setSplitWhenNarrow(splitWhenNarrow); mActionModeView = (ActionBarContextView) mDecor.findViewById(R.id.abs__action_context_bar); mActionModeView.setSplitView(splitView); mActionModeView.setSplitActionBar(splitActionBar); mActionModeView.setSplitWhenNarrow(splitWhenNarrow); } else if (splitActionBar) { Log.e(TAG, "Requested split action bar with incompatible window decor! Ignoring request."); } // Post the panel invalidate for later; avoid application onCreateOptionsMenu // being called in the middle of onCreate or similar. mDecor.post(new Runnable() { @Override public void run() { //Invalidate if the panel menu hasn't been created before this. if (!mIsDestroyed && !mActivity.isFinishing() && mMenu == null) { dispatchInvalidateOptionsMenu(); } } }); } } } }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
@SuppressLint("ResourceAsColor") @Override//www . ja v a2 s. com public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_PROGRESS); if (!K9.isHideSpecialAccounts()) { createSpecialAccounts(); } Account[] accounts = Preferences.getPreferences(this).getAccounts(); Intent intent = getIntent(); // onNewIntent(intent); // see if we should show the welcome message if (ACTION_IMPORT_SETTINGS.equals(intent.getAction())) { mAccounts.onImport(); } else if (accounts.length < 1) { WelcomeMessage.showWelcomeMessage(this); finish(); return; } if (UpgradeDatabases.actionUpgradeDatabases(this, intent)) { finish(); return; } Log.d(TAG, "onCreate()"); String packageName = "com.bernard.beaconportal.activities"; counterss = "0"; int versionNumber = 0; try { PackageInfo pi = getApplicationContext().getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA); versionNumber = pi.versionCode; String versionName = pi.versionName; Log.d(TAG, "K-9 is installed - " + versionNumber + " " + versionName); } catch (NameNotFoundException e) { Log.d(TAG, "K-9 not found"); } if (versionNumber <= 1) { // Register a listener for broadcasts (needed for the older versions // of k9) Log.d(TAG, "Initialising BroadcastReceiver for old K-9 version"); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "receiver.onReceive()"); doRefresh(); } }; filter = new IntentFilter(); filter.addAction("com.bernard.beaconportal.activities.intent.action.EMAIL_RECEIVED"); filter.addAction("com.bernard.beaconportal.activities.intent.action.EMAIL_DELETED"); filter.addDataScheme("email"); registerReceiver(receiver, filter); } else { // Register our own content observer, rather than using // addWatchContentUris() // since DashClock might not have permission to access the database Log.d(TAG, "Initialising ContentObserver for new K-9 version"); contentObserver = new ContentObserver(null) { @Override public void onChange(boolean selfChange) { Log.d(TAG, "contentResolver.onChange()"); doRefresh(); } }; getContentResolver().registerContentObserver(Uri.parse(k9UnreadUri), true, contentObserver); } doRefresh(); if (UpgradeDatabases.actionUpgradeDatabases(this, getIntent())) { finish(); return; } if (useSplitView()) { setContentView(R.layout.split_drawer_main); } else { setContentView(R.layout.drawermain1); mViewSwitcher = (ViewSwitcher) findViewById(R.id.container); mViewSwitcher.setFirstInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_left)); mViewSwitcher.setFirstOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_right)); mViewSwitcher.setSecondInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_right)); mViewSwitcher.setSecondOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_left)); mViewSwitcher.setOnSwitchCompleteListener(this); } mergeadapter = new MergeAdapter(); LayoutInflater inflater = getLayoutInflater(); accounts_view = inflater.inflate(R.layout.accounts_list, null); portals_view = inflater.inflate(R.layout.portal_list, null); folders_view = inflater.inflate(R.layout.folders_list, null); header_folders = inflater.inflate(R.layout.header_folders, null); header_drawer = inflater.inflate(R.layout.header_drawer, null); initializeActionBar(); mListView = (ListView) findViewById(android.R.id.list); // mListView.addHeaderView(header_folders, null, false); mListView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); mListView.setLongClickable(true); mListView.setFastScrollEnabled(true); mListView.setScrollingCacheEnabled(false); // mListView.setOnItemClickListener(new OnItemClickListener() { // public void onItemClick(AdapterView<?> parent, View view, // int position, long id) { // // onOpenFolder(((FolderInfoHolder) mAdapter.getItem(position)).name); // // Log.d("Folder Click Listener", "clicked"); // // } // }); setResult(RESULT_CANCELED); // mDrawerList_Inbox = (ListView) findViewById(R.id.listview_inbox); // // View header_inbox = (View) inflater // .inflate(R.layout.header_inbox, null); // // mDrawerList_Inbox.setOnItemClickListener(this); // // mDrawerList_Inbox.setItemsCanFocus(false); // // mDrawerList_Inbox.setLongClickable(true); mListView.setSaveEnabled(true); mInflater = getLayoutInflater(); onNewIntent(getIntent()); context = this; SharedPreferences sharedpre = getSharedPreferences("show_view", Context.MODE_PRIVATE); Show_View = sharedpre.getString("show_view", ""); SharedPreferences Today_Homework = getApplicationContext().getSharedPreferences("due_today", Context.MODE_PRIVATE); SharedPreferences counts = getSharedPreferences("due_today", Context.MODE_PRIVATE); if (counts.contains("homeworkdue")) { counterss = counts.getString("homeworkdue", null); } else { counterss = null; } title_Inbox = new String[] { "Inbox" }; icon_Inbox = new int[] { R.drawable.ic_action_email }; count_Inbox = new String[] { K9counts }; if (Show_View.equals("Homework Due")) { title = new String[] { "Homework Due", "Schedule", "Resources", "Options", "Logout" }; icon = new int[] { R.drawable.ic_action_duehomework, R.drawable.ic_action_go_to_today, R.drawable.ic_action_resources, R.drawable.ic_action_settings, R.drawable.ic_action_logout }; if (counterss == null && counterss.isEmpty()) { count = new String[] { "", "", "", "", "" }; } else { count = new String[] { counterss, "", "", "", "" }; } } else { if (counterss == null && counterss.isEmpty()) { count = new String[] { "", "", "", "", "" }; } else { count = new String[] { "", counterss, "", "", "" }; } title = new String[] { "Schedule", "Homework Due", "Resources", "Options", "Logout" }; icon = new int[] { R.drawable.ic_action_go_to_today, R.drawable.ic_action_duehomework, R.drawable.ic_action_resources, R.drawable.ic_action_settings, R.drawable.ic_action_logout }; } mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLinear = (LinearLayout) findViewById(R.id.left_drawer); // mDrawerList_Inbox = (ListView) findViewById(R.id.listview_inbox); // mDrawerList = (ListView) findViewById(R.id.listview_drawer); // mDrawer_Scroll = (ScrollView) // findViewById(R.id.left_drawer_scrollview); // mDrawerList.addHeaderView(header_drawer, null, false); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // mMenuAdapter_Inbox = new MenuListAdapter(MessageList.this, // title_Inbox, // icon_Inbox, count_Inbox); // mDrawerList_Inbox.setAdapter(mMenuAdapter_Inbox); // mDrawerList_Inbox // .setOnItemClickListener(new DrawerItemClickListener_Inbox()); mMenuAdapter = new MenuListAdapter(MessageList.this, title, icon, count); // mDrawerList.setAdapter(mMenuAdapter); // mergeadapter.addView(header_drawer); // // mergeadapter.addAdapter(mMenuAdapter); // // mergeadapter.addadapter(AccountsAdapter); // // mDrawerList.setAdapter(mergeadapter); getListView().setOnItemClickListener(new DrawerItemClickListener()); // mDrawerList_Inbox.setOnItemClickListener(new // DrawerItemClickListener()); // // if (savedInstanceState == null) { // selectItem_Inbox(1); // } SharedPreferences sharedpref = getSharedPreferences("actionbar_color", Context.MODE_PRIVATE); final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android"); final View splitActionBar = findViewById(splitBarId); if (!sharedpref.contains("actionbar_color")) { getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4"))); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4"))); } } else { actionbar_colors = sharedpref.getString("actionbar_color", null); getActionBar().setBackgroundDrawable( new ColorDrawable(Color.parseColor(actionbar_colors))); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(actionbar_colors))); } } android.app.ActionBar bar = getActionBar(); bar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); // Enable gesture detection for MessageLists // setupGestureDetector(this); if (!decodeExtras(getIntent())) { return; } findFragments(); initializeDisplayMode(savedInstanceState); initializeLayout(); initializeFragments(); displayViews(); // registerForContextMenu(mDrawerList_Inbox); registerForContextMenu(mListView); getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerClosed(View view) { // TODO Auto-generated method stub super.onDrawerClosed(view); } @Override public void onDrawerOpened(View drawerView) { // TODO Auto-generated method stub super.onDrawerOpened(drawerView); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); }
From source file:com.codename1.impl.android.AndroidImplementation.java
@Override public void init(Object m) { if (m instanceof CodenameOneActivity) { setContext(null);// ww w . j a v a 2s . c o m setActivity((CodenameOneActivity) m); } else { setActivity(null); setContext((Context) m); } instance = this; if (getActivity() != null && getActivity().hasUI()) { if (!hasActionBar()) { try { getActivity().requestWindowFeature(Window.FEATURE_NO_TITLE); } catch (Exception e) { //Log.d("Codename One", "No idea why this throws a Runtime Error", e); } } else { getActivity().invalidateOptionsMenu(); try { getActivity().requestWindowFeature(Window.FEATURE_ACTION_BAR); getActivity().requestWindowFeature(Window.FEATURE_PROGRESS); if (android.os.Build.VERSION.SDK_INT >= 21) { //WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS getActivity().getWindow().addFlags(-2147483648); } } catch (Exception e) { //Log.d("Codename One", "No idea why this throws a Runtime Error", e); } NotifyActionBar notify = new NotifyActionBar(getActivity(), false); notify.run(); } if (statusBarHidden) { getActivity().getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); getActivity().getWindow().setStatusBarColor(android.graphics.Color.TRANSPARENT); } if (Display.getInstance().getProperty("StatusbarHidden", "").equals("true")) { getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } if (Display.getInstance().getProperty("KeepScreenOn", "").equals("true")) { getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } if (Display.getInstance().getProperty("DisableScreenshots", "").equals("true")) { getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE); } if (m instanceof CodenameOneActivity) { ((CodenameOneActivity) m).setDefaultIntentResultListener(this); ((CodenameOneActivity) m).setIntentResultListener(this); } /** * translate our default font height depending on the screen density. * this is required for new high resolution devices. otherwise * everything looks awfully small. * * we use our default font height value of 16 and go from there. i * thought about using new Paint().getTextSize() for this value but if * some new version of android suddenly returns values already tranlated * to the screen then we might end up with too large fonts. the * documentation is not very precise on that. */ final int defaultFontPixelHeight = 16; this.defaultFontHeight = this.translatePixelForDPI(defaultFontPixelHeight); this.defaultFont = (CodenameOneTextPaint) ((NativeFont) this.createFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM)).font; Display.getInstance().setTransitionYield(-1); initSurface(); /** * devices are extremely sensitive so dragging should start a little * later than suggested by default implementation. */ this.setDragStartPercentage(1); VirtualKeyboardInterface vkb = new AndroidKeyboard(this); Display.getInstance().registerVirtualKeyboard(vkb); Display.getInstance().setDefaultVirtualKeyboard(vkb); InPlaceEditView.endEdit(); getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); if (nativePeers.size() > 0) { for (int i = 0; i < nativePeers.size(); i++) { ((AndroidImplementation.AndroidPeer) nativePeers.elementAt(i)).init(); } } } else { /** * translate our default font height depending on the screen density. * this is required for new high resolution devices. otherwise * everything looks awfully small. * * we use our default font height value of 16 and go from there. i * thought about using new Paint().getTextSize() for this value but if * some new version of android suddenly returns values already tranlated * to the screen then we might end up with too large fonts. the * documentation is not very precise on that. */ final int defaultFontPixelHeight = 16; this.defaultFontHeight = this.translatePixelForDPI(defaultFontPixelHeight); this.defaultFont = (CodenameOneTextPaint) ((NativeFont) this.createFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM)).font; } HttpURLConnection.setFollowRedirects(false); CookieHandler.setDefault(null); }