Search in sources :

Example 41 with Window

use of android.view.Window in project zxing-lib by kennydude.

the class ZXingFragment method onStart.

@Override
public void onStart() {
    super.onStart();
    // This is a good forced option
    Window window = getActivity().getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    hasSurface = false;
}
Also used : Window(android.view.Window)

Example 42 with Window

use of android.view.Window in project qksms by moezbhatti.

the class QKDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(mContext);
    Window window = dialog.getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_material, null);
    if (mTitleEnabled || mMessageEnabled) {
        mContentPanel = (LinearLayout) view.findViewById(R.id.contentPanel);
        mContentPanel.setVisibility(View.VISIBLE);
    }
    if (mTitleEnabled) {
        mTitleView = (QKTextView) view.findViewById(R.id.alertTitle);
        mTitleView.setVisibility(View.VISIBLE);
        mTitleView.setText(mTitleText);
        Log.d(TAG, "title enabled");
    }
    if (mMessageEnabled) {
        mMessageView = (QKTextView) view.findViewById(R.id.message);
        mMessageView.setVisibility(View.VISIBLE);
        mMessageView.setText(mMessageText);
    }
    if (mCustomViewEnabled) {
        mCustomPanel = (LinearLayout) view.findViewById(R.id.customPanel);
        mCustomPanel.setVisibility(View.VISIBLE);
        if (mCustomView instanceof ListView || mCustomView instanceof RecyclerView) {
            mCustomPanel.addView(mCustomView);
        } else {
            ScrollView scrollView = new ScrollView(mContext);
            scrollView.addView(mCustomView);
            mCustomPanel.addView(scrollView);
        }
    }
    if (mPositiveButtonEnabled || mNegativeButtonEnabled) {
        mButtonBar = (LinearLayout) view.findViewById(R.id.buttonPanel);
        mButtonBar.setVisibility(View.VISIBLE);
        mButtonBar.setOrientation(mButtonBarOrientation);
    }
    if (mPositiveButtonEnabled) {
        mPositiveButtonView = (QKTextView) view.findViewById(R.id.buttonPositive);
        mPositiveButtonView.setVisibility(View.VISIBLE);
        mPositiveButtonView.setText(mPositiveButtonText);
        mPositiveButtonView.setOnClickListener(mPositiveButtonClickListener);
        LiveViewManager.registerView(QKPreference.THEME, mPositiveButtonView, key -> {
            mPositiveButtonView.setTextColor(ThemeManager.getColor());
        });
    }
    if (mNeutralButtonEnabled) {
        mNeutralButtonView = (QKTextView) view.findViewById(R.id.buttonNeutral);
        mNeutralButtonView.setVisibility(View.VISIBLE);
        mNeutralButtonView.setText(mNeutralButtonText);
        mNeutralButtonView.setOnClickListener(mNeutralButtonClickListener);
    }
    if (mNegativeButtonEnabled) {
        mNegativeButtonView = (QKTextView) view.findViewById(R.id.buttonNegative);
        mNegativeButtonView.setVisibility(View.VISIBLE);
        mNegativeButtonView.setText(mNegativeButtonText);
        mNegativeButtonView.setOnClickListener(mNegativeButtonClickListener);
    }
    dialog.setContentView(view);
    return dialog;
}
Also used : Window(android.view.Window) ListView(android.widget.ListView) ColorDrawable(android.graphics.drawable.ColorDrawable) ScrollView(android.widget.ScrollView) Dialog(android.app.Dialog) LayoutInflater(android.view.LayoutInflater) RecyclerView(android.support.v7.widget.RecyclerView) QKTextView(com.moez.QKSMS.ui.view.QKTextView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) ScrollView(android.widget.ScrollView) ListView(android.widget.ListView)

Example 43 with Window

use of android.view.Window in project okhttp-OkGo by jeasonlzy.

the class BaseActivity method initSystemBarTint.

/** 设置状态栏颜色 */
protected void initSystemBarTint() {
    Window window = getWindow();
    if (translucentStatusBar()) {
        // 设置状态栏全透明
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            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);
        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        return;
    }
    // 沉浸式状态栏
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //5.0以上使用原生方法
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(setStatusBarColor());
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        //4.4-5.0使用三方工具类,有些4.4的手机有问题,这里为演示方便,不使用沉浸式
        //            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        SystemBarTintManager tintManager = new SystemBarTintManager(this);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setStatusBarTintColor(setStatusBarColor());
    }
}
Also used : Window(android.view.Window) SystemBarTintManager(com.lzy.imagepicker.view.SystemBarTintManager)

Example 44 with Window

use of android.view.Window in project okhttp-OkGo by jeasonlzy.

the class BaseDetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
    }
    getDelegate().setContentView(R.layout.activity_base);
    Window window = getWindow();
    requestState = (TextView) window.findViewById(R.id.requestState);
    requestHeaders = (TextView) window.findViewById(R.id.requestHeaders);
    responseData = (TextView) window.findViewById(R.id.responseData);
    responseHeader = (TextView) window.findViewById(R.id.responseHeader);
    rootContent = (FrameLayout) window.findViewById(R.id.content);
    onActivityCreate(savedInstanceState);
}
Also used : Window(android.view.Window)

Example 45 with Window

use of android.view.Window in project Android-Terminal-Emulator by jackpal.

the class Term method updatePrefs.

private void updatePrefs() {
    mUseKeyboardShortcuts = mSettings.getUseKeyboardShortcutsFlag();
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);
    mViewFlipper.updatePrefs(mSettings);
    for (View v : mViewFlipper) {
        ((EmulatorView) v).setDensity(metrics);
        ((TermView) v).updatePrefs(mSettings);
    }
    if (mTermSessions != null) {
        for (TermSession session : mTermSessions) {
            ((GenericTermSession) session).updatePrefs(mSettings);
        }
    }
    {
        Window win = getWindow();
        WindowManager.LayoutParams params = win.getAttributes();
        final int FULLSCREEN = WindowManager.LayoutParams.FLAG_FULLSCREEN;
        int desiredFlag = mSettings.showStatusBar() ? 0 : FULLSCREEN;
        if (desiredFlag != (params.flags & FULLSCREEN) || (AndroidCompat.SDK >= 11 && mActionBarMode != mSettings.actionBarMode())) {
            if (mAlreadyStarted) {
                // Can't switch to/from fullscreen after
                // starting the activity.
                restart();
            } else {
                win.setFlags(desiredFlag, FULLSCREEN);
                if (mActionBarMode == TermSettings.ACTION_BAR_MODE_HIDES) {
                    if (mActionBar != null) {
                        mActionBar.hide();
                    }
                }
            }
        }
    }
    int orientation = mSettings.getScreenOrientation();
    int o = 0;
    if (orientation == 0) {
        o = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    } else if (orientation == 1) {
        o = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    } else if (orientation == 2) {
        o = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
    } else {
    /* Shouldn't be happened. */
    }
    setRequestedOrientation(o);
}
Also used : Window(android.view.Window) EmulatorView(jackpal.androidterm.emulatorview.EmulatorView) TermSession(jackpal.androidterm.emulatorview.TermSession) DisplayMetrics(android.util.DisplayMetrics) View(android.view.View) TextView(android.widget.TextView) EmulatorView(jackpal.androidterm.emulatorview.EmulatorView)

Aggregations

Window (android.view.Window)322 View (android.view.View)72 WindowManager (android.view.WindowManager)58 TextView (android.widget.TextView)34 TargetApi (android.annotation.TargetApi)29 ImageView (android.widget.ImageView)25 ViewGroup (android.view.ViewGroup)22 Activity (android.app.Activity)17 Dialog (android.app.Dialog)17 ColorDrawable (android.graphics.drawable.ColorDrawable)16 AdapterView (android.widget.AdapterView)16 PhoneWindow (com.android.internal.policy.PhoneWindow)15 Intent (android.content.Intent)11 Context (android.content.Context)10 LayoutInflater (android.view.LayoutInflater)10 WindowDecorActionBar (com.android.internal.app.WindowDecorActionBar)10 RemoteException (android.os.RemoteException)9 DisplayMetrics (android.util.DisplayMetrics)9 LinearLayout (android.widget.LinearLayout)9 PopupWindow (android.widget.PopupWindow)8