android.view.Window Java Examples

The following examples show how to use android.view.Window. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QuickContactFragment.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    if (getDialog() != null) {
        getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
        getDialog().getWindow().setBackgroundDrawableResource(android.R.color.transparent);
    }

    View root = inflater.inflate(R.layout.viewpager_sliding_tabs_fragment_quick_contact, container, false);

    tabs = (PagerSlidingTabStrip) root.findViewById(R.id.tabs);
    pager = (ViewPager) root.findViewById(R.id.pager);
    adapter = new ContactPagerAdapter();

    pager.setAdapter(adapter);

    tabs.setViewPager(pager);

    return root;
}
 
Example #2
Source File: MyActionBarActivity.java    From Clip-Stack with MIT License 6 votes vote down vote up
@Override
public void onGlobalLayout() {
    int heightDiff = rootLayout.getRootView().getHeight() - rootLayout.getHeight();
    int contentViewTop = getWindow().findViewById(Window.ID_ANDROID_CONTENT).getHeight();

    if (heightDiff <= contentViewTop) {
        if (!isKeyboardShow) return;
        onHideKeyboard();
        isKeyboardShow = false;

    } else {
        if (isKeyboardShow) return;
        int keyboardHeight = heightDiff - contentViewTop;
        onShowKeyboard(keyboardHeight);
        isKeyboardShow = true;

    }
}
 
Example #3
Source File: CustomDialogShoppingListOptions.java    From ShoppingList with MIT License 6 votes vote down vote up
public CustomDialogShoppingListOptions(Context context, int idShoppingList) {
    super(context);

    setCancelable(true);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    String[] options = { context.getString(R.string.rename), context.getString(R.string.duplicate), context.getString(R.string.delete), context.getString(R.string.schedule), context.getString(R.string.share), context.getString(R.string.share_via_text) };

    OptionAdapter adapter = new OptionAdapter(context, options);
    ListView lv = new ListView(context);

    lv.setAdapter(adapter);
    lv.setLayoutParams(new ListView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    lv.setOnItemClickListener(this);

    this.context = context;
    this.idShoppingList = idShoppingList;
    setContentView(lv);
}
 
Example #4
Source File: BitBaseDialogFragment.java    From tysq-android with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 初始化窗口
 *
 * @param window
 */
protected void initWindows(Window window) {

    if (this.mAnim != CLOSE) {

        if (this.mAnim == NONE) { // 默认动画
            if (BitManager.getInstance().getDialogAnim() != NONE) {
                window.getAttributes().windowAnimations =
                        BitManager.getInstance().getDialogAnim();
            }
        } else {    // 自行设置动画
            window.getAttributes().windowAnimations = this.mAnim;
        }
    }

}
 
Example #5
Source File: RequestSendtoAdmin.java    From XERUNG with Apache License 2.0 6 votes vote down vote up
public RequestSendtoAdmin(Context context, int id, String number,String name, String request, Object dashBoardActivity) {
	super(context);
	// TODO Auto-generated constructor stub
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.dialog_send_request_admin);
	getWindow().setBackgroundDrawable(new ColorDrawable(android.R.color.transparent));
	setCancelable(false);
	this.context = context;
	roboto = Typeface.createFromAsset(context.getAssets(),"font/Roboto-Regular.ttf");
	activity = (Activity) context;
	this.requestSend= request;
	this.groupName= name;
	this.groupNumber= number;
	this.gUID= id;
	dashBoardActObjecct = dashBoardActivity;
	shared = new SharedPreferanceData(context);
	requestDilog = this;
	comman = new Comman();
	
}
 
Example #6
Source File: StatusBarUtil.java    From MultiScrollDemo with Apache License 2.0 6 votes vote down vote up
/**
 * 设置MIUI6+的状态栏是否为darkMode,darkMode时候字体颜色及icon变黑
 * http://dev.xiaomi.com/doc/p=4769/
 */
public static boolean darkModeForMIUI6(Window window, boolean darkmode) {
    Class<? extends Window> clazz = window.getClass();
    try {
        int darkModeFlag = 0;
        Class<?> layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
        Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
        darkModeFlag = field.getInt(layoutParams);
        Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
        extraFlagField.invoke(window, darkmode ? darkModeFlag : 0, darkModeFlag);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
 
Example #7
Source File: RxBarTool.java    From RxTools-master with Apache License 2.0 6 votes vote down vote up
/**
 * 设置状态栏字体图标为深色,需要MIUIV6以上
 *
 * @param window 需要设置的窗口
 * @param dark   是否把状态栏字体及图标颜色设置为深色
 * @return boolean 成功执行返回true
 */
public static boolean MIUISetStatusBarLightMode(Window window, boolean dark) {
    boolean result = false;
    if (window != null) {
        Class clazz = window.getClass();
        try {
            int darkModeFlag = 0;
            Class layoutParams = Class.forName("android.view.MiuiWindowManager$LayoutParams");
            Field field = layoutParams.getField("EXTRA_FLAG_STATUS_BAR_DARK_MODE");
            darkModeFlag = field.getInt(layoutParams);
            Method extraFlagField = clazz.getMethod("setExtraFlags", int.class, int.class);
            if (dark) {
                extraFlagField.invoke(window, darkModeFlag, darkModeFlag);//状态栏透明且黑色字体
            } else {
                extraFlagField.invoke(window, 0, darkModeFlag);//清除黑色字体
            }
            result = true;
        } catch (Exception e) {

        }
    }
    return result;
}
 
Example #8
Source File: ConfigActivity.java    From Dainty with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    overridePendingTransition(R.anim.left_in, 0);
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        window.getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        );
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);
    }
    mSwipeBackLayout = new SwipeBackLayout(this);
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.add(android.R.id.content, new SettingsFragment());
    ft.commit();
    PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
}
 
Example #9
Source File: StatusBarUtil.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public static boolean FlymeSetStatusBarLightMode(Window window, boolean dark) {
    if (window == null) {
        return false;
    }
    try {
        WindowManager.LayoutParams lp = window.getAttributes();
        Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
        Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags");
        darkFlag.setAccessible(true);
        meizuFlags.setAccessible(true);
        int bit = darkFlag.getInt(null);
        int value = meizuFlags.getInt(lp);
        if (dark) {
            value |= bit;
        } else {
            value &= bit ^ -1;
        }
        meizuFlags.setInt(lp, value);
        window.setAttributes(lp);
        return true;
    } catch (Exception e) {
        return false;
    }
}
 
Example #10
Source File: KeyboardUtils.java    From AndroidUtilCode with Apache License 2.0 6 votes vote down vote up
/**
 * Register soft input changed listener.
 *
 * @param window   The window.
 * @param listener The soft input changed listener.
 */
public static void registerSoftInputChangedListener(@NonNull final Window window,
                                                    @NonNull final OnSoftInputChangedListener listener) {
    final int flags = window.getAttributes().flags;
    if ((flags & WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS) != 0) {
        window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    }
    final FrameLayout contentView = window.findViewById(android.R.id.content);
    final int[] decorViewInvisibleHeightPre = {getDecorViewInvisibleHeight(window)};
    OnGlobalLayoutListener onGlobalLayoutListener = new OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            int height = getDecorViewInvisibleHeight(window);
            if (decorViewInvisibleHeightPre[0] != height) {
                listener.onSoftInputChanged(height);
                decorViewInvisibleHeightPre[0] = height;
            }
        }
    };
    contentView.getViewTreeObserver().addOnGlobalLayoutListener(onGlobalLayoutListener);
    contentView.setTag(TAG_ON_GLOBAL_LAYOUT_LISTENER, onGlobalLayoutListener);
}
 
Example #11
Source File: ActionBarSherlockCompat.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setContentView(View view, ViewGroup.LayoutParams params) {
    if (ActionBarSherlock.DEBUG) Log.d(TAG, "[setContentView] view: " + view + ", params: " + params);

    if (mContentParent == null) {
        installDecor();
    } else {
        mContentParent.removeAllViews();
    }
    mContentParent.addView(view, params);

    Window.Callback callback = mActivity.getWindow().getCallback();
    if (callback != null) {
        callback.onContentChanged();
    }

    initActionBar();
}
 
Example #12
Source File: SwipeBackAppCompatScene.java    From scene with Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    this.mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getNavigationScene().pop();
        }
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Activity activity = this.requireActivity();
        Window window = activity.getWindow();
        window.setStatusBarColor(Color.TRANSPARENT);
        window.setNavigationBarColor(Color.TRANSPARENT);
    }
}
 
Example #13
Source File: StatusBarUtil.java    From StatusBarUtil with Apache License 2.0 6 votes vote down vote up
/**
 * 设置Flyme4+的状态栏的darkMode,darkMode时候字体颜色及icon
 * http://open-wiki.flyme.cn/index.php?title=Flyme%E7%B3%BB%E7%BB%9FAPI
 *
 * @param window 目标window
 * @param dark   亮色 or 暗色
 */
private static void setModeForFlyme4(Window window, boolean dark) {
    try {
        WindowManager.LayoutParams lp = window.getAttributes();
        Field darkFlag = WindowManager.LayoutParams.class.getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
        Field meizuFlags = WindowManager.LayoutParams.class.getDeclaredField("meizuFlags");
        darkFlag.setAccessible(true);
        meizuFlags.setAccessible(true);
        int bit = darkFlag.getInt(null);
        int value = meizuFlags.getInt(lp);
        if (dark) {
            value |= bit;
        } else {
            value &= ~bit;
        }
        meizuFlags.setInt(lp, value);
        window.setAttributes(lp);
    } catch (Exception e) {
        Log.e("StatusBar", "darkIcon: failed");
    }
}
 
Example #14
Source File: DialogFragment.java    From guideshow with MIT License 6 votes vote down vote up
/** @hide */
@Override
public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
    if (!mShowsDialog) {
        return super.getLayoutInflater(savedInstanceState);
    }

    mDialog = onCreateDialog(savedInstanceState);
    switch (mStyle) {
        case STYLE_NO_INPUT:
            mDialog.getWindow().addFlags(
                    WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
                    WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
            // fall through...
        case STYLE_NO_FRAME:
        case STYLE_NO_TITLE:
            mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    }
    if (mDialog != null) {
        return (LayoutInflater) mDialog.getContext().getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
    }
    return (LayoutInflater) mActivity.getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
}
 
Example #15
Source File: MainActivity.java    From financisto with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    greenRobotBus = GreenRobotBus_.getInstance_(this);

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    initialLoad();

    final TabHost tabHost = getTabHost();

    setupAccountsTab(tabHost);
    setupBlotterTab(tabHost);
    setupBudgetsTab(tabHost);
    setupReportsTab(tabHost);
    setupMenuTab(tabHost);

    MyPreferences.StartupScreen screen = MyPreferences.getStartupScreen(this);
    tabHost.setCurrentTabByTag(screen.tag);
    tabHost.setOnTabChangedListener(this);
}
 
Example #16
Source File: EmotionKeyboard.java    From timecat with Apache License 2.0 6 votes vote down vote up
/**
 * 释放被锁定的内容高度
 */
private void unlockContentHeightDelayed() {
    mEditText.postDelayed(new Runnable() {
        @Override
        public void run() {
            mActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN |
                    WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
            //窗口对齐屏幕宽度
            Window win = mActivity.getWindow();
            win.getDecorView().setPadding(0, 0, 0, 0);
            WindowManager.LayoutParams lp = win.getAttributes();
            lp.gravity = Gravity.BOTTOM;//设置对话框置顶显示
            lp.y = 0;
            win.setAttributes(lp);
        }
    }, 300);
}
 
Example #17
Source File: PickerDialog.java    From ColorPickerDialog with Apache License 2.0 6 votes vote down vote up
@Override
public void onResume() {
    super.onResume();

    Window window = getDialog().getWindow();
    DisplayMetrics displayMetrics = new DisplayMetrics();
    WindowManager windowmanager = window.getWindowManager();
    windowmanager.getDefaultDisplay().getMetrics(displayMetrics);

    window.setLayout(
            Math.min(DimenUtils.dpToPx(displayMetrics.widthPixels > displayMetrics.heightPixels ? 800 : 500),
                    (int) (displayMetrics.widthPixels * 0.9f)),
            WindowManager.LayoutParams.WRAP_CONTENT
    );

    GradientDrawable drawable = new GradientDrawable();
    drawable.setColor(ColorUtils.fromAttr(new ContextThemeWrapper(getContext(), getTheme()),
            android.R.attr.colorBackground, Color.WHITE));
    drawable.setCornerRadius(cornerRadius);

    window.setBackgroundDrawable(new InsetDrawable(drawable, DimenUtils.dpToPx(12)));
}
 
Example #18
Source File: LoginActivity.java    From LoveTalkClient with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.activity_login);

	enterLogin = (EditText) findViewById(R.id.enterlogin);
	enterPassword = (EditText) findViewById(R.id.enterpassword);
	registebtn = (ImageView) findViewById(R.id.registebtn);
	loginbtn = (ImageView) findViewById(R.id.loginbtn);
	forgetbtn = (ImageView) findViewById(R.id.forget);

	enterLogin.setOnFocusChangeListener(this);
	enterPassword.setOnFocusChangeListener(this);
	registebtn.setOnClickListener(this);
	loginbtn.setOnClickListener(this);
	forgetbtn.setOnClickListener(this);
}
 
Example #19
Source File: Logout.java    From XERUNG with Apache License 2.0 6 votes vote down vote up
public Logout(Context context, String emailID, Object dashBoardActivity) {
	super(context);
	// TODO Auto-generated constructor stub
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.dialog_logout);
	getWindow().setBackgroundDrawable(new ColorDrawable(android.R.color.transparent));
	setCancelable(false);
	this.context = context;
	roboto = Typeface.createFromAsset(context.getAssets(),"font/Roboto-Regular.ttf");
	activity = (Activity) context;
	pbbar = new ProgressDialog();
	db = new GroupDb(context);
	this.email= emailID;
	dashBoardActObjecct = dashBoardActivity;
	
}
 
Example #20
Source File: ActivityTransitionState.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
public void setEnterActivityOptions(Activity activity, ActivityOptions options) {
    final Window window = activity.getWindow();
    if (window == null) {
        return;
    }
    // ensure Decor View has been created so that the window features are activated
    window.getDecorView();
    if (window.hasFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)
            && options != null && mEnterActivityOptions == null
            && mEnterTransitionCoordinator == null
            && options.getAnimationType() == ActivityOptions.ANIM_SCENE_TRANSITION) {
        mEnterActivityOptions = options;
        mIsEnterTriggered = false;
        if (mEnterActivityOptions.isReturning()) {
            restoreExitedViews();
            int result = mEnterActivityOptions.getResultCode();
            if (result != 0) {
                Intent intent = mEnterActivityOptions.getResultData();
                if (intent != null) {
                    intent.setExtrasClassLoader(activity.getClassLoader());
                }
                activity.onActivityReenter(result, intent);
            }
        }
    }
}
 
Example #21
Source File: BaseFragmentActivity.java    From DMusic with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    mActivity = this;
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(getLayoutRes());
    if (getDSLayoutRes() != 0) {
        mDslDs = (DSLayout) findViewById(getDSLayoutRes());
    }
    bindView();
    mUnbinder = ButterKnife.bind(this);
    mPresenter = getPresenter();
    if (mPresenter != null) {
        mPresenter.attachView(getMvpView());
    }
    init();
}
 
Example #22
Source File: Floating.java    From FloatingView with Apache License 2.0 6 votes vote down vote up
public Floating(Activity activity){

        if (activity == null){
            throw new NullPointerException("Activity should not be null");
        }
        
        ViewGroup rootView = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT);
        View decorView = rootView.findViewById(R.id.floating_decor);
        if (decorView instanceof  FloatingDecorView){
            mFloatingDecorView = (FloatingDecorView) decorView;
        }else {
            mFloatingDecorView = new FloatingDecorView(activity);
            mFloatingDecorView.setId(R.id.floating_decor);
            rootView.addView(mFloatingDecorView);
        }
        
        if (mSpringSystem == null){
            mSpringSystem = SpringSystem.create();
        }
        
    }
 
Example #23
Source File: SpecialBarFontUtils.java    From MNProgressHUD with Apache License 2.0 5 votes vote down vote up
/**
 * 设置状态栏字体图标颜色(只限全屏非activity情况)
 *
 * @param window 当前窗口
 * @param color  颜色
 */
public static void setStatusBarDarkIcon(Window window, int color) {
    try {
        setStatusBarColor(window, color);
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
            setStatusBarDarkIcon(window.getDecorView(), true);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #24
Source File: ExplodeAnimationActivity.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    getWindow().setEnterTransition( new Explode() );
    getWindow().setExitTransition( new Explode() );
    setContentView(R.layout.activity_explode_animation);
}
 
Example #25
Source File: Shake2Share.java    From ShareSDKShareDifMsgDemo-Android with MIT License 5 votes vote down vote up
public void setActivity(Activity activity) {
	super.setActivity(activity);
	int resId = getBitmapRes(activity, "ssdk_oks_shake_to_share_back");
	if (resId > 0) {
		activity.setTheme(android.R.style.Theme_Dialog);
		activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
		Window win = activity.getWindow();
		win.setBackgroundDrawableResource(resId);
	}
}
 
Example #26
Source File: ScreenUtils.java    From BookReader with Apache License 2.0 5 votes vote down vote up
/**
 * 设置Activity的亮度
 *
 * @param paramInt
 * @param mActivity
 */
public static void setScreenBrightness(int paramInt, Activity mActivity) {
    if (paramInt <= 5) {
        paramInt = 5;
    }
    Window localWindow = mActivity.getWindow();
    WindowManager.LayoutParams localLayoutParams = localWindow.getAttributes();
    float f = paramInt / 100.0F;
    localLayoutParams.screenBrightness = f;
    localWindow.setAttributes(localLayoutParams);
}
 
Example #27
Source File: WeatherActivity.java    From coolweather with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	setContentView(R.layout.weather_layout);
	// 初始化各控件
	weatherInfoLayout = (LinearLayout) findViewById(R.id.weather_info_layout);
	cityNameText = (TextView) findViewById(R.id.city_name);
	publishText = (TextView) findViewById(R.id.publish_text);
	weatherDespText = (TextView) findViewById(R.id.weather_desp);
	temp1Text = (TextView) findViewById(R.id.temp1);
	temp2Text = (TextView) findViewById(R.id.temp2);
	currentDateText = (TextView) findViewById(R.id.current_date);
	switchCity = (Button) findViewById(R.id.switch_city);
	refreshWeather = (Button) findViewById(R.id.refresh_weather);
	String countyCode = getIntent().getStringExtra("county_code");
	if (!TextUtils.isEmpty(countyCode)) {
		// 有县级代号时就去查询天气
		publishText.setText("同步中...");
		weatherInfoLayout.setVisibility(View.INVISIBLE);
		cityNameText.setVisibility(View.INVISIBLE);
		queryWeatherCode(countyCode);
	} else {
		// 没有县级代号时就直接显示本地天气
		showWeather();
	}
	switchCity.setOnClickListener(this);
	refreshWeather.setOnClickListener(this);
	//实例化广告条
    AdView adView = new AdView(this, AdSize.FIT_SCREEN);
    //获取要嵌入广告条的布局
    LinearLayout adLayout=(LinearLayout)findViewById(R.id.adLayout);
    //将广告条加入到布局中
    adLayout.addView(adView);
}
 
Example #28
Source File: Splash.java    From palmsuda with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	// 设置为无标题栏
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	// 设置为全屏模式
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
			WindowManager.LayoutParams.FLAG_FULLSCREEN);
	setContentView(R.layout.splash);

	// 获取当前版本,并设置在启动界面的TextView
	this.getCurrentVersion();

	cover_page = (RelativeLayout) findViewById(R.id.cover_page);
	AlphaAnimation aa = new AlphaAnimation(0.1f, 1.0f);
	aa.setDuration(5000);
	cover_page.startAnimation(aa);

	Animation anim = android.view.animation.AnimationUtils.loadAnimation(
			this, R.anim.rotate);
	android.view.animation.LinearInterpolator lir = new android.view.animation.LinearInterpolator();
	anim.setInterpolator(lir);
	findViewById(R.id.progressBar1).startAnimation(anim);

	handler.postDelayed(new SplashHandler(), 8000);
	// 延迟8秒,再运行SplashHandler的run()方法
}
 
Example #29
Source File: SelectDateDialog.java    From SmartChart with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Window window = getWindow();
    WindowManager.LayoutParams wl = window.getAttributes();
    wl.width = ViewGroup.LayoutParams.MATCH_PARENT;
    wl.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    onWindowAttributesChanged(wl);
}
 
Example #30
Source File: CordovaActivity.java    From reader with MIT License 5 votes vote down vote up
/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
    LOG.d(TAG, "CordovaActivity.onCreate()");

    // need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
    loadConfig();
    if(!preferences.getBoolean("ShowTitle", false))
    {
        getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    }
    
    if(preferences.getBoolean("SetFullscreen", false))
    {
        Log.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else if (preferences.getBoolean("Fullscreen", false)) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    }

    super.onCreate(savedInstanceState);

    if(savedInstanceState != null)
    {
        initCallbackClass = savedInstanceState.getString("callbackClass");
    }
}