Activity getWindow - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Activity getWindow method.

This code example shows how to use the following methods:getWindow, getWindowManager, getDefaultSharedPreferences
        super.onCreate(savedInstanceState);
    } 
 
    public static void setBackgroundImage (Activity activity)
    { 
        SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(activity);
        //int themeId = settings.getInt("theme", R.style.Theme_Gibberbot_Light); 
        boolean themeDark = settings.getBoolean("themeDark", false);
        String themebg = settings.getString("pref_background", "");
         
         
        if (themebg != null && themebg.length() > 0)
        { 
 
            File fileThemeBg = new File(themebg);
            if (!fileThemeBg.exists())
                return; 
             
            if (mThemeBg == null || (!mThemeBg.equals(themebg)))
            { 

7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:findViewById, getWindow, getTheme
 
		if (getParent() != null)
			throw new IllegalStateException("This SlidingMenu appears to already be attached");
 
		// get the window background 
		TypedArray a = activity.getTheme().obtainStyledAttributes(new int[] {android.R.attr.windowBackground});
		int background = a.getResourceId(0, 0);
		a.recycle();
 
		switch (slideStyle) {
		case SLIDING_WINDOW:
			mActionbarOverlay = false;
			ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
			ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
			// save ActionBar themes that have transparent assets 
			decorChild.setBackgroundResource(background);
			decor.removeView(decorChild);
			decor.addView(this);
			setContent(decorChild);
			break; 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getWindow
 
    public static final String ERROR_DIALOG_TITLE_RESOURCE = "droidfu_error_dialog_title";
 
    // FIXME: this method currently doesn't work as advertised 
    public static int getWindowFeatures(Activity activity) {
        Window window = activity.getWindow();
        if (window == null) {
            return 0; 
        } 
        try { 
            // Method m = 
            // activity.getWindow().getClass().getMethod("getFeatures"); 
            // Method[] m = window.getClass().getMethods(); 
            // m.setAccessible(true); 
            // return (Integer) m.invoke(window); 
            return 0; 
        } catch (Exception e) {
            return 0; 
        } 
    } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getWindow, getTheme
        setShadow(R.drawable.swipeback_shadow_bottom, EDGE_BOTTOM);
    } 
 
    public void attachToActivity(final Activity activity) {
        mActivity = activity;
        final TypedArray a = activity.getTheme().obtainStyledAttributes(new int[] {
            android.R.attr.windowBackground
        }); 
        final int background = a.getResourceId(0, 0);
        a.recycle();
 
        final ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
        final ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
        decorChild.setBackgroundResource(background);
        decor.removeView(decorChild);
        addView(decorChild);
        setContentView(decorChild);
        decor.addView(this);
    } 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getRequestedOrientation, getWindow, setRequestedOrientation
        if (mCustomView != null) {
            callback.onCustomViewHidden();
            return; 
        } 
 
        mOriginalOrientation = mActivity.getRequestedOrientation();
        FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
        mFullscreenContainer = new FullscreenHolder(mActivity);
        mFullscreenContainer.addView(view, COVER_SCREEN_PARAMS);
        decor.addView(mFullscreenContainer, COVER_SCREEN_PARAMS);
        mCustomView = view;
        setFullscreen(true); 
        ((BrowserWebView) getWebView()).setVisibility(View.INVISIBLE);
        mCustomViewCallback = callback;
        mActivity.setRequestedOrientation(requestedOrientation);
    } 
 
    @Override 
    public void onHideCustomView() { 
        ((BrowserWebView) getWebView()).setVisibility(View.VISIBLE);

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getWindow, overridePendingTransition, startActivity
    public static void startActivity(Activity currActivity, Intent intent, int splitYCoord) {
 
        // Preparing the bitmaps that we need to show 
        prepare(currActivity, splitYCoord);
 
        currActivity.startActivity(intent);
        currActivity.overridePendingTransition(0, 0);
    } 
 
    /** 
     * Start a new Activity with a Split animation right in the middle of the Activity 
     * 
     * @param currActivity The current Activity 
     * @param intent       The Intent needed tot start the new Activity 
     */ 
    public static void startActivity(Activity currActivity, Intent intent) {
        startActivity(currActivity, intent, -1);
    } 
 
    /** 

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getWindow, getWindowManager
				android.R.drawable.stat_sys_phone_call);
		return ico.getIntrinsicHeight();
	} 
 
	public static void setActivitySizePos(Activity activity) {
		WindowManager m = activity.getWindowManager();
		Display d = m.getDefaultDisplay();
		WindowManager.LayoutParams p = activity.getWindow().getAttributes();
		p.y = 4;
		p.height = (int) (d.getHeight() - 72);
		activity.getWindow().setAttributes(p);
	} 
 
	public static int dipToPx(int dip) {
		if (dm == null) {
			return -1; 
		} 
		return (int) (dip * dm.density + 0.5f);
	} 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getWindow, getWindowManager
		return ico.getIntrinsicHeight();
	} 
 
	@SuppressWarnings("deprecation") 
	public static void setActivitySizePos(Activity activity) {
		WindowManager m = activity.getWindowManager();
		Display d = m.getDefaultDisplay();
		WindowManager.LayoutParams p = activity.getWindow().getAttributes();
		p.y = 4;
		p.height = (int) (d.getHeight() - 72);
		activity.getWindow().setAttributes(p);
	} 
 
	public static int dipToPx(int dip) {
		if (dm == null) {
			return -1; 
		} 
		return (int) (dip * dm.density + 0.5f);
	} 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getActionBar, getWindow
	 
	@SuppressLint("NewApi") 
	public static void ToggleFullscreen(Activity activity, boolean fullscreen) {
		if(fullscreen) {
			if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
				ActionBar actionBar = activity.getActionBar();
				if(actionBar != null) actionBar.hide();
			} 
			else { 
				activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
			} 
			 
			//activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
			//						  WindowManager.LayoutParams.FLAG_FULLSCREEN); 
			activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
			activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
		} 
		else { 
			activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
			activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getWindow
                        Gravity.CENTER));
    } 
 
    @Override 
    public void onDestroyContentVideoView() { 
        mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } 
 
    @Override 
    public Context getContext() {
        return mActivity;
    } 
 
    @Override 
    public View getVideoLoadingProgressView() {
        return null; 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Activity getWindow Questions & Answers:

getWindow Method Overview
Retrieve the current Window for the activity.
See Code Examples for other Android Activity Methods: