List of usage examples for android.view Window FEATURE_NO_TITLE
int FEATURE_NO_TITLE
To view the source code for android.view Window FEATURE_NO_TITLE.
Click Source Link
From source file:dev.memento.MementoBrowser.java
/** Called when the activity is first created. */ @Override//from ww w. j a v a 2s . c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main); mUserAgent = getApplicationContext().getText(R.string.user_agent).toString(); // Set the date and time format SimpleDateTime.mDateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext()); SimpleDateTime.mTimeFormat = android.text.format.DateFormat.getTimeFormat(getApplicationContext()); mDateChosenButton = (Button) findViewById(R.id.dateChosen); mDateDisplayedView = (TextView) findViewById(R.id.dateDisplayed); // Launch the DatePicker dialog box mDateChosenButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showDialog(DIALOG_DATE); } }); // Set the current date mToday = new SimpleDateTime(); // Handle change in orientation gracefully if (savedInstanceState == null) { mCurrentUrl = getApplicationContext().getText(R.string.homepage).toString(); mOriginalUrl = mCurrentUrl; setChosenDate(mToday); setDisplayedDate(mToday); mMementos = new MementoList(); } else { mCurrentUrl = savedInstanceState.getString("mCurrentUrl"); mDateChosen = (SimpleDateTime) savedInstanceState.getSerializable("mDateChosen"); mDateDisplayed = (SimpleDateTime) savedInstanceState.getSerializable("mDateDisplayed"); setChosenDate(mDateChosen); setDisplayedDate(mDateDisplayed); } mTimegateUris = getResources().getStringArray(R.array.listTimegates); // Add some favicons of web archives used by proxy server mFavicons = new HashMap<String, Bitmap>(); mFavicons.put("ia", BitmapFactory.decodeResource(getResources(), R.drawable.ia_favicon)); mFavicons.put("webcite", BitmapFactory.decodeResource(getResources(), R.drawable.webcite_favicon)); mFavicons.put("national-archives", BitmapFactory.decodeResource(getResources(), R.drawable.national_archives_favicon)); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mProgressBar.setVisibility(View.GONE); mLocation = (TextView) findViewById(R.id.locationEditText); mLocation.setSelectAllOnFocus(true); mLocation.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // Replace title with URL when focus is lost if (hasFocus) mLocation.setText(mCurrentUrl); else if (mPageTitle.length() > 0) mLocation.setText(mPageTitle); } }); mLocation.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { //Log.d(LOG_TAG, "keyCode = " + keyCode + " event = " + event.getAction()); // Go to URL if user presses Go button if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) { mOriginalUrl = fixUrl(mLocation.getText().toString()); // Access live version if date is today or in the future if (mToday.compareTo(mDateChosen) <= 0) { Log.d(LOG_TAG, "Browsing to " + mOriginalUrl); mWebview.loadUrl(mOriginalUrl); // Clear since we are visiting a different page in the present mMementos.clear(); } else makeMementoRequests(); // Hide the virtual keyboard ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mLocation.getWindowToken(), 0); return true; } return false; } }); // TEST /* Context context = getBaseContext(); Drawable image = getImage(context, "http://web.archive.org/favicon.ico"); if (image == null) { System.out.println("image is null !!"); } else { //image.setBounds(5, 5, 5, 5); //ImageView imgView = new ImageView(context); //ImageView imgView = (ImageView)findViewById(R.id.imagetest); //imgView.setImageDrawable(image); mLocation.setCompoundDrawablesWithIntrinsicBounds(image, null, null, null); } */ mNextButton = (Button) findViewById(R.id.next); mNextButton.setEnabled(false); mNextButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Advance to next Memento // This could happen if the index has not been set yet if (mMementos.getCurrentIndex() < 0) { int index = mMementos.getIndex(mDateDisplayed); if (index < 0) { Log.d(LOG_TAG, "Could not find next Memento after date " + mDateDisplayed); return; } else mMementos.setCurrentIndex(index); } // Locate the next Memento in the list Memento nextMemento = mMementos.getNext(); if (nextMemento == null) { Log.d(LOG_TAG, "Still could not find next Memento!"); Log.d(LOG_TAG, "Current index is " + mMementos.getCurrentIndex()); } else { SimpleDateTime date = nextMemento.getDateTime(); setChosenDate(nextMemento.getDateTime()); showToast("Time travelling to next Memento on " + mDateChosen.dateFormatted()); mDateDisplayed = date; String redirectUrl = nextMemento.getUrl(); Log.d(LOG_TAG, "Sending browser to " + redirectUrl); mWebview.loadUrl(redirectUrl); // Just in case it wasn't already enabled mPreviousButton.setEnabled(true); // If this is the last memento, disable button if (mMementos.isLast(date)) mNextButton.setEnabled(false); } } }); mPreviousButton = (Button) findViewById(R.id.previous); mPreviousButton.setEnabled(false); mPreviousButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Advance to previous Memento // This could happen if the index has not been set yet if (mMementos.getCurrentIndex() < 0) { int index = mMementos.getIndex(mDateDisplayed); if (index < 0) { Log.d(LOG_TAG, "Could not find previous Memento before date " + mDateDisplayed); return; } else mMementos.setCurrentIndex(index); } // Locate the prev Memento in the list Memento prevMemento = mMementos.getPrevious(); if (prevMemento == null) { Log.d(LOG_TAG, "Still could not find previous Memento!"); Log.d(LOG_TAG, "Current index is " + mMementos.getCurrentIndex()); } else { SimpleDateTime date = prevMemento.getDateTime(); setChosenDate(date); showToast("Time travelling to previous Memento on " + mDateChosen.dateFormatted()); mDateDisplayed = date; String redirectUrl = prevMemento.getUrl(); Log.d(LOG_TAG, "Sending browser to " + redirectUrl); mWebview.loadUrl(redirectUrl); // Just in case it wasn't already enabled mNextButton.setEnabled(true); // If this is the first memento, disable button if (mMementos.isFirst(date)) mPreviousButton.setEnabled(false); } } }); mWebview = (WebView) findViewById(R.id.webview); mWebview.setWebViewClient(new MementoWebViewClient()); mWebview.setWebChromeClient(new MementoWebChromClient()); mWebview.getSettings().setJavaScriptEnabled(true); mWebview.loadUrl(mCurrentUrl); mWebview.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // Set focus here so focus is removed from the location text field // which will change the URL into the page's title. // There really should be a better way to do this, but it's a general // problem that other developers have ran into as well: // http://groups.google.com/group/android-developers/browse_thread/thread/9d1681a01f05e782?pli=1 if (mLocation.hasFocus()) { mWebview.requestFocus(); return true; } // Hide the virtual keyboard ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mLocation.getWindowToken(), 0); return false; } }); //testMementos(); }
From source file:com.teleca.jamendo.activity.PlayerActivity.java
/** Called when the activity is first created. */ @Override/*w w w . ja v a 2 s .co m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(JamendoApplication.TAG, "PlayerActivity.onCreate"); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.player); // XML binding mBetterRes = getResources().getString(R.string.better_res); mArtistTextView = (TextView) findViewById(R.id.ArtistTextView); mSongTextView = (TextView) findViewById(R.id.SongTextView); //AutoScrolling of long song titles mSongTextView.setEllipsize(TruncateAt.MARQUEE); mSongTextView.setHorizontallyScrolling(true); mSongTextView.setSelected(true); mCurrentTimeTextView = (TextView) findViewById(R.id.CurrentTimeTextView); mTotalTimeTextView = (TextView) findViewById(R.id.TotalTimeTextView); mRatingBar = (RatingBar) findViewById(R.id.TrackRowRatingBar); mCoverImageView = (RemoteImageView) findViewById(R.id.CoverImageView); mCoverImageView.setOnClickListener(mCoverOnClickListener); mCoverImageView.setDefaultImage(R.drawable.no_cd_300); mProgressBar = (ProgressBar) findViewById(R.id.ProgressBar); mReflectableLayout = (ReflectableLayout) findViewById(R.id.ReflectableLayout); mReflectiveSurface = (ReflectiveSurface) findViewById(R.id.ReflectiveSurface); if (mReflectableLayout != null && mReflectiveSurface != null) { mReflectableLayout.setReflectiveSurface(mReflectiveSurface); mReflectiveSurface.setReflectableLayout(mReflectableLayout); } handleIntent(); //used for Fade Out Animation handle control mHandlerOfFadeOutAnimation = new Handler(); mRunnableOfFadeOutAnimation = new Runnable() { public void run() { if (mFadeInAnimation.hasEnded()) mPlayImageButton.startAnimation(mFadeOutAnimation); } }; mPlayImageButton = (ImageButton) findViewById(R.id.PlayImageButton); mPlayImageButton.setOnClickListener(mPlayOnClickListener); mNextImageButton = (ImageButton) findViewById(R.id.NextImageButton); mNextImageButton.setOnTouchListener(mOnForwardTouchListener); mPrevImageButton = (ImageButton) findViewById(R.id.PrevImageButton); mPrevImageButton.setOnTouchListener(mOnRewindTouchListener); mStopImageButton = (ImageButton) findViewById(R.id.StopImageButton); mStopImageButton.setOnClickListener(mStopOnClickListener); mShuffleImageButton = (ImageButton) findViewById(R.id.ShuffleImageButton); mShuffleImageButton.setOnClickListener(mShuffleOnClickListener); mRepeatImageButton = (ImageButton) findViewById(R.id.RepeatImageButton); mRepeatImageButton.setOnClickListener(mRepeatOnClickListener); mFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_in); mFadeInAnimation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { mHandlerOfFadeOutAnimation.removeCallbacks(mRunnableOfFadeOutAnimation); mHandlerOfFadeOutAnimation.postDelayed(mRunnableOfFadeOutAnimation, 7500); } @Override public void onAnimationRepeat(Animation animation) { // nothing here } @Override public void onAnimationStart(Animation animation) { setMediaVisible(); } }); mFadeOutAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_out); mFadeOutAnimation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { setMediaGone(); } @Override public void onAnimationRepeat(Animation animation) { // nothing here } @Override public void onAnimationStart(Animation animation) { setFadeOutAnimation(); } }); mLicenseImageView = (RemoteImageView) findViewById(R.id.LicenseImageView); mCurrentAlbum = null; mSlidingDrawer = (SlidingDrawer) findViewById(R.id.drawer); // cupcake backwards compability int sdkVersion = Integer.parseInt(Build.VERSION.SDK); if (sdkVersion == Build.VERSION_CODES.CUPCAKE) { new CupcakeListener(); } mGesturesOverlayView = (GestureOverlayView) findViewById(R.id.gestures); mGesturesOverlayView .addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler()); }
From source file:fr.music.overallbrothers.activity.PlayerActivity.java
/** Called when the activity is first created. */ @Override// www .ja v a 2 s . co m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(JamendoApplication.TAG, "PlayerActivity.onCreate"); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.player); // XML binding mBetterRes = getResources().getString(R.string.better_res); mArtistTextView = (TextView) findViewById(R.id.ArtistTextView); mSongTextView = (TextView) findViewById(R.id.SongTextView); //AutoScrolling of long song titles mSongTextView.setEllipsize(TruncateAt.MARQUEE); mSongTextView.setHorizontallyScrolling(true); mSongTextView.setSelected(true); mCurrentTimeTextView = (TextView) findViewById(R.id.CurrentTimeTextView); mTotalTimeTextView = (TextView) findViewById(R.id.TotalTimeTextView); mRatingBar = (RatingBar) findViewById(R.id.TrackRowRatingBar); mCoverImageView = (RemoteImageView) findViewById(R.id.CoverImageView); mCoverImageView.setOnClickListener(mCoverOnClickListener); mCoverImageView.setDefaultImage(R.drawable.no_cd_300); mProgressBar = (ProgressBar) findViewById(R.id.ProgressBar); mReflectableLayout = (ReflectableLayout) findViewById(R.id.ReflectableLayout); mReflectiveSurface = (ReflectiveSurface) findViewById(R.id.ReflectiveSurface); if (mReflectableLayout != null && mReflectiveSurface != null) { mReflectableLayout.setReflectiveSurface(mReflectiveSurface); mReflectiveSurface.setReflectableLayout(mReflectableLayout); } handleIntent(); //used for Fade Out Animation handle control mHandlerOfFadeOutAnimation = new Handler(); mRunnableOfFadeOutAnimation = new Runnable() { public void run() { if (mFadeInAnimation.hasEnded()) mPlayImageButton.startAnimation(mFadeOutAnimation); } }; mPlayImageButton = (ImageButton) findViewById(R.id.PlayImageButton); mPlayImageButton.setOnClickListener(mPlayOnClickListener); mNextImageButton = (ImageButton) findViewById(R.id.NextImageButton); mNextImageButton.setOnTouchListener(mOnForwardTouchListener); mPrevImageButton = (ImageButton) findViewById(R.id.PrevImageButton); mPrevImageButton.setOnTouchListener(mOnRewindTouchListener); mStopImageButton = (ImageButton) findViewById(R.id.StopImageButton); mStopImageButton.setOnClickListener(mStopOnClickListener); mPrevListImageButton = (ImageButton) findViewById(R.id.PrevListImageButton); mPrevListImageButton.setOnClickListener(mPrevListOnClickListener); mShuffleImageButton = (ImageButton) findViewById(R.id.ShuffleImageButton); mShuffleImageButton.setOnClickListener(mShuffleOnClickListener); mRepeatImageButton = (ImageButton) findViewById(R.id.RepeatImageButton); mRepeatImageButton.setOnClickListener(mRepeatOnClickListener); mFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_in); mFadeInAnimation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { mHandlerOfFadeOutAnimation.removeCallbacks(mRunnableOfFadeOutAnimation); mHandlerOfFadeOutAnimation.postDelayed(mRunnableOfFadeOutAnimation, 7500); } @Override public void onAnimationRepeat(Animation animation) { // nothing here } @Override public void onAnimationStart(Animation animation) { setMediaVisible(); } }); mFadeOutAnimation = AnimationUtils.loadAnimation(this, R.anim.fade_out); mFadeOutAnimation.setAnimationListener(new AnimationListener() { @Override public void onAnimationEnd(Animation animation) { setMediaGone(); } @Override public void onAnimationRepeat(Animation animation) { // nothing here } @Override public void onAnimationStart(Animation animation) { setFadeOutAnimation(); } }); mLicenseImageView = (RemoteImageView) findViewById(R.id.LicenseImageView); mCurrentAlbum = null; mSlidingDrawer = (SlidingDrawer) findViewById(R.id.drawer); // cupcake backwards compability int sdkVersion = Integer.parseInt(Build.VERSION.SDK); if (sdkVersion == Build.VERSION_CODES.CUPCAKE) { new CupcakeListener(); } mGesturesOverlayView = (GestureOverlayView) findViewById(R.id.gestures); mGesturesOverlayView .addOnGesturePerformedListener(JamendoApplication.getInstance().getPlayerGestureHandler()); }
From source file:com.gcloud.gaadi.ui.sleepbot.datetimepicker.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.time_picker_dialog, null); KeyboardListener keyboardListener = new KeyboardListener(); view.setOnKeyListener(keyboardListener); Resources res = getResources(); mHourPickerDescription = res.getString(R.string.hour_picker_description); mSelectHours = res.getString(R.string.select_hours); mMinutePickerDescription = res.getString(R.string.minute_picker_description); mSelectMinutes = res.getString(R.string.select_minutes); mBlue = res.getColor(R.color.orange); mBlack = res.getColor(R.color.numbers_text_color); mHourView = (TextView) view.findViewById(R.id.hours); mHourView.setOnKeyListener(keyboardListener); mHourSpaceView = (TextView) view.findViewById(R.id.hour_space); mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space); mMinuteView = (TextView) view.findViewById(R.id.minutes); mMinuteView.setOnKeyListener(keyboardListener); mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label); mAmPmTextView.setOnKeyListener(keyboardListener); if (Build.VERSION.SDK_INT <= 14) { mAmPmTextView.setTransformationMethod(new TransformationMethod() { private final Locale locale = getResources().getConfiguration().locale; @Override//from w w w . ja v a 2 s. c o m public CharSequence getTransformation(CharSequence source, View view) { return source != null ? source.toString().toUpperCase(locale) : null; } @Override public void onFocusChanged(View view, CharSequence sourceText, boolean focused, int direction, Rect previouslyFocusedRect) { } }); } String[] amPmTexts = new DateFormatSymbols().getAmPmStrings(); mAmText = amPmTexts[0]; mPmText = amPmTexts[1]; mTimePicker = (RadialPickerLayout) view.findViewById(R.id.time_picker); mTimePicker.setOnValueSelectedListener(this); mTimePicker.setOnKeyListener(keyboardListener); mTimePicker.initialize(getActivity(), mInitialHourOfDay, mInitialMinute, mIs24HourMode, mVibrate); int currentItemShowing = HOUR_INDEX; if (savedInstanceState != null && savedInstanceState.containsKey(KEY_CURRENT_ITEM_SHOWING)) { currentItemShowing = savedInstanceState.getInt(KEY_CURRENT_ITEM_SHOWING); } setCurrentItemShowing(currentItemShowing, false, true, true); mTimePicker.invalidate(); mHourView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setCurrentItemShowing(HOUR_INDEX, true, false, true); mTimePicker.tryVibrate(); } }); mMinuteView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { setCurrentItemShowing(MINUTE_INDEX, true, false, true); mTimePicker.tryVibrate(); } }); mDoneButton = (TextView) view.findViewById(R.id.done_button); mDoneButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { onDoneButtonClick(); } }); mDoneButton.setOnKeyListener(keyboardListener); // Enable or disable the AM/PM view. mAmPmHitspace = view.findViewById(R.id.ampm_hitspace); if (mIs24HourMode) { mAmPmTextView.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); separatorView.setLayoutParams(paramsSeparator); } else { mAmPmTextView.setVisibility(View.VISIBLE); updateAmPmDisplay(mInitialHourOfDay < 12 ? AM : PM); mAmPmHitspace.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mTimePicker.tryVibrate(); int amOrPm = mTimePicker.getIsCurrentlyAmOrPm(); if (amOrPm == AM) { amOrPm = PM; } else if (amOrPm == PM) { amOrPm = AM; } updateAmPmDisplay(amOrPm); mTimePicker.setAmOrPm(amOrPm); } }); } mAllowAutoAdvance = true; setHour(mInitialHourOfDay, true); setMinute(mInitialMinute); // Set up for keyboard mode. mDoublePlaceholderText = res.getString(R.string.time_placeholder); mDeletedKeyFormat = res.getString(R.string.deleted_key); mPlaceholderText = mDoublePlaceholderText.charAt(0); mAmKeyCode = mPmKeyCode = -1; generateLegalTimesTree(); if (mInKbMode) { mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES); tryStartingKbMode(-1); mHourView.invalidate(); } else if (mTypedTimes == null) { mTypedTimes = new ArrayList<Integer>(); } return view; }
From source file:com.cerema.cloud2.ui.dialog.SslUntrustedCertDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { Log_OC.d(TAG, "onCreateDialog, savedInstanceState is " + savedInstanceState); final Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); return dialog; }
From source file:cm.aptoide.pt.Aptoide.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); keepScreenOn = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "Full Power"); DownloadQueueServiceIntent = new Intent(getApplicationContext(), DownloadQueueService.class); startService(DownloadQueueServiceIntent); //@dsilveira #534 +10lines Check if Aptoide is already running to avoid wasting time and showing the splash ActivityManager activityManager = (ActivityManager) getApplicationContext() .getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> running = activityManager.getRunningTasks(Integer.MAX_VALUE); for (RunningTaskInfo runningTask : running) { if (runningTask.baseActivity.getClassName().equals("cm.aptoide.pt.RemoteInTab")) { //RemoteInTab is the real Aptoide Activity Message msg = new Message(); msg.what = LOAD_TABS;/*from w w w.j a v a 2s .c om*/ startHandler.sendMessage(msg); return; } } Log.d("Aptoide", "******* \n Downloads will be made to: " + Environment.getExternalStorageDirectory().getPath() + "\n ********"); sPref = getSharedPreferences("aptoide_prefs", MODE_PRIVATE); prefEdit = sPref.edit(); db = new DbHandler(this); PackageManager mPm = getPackageManager(); try { pkginfo = mPm.getPackageInfo("cm.aptoide.pt", 0); } catch (NameNotFoundException e) { } requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); try { if (pkginfo.versionCode < Integer.parseInt(getXmlElement("versionCode"))) { Log.d("Aptoide-VersionCode", "Using version " + pkginfo.versionCode + ", suggest update!"); requestUpdateSelf(); } else { proceed(); } } catch (Exception e) { e.printStackTrace(); proceed(); } }
From source file:com.c4fcm.actionpath.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set the pattern for the latitude and longitude format String latLngPattern = getString(R.string.lat_lng_pattern); // Set the format for latitude and longitude mLatLngFormat = new DecimalFormat(latLngPattern); // Localize the format mLatLngFormat.applyLocalizedPattern(mLatLngFormat.toLocalizedPattern()); // Set the pattern for the radius format String radiusPattern = getString(R.string.radius_pattern); // Set the format for the radius mRadiusFormat = new DecimalFormat(radiusPattern); // Localize the pattern mRadiusFormat.applyLocalizedPattern(mRadiusFormat.toLocalizedPattern()); // Create a new broadcast receiver to receive updates from the listeners and service mBroadcastReceiver = new GeofenceSampleReceiver(); // Create a new broadcast receiver to receive updates from SynchronizeDataService mSyncDataReceiver = new SynchronizeDataReceiver(); // Create an intent filter for the broadcast receiver mIntentFilter = new IntentFilter(); // Action for broadcast Intents that report successful addition of geofences mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_ADDED); // Action for broadcast Intents that report successful removal of geofences mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_REMOVED); // Action for broadcast Intents containing various types of geofencing errors mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCE_ERROR); // All Location Services sample apps use this category mIntentFilter.addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES); mSyncIntentFilter = new IntentFilter(); mSyncIntentFilter.addAction(GeofenceUtils.UPDATE_GEOFENCES); // Instantiate a new geofence storage area Context ctx = this.getApplicationContext(); Log.i("MainActivityContext", ctx.toString()); mPrefs = new SurveyGeofenceStore(ctx); // Instantiate the current List of geofences mCurrentGeofences = new ArrayList<Geofence>(); // Instantiate a Geofence requester mGeofenceRequester = new GeofenceRequester(this); // Instantiate a Geofence remover mGeofenceRemover = new GeofenceRemover(this); //instantiate list of geofences mUIGeofences = new ArrayList<SurveyGeofence>(); // addGeoFences(); //disallow the title bar from appearing this.requestWindowFeature(Window.FEATURE_NO_TITLE); //Remove notification bar //this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // Attach to the main UI setContentView(R.layout.activity_main); Log.i("MainActivity.OnCreate", "synchronizeDataService"); synchronizeDataService();/*from w w w. j a va 2s. c o m*/ }
From source file:com.example.damerap_ver1.IntroVideoActivity.java
@Override protected void onCreate(Bundle pSavedInstanceState) { super.onCreate(pSavedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // create the layout of the view setupView();/* w w w . j a v a 2 s.c o m*/ // determine the messages to be displayed as the view loads the video extractMessages(); // grab a wake-lock so that the video can play without the screen being turned off PowerManager lPwrMgr = (PowerManager) getSystemService(POWER_SERVICE); mWakeLock = lPwrMgr.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, TAG_WAKELOCK); mWakeLock.acquire(); mProgressMessage.setText(mMsgInit); // extract the playlist or video id from the intent that started this video Uri lVideoIdUri = this.getIntent().getData(); if (lVideoIdUri == null) { Log.i(this.getClass().getSimpleName(), "No video ID was specified in the intent. Closing video activity."); finish(); } String lVideoSchemeStr = lVideoIdUri.getScheme(); String lVideoIdStr = lVideoIdUri.getEncodedSchemeSpecificPart(); if (lVideoIdStr == null) { Log.i(this.getClass().getSimpleName(), "No video ID was specified in the intent. Closing video activity."); finish(); } if (lVideoIdStr.startsWith("//")) { if (lVideoIdStr.length() > 2) { lVideoIdStr = lVideoIdStr.substring(2); } else { Log.i(this.getClass().getSimpleName(), "No video ID was specified in the intent. Closing video activity."); finish(); } } /////////////////// // extract either a video id or a playlist id, depending on the uri scheme YouTubeId lYouTubeId = null; if (lVideoSchemeStr != null && lVideoSchemeStr.equalsIgnoreCase(SCHEME_YOUTUBE_PLAYLIST)) { lYouTubeId = new PlaylistId(lVideoIdStr); } else if (lVideoSchemeStr != null && lVideoSchemeStr.equalsIgnoreCase(SCHEME_YOUTUBE_VIDEO)) { lYouTubeId = new VideoId(lVideoIdStr); } if (lYouTubeId == null) { Log.i(this.getClass().getSimpleName(), "Unable to extract video ID from the intent. Closing video activity."); finish(); } mQueryYouTubeTask = (QueryYouTubeTask) new QueryYouTubeTask().execute(lYouTubeId); }
From source file:com.android.datetimepicker.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.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.hour_picker_description); mSelectHours = res.getString(R.string.select_hours); mMinutePickerDescription = res.getString(R.string.minute_picker_description); mSelectMinutes = res.getString(R.string.select_minutes); mSelectedColor = res.getColor(mThemeDark ? R.color.red : R.color.blue); mUnselectedColor = res.getColor(mThemeDark ? R.color.white : R.color.numbers_text_color); mHourView = (TextView) view.findViewById(R.id.hours); mHourView.setOnKeyListener(keyboardListener); mHourSpaceView = (TextView) view.findViewById(R.id.hour_space); mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space); mMinuteView = (TextView) view.findViewById(R.id.minutes); mMinuteView.setOnKeyListener(keyboardListener); mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label); mAmPmTextView.setOnKeyListener(keyboardListener); String[] amPmTexts = new DateFormatSymbols().getAmPmStrings(); mAmText = amPmTexts[0];/*from w ww . ja va 2 s .c o m*/ mPmText = amPmTexts[1]; mHapticFeedbackController = new HapticFeedbackController(getActivity()); mTimePicker = (RadialPickerLayout) view.findViewById(R.id.time_picker); mTimePicker.setOnValueSelectedListener(this); mTimePicker.setOnKeyListener(keyboardListener); mTimePicker.initialize(getActivity(), mHapticFeedbackController, mInitialHourOfDay, mInitialMinute, mIs24HourMode); int currentItemShowing = HOUR_INDEX; if (savedInstanceState != null && savedInstanceState.containsKey(KEY_CURRENT_ITEM_SHOWING)) { currentItemShowing = savedInstanceState.getInt(KEY_CURRENT_ITEM_SHOWING); } setCurrentItemShowing(currentItemShowing, false, true, true); mTimePicker.invalidate(); mHourView.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(); } }); mDoneButton = (TextView) view.findViewById(R.id.done_button); mDoneButton.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()); } dismiss(); } }); mDoneButton.setOnKeyListener(keyboardListener); // Enable or disable the AM/PM view. mAmPmHitspace = view.findViewById(R.id.ampm_hitspace); if (mIs24HourMode) { mAmPmTextView.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); separatorView.setLayoutParams(paramsSeparator); } else { mAmPmTextView.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); } }); } mAllowAutoAdvance = true; setHour(mInitialHourOfDay, true); setMinute(mInitialMinute); // Set up for keyboard mode. mDoublePlaceholderText = res.getString(R.string.time_placeholder); mDeletedKeyFormat = res.getString(R.string.deleted_key); mPlaceholderText = mDoublePlaceholderText.charAt(0); mAmKeyCode = mPmKeyCode = -1; generateLegalTimesTree(); if (mInKbMode) { mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES); tryStartingKbMode(-1); mHourView.invalidate(); } else if (mTypedTimes == null) { mTypedTimes = new ArrayList<Integer>(); } // Set the theme at the end so that the initialize()s above don't counteract the theme. mTimePicker.setTheme(getActivity().getApplicationContext(), mThemeDark); // Prepare some colors to use. int white = res.getColor(R.color.white); int circleBackground = res.getColor(R.color.circle_background); int line = res.getColor(R.color.line_background); int timeDisplay = res.getColor(R.color.numbers_text_color); ColorStateList doneTextColor = res.getColorStateList(R.color.done_text_color); int doneBackground = R.drawable.done_background_color; int darkGray = res.getColor(R.color.dark_gray); int lightGray = res.getColor(R.color.light_gray); int darkLine = res.getColor(R.color.line_dark); ColorStateList darkDoneTextColor = res.getColorStateList(R.color.done_text_color_dark); int darkDoneBackground = R.drawable.done_background_color_dark; // Set the colors for each view based on the theme. view.findViewById(R.id.time_display_background).setBackgroundColor(mThemeDark ? darkGray : white); view.findViewById(R.id.time_display).setBackgroundColor(mThemeDark ? darkGray : white); ((TextView) view.findViewById(R.id.separator)).setTextColor(mThemeDark ? white : timeDisplay); ((TextView) view.findViewById(R.id.ampm_label)).setTextColor(mThemeDark ? white : timeDisplay); view.findViewById(R.id.line).setBackgroundColor(mThemeDark ? darkLine : line); mDoneButton.setTextColor(mThemeDark ? darkDoneTextColor : doneTextColor); mTimePicker.setBackgroundColor(mThemeDark ? lightGray : circleBackground); mDoneButton.setBackgroundResource(mThemeDark ? darkDoneBackground : doneBackground); return view; }
From source file:com.fvd.nimbus.BrowseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up ); //overridePendingTransition(R.anim.carbon_slide_in,R.anim.carbon_slide_out); //overridePendingTransition(R.anim.activity_open_scale,R.anim.activity_close_translate); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); try {/*w ww . j a v a 2 s .c o m*/ requestWindowFeature(Window.FEATURE_NO_TITLE); } catch (Exception e) { e.printStackTrace(); } clipData = new DataExchange(); isInitNow = true; setContentView(R.layout.screen_browser); serverHelper.getInstance().setCallback(this, this); prefs = PreferenceManager.getDefaultSharedPreferences(this); lastUrl = prefs.getString("LAST_URL", ""); saveCSS = prefs.getString("clipStyle", "1").equals("1"); ctx = this; //adapter = new TextAdapter(this); /*Uri data = getIntent().getData(); if(data!=null){ lastUrl=data.toString(); }*/ Intent intent = getIntent(); String action = intent.getAction(); String type = intent.getType(); if (Intent.ACTION_VIEW.equals(action) /*&& type != null*/) { Uri data = intent.getData(); if (data != null) { lastUrl = data.toString(); appSettings.appendLog("browse:onCreate " + lastUrl); } } else if (Intent.ACTION_SEND.equals(action) /*&& type != null*/) { if ("text/plain".equals(type)) { String surl = intent.getStringExtra(Intent.EXTRA_TEXT); if (surl.contains(" ")) { String[] arr = surl.replace("\t", " ").split(" "); for (String s : arr) { if (s.contains("://")) { lastUrl = s.trim(); break; } } } else if (surl.contains("://")) lastUrl = surl.trim(); appSettings.appendLog("browse:onCreate " + lastUrl); } } drawer = (DrawerLayout) findViewById(R.id.root); View v = findViewById(R.id.wv); wv = (fvdWebView) findViewById(R.id.wv); wv.setEventsHandler(this); //registerForContextMenu(wv); urlField = (AutoCompleteTextView) findViewById(R.id.etAddess); urlField.setSelectAllOnFocus(true); urlField.setOnEditorActionListener(new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { /*InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0);*/ onNavButtonClicked(); return true; } else if (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) { onNavButtonClicked(); return true; } return false; } }); onViewCreated(); handler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case 0: findViewById(R.id.bZoomStack).setVisibility(View.VISIBLE); findViewById(R.id.bToggleMenu).setVisibility(View.GONE); break; default: break; } } }; navButton = (ImageButton) findViewById(R.id.ibReloadWebPage); navButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //Toast.makeText(getApplicationContext(), "You made a mess", Toast.LENGTH_LONG).show(); onNavButtonClicked(); } }); findViewById(R.id.bSavePageFragment).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //toggleTools(); floatMenu.collapse(); if (!wv.getInjected()) Toast.makeText(ctx, getString(R.string.wait_load), Toast.LENGTH_LONG).show(); clipMode = 2; if (wv.getInjected()/* && !v.isSelected()*/) { wv.setCanClip(true); v.setSelected(true); Toast.makeText(ctx, ctx.getString(R.string.use_longtap), Toast.LENGTH_LONG).show(); } } }); (findViewById(R.id.bSaveFullPage)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { floatMenu.collapse(); if (wv.getInjected()) { wv.setCanClip(false); wv.saveArticle(); clipMode = 1; progressDialog = ProgressDialog.show(v.getContext(), "Nimbus Clipper", getString(R.string.please_wait), true, false); } else { Toast.makeText(ctx, getString(R.string.wait_load), Toast.LENGTH_LONG).show(); } } }); findViewById(R.id.bTakeScreenshot).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { //toggleTools(); floatMenu.collapse(); findViewById(R.id.bSaveFullPage).setVisibility(View.GONE); findViewById(R.id.bSavePageFragment).setVisibility(View.GONE); findViewById(R.id.bTakeScreenshot).setVisibility(View.GONE); if (wv.getInjected()) { wv.setCanClip(false); } findViewById(R.id.bToggleMenu).setVisibility(View.GONE); /*screenCapture(); findViewById(R.id.bToggleMenu).setVisibility(View.VISIBLE);*/ findViewById(R.id.bTakeScreenshot).postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub screenCapture(); findViewById(R.id.bToggleMenu).setVisibility(View.VISIBLE); finish(); } }, 10); //showDialog(DIALOG_CAPTURE); } }); (findViewById(R.id.bDone)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { { try { wv.setCanClip(false); wv.endSelectionMode(); //findViewById(R.id.bSavePageFragment).setSelected(false); clipMode = 2; wv.endSelectionMode(); String selHtml = clipData.getContent(); if (selHtml.length() > 0) { String ss = selHtml.substring(0, selHtml.indexOf(">") + 1).toLowerCase(); int j = ss.indexOf("<div"); if (j == 0) { j = ss.indexOf("style"); if (j > 0) { int k = ss.indexOf("\"", j + 11); if (k > 0) selHtml = selHtml.replace(selHtml.substring(j, k + 1), ""); } //selHtml="<DIV>"+selHtml.substring(ss.length()); } clipData.setContent(selHtml); clipData.setTitle(wv.getTitle()); /*if (true){ if(sessionId.length() == 0 || userPass.length()==0) showSettings(); else { if(prefs.getBoolean("check_fast", false)){ sendNote(wv.getTitle(), clipData.getContent(), parent, tag); clipData.setContent(""); } else { //serverHelper.getInstance().setCallback(this,this); if(appSettings.sessionId.length()>0) { serverHelper.getInstance().sendRequest("notes:getFolders", "",""); } } } wv.endSelectionMode(); } */ Intent i = new Intent(getApplicationContext(), previewActivity.class); i.putExtra("content", clipData); startActivityForResult(i, 5); //overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up ); overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); } //clipData.setContent(""); } catch (Exception e) { BugReporter.Send("onEndSelection", e.getMessage()); } } //showDialog(DIALOG_CAPTURE); } }); findViewById(R.id.bZoomIn).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { wv.ZoomInSelection(); } }); findViewById(R.id.bZoomOut).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { wv.ZoomOutSelection(); } }); setNavButtonState(NavButtonState.NBS_GO); progressBar = (ProgressBar) findViewById(R.id.progressbar); //CookieSyncManager.createInstance(this); //webSettings.setLoadsImagesAutomatically(imgOn); userMail = prefs.getString("userMail", ""); userPass = prefs.getString("userPass", ""); sessionId = prefs.getString("sessionId", ""); appSettings.sessionId = sessionId; appSettings.userMail = userMail; appSettings.userPass = userPass; if ("1".equals(prefs.getString("userAgent", "1"))) { wv.setUserAgent(null); } else wv.setUserAgent(deskAgent); final Activity activity = this; //lastUrl="file:///android_asset/android.html"; if (lastUrl.length() > 0) { //wv.navigate(lastUrl); //if(!urlField.getText().toString().equals(wv.getUrl())) urlField.setText(lastUrl); openURL(); } isInitNow = false; urlField.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { // TODO Auto-generated method stub /*String item = (String)parent.getItemAtPosition(position); Toast.makeText( getApplicationContext(), " " + item, Toast.LENGTH_SHORT).show();*/ openURL(); } }); urlField.addTextChangedListener(this); parent = prefs.getString("remFolderId", "default"); /*ListView listView = (ListView) findViewById(R.id.left_drawer); listView.setAdapter(new DrawerMenuAdapter(this,getResources().getStringArray(R.array.lmenu_browser))); listView.setOnItemClickListener(this);*/ }