Example usage for android.view Window FEATURE_NO_TITLE

List of usage examples for android.view Window FEATURE_NO_TITLE

Introduction

In this page you can find the example usage for android.view Window FEATURE_NO_TITLE.

Prototype

int FEATURE_NO_TITLE

To view the source code for android.view Window FEATURE_NO_TITLE.

Click Source Link

Document

Flag for the "no title" feature, turning off the title at the top of the screen.

Usage

From source file:com.dlam.activity.ChatActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_chat);
    activityInstance = this;
    initView();//from   www .  j av a2 s.  c o  m
    setUpView();
}

From source file:com.example.ecgfile.DeviceControlActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.gatt_services_characteristics);
    if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }/*from  w  w  w .  j av  a  2s  . co m*/
    init_ecg();

    mDeviceAddress = getIntent().getStringExtra(EXTRAS_DEVICE_ADDRESS);
    //        getActionBar().setDisplayHomeAsUpEnabled(true);
    Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
    bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
}

From source file:com.owncloud.android.authentication.AuthenticatorActivity.java

/**
 * {@inheritDoc}/*from www.j  av a 2s  .  co m*/
 * 
 * IMPORTANT ENTRY POINT 1: activity is shown to the user
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.account_setup);
    mAuthMessage = (TextView) findViewById(R.id.auth_message);
    mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);
    mHostUrlInput.setText(getString(R.string.server_url)); // valid although
                                                           // R.string.server_url
                                                           // is an empty
                                                           // string
    mUsernameInput = (EditText) findViewById(R.id.account_username);
    mPasswordInput = (EditText) findViewById(R.id.account_password);
    mPasswordInput2 = (EditText) findViewById(R.id.account_password2);
    mOAuthAuthEndpointText = (TextView) findViewById(R.id.oAuthEntryPoint_1);
    mOAuthTokenEndpointText = (TextView) findViewById(R.id.oAuthEntryPoint_2);
    mOAuth2Check = (CheckBox) findViewById(R.id.oauth_onOff_check);
    mOkButton = findViewById(R.id.buttonOK);
    mAuthStatusLayout = (TextView) findViewById(R.id.auth_status_text);

    // / set Host Url Input Enabled
    mHostUrlInputEnabled = getResources().getBoolean(R.bool.show_server_url_input);
    locationSpinner = (Spinner) findViewById(R.id.spinner1);

    // / complete label for 'register account' button
    Button b = (Button) findViewById(R.id.account_register);
    if (b != null) {
        b.setText(String.format(getString(R.string.auth_register), getString(R.string.app_name)));
    }

    // / initialization
    mAccountMgr = AccountManager.get(this);
    mNewCapturedUriFromOAuth2Redirection = null;
    mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE);
    mAccount = null;
    mHostBaseUrl = "";
    location = " ";//locationSpinner.getSelectedItem();
    locationSpinner.setOnItemSelectedListener(this);
    boolean refreshButtonEnabled = false;

    // URL input configuration applied
    if (!mHostUrlInputEnabled) {
        findViewById(R.id.hostUrlFrame).setVisibility(View.GONE);
        mRefreshButton = findViewById(R.id.centeredRefreshButton);

    } else {
        mRefreshButton = findViewById(R.id.embeddedRefreshButton);
    }

    if (savedInstanceState == null) {
        mResumed = false;
        // / connection state and info
        mAuthMessageVisibility = View.GONE;
        mServerStatusText = mServerStatusIcon = 0;
        mServerIsValid = false;
        mServerIsChecked = false;
        mIsSslConn = false;
        mAuthStatusText = mAuthStatusIcon = 0;

        // / retrieve extras from intent
        mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);

        if (mAccount != null) {
            String ocVersion = mAccountMgr.getUserData(mAccount, AccountAuthenticator.KEY_OC_VERSION);
            Log.d("!!!!!!!!!!!!!!!!!!!!!!!!! ", mAccount.name);
            if (ocVersion != null) {
                mDiscoveredVersion = new OwnCloudVersion(ocVersion);
            }
            mHostBaseUrl = normalizeUrl(
                    mAccountMgr.getUserData(mAccount, AccountAuthenticator.KEY_OC_BASE_URL));
            mHostUrlInput.setText(mHostBaseUrl);

            String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));
            Log.d("!!!!!!!!!!!!!!!!!!!!!!!!!4234 ", userName);
            mUsernameInput.setText(userName);
        }
        initAuthorizationMethod(); // checks intent and setup.xml to
                                   // determine mCurrentAuthorizationMethod
        mJustCreated = true;

        if (mAction == ACTION_UPDATE_TOKEN || !mHostUrlInputEnabled) {
            checkOcServer();
        }

    } else {
        mResumed = true;
        // / connection state and info
        mAuthMessageVisibility = savedInstanceState.getInt(KEY_AUTH_MESSAGE_VISIBILITY);
        mAuthMessageText = savedInstanceState.getString(KEY_AUTH_MESSAGE_TEXT);
        mServerIsValid = savedInstanceState.getBoolean(KEY_SERVER_VALID);
        mServerIsChecked = savedInstanceState.getBoolean(KEY_SERVER_CHECKED);
        mServerStatusText = savedInstanceState.getInt(KEY_SERVER_STATUS_TEXT);
        mServerStatusIcon = savedInstanceState.getInt(KEY_SERVER_STATUS_ICON);
        mIsSslConn = savedInstanceState.getBoolean(KEY_IS_SSL_CONN);
        mAuthStatusText = savedInstanceState.getInt(KEY_AUTH_STATUS_TEXT);
        mAuthStatusIcon = savedInstanceState.getInt(KEY_AUTH_STATUS_ICON);
        if (savedInstanceState.getBoolean(KEY_PASSWORD_VISIBLE, false)) {
            showPassword();
        }

        // / server data
        String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);
        if (ocVersion != null) {
            mDiscoveredVersion = new OwnCloudVersion(ocVersion);
        }
        mHostBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);

        // account data, if updating
        mAccount = savedInstanceState.getParcelable(KEY_ACCOUNT);
        // Log.d("////////////////// ",mAccount.name);
        mAuthTokenType = savedInstanceState.getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE);
        if (mAuthTokenType == null) {
            mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_PASSWORD;

        }

        // check if server check was interrupted by a configuration change
        if (savedInstanceState.getBoolean(KEY_SERVER_CHECK_IN_PROGRESS, false)) {
            checkOcServer();
        }

        // refresh button enabled
        refreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);

    }

    if (mAuthMessageVisibility == View.VISIBLE) {
        showAuthMessage(mAuthMessageText);
    } else {
        hideAuthMessage();
    }
    adaptViewAccordingToAuthenticationMethod();
    showServerStatus();
    showAuthStatus();

    if (mAction == ACTION_UPDATE_TOKEN) {
        // / lock things that should not change
        mHostUrlInput.setEnabled(false);
        mHostUrlInput.setFocusable(false);
        mUsernameInput.setEnabled(false);
        mUsernameInput.setFocusable(false);
        mOAuth2Check.setVisibility(View.GONE);
    }

    // if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled)
    // showRefreshButton();
    if (mServerIsChecked && !mServerIsValid && refreshButtonEnabled)
        showRefreshButton();
    mOkButton.setEnabled(mServerIsValid); // state not automatically
                                          // recovered in configuration
                                          // changes

    if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)
            || !AUTH_OPTIONAL.equals(getString(R.string.auth_method_oauth2))) {
        mOAuth2Check.setVisibility(View.GONE);
    }

    mPasswordInput.setText(""); // clean password to avoid social hacking
                                // (disadvantage: password in removed if the
                                // device is turned aside)

    // / bind view elements to listeners and other friends
    mHostUrlInput.setOnFocusChangeListener(this);
    mHostUrlInput.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    mHostUrlInput.setOnEditorActionListener(this);
    mHostUrlInput.addTextChangedListener(new TextWatcher() {

        @Override
        public void afterTextChanged(Editable s) {
            if (!mHostBaseUrl.equals(normalizeUrl(mHostUrlInput.getText().toString()))) {
                mOkButton.setEnabled(false);
            }
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (!mResumed) {
                mAuthStatusIcon = 0;
                mAuthStatusText = 0;
                showAuthStatus();
            }
            mResumed = false;
        }
    });

    mPasswordInput.setOnFocusChangeListener(this);
    mPasswordInput.setImeOptions(EditorInfo.IME_ACTION_DONE);
    mPasswordInput.setOnEditorActionListener(this);
    mPasswordInput.setOnTouchListener(new RightDrawableOnTouchListener() {
        @Override
        public boolean onDrawableTouch(final MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP) {
                AuthenticatorActivity.this.onViewPasswordClick();
            }
            return true;
        }
    });

    findViewById(R.id.scroll).setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)
                        && mHostUrlInput.hasFocus()) {
                    checkOcServer();
                }
            }
            return false;
        }
    });
}

From source file:org.csp.everyaware.offline.Map.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d("Map", "******************************onCreate()******************************");
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.map_container);

    mToBeHideBtn = (Button) findViewById(R.id.startStopBtn);
    mToBeHideBtn.setVisibility(View.GONE);

    mPowerMan = (PowerManager) getSystemService(Context.POWER_SERVICE);
    mWakeLock = mPowerMan.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "CPUalwaysOn");

    Utils.setStep(Constants.TRACK_MAP, getApplicationContext());

    mDbManager = DbManager.getInstance(getApplicationContext());
    mDbManager.openDb();// w  w w  .ja va  2s . co m

    //it will contain  displayed latlng points
    mLatLngPoints = new ArrayList<ExtendedLatLng>();

    //istantiate custom implementation of LocationSource interface
    mLocationSource = new MyLocationSource();

    //google map initialization
    setUpMapIfNeeded(savedInstanceState);

    //obtaining references to buttons and defining listeners
    getButtonRefs();

    mHandler = new Handler();

    mKmlParser = new KmlParser();

    //starting store'n'forward service and saving reference to it
    Intent serviceIntent = new Intent(getApplicationContext(), StoreAndForwardService.class);
    Utils.storeForwServIntent = serviceIntent;
    startService(serviceIntent);

    //set appropriate colors in all seven black carbon levels under black carbon text box
    setBcLevelColors();
}

From source file:com.example.gemswin.screencastrecevertest.MainActivity_Reciever.java

 protected void DoubtBox1 () {
   // TODO Auto-generated method stub

   dialogDoubt1 = new Dialog(MainActivity_Reciever.this);
   dialogDoubt1.requestWindowFeature(Window.FEATURE_NO_TITLE);
   dialogDoubt1.setContentView(R.layout.activity_doubtlist_reciever);  //here

   mainListView = (ListView)dialogDoubt1.findViewById(R.id.mainListView);


   //list ki shuruat




   /*String[] planets = new String[] { "Mercury", "Venus", "Earth", "Mars",
         "Jupiter", "Saturn", "Uranus", "Neptune"};
   planetList.addAll( Arrays.asList(planets) );*/

   // Create ArrayAdapter using the planet list.
   listAdapter = new ArrayAdapter<String>(MainActivity_Reciever.this, R.layout.simplerow_reciever, planetList);
   mainListView.setAdapter(listAdapter);

   mainListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
      public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
                              final int pos, long id) {
         // TODO Auto-generated method stub
         itemValue = (String) mainListView.getItemAtPosition(pos);
         DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
            @Override/*from w  w w. j av  a 2  s. c  o m*/
            public void onClick(DialogInterface dialog, int which) {
               switch (which) {
                  case DialogInterface.BUTTON_POSITIVE:

                     new delete().execute();
                     break;

                  case DialogInterface.BUTTON_NEGATIVE:
                     //No button clicked
                     break;
               }
            }
         };

         AlertDialog.Builder builder = new AlertDialog.Builder(arg1.getContext());
         builder.setMessage("Are you sure to delete this doubt ?").setPositiveButton("Yes", dialogClickListener)
               .setNegativeButton("No", dialogClickListener).show();

         return true;

      }
   });




   dialogDoubt1.show();

}

From source file:com.cloudexplorers.plugins.childBrowser.ChildBrowser.java

/**
 * Display a new browser with the specified URL.
 * /*from  w ww.  j  a va2s  .  co m*/
 * @param url
 *          The url to load.
 * @param jsonObject
 */
public String showWebPage(final String url, JSONObject options) {
    // Determine if we should hide the location bar.
    if (options != null) {
        showLocationBar = options.optBoolean("showLocationBar", true);
    }

    // Create dialog in new thread
    Runnable runnable = new Runnable() {
        /**
         * Convert our DIP units to Pixels
         * 
         * @return int
         */
        private int dpToPixels(int dipValue) {
            int value = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) dipValue,
                    cordova.getActivity().getResources().getDisplayMetrics());

            return value;
        }

        public void run() {
            // Let's create the main dialog
            dialog = new Dialog(cordova.getActivity(), android.R.style.Theme_NoTitleBar);
            dialog.getWindow().getAttributes().windowAnimations = android.R.style.Animation_Dialog;
            dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setCancelable(true);
            dialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
                public void onDismiss(DialogInterface dialog) {
                    try {
                        JSONObject obj = new JSONObject();
                        obj.put("type", CLOSE_EVENT);

                        sendUpdate(obj, false);
                    } catch (JSONException e) {
                        Log.d(LOG_TAG, "Should never happen");
                    }
                }
            });

            // Main container layout
            LinearLayout main = new LinearLayout(cordova.getActivity());
            main.setOrientation(LinearLayout.VERTICAL);

            // Toolbar layout
            RelativeLayout toolbar = new RelativeLayout(cordova.getActivity());
            toolbar.setLayoutParams(
                    new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, this.dpToPixels(44)));
            toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2));
            toolbar.setHorizontalGravity(Gravity.LEFT);
            toolbar.setVerticalGravity(Gravity.TOP);

            // Action Button Container layout
            RelativeLayout actionButtonContainer = new RelativeLayout(cordova.getActivity());
            actionButtonContainer.setLayoutParams(
                    new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
            actionButtonContainer.setHorizontalGravity(Gravity.LEFT);
            actionButtonContainer.setVerticalGravity(Gravity.CENTER_VERTICAL);
            actionButtonContainer.setId(1);

            // Back button
            ImageButton back = new ImageButton(cordova.getActivity());
            RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
            backLayoutParams.addRule(RelativeLayout.ALIGN_LEFT);
            back.setLayoutParams(backLayoutParams);
            back.setContentDescription("Back Button");
            back.setId(2);
            try {
                back.setImageBitmap(loadDrawable("www/childbrowser/icon_arrow_left.png"));
            } catch (IOException e) {
                Log.e(LOG_TAG, e.getMessage(), e);
            }
            back.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    goBack();
                }
            });

            // Forward button
            ImageButton forward = new ImageButton(cordova.getActivity());
            RelativeLayout.LayoutParams forwardLayoutParams = new RelativeLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
            forwardLayoutParams.addRule(RelativeLayout.RIGHT_OF, 2);
            forward.setLayoutParams(forwardLayoutParams);
            forward.setContentDescription("Forward Button");
            forward.setId(3);
            try {
                forward.setImageBitmap(loadDrawable("www/childbrowser/icon_arrow_right.png"));
            } catch (IOException e) {
                Log.e(LOG_TAG, e.getMessage(), e);
            }
            forward.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    goForward();
                }
            });

            // Edit Text Box
            edittext = new EditText(cordova.getActivity());
            RelativeLayout.LayoutParams textLayoutParams = new RelativeLayout.LayoutParams(
                    LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
            textLayoutParams.addRule(RelativeLayout.RIGHT_OF, 1);
            textLayoutParams.addRule(RelativeLayout.LEFT_OF, 5);
            edittext.setLayoutParams(textLayoutParams);
            edittext.setId(4);
            edittext.setSingleLine(true);
            edittext.setText(url);
            edittext.setInputType(InputType.TYPE_TEXT_VARIATION_URI);
            edittext.setImeOptions(EditorInfo.IME_ACTION_GO);
            edittext.setInputType(InputType.TYPE_NULL); // Will not except input...
                                                        // Makes the text
                                                        // NON-EDITABLE
            edittext.setOnKeyListener(new View.OnKeyListener() {
                public boolean onKey(View v, int keyCode, KeyEvent event) {
                    // If the event is a key-down event on the "enter" button
                    if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                        navigate(edittext.getText().toString());
                        return true;
                    }
                    return false;
                }
            });

            // Close button
            ImageButton close = new ImageButton(cordova.getActivity());
            RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
            closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            close.setLayoutParams(closeLayoutParams);
            forward.setContentDescription("Close Button");
            close.setId(5);
            try {
                close.setImageBitmap(loadDrawable("www/childbrowser/icon_close.png"));
            } catch (IOException e) {
                Log.e(LOG_TAG, e.getMessage(), e);
            }
            close.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
                    closeDialog();
                }
            });

            // WebView
            webview = new WebView(cordova.getActivity());
            webview.setLayoutParams(
                    new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
            webview.setWebChromeClient(new WebChromeClient());
            WebViewClient client = new ChildBrowserClient(edittext);
            webview.setWebViewClient(client);
            WebSettings settings = webview.getSettings();
            settings.setJavaScriptEnabled(true);
            settings.setJavaScriptCanOpenWindowsAutomatically(true);
            settings.setBuiltInZoomControls(true);
            settings.setPluginsEnabled(true);
            settings.setDomStorageEnabled(true);

            webview.loadUrl(url);
            webview.setId(6);
            webview.getSettings().setLoadWithOverviewMode(true);
            webview.getSettings().setUseWideViewPort(true);
            webview.getSettings().setJavaScriptEnabled(true);
            webview.getSettings().setPluginsEnabled(true);

            webview.requestFocus();
            webview.requestFocusFromTouch();

            // Add the back and forward buttons to our action button container
            // layout
            actionButtonContainer.addView(back);
            actionButtonContainer.addView(forward);

            // Add the views to our toolbar
            toolbar.addView(actionButtonContainer);
            toolbar.addView(edittext);
            toolbar.addView(close);

            // Don't add the toolbar if its been disabled
            if (getShowLocationBar()) {
                // Add our toolbar to our main view/layout
                main.addView(toolbar);
            }

            // Add our webview to our main view/layout
            main.addView(webview);

            WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
            lp.copyFrom(dialog.getWindow().getAttributes());
            lp.width = WindowManager.LayoutParams.FILL_PARENT;
            lp.height = WindowManager.LayoutParams.FILL_PARENT;

            dialog.setContentView(main);
            dialog.show();
            dialog.getWindow().setAttributes(lp);
        }

        private Bitmap loadDrawable(String filename) throws java.io.IOException {
            InputStream input = cordova.getActivity().getAssets().open(filename);
            return BitmapFactory.decodeStream(input);
        }
    };
    this.cordova.getActivity().runOnUiThread(runnable);
    return "";
}

From source file:com.borax12.materialdaterangepicker.time.TimePickerDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    View view = inflater.inflate(R.layout.range_time_picker_dialog, null);
    KeyboardListener keyboardListener = new KeyboardListener();
    view.findViewById(R.id.time_picker_dialog).setOnKeyListener(keyboardListener);

    Resources res = getResources();
    mHourPickerDescription = res.getString(R.string.mdtp_hour_picker_description);
    mSelectHours = res.getString(R.string.mdtp_select_hours);
    mMinutePickerDescription = res.getString(R.string.mdtp_minute_picker_description);
    mSelectMinutes = res.getString(R.string.mdtp_select_minutes);
    mSelectedColor = res.getColor(R.color.mdtp_white);
    mUnselectedColor = res.getColor(R.color.mdtp_accent_color_focused);

    tabHost = (TabHost) view.findViewById(R.id.tabHost);
    tabHost.findViewById(R.id.tabHost);/*from ww  w  .  j  a  v  a 2s  . co  m*/
    tabHost.setup();
    TabHost.TabSpec startDatePage = tabHost.newTabSpec("start");
    startDatePage.setContent(R.id.start_date_group);
    startDatePage.setIndicator("FROM");

    TabHost.TabSpec endDatePage = tabHost.newTabSpec("end");
    endDatePage.setContent(R.id.end_date_group);
    endDatePage.setIndicator("TO");

    tabHost.addTab(startDatePage);
    tabHost.addTab(endDatePage);

    mHourView = (TextView) view.findViewById(R.id.hours);
    mHourView.setOnKeyListener(keyboardListener);
    mHourViewEnd = (TextView) view.findViewById(R.id.hours_end);
    mHourViewEnd.setOnKeyListener(keyboardListener);
    mHourSpaceView = (TextView) view.findViewById(R.id.hour_space);
    mHourSpaceViewEnd = (TextView) view.findViewById(R.id.hour_space_end);
    mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space);
    mMinuteSpaceViewEnd = (TextView) view.findViewById(R.id.minutes_space_end);
    mMinuteView = (TextView) view.findViewById(R.id.minutes);
    mMinuteView.setOnKeyListener(keyboardListener);
    mMinuteViewEnd = (TextView) view.findViewById(R.id.minutes_end);
    mMinuteViewEnd.setOnKeyListener(keyboardListener);
    mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label);
    mAmPmTextView.setOnKeyListener(keyboardListener);
    mAmPmTextViewEnd = (TextView) view.findViewById(R.id.ampm_label_end);
    mAmPmTextViewEnd.setOnKeyListener(keyboardListener);
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];

    mHapticFeedbackController = new HapticFeedbackController(getActivity());

    mTimePicker = (RadialPickerLayout) view.findViewById(R.id.time_picker);
    mTimePicker.setOnValueSelectedListener(this);
    mTimePicker.setOnKeyListener(keyboardListener);
    mTimePicker.initialize(getActivity(), this, mInitialHourOfDay, mInitialMinute, mIs24HourMode);

    mTimePickerEnd = (RadialPickerLayout) view.findViewById(R.id.time_picker_end);
    mTimePickerEnd.setOnValueSelectedListener(this);
    mTimePickerEnd.setOnKeyListener(keyboardListener);
    mTimePickerEnd.initialize(getActivity(), this, mInitialHourOfDay, mInitialMinute, mIs24HourMode);

    int currentItemShowing = HOUR_INDEX;
    int currentItemShowingEnd = HOUR_INDEX;
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_CURRENT_ITEM_SHOWING)) {
        currentItemShowing = savedInstanceState.getInt(KEY_CURRENT_ITEM_SHOWING);
    }
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_CURRENT_ITEM_SHOWING_END)) {
        currentItemShowingEnd = savedInstanceState.getInt(KEY_CURRENT_ITEM_SHOWING_END);
    }
    setCurrentItemShowing(currentItemShowing, false, true, true);
    setCurrentItemShowing(currentItemShowingEnd, false, true, true);
    mTimePicker.invalidate();
    mTimePickerEnd.invalidate();

    mHourView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setCurrentItemShowing(HOUR_INDEX, true, false, true);
            tryVibrate();
        }
    });
    mHourViewEnd.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setCurrentItemShowing(HOUR_INDEX, true, false, true);
            tryVibrate();
        }
    });
    mMinuteView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setCurrentItemShowing(MINUTE_INDEX, true, false, true);
            tryVibrate();
        }
    });
    mMinuteViewEnd.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setCurrentItemShowing(MINUTE_INDEX, true, false, true);
            tryVibrate();
        }
    });

    mOkButton = (Button) view.findViewById(R.id.ok);
    mOkButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mInKbMode && isTypedTimeFullyLegal()) {
                finishKbMode(false);
            } else {
                tryVibrate();
            }
            if (mCallback != null) {
                mCallback.onTimeSet(mTimePicker, mTimePicker.getHours(), mTimePicker.getMinutes(),
                        mTimePickerEnd.getHours(), mTimePickerEnd.getMinutes());
            }
            dismiss();
        }
    });
    mOkButton.setOnKeyListener(keyboardListener);
    mOkButton.setTypeface(TypefaceHelper.get(getDialog().getContext(), "Roboto-Medium"));

    mCancelButton = (Button) view.findViewById(R.id.cancel);
    mCancelButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            tryVibrate();
            if (getDialog() != null)
                getDialog().cancel();
        }
    });
    mCancelButton.setTypeface(TypefaceHelper.get(getDialog().getContext(), "Roboto-Medium"));
    mCancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE);

    // Enable or disable the AM/PM view.
    mAmPmHitspace = view.findViewById(R.id.ampm_hitspace);
    mAmPmHitspaceEnd = view.findViewById(R.id.ampm_hitspace_end);

    if (mIs24HourMode) {
        mAmPmTextView.setVisibility(View.GONE);
        mAmPmTextViewEnd.setVisibility(View.GONE);

        RelativeLayout.LayoutParams paramsSeparator = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        paramsSeparator.addRule(RelativeLayout.CENTER_IN_PARENT);
        TextView separatorView = (TextView) view.findViewById(R.id.separator);
        TextView separatorViewEnd = (TextView) view.findViewById(R.id.separator_end);
        separatorView.setLayoutParams(paramsSeparator);
        separatorViewEnd.setLayoutParams(paramsSeparator);
    } else {
        mAmPmTextView.setVisibility(View.VISIBLE);
        mAmPmTextViewEnd.setVisibility(View.VISIBLE);
        updateAmPmDisplay(mInitialHourOfDay < 12 ? AM : PM);
        mAmPmHitspace.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                tryVibrate();
                int amOrPm = mTimePicker.getIsCurrentlyAmOrPm();
                if (amOrPm == AM) {
                    amOrPm = PM;
                } else if (amOrPm == PM) {
                    amOrPm = AM;
                }
                updateAmPmDisplay(amOrPm);
                mTimePicker.setAmOrPm(amOrPm);
            }
        });
        mAmPmHitspaceEnd.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                tryVibrate();
                int amOrPm = mTimePickerEnd.getIsCurrentlyAmOrPm();
                if (amOrPm == AM) {
                    amOrPm = PM;
                } else if (amOrPm == PM) {
                    amOrPm = AM;
                }
                updateAmPmDisplay(amOrPm);
                mTimePickerEnd.setAmOrPm(amOrPm);
            }
        });
    }

    mAllowAutoAdvance = true;
    setHour(mInitialHourOfDay, true);
    setMinute(mInitialMinute);

    // Set up for keyboard mode.
    mDoublePlaceholderText = res.getString(R.string.mdtp_time_placeholder);
    mDeletedKeyFormat = res.getString(R.string.mdtp_deleted_key);
    mPlaceholderText = mDoublePlaceholderText.charAt(0);
    mAmKeyCode = mPmKeyCode = -1;
    generateLegalTimesTree();
    if (mInKbMode) {
        mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES);
        tryStartingKbMode(-1);
        mHourView.invalidate();
        mHourViewEnd.invalidate();
    } else if (mTypedTimes == null) {
        mTypedTimes = new ArrayList<>();
    }

    // Set the title (if any)
    TextView timePickerHeader = (TextView) view.findViewById(R.id.time_picker_header);
    TextView timePickerHeaderEnd = (TextView) view.findViewById(R.id.time_picker_header_end);
    if (!mTitle.isEmpty()) {
        timePickerHeader.setVisibility(TextView.VISIBLE);
        timePickerHeader.setText(mTitle);
        timePickerHeaderEnd.setVisibility(TextView.VISIBLE);
        timePickerHeaderEnd.setText(mTitle);
    }

    // Set the theme at the end so that the initialize()s above don't counteract the theme.
    mTimePicker.setTheme(getActivity().getApplicationContext(), mThemeDark);
    mTimePickerEnd.setTheme(getActivity().getApplicationContext(), mThemeDark);

    //If an accent color has not been set manually, try and get it from the context
    if (mAccentColor == -1) {
        int accentColor = Utils.getAccentColorFromThemeIfAvailable(getActivity());
        if (accentColor != -1) {
            mAccentColor = accentColor;
        }
    }
    if (mAccentColor != -1) {
        mTimePicker.setAccentColor(mAccentColor);
        mTimePickerEnd.setAccentColor(mAccentColor);
        mOkButton.setTextColor(mAccentColor);
    } else {
        int circleBackground = res.getColor(R.color.mdtp_circle_background);
        int backgroundColor = res.getColor(R.color.mdtp_background_color);
        int darkBackgroundColor = res.getColor(R.color.mdtp_light_gray);
        int lightGray = res.getColor(R.color.mdtp_light_gray);

        mTimePicker.setBackgroundColor(mThemeDark ? lightGray : circleBackground);
        mTimePickerEnd.setBackgroundColor(mThemeDark ? lightGray : circleBackground);
        view.findViewById(R.id.time_picker_dialog)
                .setBackgroundColor(mThemeDark ? darkBackgroundColor : backgroundColor);
    }

    tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            if (tabId == "start") {
                setCurrentItemShowing(mTimePicker.getCurrentItemShowing(), true, false, true);
                setHour(mTimePicker.getHours(), false);
                setMinute(mTimePicker.getMinutes());
                updateAmPmDisplay(mTimePicker.getIsCurrentlyAmOrPm());
            } else {
                setCurrentItemShowing(mTimePickerEnd.getCurrentItemShowing(), true, false, true);
                setHour(mTimePickerEnd.getHours(), false);
                setMinute(mTimePickerEnd.getMinutes());
                updateAmPmDisplay(mTimePickerEnd.getIsCurrentlyAmOrPm());
            }
        }
    });
    return view;
}

From source file:com.daiv.android.twitter.ui.compose.Compose.java

public void setUpWindow() {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND,
            WindowManager.LayoutParams.FLAG_DIM_BEHIND);

    // Params for the window.
    // You can easily set the alpha and the dim behind the window from here
    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.alpha = 1.0f; // lower than one makes it more transparent
    params.dimAmount = .6f; // set it higher if you want to dim behind the window
    getWindow().setAttributes(params);//  w w w .  ja  va 2s  . co m
    getWindow().setBackgroundDrawable(new ColorDrawable(getResources().getColor(android.R.color.transparent)));

    // Gets the display size so that you can set the window to a percent of that
    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;

    // You could also easily used an integer value from the shared preferences to set the percent
    if (height > width) {
        getWindow().setLayout((int) (width * .9), (int) (height * .9));
    } else {
        getWindow().setLayout((int) (width * .7), (int) (height * .8));
    }
}

From source file:com.vuzix.samplewebrtc.android.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (TextUtils.isEmpty(SESSION_ID)) {
        Toast.makeText(this,
                ": SESSION_ID???\n"
                        + "MainActivity.java??SESSION_ID???????",
                Toast.LENGTH_LONG).show();
        finish();/* w  w w . j a va 2 s.co m*/
        return;
    }

    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    updateUis();
}

From source file:com.entertailion.android.launcher.Dialogs.java

/**
 * Display a grid of all installed apps + virtual apps. Allow user to launch
 * apps.//from   w ww .  j  a  v  a 2s  .  com
 * 
 * @param context
 * @param applications
 */
public static void displayAllApps(final Launcher context, final ArrayList<ApplicationInfo> applications) {
    final Dialog dialog = new Dialog(context);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.apps_grid);

    final GridView gridView = (GridView) dialog.findViewById(R.id.grid);
    gridView.setAdapter(new AllItemAdapter(context, getApplications(context, applications, false)));
    gridView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ItemInfo itemInfo = (ItemInfo) parent.getAdapter().getItem(position);
            itemInfo.invoke(context);
            context.showCover(false);
            dialog.dismiss();
            if (itemInfo instanceof ApplicationInfo) {
                ApplicationInfo applicationInfo = (ApplicationInfo) itemInfo;
                RecentAppsTable.persistRecentApp(context, applicationInfo);
            }
        }

    });
    gridView.setOnItemLongClickListener(new OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> gridView, View view, int pos, long arg3) {
            ItemInfo itemInfo = (ItemInfo) gridView.getAdapter().getItem(pos);
            if (itemInfo instanceof ApplicationInfo) {
                Uri packageURI = Uri.parse("package:" + itemInfo.getIntent().getComponent().getPackageName());
                Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
                context.startActivity(uninstallIntent);
                context.showCover(false);
                dialog.dismiss();
                Analytics.logEvent(Analytics.UNINSTALL_APP);
            }

            return false;
        }

    });
    gridView.setDrawingCacheEnabled(true);
    gridView.setOnKeyListener(onKeyListener);
    dialog.setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss(DialogInterface dialog) {
            context.showCover(false);
        }

    });
    context.showCover(true);
    dialog.show();
    Analytics.logEvent(Analytics.DIALOG_ALL_APPS);
}