List of usage examples for android.widget TextView setTypeface
public void setTypeface(@Nullable Typeface tf)
From source file:com.example.ray.firstapp.bottombar.BottomBar.java
private void updateItems(final BottomBarItemBase[] bottomBarItems) { if (mItemContainer == null) { initializeViews();// w w w . j a va 2 s . c o m } int index = 0; int biggestWidth = 0; mIsShiftingMode = MAX_FIXED_TAB_COUNT < bottomBarItems.length; if (!mIsDarkTheme && !mIgnoreNightMode && MiscUtils.isNightMode(mContext)) { mIsDarkTheme = true; } if (!mIsTabletMode && mIsShiftingMode) { mDefaultBackgroundColor = mCurrentBackgroundColor = mPrimaryColor; mBackgroundView.setBackgroundColor(mDefaultBackgroundColor); if (mContext instanceof Activity) { navBarMagic((Activity) mContext, this); } } else if (mIsDarkTheme) { darkThemeMagic(); } View[] viewsToAdd = new View[bottomBarItems.length]; for (BottomBarItemBase bottomBarItemBase : bottomBarItems) { int layoutResource; if (mIsShiftingMode && !mIsTabletMode) { layoutResource = R.layout.bb_bottom_bar_item_shifting; } else { layoutResource = mIsTabletMode ? R.layout.bb_bottom_bar_item_fixed_tablet : R.layout.bb_bottom_bar_item_fixed; } View bottomBarTab = View.inflate(mContext, layoutResource, null); ImageView icon = (ImageView) bottomBarTab.findViewById(R.id.bb_bottom_bar_icon); icon.setImageDrawable(bottomBarItemBase.getIcon(mContext)); if (!mIsTabletMode) { TextView title = (TextView) bottomBarTab.findViewById(R.id.bb_bottom_bar_title); title.setText(bottomBarItemBase.getTitle(mContext)); if (mPendingTextAppearance != -1) { MiscUtils.setTextAppearance(title, mPendingTextAppearance); } if (mPendingTypeface != null) { title.setTypeface(mPendingTypeface); } } if (mIsDarkTheme || (!mIsTabletMode && mIsShiftingMode)) { icon.setColorFilter(mWhiteColor); } if (bottomBarItemBase instanceof BottomBarTab) { bottomBarTab.setId(((BottomBarTab) bottomBarItemBase).id); } if (index == mCurrentTabPosition) { selectTab(bottomBarTab, false); } else { unselectTab(bottomBarTab, false); } if (!mIsTabletMode) { if (bottomBarTab.getWidth() > biggestWidth) { biggestWidth = bottomBarTab.getWidth(); } viewsToAdd[index] = bottomBarTab; } else { mItemContainer.addView(bottomBarTab); } bottomBarTab.setOnClickListener(this); bottomBarTab.setOnLongClickListener(this); index++; } if (!mIsTabletMode) { int proposedItemWidth = Math.min(MiscUtils.dpToPixel(mContext, mScreenWidth / bottomBarItems.length), mMaxFixedItemWidth); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(proposedItemWidth, LinearLayout.LayoutParams.WRAP_CONTENT); for (View bottomBarView : viewsToAdd) { bottomBarView.setLayoutParams(params); mItemContainer.addView(bottomBarView); } } if (mPendingTextAppearance != -1) { mPendingTextAppearance = -1; } if (mPendingTypeface != null) { mPendingTypeface = null; } }
From source file:com.harlan.jxust.ui.view.bottombar.BottomBar.java
private void updateItems(final BottomBarItemBase[] bottomBarItems) { if (mItemContainer == null) { initializeViews();/*from w w w . j ava 2s .co m*/ } int index = 0; int biggestWidth = 0; mIsShiftingMode = MAX_FIXED_TAB_COUNT < bottomBarItems.length; if (!mIsDarkTheme && !mIgnoreNightMode && MiscUtils.isNightMode(mContext)) { mIsDarkTheme = true; } if (mIsDarkTheme) { darkThemeMagic(); } else if (!mIsTabletMode && mIsShiftingMode) { mDefaultBackgroundColor = mCurrentBackgroundColor = mPrimaryColor; mBackgroundView.setBackgroundColor(mDefaultBackgroundColor); if (mContext instanceof Activity) { navBarMagic((Activity) mContext, this); } } View[] viewsToAdd = new View[bottomBarItems.length]; for (BottomBarItemBase bottomBarItemBase : bottomBarItems) { int layoutResource; if (mIsShiftingMode && !mIsTabletMode) { layoutResource = R.layout.bb_bottom_bar_item_shifting; } else { layoutResource = mIsTabletMode ? R.layout.bb_bottom_bar_item_fixed_tablet : R.layout.bb_bottom_bar_item_fixed; } View bottomBarTab = View.inflate(mContext, layoutResource, null); ImageView icon = (ImageView) bottomBarTab.findViewById(R.id.bb_bottom_bar_icon); icon.setImageDrawable(bottomBarItemBase.getIcon(mContext)); if (!mIsTabletMode) { TextView title = (TextView) bottomBarTab.findViewById(R.id.bb_bottom_bar_title); title.setText(bottomBarItemBase.getTitle(mContext)); if (mPendingTextAppearance != -1) { MiscUtils.setTextAppearance(title, mPendingTextAppearance); } if (mPendingTypeface != null) { title.setTypeface(mPendingTypeface); } } if (mIsDarkTheme || (!mIsTabletMode && mIsShiftingMode)) { icon.setColorFilter(mWhiteColor); } if (bottomBarItemBase instanceof BottomBarTab) { bottomBarTab.setId(((BottomBarTab) bottomBarItemBase).id); } if (index == mCurrentTabPosition) { selectTab(bottomBarTab, false); } else { unselectTab(bottomBarTab, false); } if (!mIsTabletMode) { if (bottomBarTab.getWidth() > biggestWidth) { biggestWidth = bottomBarTab.getWidth(); } viewsToAdd[index] = bottomBarTab; } else { mItemContainer.addView(bottomBarTab); } bottomBarTab.setOnClickListener(this); bottomBarTab.setOnLongClickListener(this); index++; } if (!mIsTabletMode) { int proposedItemWidth = Math.min(MiscUtils.dpToPixel(mContext, mScreenWidth / bottomBarItems.length), mMaxFixedItemWidth); mInActiveShiftingItemWidth = (int) (proposedItemWidth * 0.9); mActiveShiftingItemWidth = (int) (proposedItemWidth + (proposedItemWidth * (bottomBarItems.length * 0.1))); for (View bottomBarView : viewsToAdd) { LinearLayout.LayoutParams params; if (mIsShiftingMode && !mIgnoreShiftingResize) { if (TAG_BOTTOM_BAR_VIEW_ACTIVE.equals(bottomBarView.getTag())) { params = new LinearLayout.LayoutParams(mActiveShiftingItemWidth, LinearLayout.LayoutParams.WRAP_CONTENT); } else { params = new LinearLayout.LayoutParams(mInActiveShiftingItemWidth, LinearLayout.LayoutParams.WRAP_CONTENT); } } else { params = new LinearLayout.LayoutParams(proposedItemWidth, LinearLayout.LayoutParams.WRAP_CONTENT); } bottomBarView.setLayoutParams(params); mItemContainer.addView(bottomBarView); } } if (mPendingTextAppearance != -1) { mPendingTextAppearance = -1; } if (mPendingTypeface != null) { mPendingTypeface = null; } }
From source file:com.mobicage.rogerthat.registration.RegistrationActivity2.java
@Override protected void onServiceBound() { T.UI();/*from www . ja v a2s .c o m*/ if (mNotYetProcessedIntent != null) { processIntent(mNotYetProcessedIntent); mNotYetProcessedIntent = null; } setContentView(R.layout.registration2); //Apply Fonts TextUtils.overrideFonts(this, findViewById(android.R.id.content)); final Typeface faTypeFace = Typeface.createFromAsset(getAssets(), "FontAwesome.ttf"); final int[] visibleLogos; final int[] goneLogos; if (AppConstants.FULL_WIDTH_HEADERS) { visibleLogos = FULL_WIDTH_ROGERTHAT_LOGOS; goneLogos = NORMAL_WIDTH_ROGERTHAT_LOGOS; View viewFlipper = findViewById(R.id.registration_viewFlipper); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) viewFlipper.getLayoutParams(); params.setMargins(0, 0, 0, 0); } else { visibleLogos = NORMAL_WIDTH_ROGERTHAT_LOGOS; goneLogos = FULL_WIDTH_ROGERTHAT_LOGOS; } for (int id : visibleLogos) findViewById(id).setVisibility(View.VISIBLE); for (int id : goneLogos) findViewById(id).setVisibility(View.GONE); handleScreenOrientation(getResources().getConfiguration().orientation); ScrollView rc = (ScrollView) findViewById(R.id.registration_container); Resources resources = getResources(); if (CloudConstants.isRogerthatApp()) { rc.setBackgroundColor(resources.getColor(R.color.mc_page_dark)); } else { rc.setBackgroundColor(resources.getColor(R.color.mc_homescreen_background)); } TextView rogerthatWelcomeTextView = (TextView) findViewById(R.id.rogerthat_welcome); TextView tosTextView = (TextView) findViewById(R.id.registration_tos); Typeface FONT_THIN_ITALIC = Typeface.createFromAsset(getAssets(), "fonts/lato_light_italic.ttf"); tosTextView.setTypeface(FONT_THIN_ITALIC); tosTextView.setTextColor(ContextCompat.getColor(RegistrationActivity2.this, R.color.mc_words_color)); Button agreeBtn = (Button) findViewById(R.id.registration_agree_tos); TextView tvRegistration = (TextView) findViewById(R.id.registration); tvRegistration.setText(getString(R.string.registration_city_app_sign_up, getString(R.string.app_name))); mEnterEmailAutoCompleteTextView = (AutoCompleteTextView) findViewById(R.id.registration_enter_email); if (CloudConstants.isEnterpriseApp()) { rogerthatWelcomeTextView .setText(getString(R.string.rogerthat_welcome_enterprise, getString(R.string.app_name))); tosTextView.setVisibility(View.GONE); agreeBtn.setText(R.string.start_registration); mEnterEmailAutoCompleteTextView.setHint(R.string.registration_enter_email_hint_enterprise); } else { rogerthatWelcomeTextView .setText(getString(R.string.registration_welcome_text, getString(R.string.app_name))); tosTextView.setText(Html.fromHtml( "<a href=\"" + CloudConstants.TERMS_OF_SERVICE_URL + "\">" + tosTextView.getText() + "</a>")); tosTextView.setMovementMethod(LinkMovementMethod.getInstance()); agreeBtn.setText(R.string.registration_btn_agree_tos); mEnterEmailAutoCompleteTextView.setHint(R.string.registration_enter_email_hint); } agreeBtn.getBackground().setColorFilter(Message.GREEN_BUTTON_COLOR, PorterDuff.Mode.MULTIPLY); agreeBtn.setOnClickListener(new SafeViewOnClickListener() { @Override public void safeOnClick(View v) { sendRegistrationStep(RegistrationWizard2.REGISTRATION_STEP_AGREED_TOS); mWiz.proceedToNextPage(); } }); initLocationUsageStep(faTypeFace); View.OnClickListener emailLoginListener = new View.OnClickListener() { @Override public void onClick(View v) { sendRegistrationStep(RegistrationWizard2.REGISTRATION_STEP_EMAIL_LOGIN); mWiz.proceedToNextPage(); } }; findViewById(R.id.login_via_email).setOnClickListener(emailLoginListener); Button facebookButton = (Button) findViewById(R.id.login_via_fb); View.OnClickListener facebookLoginListener = new View.OnClickListener() { @Override public void onClick(View v) { // Check network connectivity if (!mService.getNetworkConnectivityManager().isConnected()) { UIUtils.showNoNetworkDialog(RegistrationActivity2.this); return; } sendRegistrationStep(RegistrationWizard2.REGISTRATION_STEP_FACEBOOK_LOGIN); FacebookUtils.ensureOpenSession(RegistrationActivity2.this, AppConstants.PROFILE_SHOW_GENDER_AND_BIRTHDATE ? Arrays.asList("email", "user_friends", "user_birthday") : Arrays.asList("email", "user_friends"), PermissionType.READ, new Session.StatusCallback() { @Override public void call(Session session, SessionState state, Exception exception) { if (session != Session.getActiveSession()) { session.removeCallback(this); return; } if (exception != null) { session.removeCallback(this); if (!(exception instanceof FacebookOperationCanceledException)) { L.bug("Facebook SDK error during registration", exception); AlertDialog.Builder builder = new AlertDialog.Builder( RegistrationActivity2.this); builder.setMessage(R.string.error_please_try_again); builder.setPositiveButton(R.string.rogerthat, null); AlertDialog dialog = builder.create(); dialog.show(); } } else if (session.isOpened()) { session.removeCallback(this); if (session.getPermissions().contains("email")) { registerWithAccessToken(session.getAccessToken()); } else { AlertDialog.Builder builder = new AlertDialog.Builder( RegistrationActivity2.this); builder.setMessage(R.string.facebook_registration_email_missing); builder.setPositiveButton(R.string.rogerthat, null); AlertDialog dialog = builder.create(); dialog.show(); } } } }, false); } ; }; facebookButton.setOnClickListener(facebookLoginListener); final Button getAccountsButton = (Button) findViewById(R.id.get_accounts); if (configureEmailAutoComplete()) { // GET_ACCOUNTS permission is granted getAccountsButton.setVisibility(View.GONE); } else { getAccountsButton.setTypeface(faTypeFace); getAccountsButton.setOnClickListener(new SafeViewOnClickListener() { @Override public void safeOnClick(View v) { ActivityCompat.requestPermissions(RegistrationActivity2.this, new String[] { Manifest.permission.GET_ACCOUNTS }, PERMISSION_REQUEST_GET_ACCOUNTS); } }); } mEnterPinEditText = (EditText) findViewById(R.id.registration_enter_pin); mEnterPinEditText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { if (s.length() == PIN_LENGTH) onPinEntered(); } }); Button requestNewPinButton = (Button) findViewById(R.id.registration_request_new_pin); requestNewPinButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mWiz.setEmail(null); hideNotification(); mWiz.reInit(); mWiz.goBackToPrevious(); mEnterEmailAutoCompleteTextView.setText(""); } }); mWiz = RegistrationWizard2.getWizard(mService); mWiz.setFlipper((ViewFlipper) findViewById(R.id.registration_viewFlipper)); setFinishHandler(); addAgreeTOSHandler(); addIBeaconUsageHandler(); addChooseLoginMethodHandler(); addEnterPinHandler(); mWiz.run(); mWiz.setDeviceId(Installation.id(this)); handleEnterEmail(); if (mWiz.getBeaconRegions() != null && mBeaconManager == null) { bindBeaconManager(); } if (CloudConstants.USE_GCM_KICK_CHANNEL && GoogleServicesUtils.checkPlayServices(this, true)) { GoogleServicesUtils.registerGCMRegistrationId(mService, new GCMRegistrationIdFoundCallback() { @Override public void idFound(String registrationId) { mGCMRegistrationId = registrationId; } }); } }
From source file:com.benefit.buy.library.http.query.AbstractAQuery.java
/** * Set the text typeface of a TextView.//from w w w . jav a2 s.com * @param typeface typeface * @return self */ public T typeface(Typeface tf) { if (view instanceof TextView) { TextView tv = (TextView) view; tv.setTypeface(tf); } return self(); }
From source file:knayi.delevadriver.JobDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_jobdetail); //typelist = Arrays.asList(new String[]{"other", "express", "freezen"}); CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/ciclefina.ttf") .setFontAttrId(R.attr.fontPath).build()); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); }//from w w w .j a va 2 s. co m Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setNavigationOnClickListener(this); TextView toolbarText = (TextView) toolbar.findViewById(R.id.toolbarTitle); toolbarText.setText("Job Details"); toolbarText.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); setTitle(""); sPref = getSharedPreferences(Config.TOKEN_PREF, MODE_PRIVATE); Bundle bundle = getIntent().getExtras(); job_id = bundle.getString("job_id"); Log.i("JOBID", job_id); Log.i("JOBID AA", sPref.getString(Config.TOKEN_JOBID, "aa")); Log.i("JOBID TRE", String.valueOf(sPref.getBoolean(Config.TOKEN_DELAY, false))); /*if(job_id.equals(sPref.getString(Config.TOKEN_JOBID, ""))){ //check if there is delay and show dialog to report reason showDelayReportDialog(); }*/ buildGoogleApiClient(); mGoogleApiClient.connect(); imageView = (ImageView) findViewById(R.id.image); mToolbarView = findViewById(R.id.toolbar); //jobtype = (TextView) findViewById(R.id.jobdetail_type_value); //jobtype.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); jobprice = (TextView) findViewById(R.id.jobdetail_price_value); jobprice.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); jobstatus = (TextView) findViewById(R.id.jobdetail_status_value); jobstatus.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); /*jobaddress = (TextView) findViewById(R.id.jobdetail_address_value); jobcreatetime = (TextView) findViewById(R.id.jobdetail_createtime_value);*/ //requestertitle = (TextView) findViewById(R.id.jobdetail_requestertitle_value); //requestername = (TextView) findViewById(R.id.jobdetail_requestername_value); //requesterbusinesstype = (TextView) findViewById(R.id.jobdetail_requesterbusinesstype_value); job_receiver_title = (TextView) findViewById(R.id.jobdetail_receivertitle); job_receiver_title.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); TextView job_requester_title = (TextView) findViewById(R.id.jobdetail_requestertitle); job_requester_title.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); requesterphone = (TextView) findViewById(R.id.jobdetail_requesterphone_value); requesterphone.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); requestername = (TextView) findViewById(R.id.jobdetail_requestername_value); requestername.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); requesteraddress = (TextView) findViewById(R.id.jobdetail_requesteraddress_value); requesteraddress.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); receivername = (TextView) findViewById(R.id.jobdetail_receiver_name_value); receivername.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); receivercontact = (TextView) findViewById(R.id.jobdetail_receiver_contact_value); receivercontact.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); /*size = (TextView) findViewById(R.id.jobdetail_size_value); size.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL));*/ weight = (TextView) findViewById(R.id.jobdetail_weight_value); weight.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); sensitivity = (TextView) findViewById(R.id.jobdetail_sensitivity_value); sensitivity.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); //duration = (TextView) findViewById(R.id.jobdetail_duration_value); bitLayout = findViewById(R.id.jobBitLayout); imageprogress = (ProgressWheel) findViewById(R.id.jobdetail_image_progress_wheel); imageprogress.bringToFront(); viewforPlacing = findViewById(R.id.viewforplacing); viewforPlacing1 = findViewById(R.id.viewforplacing1); relativeLayout = (RelativeLayout) findViewById(R.id.jobdetail_relativelalyout); pickuptime = (TextView) findViewById(R.id.jobdetail_pickuptime_value); pickuptime.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); pickupdate = (TextView) findViewById(R.id.jobdetail_pickupdate_value); pickupdate.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); deliveryaddress = (TextView) findViewById(R.id.jobdetail_receiver_address_value); deliveryaddress.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); TextView price_title = (TextView) findViewById(R.id.jobdetail_price); price_title.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); SharedPreferences sharedPreferences = this.getSharedPreferences("com.websmithing.gpstracker.prefs", Context.MODE_PRIVATE); currentlyTracking = sharedPreferences.getBoolean("currentlyTracking", false); setBackgroundAlpha(mToolbarView, 1.0f, getResources().getColor(R.color.primary)); Log.i("NOTI_TYPE_DETAIL", bundle.getString("type")); if (bundle.getString("type").equals("job-nego-agree")) { Log.i("NOTI", "FROM REQUEST"); String agree = bundle.getString("agree"); String price = bundle.getString("price"); String agreestring; if (agree.equals("true")) { agreestring = "Request was agreed with " + price; } else { agreestring = "Request was not agreed"; } MaterialDialog dialog = new MaterialDialog.Builder(this) .customView(R.layout.custom_message_dialog, false).positiveText("OK") .positiveColor(R.color.white).positiveColorRes(R.color.white) .backgroundColorRes(R.color.primary).callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(final MaterialDialog dialog) { super.onPositive(dialog); dialog.dismiss(); } @Override public void onNegative(MaterialDialog dialog) { super.onNegative(dialog); dialog.dismiss(); } } ).build(); dialog.show(); TextView txt_title = (TextView) dialog.findViewById(R.id.dialog_title); TextView txt_message = (TextView) dialog.findViewById(R.id.dialog_message); txt_title.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); txt_message.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); txt_title.setText("Reply your request!"); txt_message.setText(agreestring); } else { Log.i("NOTI", "NOT FROM REQUEST"); } Log.i("JOB_Detail_ID", job_id); ((TextView) findViewById(R.id.jobdetail_showmap)) .setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); findViewById(R.id.jobdetail_showmap).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(JobDetailActivity.this, GoogleMapActivity.class); intent.putExtra("JobItem", jobitem); startActivity(intent); } }); progress = (ProgressWheel) findViewById(R.id.progress_wheel); progress_background = findViewById(R.id.detail_progresswheel_background); progress_background.bringToFront(); progress.bringToFront(); job_bid = (TextView) findViewById(R.id.job_bid); job_bid.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); job_reject = (TextView) findViewById(R.id.job_reject); job_reject.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); job_report = (TextView) findViewById(R.id.job_report); job_report.setTypeface(MyTypeFace.get(JobDetailActivity.this, MyTypeFace.NORMAL)); job_bid.setOnClickListener(this); job_reject.setOnClickListener(this); job_report.setOnClickListener(this); getDataFromServer(job_id); progress_background.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll); scrollView.setScrollViewCallbacks(this); mParallaxImageHeight = getResources().getDimensionPixelSize(R.dimen.parallax_image_height); }
From source file:knayi.delevadriver.AvaliableJobDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_avaliablejobdetail); //typelist = Arrays.asList(new String[]{"other", "express", "freezen"}); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); }/* www . ja v a 2s .co m*/ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setNavigationOnClickListener(this); TextView toolbarText = (TextView) toolbar.findViewById(R.id.toolbarTitle); toolbarText.setText("Job Details"); toolbarText.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); setTitle(""); sPref = getSharedPreferences(Config.TOKEN_PREF, MODE_PRIVATE); Bundle bundle = getIntent().getExtras(); job_id = bundle.getString("job_id"); Log.i("JOBID", job_id); Log.i("JOBID AA", sPref.getString(Config.TOKEN_JOBID, "aa")); Log.i("JOBID TRE", String.valueOf(sPref.getBoolean(Config.TOKEN_DELAY, false))); //check condition and show Delay Report Dialog /*if(job_id.equals(sPref.getString(Config.TOKEN_JOBID, ""))){ //check if there is delay and show dialog to report reason showDelayReportDialog(); }*/ buildGoogleApiClient(); mGoogleApiClient.connect(); mImageView = (ImageView) findViewById(R.id.image); mToolbarView = findViewById(R.id.toolbar); //jobtype = (TextView) findViewById(R.id.aval_jobdetail_type_value); //jobtype.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); jobprice = (TextView) findViewById(R.id.aval_jobdetail_price_value); jobprice.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); jobstatus = (TextView) findViewById(R.id.aval_jobdetail_status_value); jobstatus.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); TextView jobDeliverAdd = (TextView) findViewById(R.id.aval_jobdetail_requestertitle); jobDeliverAdd.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); /*jobaddress = (TextView) findViewById(R.id.aval_jobdetail_address_value); jobcreatetime = (TextView) findViewById(R.id.aval_jobdetail_createtime_value);*/ //requestertitle = (TextView) findViewById(R.id.aval_jobdetail_requestertitle_value); /*requesterphone = (TextView) findViewById(R.id.aval_jobdetail_requesterphone_value); requesterphone.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); requesteremail = (TextView) findViewById(R.id.aval_jobdetail_requesteremail_value); requesteremail.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); requesteraddress = (TextView) findViewById(R.id.aval_jobdetail_requesteraddress_value); requesteraddress.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL));*/ /*receivername = (TextView) findViewById(R.id.aval_jobdetail_receiver_name_value); receivercontact = (TextView) findViewById(R.id.aval_jobdetail_receiver_contact_value); size = (TextView) findViewById(R.id.aval_jobdetail_size_value);*/ weight = (TextView) findViewById(R.id.aval_jobdetail_weight_value); weight.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); sensitivity = (TextView) findViewById(R.id.aval_jobdetail_sensitivity_value); sensitivity.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); //duration = (TextView) findViewById(R.id.aval_jobdetail_duration_value); bitLayout = findViewById(R.id.jobBitLayout); imageprogress = (ProgressWheel) findViewById(R.id.aval_jobdetail_image_progress_wheel); imageprogress.bringToFront(); viewforPlacing = findViewById(R.id.viewforplacing); viewforPlacing1 = findViewById(R.id.viewforplacing1); relativeLayout = (RelativeLayout) findViewById(R.id.aval_jobdetail_relativelalyout); //pickuptime = (TextView) findViewById(R.id.aval_jobdetail_pickuptime_value); pickup_date = (TextView) findViewById(R.id.aval_jobdetail_pickupdate_value); pickup_date.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); pickup_time = (TextView) findViewById(R.id.aval_jobdetail_pickuptime_value); pickup_time.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); pickup_address = (TextView) findViewById(R.id.aval_jobdetail_pickupaddress_value); pickup_address.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); delivery_address = (TextView) findViewById(R.id.aval_jobdetail_deliverypaddress_value); delivery_address.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); TextView price_title = (TextView) findViewById(R.id.aval_jobdetail_price); price_title.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); SharedPreferences sharedPreferences = this.getSharedPreferences("com.websmithing.gpstracker.prefs", Context.MODE_PRIVATE); currentlyTracking = sharedPreferences.getBoolean("currentlyTracking", false); Log.i("NOTI_TYPE_DETAIL", bundle.getString("type")); if (bundle.getString("type").equals("job-nego-agree")) { Log.i("NOTI", "FROM REQUEST"); String agree = bundle.getString("agree"); String price = bundle.getString("price"); String agreestring; if (agree.equals("true")) { agreestring = "Request was agreed with " + price; } else { agreestring = "Request was not agreed"; } MaterialDialog dialog = new MaterialDialog.Builder(this) .customView(R.layout.custom_message_dialog, false).positiveText("OK") .positiveColor(R.color.white).positiveColorRes(R.color.white) .backgroundColorRes(R.color.primary).callback(new MaterialDialog.ButtonCallback() { @Override public void onPositive(final MaterialDialog dialog) { super.onPositive(dialog); dialog.dismiss(); } @Override public void onNegative(MaterialDialog dialog) { super.onNegative(dialog); dialog.dismiss(); } } ).build(); dialog.show(); TextView txt_title = (TextView) dialog.findViewById(R.id.dialog_title); TextView txt_message = (TextView) dialog.findViewById(R.id.dialog_message); txt_title.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); txt_message.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); txt_title.setText("Reply your request!"); txt_message.setText(agreestring); } else { Log.i("NOTI", "NOT FROM REQUEST"); } Log.i("JOB_Detail_ID", job_id); ((TextView) findViewById(R.id.aval_jobdetail_showmap)) .setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); findViewById(R.id.aval_jobdetail_showmap).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(AvaliableJobDetailActivity.this, GoogleMapActivity.class); intent.putExtra("JobItem", jobitem); startActivity(intent); } }); progress = (ProgressWheel) findViewById(R.id.progress_wheel); progress_background = findViewById(R.id.detail_progresswheel_background); progress_background.bringToFront(); progress.bringToFront(); job_bid = (TextView) findViewById(R.id.job_bid); job_bid.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); //job_reject = (TextView) findViewById(R.id.job_reject); //job_reject.setTypeface(MyTypeFace.get(AvaliableJobDetailActivity.this, MyTypeFace.NORMAL)); //job_report = (TextView) findViewById(R.id.job_report); job_bid.setOnClickListener(this); //job_reject.setOnClickListener(this); //job_report.setOnClickListener(this); getDataFromServer(job_id); progress_background.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); setBackgroundAlpha(mToolbarView, 1, getResources().getColor(R.color.primary)); ObservableScrollView scrollView = (ObservableScrollView) findViewById(R.id.scroll); scrollView.setScrollViewCallbacks(this); mParallaxImageHeight = getResources().getDimensionPixelSize(R.dimen.parallax_image_height); }
From source file:es.javocsoft.android.lib.toolbox.ToolBox.java
/** * Set a font to a text view./*from www.j a v a2 s . co m*/ * * @param context * @param textView * @param fontPath The path to the font resource. Must be placed in asset * folder. */ public static void font_applyTitleFont(Context context, TextView textView, String fontPath) { if (textView != null) { Typeface font = Typeface.createFromAsset(context.getAssets(), fontPath); textView.setTypeface(font); } }
From source file:com.fizz.StickyFragment.java
@Override public void onStart() { super.onStart(); LinearLayout ll = (LinearLayout) getActivity().findViewById(R.id.ll); for (int i = 0; i < drinks.length; i++) { TextView tt = new TextView(getActivity()); tt.setText(drinks[i].toUpperCase(Locale.US) + "\n" + ingredients[i]); tt.setPadding(15, 15, 15, 15);/*from w w w. j a va2 s. c o m*/ tt.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { drink = ((TextView) v).getText().toString(); try { Intent venmoIntent = VenmoLibrary.openVenmoPayment("1684", "Fizz", "8123744601", "0.01", drink, "pay"); startActivityForResult(venmoIntent, 1); // 1 is the requestCode we are using for Venmo. Feel // free to change this to another number. // Venmo native app not install on device, so let's // instead open a mobile web version of Venmo in a // WebView } catch (android.content.ActivityNotFoundException e) { Log.e("Fizz", "onClicked"); { Intent venmoIntent = new Intent(getActivity(), VenmoWebViewActivity.class); String venmo_uri = VenmoLibrary.openVenmoPaymentInWebView("1684", "Fizz", "8123744601", "0.01", "Drink", "pay"); venmoIntent.putExtra("url", venmo_uri); startActivityForResult(venmoIntent, 1); } //} catch (android.content.ActivityNotFoundException e) { //e.printStackTrace() ; } } }); tt.setTextSize(22); if (textnum % 2 == 0) { tt.setBackgroundColor(Color.argb(0, 51, 181, 229)); tt.setTextColor(Color.argb(255, 51, 181, 229)); } else { tt.setBackgroundColor(Color.argb(240, 51, 181, 229)); tt.setTextColor(Color.argb(255, 255, 255, 255)); } tt.setTypeface(SplashActivity.tp); ll.addView(tt); textnum++; } }
From source file:com.stikyhive.stikyhive.ChattingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { getWindow().setBackgroundDrawableResource(R.drawable.chat_bg); // this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); recipientStkid = getIntent().getExtras().getString("recipientStkid"); chatRecipient = getIntent().getExtras().getString("chatRecipient"); chatRecipientUrl = getIntent().getExtras().getString("chatRecipientUrl"); senderToken = getIntent().getExtras().getString("senderToken"); recipientToken = getIntent().getExtras().getString("recipientToken"); noti = getIntent().getExtras().getBoolean("noti"); message = getIntent().getExtras().getString("message"); rows = getIntent().getExtras().getInt("rows"); flagChatting = true;// w ww . ja v a 2s. c om pref = PreferenceManager.getDefaultSharedPreferences(this); offerId = 0; offerStatus = 0; ws = new JsonWebService(); dbHelper = new DBHelper(this); dialog = new ProgressDialog(this); listChatContact = new ArrayList<>(); listChatContact = dbHelper.getChatContact(); Log.i(" Chat Contact ", " " + listChatContact.size()); metrics = this.getResources().getDisplayMetrics(); //to change font faceSemi_bold = Typeface.createFromAsset(getAssets(), fontOSSemi_bold); Typeface faceLight = Typeface.createFromAsset(getAssets(), fontOSLight); faceRegular = Typeface.createFromAsset(getAssets(), fontOSRegular); imageLoader = ImageLoader.getInstance(); if (!imageLoader.isInited()) { imageLoader.init(ImageLoaderConfiguration.createDefault(this)); } start = new Date(); SimpleDateFormat oFormat = new SimpleDateFormat("dd MMM HH:mm"); timeSend = oFormat.format(start); super.onCreate(savedInstanceState); setContentView(R.layout.chat); layoutTalk = (LinearLayout) findViewById(R.id.layoutTalk); txtUserName = (TextView) findViewById(R.id.txtChatName); edTxtMsg = (EditText) findViewById(R.id.edTxtMsg); imgViewProfile = (ImageView) findViewById(R.id.imgViewChat); imgViewAddCon = (ImageView) findViewById(R.id.imgAddContact); lv = (ListView) findViewById(R.id.listView1); layoutLabel = (LinearLayout) findViewById(R.id.layoutLabel); txtLabel1 = (TextView) findViewById(R.id.txtLabel1); txtLabel2 = (TextView) findViewById(R.id.txtLabel2); txtLabel3 = (TextView) findViewById(R.id.txtLabel3); txtLabel2.setText(" " + chatRecipient + " "); txtLabel1.setTypeface(faceLight); txtLabel2.setTypeface(faceRegular); txtLabel3.setTypeface(faceLight); for (ChatContact contact : listChatContact) { if (contact.getContactId().equals(recipientStkid)) { imgViewAddCon.setVisibility(View.INVISIBLE); layoutLabel.setVisibility(View.GONE); break; } } Log.i(TAG, " come back again"); adapter = new ChatArrayAdapter(this, R.layout.chatting_listview, faceSemi_bold, faceRegular, recipientStkid, senderToken, recipientToken); lv.setAdapter(adapter); // adapter.add(new StikyChat(chatRecipientUrl, "Hello", false, "12.10.2015", "12.1.2014")); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout); // BEGIN_INCLUDE (change_colors) // Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids swipeRefreshLayout.setColorScheme(R.color.swipe_color_1, R.color.swipe_color_2, R.color.swipe_color_3, R.color.swipe_color_4); limitMsg = 7; // END_INCLUDE (change_colors) swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { Log.i(" Refresh Layout ", "onRefresh called from SwipeRefreshLayout"); if (limitMsg < rows) { Log.i("Limit Message ", " " + limitMsg); limitMsg *= 2; fetchRecords(); } else if ((!(rows <= 7)) && limitMsg > rows && (limitMsg - rows < 7)) { fetchRecords(); } else { Log.i("No data ", "to refresh"); swipeRefreshLayout.setRefreshing(false); Toast.makeText(getApplicationContext(), "No data to refresh!", Toast.LENGTH_SHORT).show(); } // initiateRefresh(); } }); LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout headerLayout = (LinearLayout) findViewById(R.id.header); View header = inflator.inflate(R.layout.header, null); TextView textView = (TextView) header.findViewById(R.id.textView1); textView.setText("StikyChat"); textView.setTypeface(faceSemi_bold); textView.setVisibility(View.VISIBLE); headerLayout.addView(header); LinearLayout layoutRight = (LinearLayout) header.findViewById(R.id.layoutRight); layoutRight.setVisibility(View.GONE); txtUserName.setText(chatRecipient); Log.i(TAG, "Activity Name " + txtUserName.getText().toString()); txtUserName.setTypeface(faceSemi_bold); String url = ""; Log.i(TAG, " ^^^ " + chatRecipientUrl + " "); if (chatRecipientUrl != null) { if (chatRecipientUrl.contains("http")) { url = chatRecipientUrl; } else if (chatRecipientUrl != "null") { url = this.getResources().getString(R.string.url) + "/" + chatRecipientUrl; } } addAndroidUniversalImageLoader(imgViewProfile, url); // if (noti && (!message.equals(""))) { // adapter.add(new StikyChat(chatRecipientUrl, message, true, timeSend, "")); // lv.smoothScrollToPosition(adapter.getCount() - 1); // } //to show history chats between two users(sender & recipient) dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); dateFormat2 = new SimpleDateFormat("dd MMM HH:mm"); listHistory = dbHelper.getStikyChat(); if (listHistory.size() > 0) { Collections.reverse(listHistory); for (final StikyChatTb chatTb : listHistory) { String getDate = chatTb.getSendDate(); String durationStr = null; String fromStikyBee = chatTb.getSender(); try { final String createDate = dateFormat2.format(dateFormat.parse(getDate)); if (chatTb.getFileName().contains("voice")) { MediaPlayer mPlayer = new MediaPlayer(); String voiceFileName = getResources().getString(R.string.url) + "/" + chatTb.getFileName(); try { mPlayer.setDataSource(voiceFileName); mPlayer.prepare(); } catch (IOException e) { e.printStackTrace(); } //mPlayer.start(); int duration = mPlayer.getDuration(); mPlayer.release(); duration = (int) Math.ceil(duration / 1024); if (duration < 10) { durationStr = "00:0" + duration; } else { durationStr = "00:" + duration; } // Log.i(TAG, "Duration Srt " + durationStr); } if (fromStikyBee.equals(pref.getString("stkid", ""))) { //String url1 = getResources().getString(R.string.url) + "/" + chatTb.getFileName(); // Log.i(TAG, " Offer Id " + chatTb.getOfferId() + " Price " + chatTb.getPrice() + " Name " + chatTb.getName()); //first false = right, second false = Offer // Log.i(TAG, " Duration " + chatTb.getRate() + " File Name " + chatTb.getFileName()); if (!chatTb.getFileName().contains("voice")) { Log.i(TAG, " Voice is not "); adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), false, createDate, chatTb.getFileName(), chatTb.getOfferId(), chatTb.getOfferStatus(), chatTb.getPrice(), chatTb.getRate(), chatTb.getName(), null, chatTb.getOriFName())); } else { Log.i(TAG, " Voice is "); adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), false, createDate, chatTb.getFileName(), chatTb.getOfferId(), chatTb.getOfferStatus(), chatTb.getPrice(), chatTb.getRate(), durationStr, null, chatTb.getOriFName())); } } else { /* Bitmap bmImg = BitmapFactory.decodeFile(getResources().getString(R.string.url) + "/" + chatTb.getFileName()); Bitmap resBm = getResizedBitmap(bmImg, 500);*/ // String url1 = getResources().getString(R.string.url) + "/" + chatTb.getFileName(); if (!chatTb.getFileName().contains("voice")) { adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), true, createDate, chatTb.getFileName(), chatTb.getOfferId(), chatTb.getOfferStatus(), chatTb.getPrice(), chatTb.getRate(), chatTb.getName(), null, chatTb.getOriFName())); } else { adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), true, createDate, chatTb.getFileName(), chatTb.getOfferId(), chatTb.getOfferStatus(), chatTb.getPrice(), chatTb.getRate(), durationStr, null, chatTb.getOriFName())); } } lv.smoothScrollToPosition(adapter.getCount() - 1); } catch (ParseException e) { e.printStackTrace(); } } } mRegistrationBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); fileNameGCM = sharedPreferences.getString("fileName", ""); messageGCM = sharedPreferences.getString("message", ""); offerIdGCM = sharedPreferences.getInt("offerId", 0); offerStatusGCM = sharedPreferences.getInt("offerStatus", 0); priceGCM = sharedPreferences.getString("price", ""); rateGCM = sharedPreferences.getString("rate", ""); nameGCM = sharedPreferences.getString("name", ""); recipientProfileGCM = sharedPreferences.getString("chatRecipientUrl", ""); recipientNameGCM = sharedPreferences.getString("chatRecipientName", ""); recipientStkidGCM = sharedPreferences.getString("recipientStkid", ""); recipientTokenGCM = sharedPreferences.getString("recipientToken", ""); senderTokenGCM = sharedPreferences.getString("senderToken", ""); Log.i(TAG, " FileName GCM " + fileNameGCM + " " + " Name Rate Price &&&&& *** " + messageGCM + " " + priceGCM + " " + rateGCM); if (firstConnect) { if (recipientStkidGCM.trim() == recipientStkid.trim() || recipientStkidGCM.equals(recipientStkid)) { MyGcmListenerService.flagSendNoti = false; Log.i(TAG, " " + message); // (1) get today's date start = new Date(); SimpleDateFormat oFormat = new SimpleDateFormat("dd MMM HH:mm"); timeSend = oFormat.format(start); Log.i(TAG, "First connect " + firstConnect); Log.i(TAG, " File Name GCMMMMMM " + fileNameGCM); /*if (!fileNameGCM.equals("") && !fileNameGCM.equals("null") && !fileNameGCM.equals(null)) { oriFName = saveFileAndImage(fileNameGCM); }*/ /*if (fileNameGCM.contains("voice")) { String durationStr; MediaPlayer mPlayer = new MediaPlayer(); String voiceFileName = getResources().getString(R.string.url) + "/" + fileNameGCM; try { mPlayer.setDataSource(voiceFileName); mPlayer.prepare(); } catch (IOException e) { e.printStackTrace(); } //mPlayer.start(); int duration = mPlayer.getDuration(); mPlayer.release(); duration = (int) Math.ceil(duration / 1024); if (duration < 10) { durationStr = "00:0" + duration; } else { durationStr = "00:" + duration; } StikyChat stikyChat = new StikyChat(recipientProfileGCM, messageGCM, true, timeSend, fileNameGCM.trim(), offerIdGCM, offerStatusGCM, priceGCM, rateGCM, durationStr, null, oriFName); adapter.add(stikyChat); } else {*/ StikyChat stikyChat = new StikyChat(recipientProfileGCM, messageGCM, true, timeSend, fileNameGCM.trim(), offerIdGCM, offerStatusGCM, priceGCM, rateGCM, nameGCM, null, oriFName); adapter.add(stikyChat); // } Log.i(TAG, " First " + message + " " + recipientProfileGCM + " " + timeSend); Log.i(TAG, "User " + txtUserName.getText().toString()); adapter.notifyDataSetChanged(); lv.setSelection(adapter.getCount() - 1); new regTask2().execute("Obj "); } else { /* if (!fileNameGCM.equals("") && !fileNameGCM.equals("null") && !fileNameGCM.equals(null)) { saveFileAndImage(fileNameGCM); }*/ Log.i(TAG, "..." + recipientStkidGCM.trim()); Log.i(TAG, "&&&" + recipientStkid.trim()); Log.i(TAG, "else casee"); //notificaton send flagNotifi = true; new regTask2().execute("Notification"); } firstConnect = false; } lv.setSelection(adapter.getCount() - 1); } }; /*edTxtMsg.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); layoutTalk.setLayoutParams(params); layoutTalk.setGravity(Gravity.CENTER); Toast.makeText(getBaseContext(), ((EditText) v).getId() + " has focus - " + hasFocus, Toast.LENGTH_LONG).show(); } });*/ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); edTxtMsg.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, 0); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); layoutTalk.setLayoutParams(params); layoutTalk.setGravity(Gravity.CENTER); flagRecord = false; /*getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE );*/ Toast.makeText(getBaseContext(), "Touch ...", Toast.LENGTH_LONG).show(); return false; } }); }
From source file:org.smilec.smile.student.CourseList.java
public void showToast(String msg) { LayoutInflater inflater = getLayoutInflater(); View layout = inflater.inflate(R.layout.toast_layout, (ViewGroup) findViewById(R.id.toast_layout_root)); TextView text = (TextView) layout.findViewById(R.id.text); text.setText(msg);/*from ww w . j av a 2s .c o m*/ Toast toast = new Toast(getApplicationContext()); if (smile.face != null) text.setTypeface(smile.face); text.setText(msg); toast.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 100); toast.setDuration(Toast.LENGTH_LONG); toast.setView(layout); toast.show(); }