List of usage examples for android.graphics Typeface BOLD
int BOLD
To view the source code for android.graphics Typeface BOLD.
Click Source Link
From source file:com.cloverstudio.spika.CreateGroupActivity.java
private void initialization() { mPasswordDialog = new HookUpPasswordDialog(this, true); mBtnCreate = (Button) findViewById(R.id.btnCreateGroup); mBtnCreate.setTypeface(SpikaApp.getTfMyriadProBold()); mEtGroupName = (EditText) findViewById(R.id.etCreateGroupName); mEtGroupName.setTypeface(SpikaApp.getTfMyriadPro()); mEtGroupPassword = (EditText) findViewById(R.id.etCreateGroupPassword); mEtGroupPassword.setTypeface(SpikaApp.getTfMyriadPro()); mEtGroupPassword.setOnTouchListener(new OnTouchListener() { @Override/*from ww w .ja v a2 s . c om*/ public boolean onTouch(View v, MotionEvent event) { mPasswordDialog.show(); hideKeyboard(); return false; } }); mEtGroupDescription = (EditText) findViewById(R.id.etCreateGroupDescription); mEtGroupDescription.setTypeface(SpikaApp.getTfMyriadPro()); mIvGroupImage = (ImageView) findViewById(R.id.ivGroupImage); mBtnBack = (Button) findViewById(R.id.btnBack); mBtnBack.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); mSpinnerCategory = (Spinner) findViewById(R.id.spinnerCategory); new GetGroupCategoriesAsync(this).execute(); }
From source file:org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { TextView vName = (TextView) view.findViewById(R.id.user_id_item_name); TextView vAddress = (TextView) view.findViewById(R.id.user_id_item_address); TextView vComment = (TextView) view.findViewById(R.id.user_id_item_comment); ImageView vVerified = (ImageView) view.findViewById(R.id.user_id_item_certified); ViewAnimator vVerifiedLayout = (ViewAnimator) view.findViewById(R.id.user_id_icon_animator); ImageView vDeleteButton = (ImageView) view.findViewById(R.id.user_id_item_delete_button); vDeleteButton.setVisibility(View.GONE); // not used String userId = cursor.getString(INDEX_USER_ID); OpenPgpUtils.UserId splitUserId = KeyRing.splitUserId(userId); if (splitUserId.name != null) { vName.setText(splitUserId.name); } else {/*from w w w.ja va2s . co m*/ vName.setText(R.string.user_id_no_name); } if (splitUserId.email != null) { vAddress.setText(splitUserId.email); vAddress.setVisibility(View.VISIBLE); } else { vAddress.setVisibility(View.GONE); } if (splitUserId.comment != null) { vComment.setText(splitUserId.comment); vComment.setVisibility(View.VISIBLE); } else { vComment.setVisibility(View.GONE); } boolean isPrimary = cursor.getInt(INDEX_IS_PRIMARY) != 0; boolean isRevoked = cursor.getInt(INDEX_IS_REVOKED) > 0; // for edit key if (mSaveKeyringParcel != null) { boolean changeAnyPrimaryUserId = (mSaveKeyringParcel.mChangePrimaryUserId != null); boolean changeThisPrimaryUserId = (mSaveKeyringParcel.mChangePrimaryUserId != null && mSaveKeyringParcel.mChangePrimaryUserId.equals(userId)); boolean revokeThisUserId = (mSaveKeyringParcel.mRevokeUserIds.contains(userId)); // only if primary user id will be changed // (this is not triggered if the user id is currently the primary one) if (changeAnyPrimaryUserId) { // change _all_ primary user ids and set new one to true isPrimary = changeThisPrimaryUserId; } if (revokeThisUserId) { if (!isRevoked) { isRevoked = true; } } vVerifiedLayout.setDisplayedChild(2); } else { vVerifiedLayout.setDisplayedChild(mShowStatusImages ? 1 : 0); } if (isRevoked) { // set revocation icon (can this even be primary?) KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.REVOKED, R.color.key_flag_gray); // disable revoked user ids vName.setEnabled(false); vAddress.setEnabled(false); vComment.setEnabled(false); } else { vName.setEnabled(true); vAddress.setEnabled(true); vComment.setEnabled(true); if (isPrimary) { vName.setTypeface(null, Typeface.BOLD); vAddress.setTypeface(null, Typeface.BOLD); } else { vName.setTypeface(null, Typeface.NORMAL); vAddress.setTypeface(null, Typeface.NORMAL); } int isVerified = cursor.getInt(INDEX_VERIFIED); switch (isVerified) { case Certs.VERIFIED_SECRET: KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.VERIFIED, KeyFormattingUtils.DEFAULT_COLOR); break; case Certs.VERIFIED_SELF: KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.UNVERIFIED, KeyFormattingUtils.DEFAULT_COLOR); break; default: KeyFormattingUtils.setStatusImage(mContext, vVerified, null, State.INVALID, KeyFormattingUtils.DEFAULT_COLOR); break; } } }
From source file:com.example.drugsformarinemammals.General_Info_Drug.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.general_info_drug); isStoredInLocal = false;//w w w . jav a 2 s.co m fiveLastScreen = false; helper = new Handler_Sqlite(this); helper.open(); Bundle extras1 = this.getIntent().getExtras(); if (extras1 != null) { infoBundle = extras1.getStringArrayList("generalInfoDrug"); fiveLastScreen = extras1.getBoolean("fiveLastScreen"); if (infoBundle == null) isStoredInLocal = true; if (!isStoredInLocal) { initializeGeneralInfoDrug(); initializeCodesInformation(); initializeCodes(); } else { drug_name = extras1.getString("drugName"); codes = helper.getCodes(drug_name); codesInformation = helper.getCodesInformation(drug_name); } //Title TextView drugTitle = (TextView) findViewById(R.id.drugTitle); drugTitle.setText(drug_name); drugTitle.setTypeface(Typeface.SANS_SERIF); //Description LinearLayout borderDescription = new LinearLayout(this); borderDescription.setOrientation(LinearLayout.VERTICAL); borderDescription .setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); borderDescription.setBackgroundResource(R.drawable.layout_border); TextView description = new TextView(this); if (isStoredInLocal) description.setText(helper.getDescription(drug_name)); else description.setText(this.description); description.setTextSize(18); description.setTypeface(Typeface.SANS_SERIF); LinearLayout.LayoutParams paramsDescription = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); paramsDescription.leftMargin = 60; paramsDescription.rightMargin = 60; paramsDescription.topMargin = 20; borderDescription.addView(description, borderDescription.getChildCount(), paramsDescription); LinearLayout layoutDescription = (LinearLayout) findViewById(R.id.layoutDescription); layoutDescription.addView(borderDescription, layoutDescription.getChildCount()); //Animals TextView headerAnimals = (TextView) findViewById(R.id.headerAnimals); headerAnimals.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); Button cetaceansButton = (Button) findViewById(R.id.cetaceansButton); cetaceansButton.setText("CETACEANS"); cetaceansButton.setTypeface(Typeface.SANS_SERIF); cetaceansButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDoseInformation(drug_name, "Cetaceans"); } }); Button pinnipedsButton = (Button) findViewById(R.id.pinnipedsButton); pinnipedsButton.setText("PINNIPEDS"); pinnipedsButton.setTypeface(Typeface.SANS_SERIF); pinnipedsButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SQLiteDatabase db = helper.open(); ArrayList<String> families = new ArrayList<String>(); if (db != null) families = helper.read_animals_family(drug_name, "Pinnipeds"); if ((families != null && families.size() == 1 && families.get(0).equals("")) || (families != null && families.size() == 0)) showDoseInformation(drug_name, "Pinnipeds"); else showDoseInformationPinnipeds(drug_name, families); } }); Button otherButton = (Button) findViewById(R.id.otherButton); otherButton.setText("OTHER MM"); otherButton.setTypeface(Typeface.SANS_SERIF); otherButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDoseInformation(drug_name, "Other MM"); } }); //Codes & therapeutic target & anatomical target TextView headerATCvetCodes = (TextView) findViewById(R.id.headerATCvetCodes); headerATCvetCodes.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); //Action TextView headerActionAnatomical = (TextView) findViewById(R.id.headerActionAnatomical); headerActionAnatomical.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); createTextViewAnatomical(); createBorderAnatomicalGroup(); TextView headerActionTherapeutic = (TextView) findViewById(R.id.headerActionTherapeutic); headerActionTherapeutic.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); createTextViewTherapeutic(); createBorderTherapeuticGroup(); params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); params.leftMargin = 60; params.rightMargin = 60; params.topMargin = 20; Spinner codesSpinner = (Spinner) findViewById(R.id.codesSpinner); SpinnerAdapter adapterCodes = new SpinnerAdapter(this, R.layout.item_spinner, codes); adapterCodes.setDropDownViewResource(R.layout.spinner_dropdown_item); codesSpinner.setAdapter(adapterCodes); codesSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View arg1, int arg2, long arg3) { userEntryCode = parent.getSelectedItem().toString(); int numCodes = codesInformation.size(); layoutAnatomicalGroup.removeView(borderAnatomicalGroup); createBorderAnatomicalGroup(); boolean founded = false; int i = 0; while (!founded && i < numCodes) { if (userEntryCode.equals(codesInformation.get(i).getCode())) { createTextViewAnatomical(); anatomicalGroup.setText(codesInformation.get(i).getAnatomic_group() + "\n"); borderAnatomicalGroup.addView(anatomicalGroup, borderAnatomicalGroup.getChildCount(), params); founded = true; } i++; } layoutAnatomicalGroup = (LinearLayout) findViewById(R.id.layoutActionAnatomical); layoutAnatomicalGroup.addView(borderAnatomicalGroup, layoutAnatomicalGroup.getChildCount()); layoutTherapeuticGroup.removeView(borderTherapeuticGroup); createBorderTherapeuticGroup(); founded = false; i = 0; while (!founded && i < numCodes) { if (userEntryCode.equals(codesInformation.get(i).getCode())) { createTextViewTherapeutic(); therapeuticGroup.setText(codesInformation.get(i).getTherapeutic_group() + "\n"); borderTherapeuticGroup.addView(therapeuticGroup, borderTherapeuticGroup.getChildCount(), params); founded = true; } i++; } layoutTherapeuticGroup = (LinearLayout) findViewById(R.id.layoutActionTherapeutic); layoutTherapeuticGroup.addView(borderTherapeuticGroup, layoutTherapeuticGroup.getChildCount()); } public void onNothingSelected(AdapterView<?> arg0) { } }); layoutAnatomicalGroup = (LinearLayout) findViewById(R.id.layoutActionAnatomical); layoutTherapeuticGroup = (LinearLayout) findViewById(R.id.layoutActionTherapeutic); borderTherapeuticGroup.addView(therapeuticGroup, borderTherapeuticGroup.getChildCount(), params); borderAnatomicalGroup.addView(anatomicalGroup, borderAnatomicalGroup.getChildCount(), params); layoutAnatomicalGroup.addView(borderAnatomicalGroup, layoutAnatomicalGroup.getChildCount()); layoutTherapeuticGroup.addView(borderTherapeuticGroup, layoutTherapeuticGroup.getChildCount()); //Generic Drug TextView headerGenericDrug = (TextView) findViewById(R.id.headerGenericDrug); headerGenericDrug.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); boolean isAvalaible = false; if (isStoredInLocal) isAvalaible = helper.isAvalaible(drug_name); else isAvalaible = available.equals("Yes"); if (isAvalaible) { ImageView genericDrug = new ImageView(this); genericDrug.setImageResource(R.drawable.tick_verde); LinearLayout layoutGenericDrug = (LinearLayout) findViewById(R.id.layoutGenericDrug); layoutGenericDrug.addView(genericDrug); } else { Typeface font = Typeface.createFromAsset(getAssets(), "Typoster_demo.otf"); TextView genericDrug = new TextView(this); genericDrug.setTypeface(font); genericDrug.setText("Nd"); genericDrug.setTextColor(getResources().getColor(R.color.maroon)); genericDrug.setTextSize(20); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int size = metrics.widthPixels; int middle = size / 2; int quarter = size / 4; genericDrug.setTranslationX(middle - quarter); genericDrug.setTranslationY(-3); LinearLayout layoutGenericDrug = (LinearLayout) findViewById(R.id.layoutGenericDrug); layoutGenericDrug.addView(genericDrug); } //Licenses TextView headerLicense = (TextView) findViewById(R.id.headerLicense); headerLicense.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD); TextView fdaLicense = (TextView) findViewById(R.id.license1); Typeface font = Typeface.createFromAsset(getAssets(), "Typoster_demo.otf"); fdaLicense.setTypeface(font); String fda; if (isStoredInLocal) fda = helper.getLicense_FDA(drug_name); else fda = license_FDA; if (fda.equals("Yes")) { fdaLicense.setText("Yes"); fdaLicense.setTextColor(getResources().getColor(R.color.lightGreen)); } else { fdaLicense.setText("Nd"); fdaLicense.setTextColor(getResources().getColor(R.color.maroon)); } TextView emaLicense = (TextView) findViewById(R.id.license3); emaLicense.setTypeface(font); String ema; if (isStoredInLocal) ema = helper.getLicense_EMA(drug_name); else ema = license_EMA; if (ema.equals("Yes")) { emaLicense.setText("Yes"); emaLicense.setTextColor(getResources().getColor(R.color.lightGreen)); } else { emaLicense.setText("Nd"); emaLicense.setTextColor(getResources().getColor(R.color.maroon)); } TextView aempsLicense = (TextView) findViewById(R.id.license2); aempsLicense.setTypeface(font); String aemps; if (isStoredInLocal) aemps = helper.getLicense_AEMPS(drug_name); else aemps = license_AEMPS; if (aemps.equals("Yes")) { aempsLicense.setText("Yes"); aempsLicense.setTextColor(getResources().getColor(R.color.lightGreen)); } else { aempsLicense.setText("Nd"); aempsLicense.setTextColor(getResources().getColor(R.color.maroon)); } ImageButton food_and_drug = (ImageButton) findViewById(R.id.food_and_drug); food_and_drug.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse( "http://www.fda.gov/animalveterinary/products/approvedanimaldrugproducts/default.htm")); startActivity(intent); } }); ImageButton european_medicines_agency = (ImageButton) findViewById(R.id.european_medicines_agency); european_medicines_agency.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse( "http://www.ema.europa.eu/ema/index.jsp?curl=pages/medicines/landing/vet_epar_search.jsp&mid=WC0b01ac058001fa1c")); startActivity(intent); } }); ImageButton logo_aemps = (ImageButton) findViewById(R.id.logo_aemps); logo_aemps.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse( "http://www.aemps.gob.es/medicamentosVeterinarios/Med-Vet-autorizados/home.htm")); startActivity(intent); } }); if (helper.existDrug(drug_name)) { int drug_priority = helper.getDrugPriority(drug_name); ArrayList<String> sorted_drugs = new ArrayList<String>(); sorted_drugs.add(0, drug_name); for (int i = 1; i < drug_priority; i++) { String name = helper.getDrugName(i); sorted_drugs.add(i, name); } for (int i = 0; i < sorted_drugs.size(); i++) helper.setDrugPriority(sorted_drugs.get(i), i + 1); } if (!isStoredInLocal) { //Server code String[] urls = { "http://formmulary.tk/Android/getDoseInformation.php?drug_name=", "http://formmulary.tk/Android/getGeneralNotesInformation.php?drug_name=" }; new GetDoseInformation(this).execute(urls); } helper.close(); } }
From source file:com.arcusapp.soundbox.fragment.PlayFragment.java
private void initUI(View rootView) { txtTitle = (TextView) rootView.findViewById(R.id.txtSongTitle); txtTitle.setTypeface(null, Typeface.BOLD); txtTitle.setSelected(true);//from w w w.j a v a 2 s .c o m txtArtist = (TextView) rootView.findViewById(R.id.txtSongArtist); txtAlbum = (TextView) rootView.findViewById(R.id.txtSongAlbum); txtTimeCurrent = (TextView) rootView.findViewById(R.id.txtTimeCurrent); txtTimeTotal = (TextView) rootView.findViewById(R.id.txtTimeTotal); btnPlayPause = (ImageButton) rootView.findViewById(R.id.btnPlayPause); btnPlayPause.setOnClickListener(this); btnPrevious = (ImageButton) rootView.findViewById(R.id.btnPrevSong); btnPrevious.setOnClickListener(this); btnNext = (ImageButton) rootView.findViewById(R.id.btnNextSong); btnNext.setOnClickListener(this); btnSwitchRandom = (ImageButton) rootView.findViewById(R.id.btnSwitchRandom); btnSwitchRandom.setOnClickListener(this); btnSwitchRepeat = (ImageButton) rootView.findViewById(R.id.btnSwitchRepeat); btnSwitchRepeat.setOnClickListener(this); btnPanel = (ImageButton) rootView.findViewById(R.id.btnPanel); btnPanel.setOnClickListener(this); // init the seekbar seekBar = (SeekBar) rootView.findViewById(R.id.seekBar); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { if (mediaService != null) { mediaService.seekTo(progress); seekBar.setProgress(progress); } } } }); }
From source file:com.androidquery.simplefeed.fragments.FeedFragment.java
public void notiCb(String url, JSONObject jo, AjaxStatus status) { AQUtility.debug("noti", jo); if (jo != null) { int count = 0; PQuery aq = aq2.recycle(header); /*//from www. java 2 s. c om JSONObject sum = jo.optJSONObject("summary"); if(sum != null){ count = sum.optInt("unseen_count", 0); }*/ JSONArray ja = jo.optJSONArray("data"); for (int i = 0; i < ja.length(); i++) { JSONObject noti = ja.optJSONObject(i); if (noti.optInt("unread", 0) != 0) { count++; } } String message = count + " " + getString(R.string.n_notifications); aq.id(R.id.text_noti).text(message); int colorId = R.color.noti; int tf = Typeface.BOLD; if (count == 0) { colorId = R.color.grey; tf = Typeface.NORMAL; } aq.textColor(getResources().getColor(colorId)).getTextView().setTypeface(null, tf); } }
From source file:fm.krui.kruifm.ScheduleFragment.java
/** * Adds a show to the schedule./*from ww w. j a v a2 s. co m*/ * @param title Title of show to display * @param description Description of show to display * @param startTime Start time of show in minutes from midnight * @param endTime End time of show in minutes from midnight * @param category Format of this show, required to correctly color the event. * * Valid settings for category include: * 1 - Regular Rotation * 2 - Music Speciality * 3 - Sports * 4 - News/Talk * 5 - Specials */ private void addShow(String title, String description, int startTime, int endTime, int category) { /* Build the LinearLayout to function as the container for this show. Since the size of the container is to represent the length of the show, its height must be proportional (1dp = 1 minute) to the length. Determine length by finding the difference between the start and end times. */ // Fix for corner case of shows ending at midnight. if (endTime == 0) { endTime = 1440; } int difference = endTime - startTime; /* Define the margins of this show. All shows must not overlap the displayed times, which are 50dp in width. Add 5 more (to the right and left) to see the schedule lines for clarity. Push the show down to align with the appropriate time marker using the top margin value set to the difference (in minutes) between midnight and the start of the show. */ Log.v(TAG, "Configuring " + title); //Log.v(TAG, "Start time: " + startTime + " End time: " + endTime); //Log.v(TAG, "Setting parameters for " + title); RelativeLayout.LayoutParams rrLayoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, dpToPixels(difference)); rrLayoutParams.leftMargin = dpToPixels(55); //Log.v(TAG, "Left margin: " + rrLayoutParams.leftMargin); rrLayoutParams.topMargin = dpToPixels(startTime); //Log.v(TAG, "Top margin: " + rrLayoutParams.topMargin); rrLayoutParams.rightMargin = dpToPixels(5); //Log.v(TAG, "Right margin: " + rrLayoutParams.rightMargin); /* Build LinearLayout and apply parameters */ LinearLayout eventLL = new LinearLayout(getActivity()); eventLL.setOrientation(LinearLayout.VERTICAL); eventLL.setPadding(dpToPixels(5), dpToPixels(2), dpToPixels(5), dpToPixels(5)); // Get background for this event eventLL.setBackgroundResource(getEventBackground(category)); /* Add title of event to LinearLayout */ TextView titleTV = new TextView(getActivity()); // Title of a show should be bolded titleTV.setText(title); titleTV.setTypeface(null, Typeface.BOLD); titleTV.setPadding(dpToPixels(5), 0, dpToPixels(5), 0); eventLL.addView(titleTV); /* Determine length of event to see if we have room to attach a description (if one was passed) */ int length = endTime - startTime; /* Attach a description with a size that depends on the event length (longer events can hold more description text). */ if (description != null) { TextView descriptionTV = new TextView(getActivity()); descriptionTV.setPadding(dpToPixels(5), dpToPixels(5), dpToPixels(5), dpToPixels(5)); descriptionTV.setText(description); // ~hour long shows can display 1 line of description if (difference >= 30 && difference <= 60) { descriptionTV.setMaxLines(1); } // 1:30 long shows can display 2 lines of description else if (difference >= 60 && difference <= 90) { descriptionTV.setMaxLines(2); } // 2:00 long shows can display 4 lines of description else if (difference >= 120) { descriptionTV.setMaxLines(4); } descriptionTV.setEllipsize(TextUtils.TruncateAt.END); descriptionTV.setPadding(dpToPixels(5), dpToPixels(5), dpToPixels(5), dpToPixels(5)); eventLL.addView(descriptionTV); } /* Add this view to the schedule UI */ RelativeLayout rl = (RelativeLayout) rootView.findViewById(R.id.schedule_container_relativelayout); rl.addView(eventLL, rrLayoutParams); }
From source file:com.owncloud.android.ui.dialog.SyncedFolderPreferencesDialogFragment.java
/** * find all relevant UI elements and set their values. * * @param view the parent view/*ww w .j a v a2 s . com*/ */ private void setupDialogElements(View view) { // find/saves UI elements mEnabledSwitch = (SwitchCompat) view.findViewById(R.id.sync_enabled); mLocalFolderPath = (TextView) view.findViewById(R.id.folder_sync_settings_local_folder_path); mRemoteFolderSummary = (TextView) view.findViewById(R.id.remote_folder_summary); mUploadOnWifiCheckbox = (CheckBox) view.findViewById(R.id.setting_instant_upload_on_wifi_checkbox); mUploadOnChargingCheckbox = (CheckBox) view.findViewById(R.id.setting_instant_upload_on_charging_checkbox); mUploadUseSubfoldersCheckbox = (CheckBox) view .findViewById(R.id.setting_instant_upload_path_use_subfolders_checkbox); mUploadBehaviorSummary = (TextView) view.findViewById(R.id.setting_instant_behaviour_summary); // Set values setEnabled(mSyncedFolder.getEnabled()); mLocalFolderPath.setText(DisplayUtils.createTextWithSpan( String.format(getString(R.string.folder_sync_preferences_folder_path), mSyncedFolder.getLocalPath()), mSyncedFolder.getFolderName(), new StyleSpan(Typeface.BOLD))); mRemoteFolderSummary.setText(mSyncedFolder.getRemotePath()); mUploadOnWifiCheckbox.setChecked(mSyncedFolder.getWifiOnly()); mUploadOnChargingCheckbox.setChecked(mSyncedFolder.getChargingOnly()); mUploadUseSubfoldersCheckbox.setChecked(mSyncedFolder.getSubfolderByDate()); mUploadBehaviorSummary.setText(mUploadBehaviorItemStrings[mSyncedFolder.getUploadActionInteger()]); }
From source file:com.metinkale.prayerapp.BaseActivity.java
@Override public void setContentView(int res) { super.setContentView(R.layout.activity_base); final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { setSupportActionBar(toolbar);/*w ww . j av a 2 s .co m*/ toolbar.setBackgroundResource(R.color.colorPrimary); toolbar.setNavigationIcon( MaterialDrawableBuilder.with(this).setIcon(MaterialDrawableBuilder.IconValue.VIEW_HEADLINE) .setColor(Color.WHITE).setToActionbarSize().build()); } ViewGroup content = (ViewGroup) findViewById(R.id.basecontent); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer); View v = LayoutInflater.from(this).inflate(res, content, false); content.addView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); mNav = (ListView) mDrawerLayout.findViewById(R.id.base_nav); ArrayAdapter<String> list = new ArrayAdapter<String>(this, R.layout.drawer_list_item, getResources().getStringArray(R.array.dropdown)) { @NonNull @Override public View getView(int pos, View v, @NonNull ViewGroup p) { v = super.getView(pos, v, p); if (pos == mNavPos) { ((TextView) v).setTypeface(null, Typeface.BOLD); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) { ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(0, 0, ICONS[pos], 0); } else { ((TextView) v).setCompoundDrawablesWithIntrinsicBounds(ICONS[pos], 0, 0, 0); } return v; } }; mNav.setAdapter(list); mNav.setOnItemClickListener(new MyClickListener()); final String title = list.getItem(mNavPos); mDrawerLayout.post(new Runnable() { @Override public void run() { if (toolbar != null) { toolbar.setTitle(title); } } }); if (getIntent().getBooleanExtra("anim", false)) { mDrawerLayout.openDrawer(GravityCompat.START); mDrawerLayout.post(new Runnable() { @Override public void run() { mDrawerLayout.closeDrawers(); } }); } }
From source file:org.sirimangalo.meditationplus.AdapterMed.java
@Override public View getView(final int position, View convertView, ViewGroup parent) { View rowView;//from w w w. jav a 2s . c o m if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.list_item_med, parent, false); } else { rowView = convertView; } JSONObject p = values.get(position); TextView walk = (TextView) rowView.findViewById(R.id.one_walking); TextView sit = (TextView) rowView.findViewById(R.id.one_sitting); ImageView status = (ImageView) rowView.findViewById(R.id.one_status); TextView name = (TextView) rowView.findViewById(R.id.one_med); ImageView flag = (ImageView) rowView.findViewById(R.id.one_flag); View anuView = rowView.findViewById(R.id.anumodana_shell); TextView anuText = (TextView) rowView.findViewById(R.id.anumodana); try { String wo = p.getString("walking"); String so = p.getString("sitting"); int wi = Integer.parseInt(wo); int si = Integer.parseInt(so); int ti = Integer.parseInt(p.getString("start")); int ei = Integer.parseInt(p.getString("end")); long nowL = System.currentTimeMillis() / 1000; int now = (int) nowL; boolean finished = false; String ws = "0"; String ss = "0"; if (ei > now) { float secs = now - ti; if (secs > wi * 60 || wi == 0) { //walking done float ssecs = (int) (secs - (wi * 60)); if (ssecs < si * 60) // still sitting ss = Integer.toString((int) Math.floor(si - ssecs / 60)); status.setImageResource(R.drawable.sitting_icon); } else { // still walking ws = Integer.toString((int) Math.floor(wi - secs / 60)); ss = so; status.setImageResource(R.drawable.walking_icon); } ws += "/" + wo; ss += "/" + so; } else { ws = wo; ss = so; double age = 1 - (now - ei) / MAX_AGE; String ageColor = Integer.toHexString((int) (255 * age)); if (ageColor.length() == 1) ageColor = "0" + ageColor; int alpha = Color.parseColor("#" + ageColor + "000000"); walk.setTextColor(alpha); sit.setTextColor(alpha); name.setTextColor(alpha); status.setAlpha((float) age); flag.setAlpha((float) age); } walk.setText(ws); sit.setText(ss); if (p.has("country")) { int id = context.getResources().getIdentifier("flag_" + p.getString("country").toLowerCase(), "drawable", context.getPackageName()); flag.setImageResource(id); flag.setVisibility(View.VISIBLE); } final String username = p.getString("username"); final String edit = p.getString("can_edit"); name.setText(username); name.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { context.showProfile(username); } }); String type = p.getString("type"); if ("love".equals(type)) status.setImageResource(R.drawable.love_icon); String anu = p.getString("anumodana"); if (!anu.equals("0")) anuText.setText(anu); if (p.getString("anu_me").equals("1")) { anuText.setTextColor(0xFF00BB00); anuText.setTypeface(null, Typeface.BOLD); } final String sid = p.getString("sid"); anuView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.d(TAG, "anu clicked"); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String loggedUsername = prefs.getString("username", ""); String loginToken = prefs.getString("login_token", ""); ArrayList<NameValuePair> nvp = new ArrayList<NameValuePair>(); nvp.add(new BasicNameValuePair("form_id", "anumed_" + sid)); nvp.add(new BasicNameValuePair("login_token", loginToken)); nvp.add(new BasicNameValuePair("submit", "Refresh")); nvp.add(new BasicNameValuePair("username", loggedUsername)); nvp.add(new BasicNameValuePair("source", "android")); PostTaskRunner postTask = new PostTaskRunner(postHandler, context); postTask.doPostTask(nvp); } }); } catch (Exception e) { e.printStackTrace(); } return rowView; }
From source file:org.gnucash.android.ui.report.BalanceSheetFragment.java
/** * Loads rows for the individual accounts and adds them to the report * @param accountTypes Account types for which to load balances * @param tableLayout Table layout into which to load the rows */// w ww .jav a2s . co m private void loadAccountViews(List<AccountType> accountTypes, TableLayout tableLayout) { LayoutInflater inflater = LayoutInflater.from(getActivity()); Cursor cursor = mAccountsDbAdapter.fetchAccounts( DatabaseSchema.AccountEntry.COLUMN_TYPE + " IN ( '" + TextUtils.join("' , '", accountTypes) + "' ) AND " + DatabaseSchema.AccountEntry.COLUMN_PLACEHOLDER + " = 0", null, DatabaseSchema.AccountEntry.COLUMN_FULL_NAME + " ASC"); while (cursor.moveToNext()) { String accountUID = cursor .getString(cursor.getColumnIndexOrThrow(DatabaseSchema.AccountEntry.COLUMN_UID)); String name = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseSchema.AccountEntry.COLUMN_NAME)); Money balance = mAccountsDbAdapter.getAccountBalance(accountUID); View view = inflater.inflate(R.layout.row_balance_sheet, tableLayout, false); ((TextView) view.findViewById(R.id.account_name)).setText(name); TextView balanceTextView = ((TextView) view.findViewById(R.id.account_balance)); TransactionsActivity.displayBalance(balanceTextView, balance); tableLayout.addView(view); } View totalView = inflater.inflate(R.layout.row_balance_sheet, tableLayout, false); TableLayout.LayoutParams layoutParams = (TableLayout.LayoutParams) totalView.getLayoutParams(); layoutParams.setMargins(layoutParams.leftMargin, 20, layoutParams.rightMargin, layoutParams.bottomMargin); totalView.setLayoutParams(layoutParams); TextView accountName = (TextView) totalView.findViewById(R.id.account_name); accountName.setTextSize(16); accountName.setText(R.string.label_balance_sheet_total); TextView accountBalance = (TextView) totalView.findViewById(R.id.account_balance); accountBalance.setTextSize(16); accountBalance.setTypeface(null, Typeface.BOLD); TransactionsActivity.displayBalance(accountBalance, mAccountsDbAdapter.getAccountBalance(accountTypes, -1, System.currentTimeMillis())); tableLayout.addView(totalView); }