List of usage examples for android.graphics.drawable ColorDrawable ColorDrawable
public ColorDrawable(@ColorInt int color)
From source file:ab.util.AbDialogUtil.java
/** * // w ww.j av a 2 s. co m */ public static MyPop showDatePopWindowHour(Context context, View contentView, View targetView) { // hourArrayString = getHMArray(24); // ?? c = Calendar.getInstance(); PopupWindow popupWindow = new PopupWindow(contentView, -2, -2); popupWindow.setBackgroundDrawable(new ColorDrawable(Color.BLACK)); popupWindow.setWidth(context.getResources().getDisplayMetrics().widthPixels); popupWindow.setOutsideTouchable(true); popupWindow.showAtLocation(targetView, Gravity.BOTTOM, 0, 0); hourWV = (WheelView) contentView.findViewById(R.id.time_hour); // ? hourWV.setVisibleItems(5); // hourWV.setLabel(":00"); hourWV.setCyclic(true); setHourData(); return new MyPop(popupWindow, yearWV, monthWV, dayWV, hourWV, minuteWV); }
From source file:com.juick.android.ThreadFragment.java
public void showThread(JuickMessage jmsg, boolean keepShow) { if (jmsg.getReplyTo() != 0) { JuickMessage reply = jmsg;/*from ww w . jav a 2s .co m*/ LinearLayout ll = new LinearLayout(getActivity()); ll.setOrientation(LinearLayout.VERTICAL); ll.setBackgroundDrawable(new ColorDrawable(Color.WHITE)); int totalCount = 0; while (reply != null) { totalCount += reply.Text.length(); if (totalCount > 500 || ll.getChildCount() > 10) break; JuickMessagesAdapter.ParsedMessage parsedMessage = JuickMessagesAdapter .formatMessageText(getActivity(), reply, true); TextView child = new TextView(getActivity()); ll.addView(child, 0); child.setText(parsedMessage.textContent); if (reply.getReplyTo() < 1) break; reply = findReply(getListView(), reply.getReplyTo()); } if (ll.getChildCount() != 0) { int xy[] = new int[2]; getListView().getLocationOnScreen(xy); int windowHeight = getActivity().getWindow().getWindowManager().getDefaultDisplay().getHeight(); int listBottom = getListView().getHeight() + xy[1]; int bottomSize = windowHeight - listBottom; ll.setPressed(true); MainActivity.restyleChildrenOrWidget(ll); if (!keepShow || shownThreadToast.getView().getParent() == null) { // new or already hidden shownThreadToast = new Toast(getActivity()); shownThreadToast.setView(ll); shownThreadToast.setGravity(Gravity.BOTTOM | Gravity.LEFT, 0, bottomSize); shownThreadToast.setDuration(Toast.LENGTH_LONG); } shownThreadToast.show(); } } }
From source file:com.ksharkapps.musicnow.ui.activities.AudioPlayerActivity.java
public void changeActionBarColor(int newColor) { int color = newColor != 0 ? newColor : SettingsActivity.getActionBarColor(this); if (SettingsActivity.getTranslucentMode(this) && Utils.hasKitKat()) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayUseLogoEnabled(false); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000ff"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000ff"))); } else {/*from ww w.j a va2 s. c o m*/ /*Drawable colorDrawable = new ColorDrawable(color); Drawable bottomDrawable = getResources().getDrawable( R.drawable.transparent_overlay); 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 { actionBar.setBackgroundDrawable(colorDrawable); } } 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 { actionBar.setBackgroundDrawable(td); } td.startTransition(200); } oldBackground = ld; // http://stackoverflow.com/questions/11002691/actionbar-setbackgrounddrawable-nulling-background-from-thread-handler actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayShowTitleEnabled(true); if (Utils.hasKitKat()) { if (SettingsActivity.getTranslucentMode(this)) { SystemBarTintManager tintManager = new SystemBarTintManager( this); tintManager.setStatusBarTintEnabled(true); tintManager.setStatusBarTintColor(color); } }*/ actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayUseLogoEnabled(false); actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000ff"))); actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#000000ff"))); } updateSeekbartheme(color); }
From source file:co.taqat.call.CallActivity.java
private void showAcceptCallUpdateDialog() { final Dialog dialog = new Dialog(this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); Drawable d = new ColorDrawable(ContextCompat.getColor(this, R.color.colorC)); d.setAlpha(200);//from w ww . jav a2 s . c o m dialog.setContentView(R.layout.dialog); dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); dialog.getWindow().setBackgroundDrawable(d); TextView customText = (TextView) dialog.findViewById(R.id.customText); customText.setText(getResources().getString(R.string.add_video_dialog)); Button delete = (Button) dialog.findViewById(R.id.delete_button); delete.setText(R.string.accept); Button cancel = (Button) dialog.findViewById(R.id.cancel); cancel.setText(R.string.decline); delete.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { int camera = getPackageManager().checkPermission(Manifest.permission.CAMERA, getPackageName()); Log.i("[Permission] Camera permission is " + (camera == PackageManager.PERMISSION_GRANTED ? "granted" : "denied")); if (camera == PackageManager.PERMISSION_GRANTED) { CallActivity.instance().acceptCallUpdate(true); } else { checkAndRequestPermission(Manifest.permission.CAMERA, PERMISSIONS_REQUEST_CAMERA); } dialog.dismiss(); } }); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { if (CallActivity.isInstanciated()) { CallActivity.instance().acceptCallUpdate(false); } dialog.dismiss(); } }); dialog.show(); }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
@SuppressLint("ResourceAsColor") @Override/*from www. j a v a 2 s .c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_PROGRESS); if (!K9.isHideSpecialAccounts()) { createSpecialAccounts(); } Account[] accounts = Preferences.getPreferences(this).getAccounts(); Intent intent = getIntent(); // onNewIntent(intent); // see if we should show the welcome message if (ACTION_IMPORT_SETTINGS.equals(intent.getAction())) { mAccounts.onImport(); } else if (accounts.length < 1) { WelcomeMessage.showWelcomeMessage(this); finish(); return; } if (UpgradeDatabases.actionUpgradeDatabases(this, intent)) { finish(); return; } Log.d(TAG, "onCreate()"); String packageName = "com.bernard.beaconportal.activities"; counterss = "0"; int versionNumber = 0; try { PackageInfo pi = getApplicationContext().getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA); versionNumber = pi.versionCode; String versionName = pi.versionName; Log.d(TAG, "K-9 is installed - " + versionNumber + " " + versionName); } catch (NameNotFoundException e) { Log.d(TAG, "K-9 not found"); } if (versionNumber <= 1) { // Register a listener for broadcasts (needed for the older versions // of k9) Log.d(TAG, "Initialising BroadcastReceiver for old K-9 version"); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d(TAG, "receiver.onReceive()"); doRefresh(); } }; filter = new IntentFilter(); filter.addAction("com.bernard.beaconportal.activities.intent.action.EMAIL_RECEIVED"); filter.addAction("com.bernard.beaconportal.activities.intent.action.EMAIL_DELETED"); filter.addDataScheme("email"); registerReceiver(receiver, filter); } else { // Register our own content observer, rather than using // addWatchContentUris() // since DashClock might not have permission to access the database Log.d(TAG, "Initialising ContentObserver for new K-9 version"); contentObserver = new ContentObserver(null) { @Override public void onChange(boolean selfChange) { Log.d(TAG, "contentResolver.onChange()"); doRefresh(); } }; getContentResolver().registerContentObserver(Uri.parse(k9UnreadUri), true, contentObserver); } doRefresh(); if (UpgradeDatabases.actionUpgradeDatabases(this, getIntent())) { finish(); return; } if (useSplitView()) { setContentView(R.layout.split_drawer_main); } else { setContentView(R.layout.drawermain1); mViewSwitcher = (ViewSwitcher) findViewById(R.id.container); mViewSwitcher.setFirstInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_left)); mViewSwitcher.setFirstOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_right)); mViewSwitcher.setSecondInAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_in_right)); mViewSwitcher.setSecondOutAnimation(AnimationUtils.loadAnimation(this, R.anim.slide_out_left)); mViewSwitcher.setOnSwitchCompleteListener(this); } mergeadapter = new MergeAdapter(); LayoutInflater inflater = getLayoutInflater(); accounts_view = inflater.inflate(R.layout.accounts_list, null); portals_view = inflater.inflate(R.layout.portal_list, null); folders_view = inflater.inflate(R.layout.folders_list, null); header_folders = inflater.inflate(R.layout.header_folders, null); header_drawer = inflater.inflate(R.layout.header_drawer, null); initializeActionBar(); mListView = (ListView) findViewById(android.R.id.list); // mListView.addHeaderView(header_folders, null, false); mListView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); mListView.setLongClickable(true); mListView.setFastScrollEnabled(true); mListView.setScrollingCacheEnabled(false); // mListView.setOnItemClickListener(new OnItemClickListener() { // public void onItemClick(AdapterView<?> parent, View view, // int position, long id) { // // onOpenFolder(((FolderInfoHolder) mAdapter.getItem(position)).name); // // Log.d("Folder Click Listener", "clicked"); // // } // }); setResult(RESULT_CANCELED); // mDrawerList_Inbox = (ListView) findViewById(R.id.listview_inbox); // // View header_inbox = (View) inflater // .inflate(R.layout.header_inbox, null); // // mDrawerList_Inbox.setOnItemClickListener(this); // // mDrawerList_Inbox.setItemsCanFocus(false); // // mDrawerList_Inbox.setLongClickable(true); mListView.setSaveEnabled(true); mInflater = getLayoutInflater(); onNewIntent(getIntent()); context = this; SharedPreferences sharedpre = getSharedPreferences("show_view", Context.MODE_PRIVATE); Show_View = sharedpre.getString("show_view", ""); SharedPreferences Today_Homework = getApplicationContext().getSharedPreferences("due_today", Context.MODE_PRIVATE); SharedPreferences counts = getSharedPreferences("due_today", Context.MODE_PRIVATE); if (counts.contains("homeworkdue")) { counterss = counts.getString("homeworkdue", null); } else { counterss = null; } title_Inbox = new String[] { "Inbox" }; icon_Inbox = new int[] { R.drawable.ic_action_email }; count_Inbox = new String[] { K9counts }; if (Show_View.equals("Homework Due")) { title = new String[] { "Homework Due", "Schedule", "Resources", "Options", "Logout" }; icon = new int[] { R.drawable.ic_action_duehomework, R.drawable.ic_action_go_to_today, R.drawable.ic_action_resources, R.drawable.ic_action_settings, R.drawable.ic_action_logout }; if (counterss == null && counterss.isEmpty()) { count = new String[] { "", "", "", "", "" }; } else { count = new String[] { counterss, "", "", "", "" }; } } else { if (counterss == null && counterss.isEmpty()) { count = new String[] { "", "", "", "", "" }; } else { count = new String[] { "", counterss, "", "", "" }; } title = new String[] { "Schedule", "Homework Due", "Resources", "Options", "Logout" }; icon = new int[] { R.drawable.ic_action_go_to_today, R.drawable.ic_action_duehomework, R.drawable.ic_action_resources, R.drawable.ic_action_settings, R.drawable.ic_action_logout }; } mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLinear = (LinearLayout) findViewById(R.id.left_drawer); // mDrawerList_Inbox = (ListView) findViewById(R.id.listview_inbox); // mDrawerList = (ListView) findViewById(R.id.listview_drawer); // mDrawer_Scroll = (ScrollView) // findViewById(R.id.left_drawer_scrollview); // mDrawerList.addHeaderView(header_drawer, null, false); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // mMenuAdapter_Inbox = new MenuListAdapter(MessageList.this, // title_Inbox, // icon_Inbox, count_Inbox); // mDrawerList_Inbox.setAdapter(mMenuAdapter_Inbox); // mDrawerList_Inbox // .setOnItemClickListener(new DrawerItemClickListener_Inbox()); mMenuAdapter = new MenuListAdapter(MessageList.this, title, icon, count); // mDrawerList.setAdapter(mMenuAdapter); // mergeadapter.addView(header_drawer); // // mergeadapter.addAdapter(mMenuAdapter); // // mergeadapter.addadapter(AccountsAdapter); // // mDrawerList.setAdapter(mergeadapter); getListView().setOnItemClickListener(new DrawerItemClickListener()); // mDrawerList_Inbox.setOnItemClickListener(new // DrawerItemClickListener()); // // if (savedInstanceState == null) { // selectItem_Inbox(1); // } SharedPreferences sharedpref = getSharedPreferences("actionbar_color", Context.MODE_PRIVATE); final int splitBarId = getResources().getIdentifier("split_action_bar", "id", "android"); final View splitActionBar = findViewById(splitBarId); if (!sharedpref.contains("actionbar_color")) { getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4"))); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#4285f4"))); } } else { actionbar_colors = sharedpref.getString("actionbar_color", null); getActionBar().setBackgroundDrawable( new ColorDrawable(Color.parseColor(actionbar_colors))); if (splitActionBar != null) { splitActionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor(actionbar_colors))); } } android.app.ActionBar bar = getActionBar(); bar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent))); // Enable gesture detection for MessageLists // setupGestureDetector(this); if (!decodeExtras(getIntent())) { return; } findFragments(); initializeDisplayMode(savedInstanceState); initializeLayout(); initializeFragments(); displayViews(); // registerForContextMenu(mDrawerList_Inbox); registerForContextMenu(mListView); getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { @Override public void onDrawerClosed(View view) { // TODO Auto-generated method stub super.onDrawerClosed(view); } @Override public void onDrawerOpened(View drawerView) { // TODO Auto-generated method stub super.onDrawerOpened(drawerView); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); }
From source file:com.gigabytedevelopersinc.app.calculator.Calculator.java
private void dismissCling(final Cling cling, final String flag, int duration) { setPagingEnabled(true);//w w w. j a v a 2 s . c om clingActive = false; if (cling != null) { cling.dismiss(); if (getActionBar() != null) { getActionBar().show(); } getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#FFFFFF"))); ObjectAnimator anim = ObjectAnimator.ofFloat(cling, "alpha", 0f); anim.setDuration(duration); anim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { cling.setVisibility(View.GONE); cling.cleanup(); CalculatorSettings.saveKey(getContext(), flag, true); } }); anim.start(); } }
From source file:com.dsdar.thosearoundme.TeamViewActivity.java
@Override public boolean onMarkerClick(final Marker theMarker) { if (theMarker.equals(MyAppConstants.myMarker)) { return false; }/* w w w.java2 s.com*/ // Normal Marker if (!theMarker.equals(MyAppConstants.myMarker) && (theMarker.getTitle() != null)) { final Dialog aMemberDialog = new Dialog(TeamViewActivity.this, R.style.DialogSlideAnim); aMemberDialog.setContentView(R.layout.member_dialog); TextView aMemberTextName = (TextView) aMemberDialog.findViewById(R.id.tvMemberName); Button aTextButton = (Button) aMemberDialog.findViewById(R.id.bMemberText); Button aPushButton = (Button) aMemberDialog.findViewById(R.id.bMemberPush); Button aCallButton = (Button) aMemberDialog.findViewById(R.id.bMemberCall); Button aRemoveButton = (Button) aMemberDialog.findViewById(R.id.bMemberRemove); String[] res = theMarker.getTitle().split("~"); String title = res[0]; final String phone = res[1]; aMemberTextName.setText("Say hello to " + title + "!"); aMemberDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); aMemberDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); aMemberDialog.getWindow().setGravity(Gravity.BOTTOM); aMemberDialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); aMemberDialog.show(); ImageView aCancelButton = (ImageView) aMemberDialog.findViewById(R.id.bCancelMemberDialog); aCancelButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { aMemberDialog.dismiss(); } }); aTextButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Uri sms_uri = Uri.parse("smsto:" + phone); Intent sms_intent = new Intent(Intent.ACTION_SENDTO, sms_uri); startActivity(sms_intent); } }); // aPushButton.setOnClickListener(new OnClickListener() { // public void onClick(View v) { // // startActivity(new Intent(Intent.ACTION_VIEW, // // Uri.parse("sms:" // // + theMarker.getSnippet()))); // } // }); aCallButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent callIntent = new Intent(Intent.ACTION_DIAL); callIntent.setData(Uri.parse("tel:" + phone)); startActivity(callIntent); } }); // aRemoveButton.setOnClickListener(new OnClickListener() { // public void onClick(View v) { // } // }); } else { StickyMarkerBehaviorDialog dialog = new StickyMarkerBehaviorDialog(this); dialog.show(); } return true; }
From source file:com.android.contacts.quickcontact.QuickContactActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Trace.beginSection("onCreate()"); super.onCreate(savedInstanceState); if (RequestPermissionsActivity.startPermissionActivity(this) || RequestDesiredPermissionsActivity.startPermissionActivity(this)) { return;//from ww w. ja va 2 s.c o m } final int previousScreenType = getIntent().getIntExtra(EXTRA_PREVIOUS_SCREEN_TYPE, ScreenType.UNKNOWN); Logger.logScreenView(this, ScreenType.QUICK_CONTACT, previousScreenType); if (CompatUtils.isLollipopCompatible()) { getWindow().setStatusBarColor(Color.TRANSPARENT); } processIntent(getIntent()); // Show QuickContact in front of soft input getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM, WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); setContentView(R.layout.quickcontact_activity); mMaterialColorMapUtils = new MaterialColorMapUtils(getResources()); mScroller = (MultiShrinkScroller) findViewById(R.id.multiscroller); mContactCard = (ExpandingEntryCardView) findViewById(R.id.communication_card); mNoContactDetailsCard = (ExpandingEntryCardView) findViewById(R.id.no_contact_data_card); mRecentCard = (ExpandingEntryCardView) findViewById(R.id.recent_card); mAboutCard = (ExpandingEntryCardView) findViewById(R.id.about_card); mCollapsedSuggestionCardView = (CardView) findViewById(R.id.collapsed_suggestion_card); mExpandSuggestionCardView = (CardView) findViewById(R.id.expand_suggestion_card); mCollapasedSuggestionHeader = findViewById(R.id.collapsed_suggestion_header); mCollapsedSuggestionCardTitle = (TextView) findViewById(R.id.collapsed_suggestion_card_title); mExpandSuggestionCardTitle = (TextView) findViewById(R.id.expand_suggestion_card_title); mSuggestionSummaryPhoto = (ImageView) findViewById(R.id.suggestion_icon); mSuggestionForName = (TextView) findViewById(R.id.suggestion_for_name); mSuggestionContactsNumber = (TextView) findViewById(R.id.suggestion_for_contacts_number); mSuggestionList = (LinearLayout) findViewById(R.id.suggestion_list); mSuggestionsCancelButton = (Button) findViewById(R.id.cancel_button); mSuggestionsLinkButton = (Button) findViewById(R.id.link_button); if (savedInstanceState != null) { mIsSuggestionListCollapsed = savedInstanceState.getBoolean(KEY_IS_SUGGESTION_LIST_COLLAPSED, true); mPreviousContactId = savedInstanceState.getLong(KEY_PREVIOUS_CONTACT_ID); mSuggestionsShouldAutoSelected = savedInstanceState.getBoolean(KEY_SUGGESTIONS_AUTO_SELECTED, true); mSelectedAggregationIds = (TreeSet<Long>) savedInstanceState .getSerializable(KEY_SELECTED_SUGGESTION_CONTACTS); } else { mIsSuggestionListCollapsed = true; mSelectedAggregationIds.clear(); } if (mSelectedAggregationIds.isEmpty()) { disableLinkButton(); } else { enableLinkButton(); } mCollapasedSuggestionHeader.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { mCollapsedSuggestionCardView.setVisibility(View.GONE); mExpandSuggestionCardView.setVisibility(View.VISIBLE); mIsSuggestionListCollapsed = false; mExpandSuggestionCardTitle.requestFocus(); mExpandSuggestionCardTitle.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED); } }); mSuggestionsCancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { mCollapsedSuggestionCardView.setVisibility(View.VISIBLE); mExpandSuggestionCardView.setVisibility(View.GONE); mIsSuggestionListCollapsed = true; } }); mNoContactDetailsCard.setOnClickListener(mEntryClickHandler); mContactCard.setOnClickListener(mEntryClickHandler); mContactCard.setExpandButtonText(getResources().getString(R.string.expanding_entry_card_view_see_all)); mContactCard.setOnCreateContextMenuListener(mEntryContextMenuListener); mRecentCard.setOnClickListener(mEntryClickHandler); mRecentCard.setTitle(getResources().getString(R.string.recent_card_title)); mAboutCard.setOnClickListener(mEntryClickHandler); mAboutCard.setOnCreateContextMenuListener(mEntryContextMenuListener); mPhotoView = (QuickContactImageView) findViewById(R.id.photo); final View transparentView = findViewById(R.id.transparent_view); if (mScroller != null) { transparentView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mScroller.scrollOffBottom(); } }); } // Allow a shadow to be shown under the toolbar. ViewUtil.addRectangularOutlineProvider(findViewById(R.id.toolbar_parent), getResources()); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setActionBar(toolbar); getActionBar().setTitle(null); // Put a TextView with a known resource id into the ActionBar. This allows us to easily // find the correct TextView location & size later. toolbar.addView(getLayoutInflater().inflate(R.layout.quickcontact_title_placeholder, null)); mHasAlreadyBeenOpened = savedInstanceState != null; mIsEntranceAnimationFinished = mHasAlreadyBeenOpened; mWindowScrim = new ColorDrawable(SCRIM_COLOR); mWindowScrim.setAlpha(0); getWindow().setBackgroundDrawable(mWindowScrim); mScroller.initialize(mMultiShrinkScrollerListener, mExtraMode == MODE_FULLY_EXPANDED); // mScroller needs to perform asynchronous measurements after initalize(), therefore // we can't mark this as GONE. mScroller.setVisibility(View.INVISIBLE); setHeaderNameText(R.string.missing_name); mSelectAccountFragmentListener = (SelectAccountDialogFragmentListener) getFragmentManager() .findFragmentByTag(FRAGMENT_TAG_SELECT_ACCOUNT); if (mSelectAccountFragmentListener == null) { mSelectAccountFragmentListener = new SelectAccountDialogFragmentListener(); getFragmentManager().beginTransaction() .add(0, mSelectAccountFragmentListener, FRAGMENT_TAG_SELECT_ACCOUNT).commit(); mSelectAccountFragmentListener.setRetainInstance(true); } mSelectAccountFragmentListener.setQuickContactActivity(this); SchedulingUtils.doOnPreDraw(mScroller, /* drawNextFrame = */ true, new Runnable() { @Override public void run() { if (!mHasAlreadyBeenOpened) { // The initial scrim opacity must match the scrim opacity that would be // achieved by scrolling to the starting position. final float alphaRatio = mExtraMode == MODE_FULLY_EXPANDED ? 1 : mScroller.getStartingTransparentHeightRatio(); final int duration = getResources().getInteger(android.R.integer.config_shortAnimTime); final int desiredAlpha = (int) (0xFF * alphaRatio); ObjectAnimator o = ObjectAnimator.ofInt(mWindowScrim, "alpha", 0, desiredAlpha) .setDuration(duration); o.start(); } } }); if (savedInstanceState != null) { final int color = savedInstanceState.getInt(KEY_THEME_COLOR, 0); SchedulingUtils.doOnPreDraw(mScroller, /* drawNextFrame = */ false, new Runnable() { @Override public void run() { // Need to wait for the pre draw before setting the initial scroll // value. Prior to pre draw all scroll values are invalid. if (mHasAlreadyBeenOpened) { mScroller.setVisibility(View.VISIBLE); mScroller.setScroll(mScroller.getScrollNeededToBeFullScreen()); } // Need to wait for pre draw for setting the theme color. Setting the // header tint before the MultiShrinkScroller has been measured will // cause incorrect tinting calculations. if (color != 0) { setThemeColor(mMaterialColorMapUtils.calculatePrimaryAndSecondaryColor(color)); } } }); } Trace.endSection(); }
From source file:com.example.search.car.pools.welcome.java
public void dialog(String name, final String[] arr, final TextView tv) { final Dialog dialog = new Dialog(welcome.this); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.setContentView(R.layout.dialog); final ListView list = (ListView) dialog.findViewById(R.id.list_cities); DialogAdapter adapter = new DialogAdapter(welcome.this, arr); list.setAdapter(adapter);/* ww w . j a v a2s .c om*/ final TextView t = (TextView) dialog.findViewById(R.id.tv_1_send_msg); t.setText("Select " + name); Typeface tf = Typeface.createFromAsset(welcome.this.getAssets(), "AvenirLTStd_Book.otf"); t.setTypeface(tf); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { tv.setText(arr[position]); dialog.dismiss(); } }); final RelativeLayout l_close = (RelativeLayout) dialog.findViewById(R.id.l_close); l_close.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub dialog.dismiss(); } }); dialog.show(); }
From source file:com.huangj.huangjlibrary.widget.drawerlayout.DrawerLayout.java
/** * Set a drawable to draw in the insets area for the status bar. * Note that this will only be activated if this DrawerLayout fitsSystemWindows. * * @param color Color to use as a background drawable to draw behind the status bar * in 0xAARRGGBB format./* w w w .ja va2s.co m*/ */ public void setStatusBarBackgroundColor(@ColorInt int color) { mStatusBarBackground = new ColorDrawable(color); invalidate(); }