@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (!isGooglePlayServicesAvailable()) { finish(); } // Create view setContentView(R.layout.activity_home_page); // Spinner spinner = (ProgressBar) findViewById(R.id.progressBar); spinner.bringToFront(); spinner.setVisibility(View.GONE); // Add Maps mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map); mapsActivity = new MapsActivity(getBaseContext(), mapFragment, this); // Get Autocomplete textview autoCompView = (AutoCompleteTextView) findViewById(R.id.destination); autoCompView.setAdapter(new GooglePlacesAutocompleteAdapter(this, R.layout.list_item)); autoCompView.setOnItemClickListener(this); // Add background to Done button submitUpdate = (Button) findViewById(R.id.submitUpdate); submitUpdate.getBackground().setColorFilter(0xFF000000, PorterDuff.Mode.MULTIPLY); // Set Date TimePicker setDateTimePicker(); // Call the method to call the Maps activity // Set the drawer setupDrawer(); addDrawerItems(); // Get hidden Panel hiddenPanel = findViewById(R.id.hidden_panel); // Call to get API esults apiResults = new GetAPIResults(getBaseContext(), mapFragment, this); // Check if there is a savedInstance if (savedInstanceState != null && savedInstanceState.getString("parking_listings") != null) { saved = true; JSONArray parking_listings_array = null; try { latitude = savedInstanceState.getDouble("lat"); longitude = savedInstanceState.getDouble("lng"); parking_listings = savedInstanceState.getString("parking_listings"); parking_listings_array = new JSONArray(parking_listings); mapsActivity.addMapsOnMarker(parking_listings_array, latitude, longitude); } catch (JSONException e) { e.printStackTrace(); } } else { mMap = mapFragment.getMap(); getCurrentLocationOfUser(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityUtils.setLayout(this, R.layout.activity_starting_point, R.layout.title_bar); mProgressBar = (ProgressBar) findViewById(R.id.dictionary_progressBar); mTopBarEditText = (TextView) findViewById(R.id.topbar_editText); mTopBarEditText.addTextChangedListener( new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {} @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {} @Override public void afterTextChanged(Editable editable) { mProgressBar.setVisibility(View.VISIBLE); mProgressBar.bringToFront(); new PopulateListView().execute(editable.toString()); } }); mProgressBar.setVisibility(View.VISIBLE); mProgressBar.bringToFront(); new PopulateListView().execute(); LinearLayout ll = (LinearLayout) findViewById(R.id.titlebar_linearlayout_tap_to_change_directions); ll.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { ImageView iv = (ImageView) findViewById(R.id.titlebar_arrow_tap_to_change_directions); TextView silesianTextView = (TextView) findViewById(R.id.titlebar_silesian_textView); TextView polishTextView = (TextView) findViewById(R.id.titlebar_polish_textView); if (isSilesianToPolish) { isSilesianToPolish = false; // // iv.setImageDrawable(getResources().getDrawable(R.drawable.left_arrow)); silesianTextView.setText(R.string.to_silesian); polishTextView.setText(R.string.from_polish); } else { isSilesianToPolish = true; // // iv.setImageDrawable(getResources().getDrawable(R.drawable.right_arrow)); silesianTextView.setText(R.string.from_silesian); polishTextView.setText(R.string.to_polish); } new PopulateListView().execute(); mTopBarEditText.setText(""); } }); }
/* * called when the post doesn't exist in local db, need to get it from server */ private void requestPost() { final ProgressBar progress = (ProgressBar) getView().findViewById(R.id.progress_loading); progress.setVisibility(View.VISIBLE); progress.bringToFront(); ReaderActions.ActionListener actionListener = new ReaderActions.ActionListener() { @Override public void onActionResult(boolean succeeded) { if (isAdded()) { progress.setVisibility(View.GONE); if (succeeded) { showPost(); } else { postFailed(); } } } }; ReaderPostActions.requestPost(mBlogId, mPostId, actionListener); }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ButterKnife.bind(this, view); ctx = getActivity(); feedProgress.bringToFront(); feedRecyclerview.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(getActivity()); feedRecyclerview.setLayoutManager(mLayoutManager); feedAdapter = new FeedAdapter(getActivity()); feedRecyclerview.setAdapter(feedAdapter); retrofit = new Retrofit.Builder() .baseUrl(Utilitys.BASE_URL) .addConverterFactory(GsonConverterFactory.create()) .build(); reqCall = retrofit.create(RequestCallBack.class); IReport application = (IReport) getActivity().getApplication(); mTracker = application.getDefaultTracker(); }
@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(); // determine the messages to be displayed as the view loads the video extractMessages(); // set the flag to keep the screen ON so that the video can play without the screen being turned // off getWindow() .setFlags( android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mProgressBar.bringToFront(); mProgressBar.setVisibility(View.VISIBLE); 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); }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) return; requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); extras = getIntent().getExtras(); // handle extras if (extras == null) { wrapItUp(RESULT_CANCELED, "Error: No options provided"); } else { if (extras.containsKey("isStreaming")) { isStreaming = extras.getBoolean("isStreaming"); } if (extras.containsKey("shouldAutoClose")) { mShouldAutoClose = extras.getBoolean("shouldAutoClose"); } mMediaType = extras.getString("type"); if (mMediaType == null) mMediaType = MEDIA_TYPE_VIDEO; mMediaPlayer = new MediaPlayer(this); mMediaController = new MediaController(this, !isStreaming); mMediaController.setMediaPlayer(this); mMediaPlayer.setOnBufferingUpdateListener(this); mMediaPlayer.setOnCompletionListener(this); mMediaPlayer.setOnErrorListener(this); mMediaPlayer.setOnPreparedListener(this); mMediaPlayer.setOnVideoSizeChangedListener(this); setVolumeControlStream(AudioManager.STREAM_MUSIC); RelativeLayout relLayout = new RelativeLayout(this); if (extras.containsKey("bgColor")) { try { bgColor = Color.parseColor(extras.getString("bgColor")); } catch (Exception e) { Log.v(TAG, "Error parsing color"); Log.e(TAG, e.toString()); bgColor = DEFAULT_BG_COLOR; } } relLayout.setBackgroundColor(bgColor); RelativeLayout.LayoutParams relLayoutParam = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); relLayoutParam.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mMediaView = new SurfaceView(this); mMediaView.setLayoutParams(relLayoutParam); relLayout.addView(mMediaView); mProgressBar = new ProgressBar(this); mProgressBar.setIndeterminate(true); mProgressBar.setVisibility(View.VISIBLE); RelativeLayout.LayoutParams pblp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); pblp.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); mProgressBar.setLayoutParams(pblp); relLayout.addView(mProgressBar); mProgressBar.bringToFront(); mMediaController.setAnchorView(relLayout); mMediaController.setEnabled(true); if (mMediaType.equalsIgnoreCase(MEDIA_TYPE_AUDIO)) { mMediaView.setBackgroundColor(bgColor); if (extras.containsKey("bgImage")) { if (extras.containsKey("bgImageScaleType")) { String scaleType = extras.getString("bgImageScaleType"); if (scaleType.equalsIgnoreCase("fit")) { bgImageScaleType = ImageView.ScaleType.FIT_CENTER; } else if (scaleType.equalsIgnoreCase("stretch")) { bgImageScaleType = ImageView.ScaleType.FIT_XY; } else { bgImageScaleType = ImageView.ScaleType.CENTER; } } bgImage = new ImageView(this); new ImageLoadTask(extras.getString("bgImage"), this).execute(null, null); RelativeLayout.LayoutParams bgImageLayoutParam = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); bgImageLayoutParam.addRule(RelativeLayout.CENTER_IN_PARENT); bgImage.setLayoutParams(bgImageLayoutParam); bgImage.setScaleType(bgImageScaleType); relLayout.addView(bgImage); } } setContentView(relLayout, relLayoutParam); holder = mMediaView.getHolder(); holder.addCallback(this); holder.setFormat(PixelFormat.RGBA_8888); } }
public void addProgressBar() { if (progressBar != null) { progressBar.setVisibility(View.VISIBLE); progressBar.bringToFront(); } }