List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable
public ColorDrawable(@ColorInt int color)
From source file:com.freecast.LudoCast.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_main); Log.d(TAG, "onCreate"); ActionBar actionBar = getSupportActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(android.R.color.transparent)); mAppConnected = false;// ww w . java2 s. co m Vibratorstatus = true; ishost = false; updatestatus = false; connectstatus = false; editText = (EditText) findViewById(R.id.editText1); Blankview = (View) findViewById(R.id.BlankView); editText.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { editText.setCursorVisible(true); } }); editText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence text, int start, int before, int count) { writeFileData(fileName, editText.getText().toString()); } @Override public void beforeTextChanged(CharSequence text, int start, int count, int after) { } @Override public void afterTextChanged(Editable edit) { writeFileData(fileName, editText.getText().toString()); } }); readFileData(fileName); mCastManager = CastApplication.getCastManager(this); mAppConnected = mCastManager.isConnected(); Log.d(TAG, "onCreate mAppConnected = " + mAppConnected); setupCastListener(); protocol = new LudoProtocol(); getOverflowMenu(); Createbnt = (Button) findViewById(R.id.Startgame); Createbnt.setEnabled(false); Createbnt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { username = editText.getText().toString(); Log.d(TAG, "username = " + username); if (username.equals("")) { Toast.makeText(MainActivity.this, "Please enter your name first !!!", Toast.LENGTH_SHORT) .show(); return; } else { writeFileData(fileName, username); } if (mAppConnected) { try { String msg = protocol.genMessage_connect(username); Log.d(TAG, "connect message: " + msg); sendMessage(msg); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { Toast.makeText(MainActivity.this, "Connect not ready, fail to start game", Toast.LENGTH_SHORT) .show(); } } }); Button Gamerule = (Button) findViewById(R.id.GameRule); Gamerule.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "Start Game Rule"); Intent it = new Intent(MainActivity.this, GameRule.class); startActivityForResult(it, FIRST_REQUEST_CODE); overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out); } }); Button Gamehelp = (Button) findViewById(R.id.GameHelp); Gamehelp.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "Start Game Help"); Intent it = new Intent(MainActivity.this, MyGuideViewActivity.class); startActivityForResult(it, FIRST_REQUEST_CODE); overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out); } }); Createbnt.setText("Disconnected"); }
From source file:com.android.dialer.filterednumber.BlockedNumbersFragment.java
@Override public void onResume() { super.onResume(); ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar(); ColorDrawable backgroundDrawable = new ColorDrawable( ActivityCompat.getColor(getActivity(), R.color.dialer_theme_color)); actionBar.setBackgroundDrawable(backgroundDrawable); actionBar.setDisplayShowCustomEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(R.string.manage_blocked_numbers_label); // If the device can use the framework blocking solution, users should not be able to add // new blocked numbers from the Blocked Management UI. They will be shown a promo card // asking them to migrate to new blocking instead. if (FilteredNumberCompat.canUseNewFiltering()) { migratePromoView.setVisibility(View.VISIBLE); blockedNumbersText.setVisibility(View.GONE); getListView().findViewById(R.id.add_number_linear_layout).setVisibility(View.GONE); getListView().findViewById(R.id.add_number_linear_layout).setOnClickListener(null); mBlockedNumberListDivider.setVisibility(View.GONE); mImportSettings.setVisibility(View.GONE); getListView().findViewById(R.id.import_button).setOnClickListener(null); getListView().findViewById(R.id.view_numbers_button).setOnClickListener(null); mBlockedNumbersDisabledForEmergency.setVisibility(View.GONE); footerText.setVisibility(View.GONE); } else {/*ww w . j a v a 2s . c o m*/ FilteredNumbersUtil.checkForSendToVoicemailContact(getActivity(), new CheckForSendToVoicemailContactListener() { @Override public void onComplete(boolean hasSendToVoicemailContact) { final int visibility = hasSendToVoicemailContact ? View.VISIBLE : View.GONE; mImportSettings.setVisibility(visibility); } }); } // All views except migrate and the block list are hidden when new filtering is available if (!FilteredNumberCompat.canUseNewFiltering() && FilteredNumbersUtil.hasRecentEmergencyCall(getContext())) { mBlockedNumbersDisabledForEmergency.setVisibility(View.VISIBLE); } else { mBlockedNumbersDisabledForEmergency.setVisibility(View.GONE); } mVoicemailEnabledChecker.asyncUpdate(); }
From source file:com.adkdevelopment.simpleflashlightadfree.ui.EmergencyFragment.java
/** * Starts emergency sound from assets/*from w w w . j a v a2s . co m*/ */ public void emergencySignal() { try { if (mMediaPlayer != null && mMediaPlayer.isPlaying() && status == FlashlightService.STATUS_OFF) { mMediaPlayer.stop(); mMediaPlayer.reset(); mMediaPlayer.release(); mMediaPlayer = null; mLinearLayout.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorBackground)); } else if (status == FlashlightService.STATUS_BLINK) { final AnimationDrawable drawable = new AnimationDrawable(); final Handler handler = new Handler(); drawable.addFrame(new ColorDrawable(Color.RED), 400); drawable.addFrame(new ColorDrawable(Color.BLUE), 400); drawable.setOneShot(false); mLinearLayout.setBackground(drawable); handler.postDelayed(new Runnable() { @Override public void run() { drawable.start(); } }, 100); mMediaPlayer = new MediaPlayer(); AssetFileDescriptor descriptor = getActivity().getAssets().openFd("sews.mp3"); mMediaPlayer.setDataSource(descriptor.getFileDescriptor(), descriptor.getStartOffset(), descriptor.getLength()); descriptor.close(); mMediaPlayer.prepare(); mMediaPlayer.setVolume(1f, 1f); mMediaPlayer.setLooping(true); mMediaPlayer.start(); } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.lithiumli.fiction.NowPlayingActivity.java
@Override public void onSongChange(Song song) { mSongName.setText(song.getTitle());//from w w w . jav a2s. co m mSongAlbum.setText(song.getAlbum()); mSongArtist.setText(song.getArtist()); mCoverPager.updateCovers(); mCoverPager.postInvalidate(); if (song.getArtist().equals("<unknown>")) { ((ImageView) findViewById(R.id.background_image)).setImageDrawable(new ColorDrawable(0xFF000000)); return; } ; mCache.cancelAll(); android.util.Log.d("fiction", "getting " + song.getArtist()); mCache.getImage(song.getArtist(), this); }
From source file:com.lulu.admin.kuyimusic.MainActivity.java
public void changeColor(int newColor) { tabs.setIndicatorColor(newColor);/*from www . j a va 2 s. co m*/ // change ActionBar color just if an ActionBar is available if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { Drawable colorDrawable = new ColorDrawable(newColor); Drawable bottomDrawable = getResources().getDrawable(R.drawable.actionbar_bottom); LayerDrawable ld = new LayerDrawable(new Drawable[] { colorDrawable, bottomDrawable }); if (oldBackground == null) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { ld.setCallback(drawableCallback); } else { getActionBar().setBackgroundDrawable(ld); } } else { TransitionDrawable td = new TransitionDrawable(new Drawable[] { oldBackground, ld }); // workaround for broken ActionBarContainer drawable handling on // pre-API 17 builds // https://github.com/android/platform_frameworks_base/commit/a7cc06d82e45918c37429a59b14545c6a57db4e4 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) { td.setCallback(drawableCallback); } else { getActionBar().setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayShowTitleEnabled(true); } currentColor = newColor; }
From source file:com.RSMSA.policeApp.OffenceReportForm.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_report_offence); sharedpreferences = getSharedPreferences(MyPREF, Context.MODE_PRIVATE); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/* w w w . j ava 2 s . c om*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { setTranslucentStatus(true); } SystemBarTintManager tintManager = new SystemBarTintManager(this); tintManager.setStatusBarTintEnabled(true); ColorDrawable colorDrawable = new ColorDrawable(getResources().getColor(R.color.blue_900)); tintManager.setTintDrawable(colorDrawable); RelativeLayout inputs = (RelativeLayout) findViewById(R.id.inputs); plateNumberEdit = (EditText) findViewById(R.id.plate_number_edit_text); licenceNumberEdit = (EditText) findViewById(R.id.licence_number_edit_text); final Bundle bundle = getIntent().getExtras(); namePassed = bundle.getString("name"); dLicense = bundle.getString("licence_number"); plateNumberObtained = bundle.getString("plate_number"); driverUid = bundle.getString("driverUid"); vehicleUid = bundle.getString("vehicleUid"); try { invalidLicence = bundle.getString("invalidLicence"); expiredInsuarance = bundle.getString("expiredInsuarance"); } catch (NullPointerException e) { } if (dLicense.equals("") || dLicense == null) { licenceNumberEdit.setVisibility(View.VISIBLE); } else if (plateNumberObtained.equals("") || plateNumberObtained == null) { plateNumberEdit.setVisibility(View.VISIBLE); } submit = (TextView) findViewById(R.id.submit_text); plateNo = (TextView) findViewById(R.id.plate_no_); chargesAcceptance = (TextView) findViewById(R.id.charges_acceptance); chargesAcceptance.setTypeface(MainOffence.Roboto_Regular); offensesCommittedTextview = (TextView) findViewById(R.id.offences_committed_title); offensesCommittedTextview.setTypeface(MainOffence.Roboto_BoldCondensed); ChargesAcceptanceTitle = (TextView) findViewById(R.id.charges_acceptance_title); paymentMethodTitle = (TextView) findViewById(R.id.payment_method_title); PaymentTitle = (TextView) findViewById(R.id.payment_title); ChargesAcceptanceTitle.setTypeface(MainOffence.Roboto_BoldCondensed); paymentMethodTitle.setTypeface(MainOffence.Roboto_BoldCondensed); PaymentTitle.setTypeface(MainOffence.Roboto_BoldCondensed); offencesCostTitle = (TextView) findViewById(R.id.offences_cost_title); offencesCostTitle.setTypeface(MainOffence.Roboto_BoldCondensed); submitText = (TextView) findViewById(R.id.submit_text); license = (TextView) findViewById(R.id.license); license.setText(dLicense); report = (RelativeLayout) findViewById(R.id.report); summary = (RelativeLayout) findViewById(R.id.summary); submit_layout = (RelativeLayout) findViewById(R.id.submit_layout); submit_layout1 = (RelativeLayout) findViewById(R.id.submit_layout1); submit_layout1.setVisibility(View.GONE); progressBar = (ProgressBar) findViewById(R.id.pbar_report); TextView driverName = (TextView) findViewById(R.id.driver_name); driverName.setTypeface(MainOffence.Roboto_BoldCondensed); TextView plateNumberTitle = (TextView) findViewById(R.id.plate_no_title_); plateNumberTitle.setTypeface(MainOffence.Roboto_BoldCondensed); TextView driverLicense = (TextView) findViewById(R.id.driver_license); driverLicense.setTypeface(MainOffence.Roboto_BoldCondensed); RelativeLayout OffenseType = (RelativeLayout) findViewById(R.id.offense_type); OffenseType.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(OffenceReportForm.this, OffenseListActivity.class); OffenceReportForm.this.startActivityForResult(intent, REPORT_RESULT); } }); offense_type_text = (TextView) findViewById(R.id.offense_type_text); offencesSelectedTextView = (TextView) findViewById(R.id.offence_list); offensesCommittedTextview = (TextView) findViewById(R.id.offences_committed); TextView name = (TextView) findViewById(R.id.name); name.setText(namePassed); final RadioButton court = (RadioButton) findViewById(R.id.court); court.setTypeface(MainOffence.Roboto_BoldCondensed); final RadioButton guilty = (RadioButton) findViewById(R.id.guilty); guilty.setTypeface(MainOffence.Roboto_BoldCondensed); guilty.setChecked(true); court.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b == true) { guilty.setChecked(false); commit = false; } } }); guilty.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b == true) { court.setChecked(false); commit = true; } } }); final String[] paymentMethodsArray = this.getResources().getStringArray(R.array.payment_methods); final Spinner paymentMethodSpinner = (Spinner) findViewById(R.id.payment_method_spinner); final RadioButton paid = (RadioButton) findViewById(R.id.paid); paid.setTypeface(MainOffence.Roboto_Regular); final RadioButton not_paid = (RadioButton) findViewById(R.id.not_paid); final TextView receipt_title = (TextView) findViewById(R.id.receipt_title); receiptEditText = (EditText) findViewById(R.id.receipt); receipt_title.setTypeface(MainOffence.Roboto_BoldCondensed); not_paid.setTypeface(MainOffence.Roboto_Regular); not_paid.setChecked(true); paymentMethodSpinner.setBackground(null); paid.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b == true) { paymentStatus = true; paymentMethodTitle.setVisibility(View.VISIBLE); paymentMethodSpinner.setVisibility(View.VISIBLE); paymentMethod = paymentMethodsArray[0]; paymentMethodSpinner.setSelection(0); receipt_title.setVisibility(View.VISIBLE); receiptEditText.setVisibility(View.VISIBLE); } } }); not_paid.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b == true) { paymentStatus = false; paymentMethodTitle.setVisibility(View.GONE); paymentMethodSpinner.setVisibility(View.GONE); receipt_title.setVisibility(View.GONE); receiptEditText.setVisibility(View.GONE); paymentMethod = ""; receiptEditText.setText(""); } } }); PaymentMethodSpinnerAdapter adapter = new PaymentMethodSpinnerAdapter( getSupportActionBar().getThemedContext(), R.layout.row_menu, paymentMethodsArray); paymentMethodSpinner.setAdapter(adapter); paymentMethodSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { paymentMethod = paymentMethodsArray[position]; if (position == 0) { receiptEditText.setVisibility(View.VISIBLE); receipt_title.setVisibility(View.VISIBLE); } else { receiptEditText.setVisibility(View.GONE); receipt_title.setVisibility(View.GONE); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }); }
From source file:com.jigarmjoshi.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (SimpleDatabaseUtil.isFirstApplicationStart(this)) { Log.i(MainActivity.class.getSimpleName(), "creating database for the first time"); SQLiteSimple databaseSimple = new SQLiteSimple(this, DATABASE_VERSION); databaseSimple.create(Report.class, LastLocation.class); } else if (SimpleDatabaseUtil.isFirstStartOnAppVersion(this, DATABASE_VERSION)) { Log.i(MainActivity.class.getSimpleName(), "creating database for the first time for this version " + DATABASE_VERSION); SQLiteSimple databaseSimple = new SQLiteSimple(this, DATABASE_VERSION); databaseSimple.create(Report.class, LastLocation.class); }//from www. ja va 2 s. c o m // initialize services EntryDao.getInstance(this); LastLocationDao.getInstance(this); // scheduler mgr = (AlarmManager) getSystemService(ALARM_SERVICE); Intent i = new Intent(this, LocationPoller.class); com.jigarmjoshi.service.LocationManager locationManager = com.jigarmjoshi.service.LocationManager .getInstance(getApplicationContext()); List<String> providers = locationManager.getAllProviders(); boolean fusedSupported = false; for (String provider : providers) { if (com.jigarmjoshi.service.LocationManager.FUSED_PROVIDER.equals(provider)) { fusedSupported = true; break; } } i.putExtra(LocationPoller.EXTRA_INTENT, new Intent(this, com.jigarmjoshi.reciever.LocationReceiver.class)); i.putExtra(LocationPoller.EXTRA_PROVIDER, (fusedSupported ? LocationManager.FUSED_PROVIDER : LocationManager.GPS_PROVIDER)); pi = PendingIntent.getBroadcast(this, 0, i, 0); mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 0, Long.parseLong(ConfigService.get(ConfigService.GPS_TASK_INTERVAL, "40000")), pi); // upload task Timer timer = new Timer(); TimerTask timerTask = new UploaderTask(this); timer.schedule(timerTask, 0, Long.parseLong(ConfigService.get(ConfigService.UPLOAD_TASK_INTERVAL, "40000"))); selectedTextView = new TextView(this); selectedTextView.setTextColor(Color.BLACK); selectedTextView.setGravity(Gravity.CENTER); selectedTextView.setPaintFlags(Paint.FAKE_BOLD_TEXT_FLAG); unSelectedTextView = new TextView(this); unSelectedTextView.setTextColor(Color.GRAY); unSelectedTextView.setGravity(Gravity.CENTER); unSelectedTextView.setPaintFlags(Paint.FAKE_BOLD_TEXT_FLAG); // create if first time getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); actionBar = getActionBar(); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#40808080"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#40808080"))); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs boolean first = false; for (String tab_name : tabs) { Tab tab = actionBar.newTab().setText(tab_name).setTabListener(this); if (first) { first = false; selectedTextView.setText(tab.getText().toString().toUpperCase(Locale.getDefault())); tab.setCustomView(selectedTextView); } else { unSelectedTextView.setText(tab.getText().toString().toUpperCase(Locale.getDefault())); tab.setCustomView(unSelectedTextView); } actionBar.addTab(tab); } /** * on swiping the viewpager make respective tab selected * */ viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); Toast.makeText(this, getString(R.string.wait_gps), Toast.LENGTH_LONG).show(); }
From source file:com.jpventura.xyzreader.ui.ArticleDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = inflater.inflate(R.layout.fragment_article_detail, container, false); mDrawInsetsFrameLayout = (DrawInsetsFrameLayout) mRootView.findViewById(R.id.draw_insets_frame_layout); mDrawInsetsFrameLayout.setOnInsetsCallback(new DrawInsetsFrameLayout.OnInsetsCallback() { @Override//from www. ja va 2s .c om public void onInsetsChanged(Rect insets) { mTopInset = insets.top; } }); mScrollView = (ObservableScrollView) mRootView.findViewById(R.id.scrollview); mScrollView.setCallbacks(new ObservableScrollView.Callbacks() { @Override public void onScrollChanged() { mScrollY = mScrollView.getScrollY(); getActivityCast().onUpButtonFloorChanged(mItemId, ArticleDetailFragment.this); mPhotoContainerView.setTranslationY((int) (mScrollY - mScrollY / PARALLAX_FACTOR)); updateStatusBar(); } }); mPhotoView = (ImageView) mRootView.findViewById(R.id.photo); mPhotoContainerView = mRootView.findViewById(R.id.photo_container); mStatusBarColorDrawable = new ColorDrawable(0); mRootView.findViewById(R.id.share_fab).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity( Intent.createChooser( ShareCompat.IntentBuilder.from(getActivity()).setType("text/plain") .setText("Some sample text").getIntent(), getString(R.string.action_share))); } }); bindViews(); updateStatusBar(); return mRootView; }
From source file:com.androidarchitecture.widgets.RecyclerViewSwipeToDeleteImpl.java
/** * We're gonna setup another ItemDecorator that will draw the red background in the empty space while the items are animating to their new positions * after an item is removed.// w w w. j av a 2 s . co m */ private void setUpAnimationDecoratorHelper() { mRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() { // we want to cache this and not allocate anything repeatedly in the onDraw method Drawable background; boolean initiated; private void init() { background = new ColorDrawable(ContextCompat.getColor(mContext, R.color.colorPrimary)); initiated = true; } @Override public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { if (!initiated) { init(); } // only if animation is in progress if (parent.getItemAnimator().isRunning()) { // some items might be animating down and some items might be animating up to close the gap left by the removed item // this is not exclusive, both movement can be happening at the same time // to reproduce this leave just enough items so the first one and the last one would be just a little off screen // then remove one from the middle // find first child with translationY > 0 // and last one with translationY < 0 // we're after a rect that is not covered in recycler-view views at this point in time View lastViewComingDown = null; View firstViewComingUp = null; // this is fixed int left = 0; int right = parent.getWidth(); // this we need to find out int top = 0; int bottom = 0; // find relevant translating views int childCount = parent.getLayoutManager().getChildCount(); for (int i = 0; i < childCount; i++) { View child = parent.getLayoutManager().getChildAt(i); if (child.getTranslationY() < 0) { // view is coming down lastViewComingDown = child; } else if (child.getTranslationY() > 0) { // view is coming up if (firstViewComingUp == null) { firstViewComingUp = child; } } } if (lastViewComingDown != null && firstViewComingUp != null) { // views are coming down AND going up to fill the void top = lastViewComingDown.getBottom() + (int) lastViewComingDown.getTranslationY(); bottom = firstViewComingUp.getTop() + (int) firstViewComingUp.getTranslationY(); } else if (lastViewComingDown != null) { // views are going down to fill the void top = lastViewComingDown.getBottom() + (int) lastViewComingDown.getTranslationY(); bottom = lastViewComingDown.getBottom(); } else if (firstViewComingUp != null) { // views are coming up to fill the void top = firstViewComingUp.getTop(); bottom = firstViewComingUp.getTop() + (int) firstViewComingUp.getTranslationY(); } background.setBounds(left, top, right, bottom); background.draw(c); } super.onDraw(c, parent, state); } }); }
From source file:com.kakao.auth.authorization.authcode.KakaoWebViewDialog.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.argb(128, 0, 0, 0))); setOnCancelListener(new OnCancelListener() { @Override// w ww. j a v a2 s . co m public void onCancel(DialogInterface dialogInterface) { sendCancelToListenerIfNeeded(); } }); spinner = new ProgressDialog(getContext()); spinner.requestWindowFeature(Window.FEATURE_NO_TITLE); //spinner.setMessage(getContext().getString(R.string.core_com_kakao_sdk_loading)); spinner.setMessage("Loading"); spinner.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialogInterface) { sendCancelToListenerIfNeeded(); KakaoWebViewDialog.this.dismiss(); } }); contentFrameLayout = new FrameLayout(getContext()); createCrossImage(); int crossWidth = crossImageView.getDrawable().getIntrinsicWidth(); setUpWebView(crossWidth / 2); contentFrameLayout.addView(crossImageView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); addContentView(contentFrameLayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); registerSmsReceiverIfNeeded(); }