diff options
12 files changed, 1716 insertions, 0 deletions
diff --git a/build/sdk.atree b/build/sdk.atree index f2b747e32..16d65de16 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -75,6 +75,7 @@ development/samples/SkeletonApp platforms/${PLATFORM_NAME}/samples/SkeletonApp development/samples/Snake platforms/${PLATFORM_NAME}/samples/Snake development/samples/SoftKeyboard platforms/${PLATFORM_NAME}/samples/SoftKeyboard development/samples/JetBoy platforms/${PLATFORM_NAME}/samples/JetBoy +development/samples/SearchableDictionary platforms/${PLATFORM_NAME}/samples/SearchableDictionary # dx bin/dx platforms/${PLATFORM_NAME}/tools/dx diff --git a/samples/SearchableDictionary/Android.mk b/samples/SearchableDictionary/Android.mk new file mode 100755 index 000000000..8c5fdf489 --- /dev/null +++ b/samples/SearchableDictionary/Android.mk @@ -0,0 +1,12 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := samples + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_SDK_VERSION := current + +LOCAL_PACKAGE_NAME := SearchableDictionary + +include $(BUILD_PACKAGE) diff --git a/samples/SearchableDictionary/AndroidManifest.xml b/samples/SearchableDictionary/AndroidManifest.xml new file mode 100644 index 000000000..93cd47beb --- /dev/null +++ b/samples/SearchableDictionary/AndroidManifest.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.example.android.searchabledict"> + + <uses-sdk android:minSdkVersion="4" /> + + <application android:label="@string/app_name" + android:icon="@drawable/ic_dictionary"> + + <!-- The default activity of the app. Can also display search results. --> + <activity android:name=".SearchableDictionary" + android:label="@string/app_name" + android:theme="@android:style/Theme.NoTitleBar"> + + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + + <!-- Receives the search request. --> + <intent-filter> + <action android:name="android.intent.action.SEARCH" /> + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + + <!-- Points to searchable meta data. --> + <meta-data android:name="android.app.searchable" + android:resource="@xml/searchable"/> + </activity> + + <!-- Displays the definition of a word. --> + <activity android:name=".WordActivity" + android:theme="@android:style/Theme.NoTitleBar"/> + + <!-- Provides search suggestions for words and their definitions. --> + <provider android:name="DictionaryProvider" + android:authorities="dictionary" + android:syncable="false" /> + + </application> +</manifest> diff --git a/samples/SearchableDictionary/res/layout/main.xml b/samples/SearchableDictionary/res/layout/main.xml new file mode 100644 index 000000000..d0dd52274 --- /dev/null +++ b/samples/SearchableDictionary/res/layout/main.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <TextView + android:id="@+id/textField" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/search_instructions"/> + + <ListView + android:id="@+id/list" + android:layout_width="fill_parent" + android:layout_height="0dip" + android:layout_weight="1"/> +</LinearLayout> + + diff --git a/samples/SearchableDictionary/res/layout/word.xml b/samples/SearchableDictionary/res/layout/word.xml new file mode 100644 index 000000000..ba1a3daf6 --- /dev/null +++ b/samples/SearchableDictionary/res/layout/word.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="fill_parent"> + <TextView + android:id="@+id/word" + android:textAppearance="?android:attr/textAppearanceLarge" + android:textSize="30sp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/search_instructions" + android:layout_marginLeft="10dip" + android:layout_marginTop="5dip" /> + <TextView + android:id="@+id/definition" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="@string/search_instructions" + android:layout_marginLeft="10dip" /> +</LinearLayout> diff --git a/samples/SearchableDictionary/res/raw/definitions.txt b/samples/SearchableDictionary/res/raw/definitions.txt new file mode 100644 index 000000000..e4e1cbda6 --- /dev/null +++ b/samples/SearchableDictionary/res/raw/definitions.txt @@ -0,0 +1,997 @@ +abbey - n. a monastery ruled by an abbot +abide - v. dwell; inhabit or live in +abound - v. be abundant or plentiful; exist in large quantities +absence - n. the state of being absent +absorb - v. assimilate or take in +abstinence - n. practice of refraining from indulging an appetite especially alcohol +absurd - j. inconsistent with reason or logic or common sense +abundant - j. present in great quantity +abusive - j. characterized by physical or psychological maltreatment +academic - j. associated with school or learning +academy - n. a school for special training +accept - v. consider or hold as true +access - v. reach or gain access to +accessible - j. easily obtained +acclaim - n. enthusiastic approval +accommodate - v. provide with something desired or needed +accompany - v. go or travel along with +accomplish - v. to gain with effort +account - v. furnish a justifying analysis or explanation +accurate - j. conforming exactly or almost exactly to fact or to a standard or performing with total accuracy +accusation - n. an assertion that someone is guilty of a fault or offence +accuse - v. blame for, make a claim of wrongdoing or misbehavior against +acid - j. biting, sarcastic, or scornful +acknowledge - v. declare to be true or admit the existence or reality or truth of +acquire - v. come into the possession of something concrete or abstract +acquisition - n. something acquired or received +adamant - j. impervious to pleas, persuasion, requests, reason +adjacent - j. having a common boundary or edge; abutting; touching +administrator - n. someone who manages a government agency or department +advent - n. arrival that has been awaited (especially of something momentous) +adverse - j. contrary to your interests or welfare +advisory - n. an announcement that usually advises or warns the public of some threat +advocacy - n. active support of an idea or cause etc.; especially the act of pleading or arguing for something +advocate - v. speak, plead, or argue in favor of +affect - n. the conscious subjective aspect of feeling or emotion +affirmative - j. affirming or giving assent +aggression - n. violent action that is hostile and usually unprovoked +airy - j. not practical or realizable; speculative +album - n. a book of blank pages with pockets or envelopes; for organizing photographs or stamp collections etc +alcohol - n. a liquor or brew containing alcohol as the active agent +alien - j. being or from or characteristic of another place or part of the world +allegiance - n. the loyalty that citizens owe to their country (or subjects to their sovereign) +alley - n. a narrow street with walls on both sides +alliance - n. a formal agreement establishing an association or alliance between nations or other groups to achieve a particular aim +ally - n. an associate who provides cooperation or assistance +altar - n. a raised structure on which gifts or sacrifices to a god are made +alter - v. cause to change; make different; cause a transformation +alternate - j. serving or used in place of another +alternative - j. serving or used in place of another +altitude - n. elevation especially above sea level or above the earth's surface +amateur - j. lacking professional skill or expertise +ambiguous - j. having more than one possible meaning +ambitious - j. having a strong desire for success or achievement +ambivalent - j. uncertain or unable to decide about what course to follow +analogy - n. drawing a comparison in order to show a similarity in some respect +analyst - n. someone who is skilled at analyzing data +analyze - v. break down into components or essential features +anchor - v. fix firmly and stably +annual - j. occurring or payable every year +anonymous - j. having no known name or identity or known source +antichrist - n. the adversary of Christ (or Christianity) mentioned in the New Testament +antique - j. made in or typical of earlier times and valued for its age +anxious - j. causing or fraught with or showing anxiety +apartheid - n. a social policy or racial segregation involving political and economic and legal discrimination against people who are not Whites +apocalyptic - j. prophetic of devastation or ultimate doom +apology - n. an expression of regret at having caused trouble for someone +apparel - n. clothing in general +apparent - j. clearly revealed to the mind or the senses or judgment +appease - v. make peace with +appropriate - j. suitable for a particular person or place or condition etc +apt - j. being of striking appropriateness and pertinence +arbitrary - j. based on or subject to individual discretion or preference or sometimes impulse or caprice +arcade - n. a covered passageway with shops and stalls on either side +arrange - v. put into a proper or systematic order +arrangement - n. an orderly grouping (of things or persons) considered as a unit; the result of arranging +arrival - n. the act of arriving at a certain place +arrogance - n. overbearing pride evidenced by a superior manner toward inferiors +arrogant - j. having or showing feelings of unwarranted importance out of overbearing pride +articulate - j. expressing yourself easily or characterized by clear expressive language +assassination - n. murder of a public figure by surprise attack +assess - v. set or determine the amount of (a payment such as a fine) +assets - n. anything of material value or usefulness that is owned by a person or company +asylum - n. a shelter from danger or hardship +auburn - j. (of hair) colored a moderate reddish-brown +august - j. profoundly honored +aura - n. a distinctive but intangible quality surrounding a person or thing +austere - j. of a stern or strict bearing or demeanor; forbidding in aspect +authentic - j. not counterfeit or copied +authenticity - n. undisputed credibility +authoritarian - n. a person who behaves in a tyrannical manner +autobiography - n. a biography of yourself +autonomous - j. existing as an independent entity +autonomy - n. immunity from arbitrary exercise of authority: political independence +avid - j. marked by active interest and enthusiasm +banal - j. repeated too often; over familiar through overuse +barring - n. the act of excluding someone by a negative vote or veto +bass - n. the lowest adult male singing voice +batter - n. a liquid or semiliquid mixture, as of flour, eggs, and milk, used in cooking +belle - n. a young woman who is the most charming and beautiful of several rivals +beneficial - j. promoting or enhancing well-being +benefit - n. something that aids or promotes well-being +benign - j. not dangerous to health; not recurrent or progressive (especially of a tumor) +bid - n. a formal proposal to buy at a specified price +biography - n. an account of the series of events making up a person's life +biology - n. the science that studies living organisms +blaze - n. a strong flame that burns brightly +bleak - j. unpleasantly cold and damp +bogus - j. fraudulent; having a misleading appearance +bolster - v. support and strengthen +bomb - n. an explosive device fused to explode under specific conditions +bore - n. a person who evokes boredom +botanical - j. of or relating to plants or botany +boycott - n. a group's refusal to have commercial dealings with some organization in protest against its policies +brass - n. an alloy of copper and zinc +breach - n. an opening (especially a gap in a dike or fortification) +broadcast - n. message that is transmitted by radio or television +brokerage - n. the business of a broker; charges a fee to arrange a contract between two parties +buffet - n. a meal set out on a buffet at which guests help themselves +bumper - n. a mechanical device consisting of bars at either end of a vehicle to absorb shock and prevent serious damage +bureau - n. an administrative unit of government +bureaucracy - n. non elected government officials +butt - v. to strike, thrust or shove against +cabinet - n. persons appointed by a head of state to head executive departments of government and act as official advisers +caliber - n. a degree or grade of excellence or worth +campaign - n. a series of actions advancing a principle or tending toward a particular end +canon - n. a rule or especially body of rules or principles generally established as valid and fundamental in a field or art or philosophy +cardinal - j. serving as an essential component +caricature - n. a representation of a person that is exaggerated for comic effect +casual - j. without or seeming to be without plan or method; offhand +catastrophe - n. an event resulting in great loss and misfortune +caucus - n. a closed political meeting +causal - j. involving or constituting a cause; causing +censure - n. harsh criticism or disapproval +census - n. a periodic count of the population +cereal - n. grass whose starchy grains are used as food: wheat; rice; rye; oats; maize; buckwheat; millet +ceremonial - j. marked by pomp or ceremony or formality +chaos - n. a state of extreme confusion and disorder +characteristic - n. a distinguishing quality +chronic - j. being long-lasting and recurrent or characterized by long suffering +citadel - n. a stronghold into which people could go for shelter during a battle +cite - v. refer to for illustration or proof +clumsy - j. not elegant or graceful in expression +coalition - n. an organization of people (or countries) involved in a pact or treaty +coherent - j. marked by an orderly, logical, and aesthetically consistent relation of parts +coincidence - n. the temporal property of two things happening at the same time +collapse - v. break down, literally or metaphorically +colleague - n. an associate that one works with +collective - j. set up on the principle of collectivism or ownership and production by the workers involved usually under the supervision of a government +collector - n. a person who collects things +collision - n. an accident resulting from violent impact of a moving object +commemorate - v. mark by some ceremony or observation +commentary - n. a written explanation or criticism or illustration that is added to a book or other textual material +commission - n. a special group delegated to consider some matter +commitment - n. the act of binding yourself (intellectually or emotionally) to a course of action +commodity - n. articles of commerce +commute - n. a regular journey of some distance to and from your place of work +comparable - j. able to be compared or worthy of comparison +comparison - n. the act of examining resemblances +compassionate - j. showing or having compassion +compensate - v. make payment to; compensate +competence - n. the quality of being adequately or well qualified physically and intellectually +competent - j. properly or sufficiently qualified or capable or efficient +competitive - j. involving competition or competitiveness +competitor - n. the contestant you hope to defeat +complex - j. complicated in structure; consisting of interconnected parts +component - n. an artifact that is one of the individual parts of which a composite entity is made up; especially a part that can be separated from or attached to a system +composer - n. someone who composes music as a profession +comprehensive - j. broad in scope +concede - v. admit (to a wrongdoing) +conceive - v. have the idea for +concession - n. a point conceded or yielded +confederate - j. united in a group or league +confidence - n. a state of confident hopefulness that events will be favorable +confident - j. having or marked by confidence or assurance +confront - v. oppose, as in hostility or a competition +conscience - n. a feeling of shame when you do something immoral +conscious - j. knowing and perceiving; having awareness of surroundings and sensations and thoughts +consecutive - j. one after the other +consensus - n. agreement in the judgment or opinion reached by a group as a whole +conservatism - n. a political or theological orientation advocating the preservation of the best in society and opposing radical changes +conservative - j. avoiding excess +consistency - n. a harmonious uniformity or agreement among things or parts +conspicuous - j. obvious to the eye or mind +conspiracy - n. a plot to carry out some harmful or illegal act (especially a political plot) +constituency - n. the body of voters who elect a representative for their area +consume - v. use up (resources or materials) +consumer - n. a person who uses goods or services +consumption - n. the process of taking food into the body through the mouth +contemplate - v. look at thoughtfully; observe deep in thought +contemporary - j. belonging to the present time +contender - n. the contestant you hope to defeat +contentious - j. inclined or showing an inclination to dispute or disagree, even to engage in law suits +contingent - j. possible but not certain to occur +continuous - j. continuing in time or space without interruption +contradiction - n. opposition between two conflicting forces or ideas +contradictory - j. unable for both to be true at the same time +contribution - n. a voluntary gift (as of money or service or ideas) made to some worthwhile cause +contributor - n. someone who contributes (or promises to contribute) a sum of money +convenience - n. the quality of being useful and convenient +conversion - n. the act of changing from one use or function or purpose to another +convertible - j. designed to be changed from one use or form to another +conviction - n. an unshakable belief in something without need for proof or evidence +corporate - j. of or belonging to a corporation +corps - n. a body of people associated together +corruption - n. destroying someone's (or some group's) honesty or loyalty; undermining moral integrity +cosmetic - j. serving an esthetic rather than a useful purpose +cosmopolitan - j. of worldwide scope or applicability +counsel - n. something that provides direction or advice as to a decision or course of action +counterpart - n. a person or thing having the same function or characteristics as another +courageous - j. able to face and deal with danger or fear without flinching +course - n. a connected series of events or actions or developments +courtesy - n. a courteous or respectful or considerate act +credible - j. appearing to merit belief or acceptance +critique - n. a serious examination and judgment of something +crusade - v. exert oneself continuously, vigorously, or obtrusively to gain an end or engage in a crusade for a certain cause or person; be an advocate for +crush - v. to compress with violence, out of natural shape or condition +curator - n. the custodian of a collection (as a museum or library) +curriculum - n. an integrated course of academic studies +cynical - j. believing the worst of human nature and motives; having a sneering disbelief in e.g. selflessness of others +cynicism - n. a cynical feeling of distrust +daring - n. the trait of being willing to undertake things that involve risk or danger +debacle - n. a sudden and violent collapse +debut - v. appear for the first time in public +decay - n. the organic phenomenon of rotting +decency - n. the quality of conforming to standards of propriety and morality +decent - j. socially or conventionally correct; refined or virtuous +decisive - j. characterized by decision and firmness +decree - n. a legally binding command or decision entered on the court record (as if issued by a court or judge) +dedication - n. complete and wholehearted fidelity +default - n. loss due to not showing up +defendant - n. a person or institution against whom an action is brought in a court of law; the person being sued or accused +defensive - j. attempting to justify or defend in speech or writing +defiance - n. a hostile challenge +definite - j. known for certain +delicacy - n. something considered choice to eat +demise - v. transfer by a lease or by a will +demonstrate - v. establish the validity of something, as by an example, explanation or experiment +denominator - n. the divisor of a fraction +deposition - n. (law) a pretrial interrogation of a witness; usually conducted in a lawyer's office +depression - n. a long-term economic state characterized by unemployment and low prices and low levels of trade and investment +depth - n. the attribute or quality of being deep, strong, or intense +derive - v. come from +descent - n. properties attributable to your ancestry +desert - n. arid land with little or no vegetation +designate - v. give an assignment to (a person) to a post, or assign a task to (a person) +despair - n. a state in which all hope is lost or absent +desperate - j. showing extreme urgency or intensity especially because of great need or desire +detect - v. discover or determine the existence, presence, or fact of +deter - v. try to prevent; show opposition to +determination - n. the quality of being determined to do or achieve something; firmness of purpose +deterrent - j. tending to deter +diagnosis - n. identifying the nature or cause of some phenomenon +dialogue - n. a discussion intended to produce an agreement +difference - n. the quality of being unlike or dissimilar +dignity - n. the quality of being worthy of esteem or respect +dilemma - n. state of uncertainty or perplexity especially as requiring a choice between equally unfavorable options +diplomacy - n. subtly skillful handling of a situation +diplomat - n. a person who deals tactfully with others +diplomatic - j. using or marked by tact in dealing with sensitive matters or people +disagree - v. be of different opinions +disappear - v. become invisible or unnoticeable +discern - v. detect with the senses +discipline - n. a system of rules of conduct or method of practice +discomfort - n. the state of being tense and feeling pain +discourse - n. extended verbal expression in speech or writing +discover - v. see for the first time; make a discovery +discriminate - v. treat differently on the basis of sex or race +discussion - n. an exchange of views on some topic +disdain - n. lack of respect accompanied by a feeling of intense dislike +dishonest - j. deceptive or fraudulent; disposed to cheat or defraud or deceive +dismal - j. causing dejection +dismay - v. fill with apprehension or alarm; cause to be unpleasantly surprised +dismissal - n. the termination of someone's employment (leaving them free to depart) +disparity - n. inequality or difference in some respect +disregard - n. willful lack of care and attention +dissent - n. a difference of opinion +distant - j. separated in space or coming from or going to a distance +distinction - n. a distinguishing difference +distress - n. extreme physical pain +distrust - v. regard as untrustworthy; regard with suspicion; have no faith or confidence in +diverse - j. many and different +diversion - n. an activity that diverts or amuses or stimulates +diversity - n. noticeable heterogeneity +divert - v. turn aside; turn away from +document - n. writing that provides information (especially information of an official nature) +doe - n. mature female of mammals of which the male is called 'buck' +domain - n. territory over which rule or control is exercised +dominance - n. the state that exists when one person or group has power over another +dominant - j. exercising influence or control +dominate - v. be in control +domination - n. social control by dominating +donate - v. give to a charity or good cause +donor - n. person who makes a gift of property +drastic - j. forceful and extreme and rigorous +drought - n. a shortage of rainfall +dubious - j. open to doubt or suspicion +dynamics - n. the branch of mechanics concerned with the forces that cause motions of bodies +earnest - j. characterized by a firm and humorless belief in the validity of your opinions +eccentric - n. a person with an unusual or odd personality +eclectic - j. selecting what seems best of various styles or ideas +editorial - n. an article giving opinions or perspectives +effect - n. a phenomenon that follows and is caused by some previous phenomenon +effective - j. works well as a means or remedy +efficiency - n. skillfulness in avoiding wasted time and effort +efficient - j. able to accomplish a purpose; functioning effectively +elaborate - v. add details, as to an account or idea; clarify the meaning of and discourse in a learned way, usually in writing +element - n. any of the more than 100 known substances (of which 92 occur naturally) that cannot be separated into simpler substances and that singly or in combination constitute all matter +eligible - j. qualified for or allowed or worthy of being chosen +eliminate - v. terminate, end, or take out +embargo - n. a government order imposing a trade barrier +emblem - n. a visible symbol representing an abstract idea +embrace - n. the act of clasping another person in the arms (as in greeting or affection) +emerge - v. come out into view, as from concealment +emergence - n. the gradual beginning or coming forth +eminent - j. of imposing height; especially standing out above others +emphasis - n. intensity or forcefulness of expression +emphasize - v. to stress, single out as important +employee - n. a worker who is hired to perform a job +employer - n. a person or firm that employs workers +emulate - v. imitate the function of (another system), as by modifying the hardware or the software +enact - v. order by virtue of superior authority; decree +encourage - v. inspire with confidence; give hope or courage to +encyclopedia - n. a reference work (often in several volumes) containing articles on various topics +endorse - v. be behind; approve of +enduring - j. patiently bearing continual wrongs or trouble +energetic - j. possessing or exerting or displaying energy +enhance - v. make better or more attractive +enormous - j. extraordinarily large in size or extent or amount or power or degree +enthusiastic - j. having or showing great excitement and interest +entity - n. that which is perceived or known or inferred to have its own distinct existence (living or nonliving) +epic - j. very imposing or impressive; surpassing the ordinary (especially in size or scale) +epidemic - n. a widespread outbreak of an infectious disease; many people are infected at the same time +episode - n. a brief section of a literary or dramatic work that forms part of a connected series +equilibrium - n. a stable situation in which forces cancel one another +equity - n. the difference between the market value of a property and the claims held against it +equivalent - j. being essentially equal to something +error - n. a wrong action attributable to bad judgment or ignorance or inattention +esquire - n. a title of respect for a member of the English gentry ranking just below a knight; placed after the name +essence - n. the central meaning or theme of a speech or literary work +evangelical - j. relating to or being a Christian church believing in personal conversion and the inerrancy of the Bible especially the 4 Gospels +evoke - v. call to mind +evolution - n. a process in which something passes by degrees to a different stage (especially a more advanced or mature stage) +exceed - v. be greater in scope or size than some standard +excellent - j. very good; of the highest quality +excerpt - n. a passage selected from a larger work +excess - j. more than is needed, desired, or required +exclude - v. prevent from being included or considered or accepted +excursion - n. a journey taken for pleasure +exempt - v. grant relief or an exemption from a rule or requirement to +existence - n. everything that exists anywhere +exit - v. move out of or depart from +exotic - j. strikingly strange or unusual +expand - v. become larger in size or volume or quantity +expansion - n. the act of increasing (something) in size or volume or quantity or scope +expect - v. regard something as probable or likely +expectancy - n. something expected (as on the basis of a norm) +expense - n. money spent to perform work and usually reimbursed by an employer +expertise - n. skillfulness by virtue of possessing special knowledge +explicit - j. precisely and clearly expressed or readily observable; leaving nothing to implication +explode - v. drive from the stage by noisy disapproval +exploit - v. use or manipulate to one's advantage +explosion - n. the act of exploding or bursting +explosive - n. a chemical substance that undergoes a rapid chemical change (with the production of gas) on being heated or struck +exposure - n. vulnerability to the elements; to the action of heat or cold or wind or rain +expressive - j. characterized by expression +extension - n. an addition to the length of something +extensive - j. large in spatial extent or range or scope or quantity +exterior - n. the outer side or surface of something +external - j. happening or arising or located outside or beyond some limits or especially surface +extradition - n. the surrender of an accused or convicted person by one state or country to another (usually under the provisions of a statute or treaty) +extraordinary - j. beyond what is ordinary or usual; highly unusual or exceptional or remarkable +extravagant - j. unrestrained, especially with regard to feelings +exuberant - j. joyously unrestrained +fabulous - j. extremely pleasing +facial - j. of or concerning the face +facility - n. something designed and created to serve a particular function and to afford a particular convenience or service +faction - n. a dissenting clique +faulty - j. characterized by errors; not agreeing with a model or not following established rules +feasible - j. capable of being done with means at hand and circumstances as they are +felony - n. a serious crime (such as murder or arson) +feminine - j. associated with women and not with men +fervor - n. the state of being emotionally aroused and worked up +fetus - n. an unborn or unhatched vertebrate in the later stages of development showing the main recognizable features of the mature animal +feud - n. a bitter quarrel between two parties +feudal - j. of or relating to or characteristic of feudalism +fidelity - n. the quality of being faithful +finale - n. the concluding part of any performance +finite - j. bounded or limited in magnitude or spatial or temporal extent +fiscal - j. involving financial matters +flag - n. emblem usually consisting of a rectangular piece of cloth of distinctive design +flamboyant - j. marked by ostentation but often tasteless +fleet - n. a group of warships organized as a tactical unit +flexible - j. able to flex; able to bend easily +flop - n. a complete failure +flourish - n. a showy gesture +foil - n. anything that serves by contrast to call attention to another thing's good qualities +ford - v. cross a river where it's shallow +forecast - n. a prediction about how something (as the weather) will develop +foreign - j. relating to or originating in or characteristic of another place or part of the world +foresee - v. act in advance of; deal with ahead of time +formation - n. an arrangement of people or things acting as a unit +formidable - j. extremely impressive in strength or excellence +formula - n. directions for making something +forte - n. an asset of special worth or utility +forth - a. forward in time or order or degree +foster - v. promote the growth of +fragile - j. easily broken or damaged or destroyed +frantic - j. excessively agitated; distraught with fear or other violent emotion +fray - v. wear away by rubbing +frequency - n. the number of occurrences within a given time period +fringe - n. a social group holding marginal or extreme views +frivolous - j. not serious in content or attitude or behavior +frontier - n. a wilderness at the edge of a settled area of a country +fundamental - j. being or involving basic facts or principles +further - v. promote the growth of +futile - j. producing no result or effect +galaxy - n. (astronomy) a collection of star systems; any of the billions of systems each having many stars and nebulae and dust +gamble - v. take a risk in the hope of a favorable outcome +gauge - n. a measuring instrument for measuring and indicating a quantity such as the thickness of wire or the amount of rain etc. +generate - v. bring into existence +generic - j. applicable to an entire class or group +generosity - n. the trait of being willing to give your money or time +genesis - n. the first book of the Old Testament: tells of Creation; Adam and Eve; Cain and Abel +gesture - n. motion of hands or body to emphasize or help to express a thought or feeling +gigantic - j. so exceedingly large or extensive as to suggest a giant or mammoth +gist - n. the choicest or most essential or most vital part of some idea or experience +glimpse - n. a brief or incomplete view +glorious - j. having great beauty and splendor +grandeur - n. the quality of being magnificent or splendid or grand +grandiose - j. impressive because of unnecessary largeness or grandeur; used to show disapproval +grave - j. of great gravity or crucial import; requiring serious thought +gravity - n. a manner that is serious and solemn +grief - n. something that causes great unhappiness +grotesque - j. distorted and unnatural in shape or size; abnormal and hideous +grove - n. a small growth of trees without underbrush +guise - n. an artful or simulated semblance +hack - n. a mediocre and disdained writer +hale - j. exhibiting or restored to vigorous good health +handwriting - n. something written by hand +harbor - v. hold back a thought or feeling about +hazard - n. a source of danger; a possibility of incurring loss or misfortune +heir - n. a person who is entitled by law or by the terms of a will to inherit the estate of another +heritage - n. practices that are handed down from the past by tradition +hilarious - j. marked by or causing boisterous merriment or convulsive laughter +hollow - j. not solid; having a space or gap or cavity +homage - n. respectful deference +hostility - n. violent action that is hostile and usually unprovoked +humane - j. marked or motivated by concern with the alleviation of suffering +humanitarian - n. someone devoted to the promotion of human welfare and to social reforms +hush - v. become quiet or still; fall silent +hybrid - n. (genetics) an organism that is the offspring of genetically dissimilar parents or stock; especially offspring produced by breeding plants or animals of different varieties or breeds or species +hypocrisy - n. insincerity by virtue of pretending to have qualities or beliefs that you do not really have +hypothesis - n. a tentative insight into the natural world; a concept that is not yet verified but that if true would explain certain facts or phenomena +hysteria - n. excessive or uncontrollable fear +icon - n. a conventional religious painting in oil on a small wooden panel; venerated in the Eastern Church +ideology - n. an orientation that characterizes the thinking of a group or nation +illusion - n. an erroneous mental representation +imaginary - j. not based on fact; unreal +imitation - n. something copied or derived from an original +immense - j. unusually great in size or amount or degree or especially extent or scope +immigrant - n. a person who comes to a country where they were not born in order to settle there +imminent - j. close in time; about to occur +immoral - j. not adhering to ethical or moral principles +immune - j. (usually followed by 'to') not affected by a given influence +impending - j. close in time; about to occur +implausible - j. having a quality that provokes disbelief +implicit - j. implied though not directly expressed; inherent in the nature of something +imply - v. express or state indirectly +impose - v. compel to behave in a certain way +improper - j. not suitable or right or appropriate +impulse - n. a sudden desire +inadequate - j. not sufficient to meet a need +incentive - n. a positive motivational influence +incidence - n. the relative frequency of occurrence of something +incident - n. a public disturbance +incidentally - a. of a minor or subordinate nature +inclined - j. at an angle to the horizontal or vertical position +incompetence - n. lack of physical or intellectual ability or qualifications +inconsistent - j. displaying a lack of consistency +inconvenient - j. not suited to your comfort, purpose or needs +indefinitely - a. to an indefinite extent; for an indefinite time +indicator - n. a device for showing the operating condition of some system +indifferent - j. showing no care or concern in attitude or action +indigenous - j. originating where it is found +indulge - v. enjoy to excess +inefficient - j. not producing desired results; wasteful +inept - j. generally incompetent and ineffectual +inevitable - j. incapable of being avoided or prevented +inexpensive - j. relatively low in price or charging low prices +infamous - j. known widely and usually unfavorably +infinite - j. having no limits or boundaries in time or space or extent or magnitude +influence - n. a power to affect persons or events especially power based on prestige etc +influential - j. having or exercising influence or power +influx - n. the process of flowing in +ingenious - j. showing inventiveness and skill +inherent - j. in the nature of something though not readily apparent +injunction - n. (law) a judicial remedy issued in order to prohibit a party from doing or continuing to do a certain activity +inland - a. towards or into the interior of a region +insight - n. the clear (and often sudden) understanding of a complex situation +insistence - n. the state of demanding notice or attention +inspector - n. a high ranking police officer +instance - n. an occurrence of something +instant - n. a very short time +insufficient - j. of a quantity not able to fulfill a need or requirement +integral - j. essential to completeness; lacking nothing +integrity - n. moral soundness +intellectual - j. appealing to or using the intellect +intelligence - n. the ability to comprehend; to understand and profit from experience +intensive - j. characterized by a high degree or intensity; often used as a combining form +intention - n. an act of intending; a volition that you intend to carry out +interact - v. act together or towards others or with others +interim - n. the time between one event, process, or period and another +intermediate - j. lying between two extremes in time or space or state +intervene - v. get involved, so as to alter or hinder an action, or through force or threat of force +intervention - n. the act of intervening (as to mediate a dispute, etc.) +intimacy - n. close or warm friendship +intricate - j. having many complexly arranged elements; elaborate +invasion - n. any entry into an area not previously occupied +inventive - j. (used of persons or artifacts) marked by independence and creativity in thought or action +investigator - n. a police officer who investigates crimes +investor - n. someone who commits capital in order to gain financial returns +invincible - j. incapable of being overcome or subdued +invoke - v. cite as an authority; resort to +involuntary - j. not subject to the control of the will +involve - v. engage as a participant +irony - n. incongruity between what might be expected and what actually occurs +irrational - j. not consistent with or using reason +irrelevant - j. having no bearing on or connection with the subject at issue +irresistible - j. impossible to resist; overpowering +irresponsible - j. showing lack of care for consequences +judgment - n. the capacity to assess situations or circumstances shrewdly and to draw sound conclusions +judicial - j. belonging or appropriate to the office of a judge +juicy - j. lucrative +junction - n. something that joins or connects +jurisdiction - n. (law) the right and power to interpret and apply the law +juror - n. someone who serves (or waits to be called to serve) on a jury +justification - n. something (such as a fact or circumstance) that shows an action to be reasonable or necessary +juvenile - j. of or relating to or characteristic of or appropriate for children or young people +ken - n. range of what one can know or understand +knight - n. originally a person of noble birth trained to arms and chivalry; today in Great Britain a person honored by the sovereign for personal merit +knit - n. needlework created by interlacing yarn in a series of connected loops using straight eyeless needles or by machine +lament - v. regret strongly +landmark - n. the position of a prominent or well-known object in a particular landscape +landscape - n. an expanse of scenery that can be seen in a single view +lapse - n. a break or intermission in the occurrence of something +laureate - n. someone honored for great achievements; figuratively someone crowned with a laurel wreath +lavish - j. very generous +lax - j. lacking in rigor or strictness +legacy - n. (law) a gift of personal property by will +legislative - j. relating to a legislature or composed of members of a legislature +legitimacy - n. lawfulness by virtue of being authorized or in accordance with law +legitimate - j. in accordance with recognized or accepted standards or principles +leisure - n. time available for ease and relaxation +lenient - j. not strict +levy - v. impose and collect +liable - j. held legally responsible +liberalism - n. a political orientation that favors social progress by reform and by changing laws rather than by revolution +lifelong - j. continuing through life +lifetime - n. the period during which something is functional (as between birth and death) +likelihood - n. the probability of a specified outcome +liking - n. a feeling of pleasure and enjoyment +liquor - n. an alcoholic beverage that is distilled rather than fermented +literacy - n. the ability to read and write +literal - j. avoiding embellishment or exaggeration (used for emphasis) +literature - n. creative writing of recognized artistic value +logic - n. the principles that guide reasoning within a given field or situation +logical - j. capable of thinking and expressing yourself in a clear and consistent manner +lovable - j. having characteristics that attract love or affection +lucrative - j. producing a sizeable profit +ludicrous - j. broadly or extravagantly humorous; resembling farce +lying - n. the deliberate act of deviating from the truth +machinery - n. machines or machine systems collectively +magnet - n. (physics) a device that attracts iron and produces a magnetic field +magnificent - j. characterized by grandeur +magnitude - n. the property of relative size or extent (whether large or small) +maintain - v. state or assert +maintenance - n. activity involved in maintaining something in good working order +makeup - n. the way in which someone or something is composed +mandate - n. an authorization to act given to a representative +mandatory - j. required by rule +maneuver - v. act in order to achieve a certain goal +manifesto - n. a public declaration of intentions (as issued by a political party or government) +marine - j. native to or inhabiting the sea +maritime - j. relating to or involving ships or shipping or navigation or seamen +martial - j. suggesting war or military life +marvel - v. be amazed at +massacre - n. the savage and excessive killing of many people +massive - j. imposing in size or bulk or solidity +masterpiece - n. the most outstanding work of a creative artist or craftsman +material - j. concerned with worldly rather than spiritual interests +maternal - j. relating to or derived from one's mother +maze - n. complex system of paths or tunnels in which it is easy to get lost +mechanics - n. the technical aspects of doing something +medicine - n. something that treats or prevents or alleviates the symptoms of disease +medieval - j. as if belonging to the Middle Ages; old-fashioned and unenlightened +mediocre - j. moderate to inferior in quality +meditation - n. continuous and profound contemplation or musing on a subject or series of subjects of a deep or abstruse nature +melodrama - n. an extravagant comedy in which action is more salient than characterization +memorable - j. worth remembering +menace - v. act in a threatening manner +mentality - n. a habitual or characteristic mental attitude that determines how you will interpret and respond to situations +mentor - v. serve as a teacher or trusted counselor +metal - n. any of several chemical elements that are usually shiny solids +metaphor - n. a figure of speech in which an expression is used to refer to something that it does not literally denote in order to suggest a similarity +metric - j. based on the meter as a standard of measurement +metropolis - n. a large and densely populated urban area; may include several independent administrative districts +metropolitan - j. relating to or characteristic of a densely populated urban area +mileage - n. the ratio of the number of miles traveled to the number of gallons of gasoline burned; miles per gallon +militant - j. disposed to warfare or hard-line policies +militia - n. civilians trained as soldiers but not part of the regular army +miniature - j. being on a very small scale +minimize - v. make small or insignificant +ministry - n. a government department under the direction of a minister +minority - n. being or relating to the smaller in number of two parts +minute - j. infinitely or immeasurably small +misdemeanor - n. a crime less serious than a felony +missile - n. a rocket carrying a warhead of conventional or nuclear explosives +momentum - n. an impelling force or strength +monarchy - n. an autocracy governed by a monarch who usually inherits the authority +monastery - n. the residence of a religious community +monetary - j. relating to or involving money +monopoly - n. (economics) a market in which there are many buyers but only one seller +morale - n. the spirit of a group that makes the members want the group to succeed +morality - n. concern with the distinction between good and evil or right and wrong; right or good conduct +motto - n. a favorite saying of a sect or political group +mundane - j. concerned with the world or worldly matters; ordinary +municipal - j. relating to city government +muster - v. gather or bring together +myriad - n. a large indefinite number +myth - n. a traditional story accepted as history; serves to explain the world view of a people +mythology - n. myths collectively; the body of stories associated with a culture or institution or person +narrative - n. a message that tells the particulars of an act or occurrence or course of events; presented in writing or drama or cinema or as a radio or television program +narrator - n. someone who tells a story +naturally - a. according to nature; by natural means; without artificial help +naval - j. connected with or belonging to or used in a navy +necessary - j. absolutely essential +necessity - n. anything indispensable +network - n. an interconnected system of things or people +neutral - j. having no personal preference +nevertheless - a. despite anything to the contrary (usually following a concession) +noisy - j. full of or characterized by loud and nonmusical sounds +nomination - n. the condition of having been proposed as a suitable candidate for appointment or election +nominee - n. a politician who is running for public office +norm - n. a standard or model or pattern regarded as typical +notorious - j. known widely and usually unfavorably +nude - n. without clothing (especially in the phrase 'in the nude') +obesity - n. more than average fatness +objective - j. undistorted by emotion or personal bias; based on observable phenomena +observatory - n. a building designed and equipped to observe astronomical phenomena +obsolete - j. no longer in use +obstruction - n. something that stands in the way and must be circumvented or surmounted +obtain - v. come into possession of +occasion - n. a vaguely specified social event +odor - n. the sensation that results when olfactory receptors in the nose are stimulated by particular chemicals in gaseous form +ominous - j. threatening or foreshadowing evil or tragic developments +operate - v. handle and cause to function +operator - n. an agent that operates some apparatus or machine +opinion - n. a personal belief or judgment that is not founded on proof or certainty +opponent - n. a contestant that you are matched against +opportunity - n. a possibility due to a favorable combination of circumstances +optimism - n. a general disposition to expect the best in all things +option - n. one of a number of things from which only one can be chosen +oral - j. of or relating to or affecting or for use in the mouth +ordeal - n. a severe or trying experience +ornate - j. marked by elaborate rhetoric and elaborated with decorative details +orthodox - j. adhering to what is commonly accepted +outbreak - n. a sudden violent spontaneous occurrence (usually of some undesirable condition) +outcry - n. a loud utterance; often in protest or opposition +outrage - n. a feeling of righteous anger +outrageous - j. grossly offensive to decency or morality; causing horror +outright - a. without reservation or concealment +overhaul - v. make repairs, renovations, revisions or adjustments to +oversee - v. watch and direct +overthrow - n. the termination of a ruler or institution (especially by force) +overweight - n. the property of excessive fatness +pact - n. a written agreement between two states or sovereigns +pageant - n. a rich and spectacular ceremony +panic - n. an overwhelming feeling of fear and anxiety +pantheon - n. all the gods of a religion +paradox - n. (logic) a statement that contradicts itself +parallel - j. being everywhere equidistant and not intersecting +parish - n. a local church community +parliament - n. a legislative assembly in certain countries +parody - v. make a spoof of or make fun of +participant - n. someone who takes part in an activity +participate - v. become a participant; be involved in +partisan - n. an ardent and enthusiastic supporter of some person or activity +partition - v. divide into parts, pieces, or sections +passive - j. lacking in energy or will +patriotism - n. love of country and willingness to sacrifice for it +patron - n. someone who supports or champions something +pavilion - n. large and often sumptuous tent +peaceful - j. not disturbed by strife or turmoil or war +pedestrian - j. lacking wit or imagination +penalty - n. a punishment for a crime or offense +penchant - n. a strong liking +pennant - n. a long flag; often tapering +pension - n. a regular payment to a person that is intended to allow them to subsist without working +pentagon - n. a five-sided polygon +perceive - v. to become aware of or conscious of +perception - n. becoming aware of something via the senses +perennial - j. lasting an indefinitely long time; suggesting self-renewal +perform - v. carry out or perform an action +perjury - n. criminal offense of making false statements under oath +permanent - j. continuing or enduring without marked change in status or condition or place +perpetual - j. continuing forever or indefinitely +persist - v. be persistent, refuse to stop +personal - j. concerning or affecting a particular person or his or her private life and personality +personality - n. the complex of all the attributes--behavioral, temperamental, emotional and mental--that characterize a unique individual +personnel - n. persons collectively in the employ of a business +perspective - n. the appearance of things relative to one another as determined by their distance from the viewer +persuade - v. cause somebody to adopt a certain position, belief, or course of action; twist somebody's arm +pervasive - j. spreading or spread throughout +petty - j. contemptibly narrow in outlook +phenomenal - j. exceedingly or unbelievably great +phenomenon - n. any state or process known through the senses rather than by intuition or reasoning +philharmonic - j. composing or characteristic of an orchestral group +philosophy - n. any personal belief about how to live or how to deal with a situation +physicist - n. a scientist trained in physics +physics - n. the science of matter and energy and their interactions +pinch - n. a squeeze with the fingers +pine - n. straight-grained white to yellowish tree +pioneer - v. open up and explore a new area +pivotal - j. being of crucial importance +plausible - j. apparently reasonable and valid, and truthful +playful - j. full of fun and high spirits +playwright - n. someone who writes plays +plea - n. a humble request for help from someone in authority +plead - v. appeal or request earnestly +pleasant - j. affording pleasure; being in harmony with your taste or likings +plunge - v. fall abruptly +poetic - j. of or relating to poetry +poignant - j. arousing emotions; touching +poised - j. in full control of your faculties +portfolio - n. a set of pieces of creative work collected to be shown to potential customers or employers +positive - j. characterized by or displaying affirmation or acceptance or certainty etc. +possess - v. have as an attribute, knowledge, or skill +possession - n. the act of having and controlling property +potent - j. having a strong physiological or chemical effect +potential - j. existing in possibility +precedent - n. an example that is used to justify similar occurrences at a later time +precise - j. sharply exact or accurate or delimited +precision - n. the quality of being reproducible in amount or performance +predecessor - n. one who precedes you in time (as in holding a position or office) +predict - v. make a prediction about; tell in advance +prediction - n. a statement made about the future +prefer - v. like better; value more highly +preference - n. a strong liking +prejudice - n. a partiality that prevents objective consideration of an issue or situation +premature - j. too soon or too hasty +premier - v. be performed for the first time +premise - v. set forth beforehand, often as an explanation +preparation - n. the activity of putting or setting in order in advance of some act or purpose +preposterous - j. incongruous; inviting ridicule +prescription - n. written instructions from a physician or dentist to a druggist concerning the form and dosage of a drug to be issued to a given patient +preservation - n. the activity of protecting something from loss or danger +pretentious - j. making claim to or creating an appearance of (often undeserved) importance or distinction +prevalent - j. most frequent or common +prevention - n. the act of preventing +primer - n. an introductory textbook +primitive - j. belonging to an early stage of technical development; characterized by simplicity and (often) crudeness +principal - n. the educator who has executive authority for a school +principle - n. a basic truth or law or assumption +principled - j. based on or manifesting objectively defined standards of rightness or morality +pristine - j. completely free from dirt or contamination +privilege - n. a special advantage or immunity or benefit not enjoyed by all +probation - n. (law) a way of dealing with offenders without imprisoning them; a defendant found guilty of a crime is released by the court without imprisonment subject to conditions imposed by the court +probe - v. question or examine thoroughly and closely +procedure - n. a process or series of acts especially of a practical or mechanical nature involved in a particular form of work +proceed - v. move ahead; travel onward in time or space +productive - j. producing or capable of producing (especially abundantly) +profession - n. an occupation requiring special education (especially in the liberal arts or sciences) +professor - n. someone who is a member of the faculty at a college or university +profile - n. an outline of something (especially a human face as seen from one side) +progressive - j. favoring or promoting progress +prohibition - n. the action of prohibiting or inhibiting or forbidding (or an instance thereof) +prolific - j. bearing in abundance especially offspring +promenade - n. a public area set aside as a pedestrian walk +prominence - n. relative importance +prominent - j. having a quality that thrusts itself into attention +promoter - n. someone who is an active supporter and advocate +prone - j. having a tendency (to); often used in combination +propaganda - n. information that is spread for the purpose of promoting some cause +prophet - n. someone who speaks by divine inspiration; someone who is an interpreter of the will of God +protagonist - n. the principal character in a work of fiction +protection - n. the activity of protecting someone or something +protective - j. intended or adapted to afford protection of some kind +protestant - j. of or relating to Protestants or Protestantism +provincial - j. characteristic of the provinces or their people +provoke - v. evoke or provoke to appear or occur +proxy - n. a person authorized to act for another +prudence - n. knowing how to avoid embarrassment or distress +psychic - j. outside the sphere of physical science +pundit - n. someone who has been admitted to membership in a scholarly field +quake - v. shake with fast, tremulous movements +qualify - v. make fit or prepared +quarterly - a. in three month intervals +radical - j. markedly new or introducing extreme change +rampant - j. unrestrained and violent +rapid - j. characterized by speed; moving with or capable of moving with high speed +rave - v. praise enthusiastically +reaction - n. a response that reveals a person's feelings or attitude +readily - a. without much difficulty +realism - n. the attribute of accepting the facts of life and favoring practicality and literal truth +recipient - n. a person who receives something +reckless - j. characterized by careless unconcern +recognize - v. detect with the senses +reconcile - v. come to terms +reconsider - v. consider again; give new consideration to; usually with a view to changing +recover - v. get or find back; recover the use of +recruit - v. cause to assemble or enlist in the military +redemption - n. (theology) the act of delivering from sin or saving from evil +refer - v. send or direct for treatment, information, or a decision +reflection - n. the image of something as reflected by a mirror (or other reflective material) +reform - v. make changes for improvement in order to remove abuse and injustices +refuge - n. a shelter from danger or hardship +refusal - n. the act of not accepting something that is offered +regime - n. the government or governing authority of a political unit +regional - j. related or limited to a particular region +reign - v. have sovereign power +relevant - j. having a bearing on or connection with the subject at issue +reliant - j. depending on another for support +reluctance - n. a certain degree of unwillingness +reluctant - j. not eager +reminiscent - j. serving to bring to mind +renaissance - n. the period of European history at the close of the Middle Ages and the rise of the modern world; a cultural rebirth from the 14th through the middle of the 17th centuries +render - v. give or supply +renowned - j. widely known and esteemed +repeal - n. cancel officially +reproduction - n. the act of making copies +requisite - n. anything indispensable +resemblance - n. similarity in appearance or external or superficial details +resent - v. feel bitter or indignant about +resist - v. withstand the force of something +resistance - n. the action of opposing something that you disapprove or disagree with +resistant - j. impervious to being affected +resort - v. have recourse to +resource - n. a source of aid or support that may be drawn upon when needed +restore - v. bring back into original existence, use, function, or position +resurrection - n. (New Testament) the rising of Christ on the third day after the Crucifixion +retrospect - n. contemplation of things past +retrospective - j. concerned with or related to the past +revelation - n. communication of knowledge to man by a divine or supernatural agency +revive - v. be brought back to life, consciousness, or strength +rhetoric - n. using language effectively to please or persuade +ridiculous - j. incongruous; absurd; nonsensical +rigorous - j. demanding strict attention to rules and procedures +robust - j. sturdy and strong in form, constitution, or construction +rue - n. sadness associated with some wrong done or some disappointment +rural - j. living in or characteristic of farming or country life +rustic - j. characteristic of the fields or country +sacrifice - v. kill or destroy +savage - v. criticize harshly or violently +scholarly - j. characteristic of learning or studying +scope - n. an area in which something acts or operates or has power or control +script - n. a written version of a play or other dramatic composition; used in preparing for a performance +secession - n. formal separation from an alliance or federation +secondary - j. not of major importance +secrecy - n. the trait of keeping things secret +secular - j. not concerned with or devoted to religion +seize - v. take hold of; grab +selective - j. characterized by very careful or fastidious choices +seminar - n. any meeting for an exchange of ideas +sensation - n. a perception associated with stimulation of a sensory organ +sensibility - n. refined sensitivity to pleasurable or painful impressions +sensitive - j. responsive to physical stimuli +sentence - n. the period of time a prisoner is imprisoned +sentinel - n. a person employed to keep watch for some anticipated event +sequel - n. a part added to a book or play that continues and extends it +sequence - n. serial arrangement in which things follow in logical order or a recurrent pattern +sergeant - n. any of several noncommissioned officer ranks in the Army or Air Force or Marines ranking above a corporal +servitude - n. state of subjection to an owner or master or forced labor imposed as punishment +severely - a. with sternness; in a severe manner +shallow - j. lacking depth of intellect or knowledge; concerned only with what is obvious +sheer - j. complete and without restriction or qualification +shrewd - j. marked by practical hardheaded intelligence +siege - n. the action of an armed force that surrounds a fortified place and isolates it while continuing to attack +significance - n. the quality of being important in effect or meaning +significant - j. important in effect or meaning +similar - j. having close to the same characteristics +sinister - j. stemming from evil characteristics or forces; wicked or dishonorable +skepticism - n. the disbelief in any claims of ultimate knowledge +slack - j. not tense or taut +slight - n. a deliberate discourteous act (usually as an expression of anger or disapproval) +sober - v. become more realistic +socialism - n. a political theory advocating state ownership of industry +socialist - j. advocating or following the socialist principles of state ownership +sociology - n. the study and classification of human societies +solar - j. relating to or derived from the sun or utilizing the energies of the sun +soldier - n. an enlisted man or woman who serves in an army +somber - j. grave or even gloomy in character +sophisticated - j. having or appealing to those having worldly knowledge and refinement +souvenir - n. a reminder of past events +specialty - n. an asset of special worth or utility +species - n. (biology) taxonomic group whose members can interbreed +spectator - n. a close observer; someone who looks at something (such as an exhibition of some kind) +specter - n. a ghostly appearing figure +spectrum - n. a broad range of related objects or ideas or activities +speculate - v. consider in an idle or casual way and with an element of doubt or without sufficient reason to reach a conclusion +spontaneous - j. said or done without having been planned or written in advance +static - j. showing little if any change +stature - n. high level of respect gained by impressive development or achievement +statute - n. an act passed by a legislative body +stealth - n. avoiding detection by moving carefully +stimulate - v. cause to be alert and energetic +stringent - j. demanding strict attention to rules and procedures +submission - n. something (manuscripts or architectural plans and models or estimates or works of art of all genres etc.) submitted for the judgment of others (as in a competition) +subsequent - j. following in time or order +subsidiary - j. functioning in a supporting capacity +substantive - j. having a firm basis in reality and being therefore important, meaningful, or considerable +subtle - j. difficult to detect or grasp by the mind or analyze +successor - n. a person who follows next in order +summary - n. a brief statement that presents the main points in a concise form +superb - j. of surpassing excellence +superficial - j. concerned with or comprehending only what is apparent or obvious; not deep or penetrating emotionally or intellectually +suppress - v. reduce the incidence or severity of or stop +surround - v. extend on all sides of simultaneously; encircle +suspense - n. excited anticipation of an approaching climax +suspension - n. an interruption in the intensity or amount of something +suspicious - j. openly distrustful and unwilling to confide +sympathetic - j. expressing or feeling or resulting from sympathy or compassion or friendly fellow feelings; disposed toward +symphony - n. a large orchestra; can perform symphonies +systematic - j. characterized by order and planning +tactics - n. the branch of military science dealing with detailed maneuvers to achieve objectives set by strategy +tangible - j. perceptible by the senses especially the sense of touch +taxation - n. the imposition of taxes; the practice of the government in levying taxes on the subjects of a state +technique - n. skillfulness in the command of fundamentals deriving from practice and familiarity +technology - n. the practical application of science to commerce or industry +telescope - n. a magnifier of images of distant objects +temporary - j. not permanent; not lasting +tendency - n. a characteristic likelihood of or natural disposition toward a certain condition or character or effect +tense - j. taut or rigid; stretched tight +tentative - j. unsettled in mind or opinion +tenure - v. give life-time employment to +terminal - j. being or situated at an end +territorial - j. displaying territoriality; defending an area from intruders +testament - n. a profession of belief +theological - j. of or relating to or concerning the study of religion +theology - n. the rational and systematic study of religion and its influences and of the nature of religious truth +theoretical - j. concerned with theories rather than their practical applications +theorist - n. someone who theorizes (especially in science or art) +thesis - n. a formal paper advancing a new point of view resulting from research; usually a requirement for an advanced academic degree +titanic - j. of great force or power +tolerance - n. willingness to recognize and respect the beliefs or practices of others +tolerant - j. showing respect for the rights or opinions or practices of others +tolerate - v. recognize and respect (rights and beliefs of others) +transcript - n. something that has been transcribed; a written record (usually typewritten) of dictated or recorded speech +transfer - v. move from one place to another +transition - v. make or undergo a transition (from one state or system to another) +translate - v. restate (words) from one language into another language +transmission - n. the act of sending a message; causing a message to be transmitted +transparent - j. transmitting light; able to be seen through with clarity +transplant - n. the act of removing something from one location and introducing it in another location +tremendous - j. extraordinarily large in size or extent or amount or power or degree +tribune - n. a protector of the people +trinity - n. the union of the Father and Son and Holy Ghost in one Godhead +triple - v. increase threefold +trivial - j. of little substance or significance +truthful - j. expressing or given to expressing the truth +turmoil - n. a violent disturbance +typical - j. exhibiting the qualities or characteristics that identify a group or kind or category +ubiquitous - j. being present everywhere at once +ultimate - j. furthest or highest in degree or order; utmost or extreme +unanimous - j. acting together as a single undiversified whole +uncommon - j. not common or ordinarily encountered; unusually great in amount or remarkable in character or kind +unconscious - j. not conscious; lacking awareness and the capacity for sensory perception as if asleep or dead +undermine - v. destroy property or hinder normal operations +unique - j. the single one of its kind +unlimited - j. having no limits in range or scope +unprecedented - j. having no previous example; novel +urban - j. located in or characteristic of a city or city life +urgency - n. an urgent situation calling for prompt action +usage - n. the act of using +utility - n. the quality of being of practical use +vacuum - n. a region that is devoid of matter +valid - j. well grounded in logic or truth or having legal force +variation - n. an artifact that deviates from a norm or standard +vegetarian - n. eater of fruits and grains and nuts; someone who eats no meat or fish or (often) any animal products +vegetation - n. all the plant life in a particular region or period +venerable - j. impressive by reason of age +verify - v. confirm the truth of +version - n. something a little different from others of the same type +vertical - j. at right angles to the plane of the horizon or a base line +veto - n. the power or right to prohibit or reject a proposed or intended act (especially the power of a chief executive to reject a bill passed by the legislature) +vigorous - j. strong and active physically or mentally +violation - n. an act that disregards an agreement or a right +vista - n. the visual percept of a region +visual - j. relating to or using sight +vitality - n. an energetic style +vogue - n. the popular taste at a given time +volatile - j. liable to lead to sudden change or violence +vulnerable - j. capable of being wounded or hurt +warrant - v. stand behind and guarantee the quality, accuracy, or condition of +wherever - a. where in the world +wholly - a. to a complete degree or to the full or entire extent ('whole' is often used informally for 'wholly') +woo - v. seek someone's favor +zeal - n. excessive fervor to do something or accomplish some end diff --git a/samples/SearchableDictionary/res/values/strings.xml b/samples/SearchableDictionary/res/values/strings.xml new file mode 100644 index 000000000..a39ba75b9 --- /dev/null +++ b/samples/SearchableDictionary/res/values/strings.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <!-- The name of the application. --> + <string name="app_name">Searchable Dictionary</string> + + <!-- The label for the search results for this app (see searchable.xml for more details). --> + <string name="search_label">Dictionary</string> + + <!-- The menu entry that invokes search. --> + <string name="menu_search">Search</string> + + <!-- The description that will show up in the search settings for this source. --> + <string name="settings_description">Definitions of words</string> + + <!-- General instructions in the main activity. --> + <string name="search_instructions">Press the search key to look up a word</string> + + <!-- Shown above search results when we receive a search request. --> + <string name="search_results">Search results for \'<xliff:g id="string">%s</xliff:g>\': </string> +</resources> diff --git a/samples/SearchableDictionary/res/xml/searchable.xml b/samples/SearchableDictionary/res/xml/searchable.xml new file mode 100644 index 000000000..1edb57c94 --- /dev/null +++ b/samples/SearchableDictionary/res/xml/searchable.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** Copyright 2009, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<!-- The attributes below configure how the search results will work: + - the 'label' points to a short description used when searching within the application if + 'badge mode' is used as specified with android:searchMode="useLabelAsBadge" (which it is not for + this application). + - the 'searchSettingsDescription' points to a string that will be displayed underneath the + name of this application in the search settings to describe what content will be searched. + - 'includeInGlobalSearch' will include this app's search suggestions in Quick Search Box. + - 'searchSuggestAuthority' specifies the authority matching the authority of the + "DictionaryProvider" specified in the manifest. This means the DictionaryProvider will be + queried for search suggestions. + - 'searchSuggestIntentAction' the default intent action used in the intent that is launched based + on a user cilcking on a search suggestion. This saves us from manually having to fill in the + SUGGEST_COLUMN_INTENT_ACTION column for each suggestion returned by the provider. + --> +<searchable xmlns:android="http://schemas.android.com/apk/res/android" + android:label="@string/search_label" + android:searchSettingsDescription="@string/settings_description" + android:includeInGlobalSearch="true" + android:searchSuggestAuthority="dictionary" + android:searchSuggestIntentAction="android.intent.action.VIEW"> +</searchable> diff --git a/samples/SearchableDictionary/src/com/example/android/searchabledict/Dictionary.java b/samples/SearchableDictionary/src/com/example/android/searchabledict/Dictionary.java new file mode 100644 index 000000000..59e735b3d --- /dev/null +++ b/samples/SearchableDictionary/src/com/example/android/searchabledict/Dictionary.java @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.searchabledict; + +import android.content.res.Resources; +import android.text.TextUtils; +import android.util.Log; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Contains logic to load the word of words and definitions and find a list of matching words + * given a query. Everything is held in memory; this is not a robust way to serve lots of + * words and is only for demo purposes. + * + * You may want to consider using an SQLite database. In practice, you'll want to make sure your + * suggestion provider is as efficient as possible, as the system will be taxed while performing + * searches across many sources for each keystroke the user enters into Quick Search Box. + */ +public class Dictionary { + + public static class Word { + public final String word; + public final String definition; + + public Word(String word, String definition) { + this.word = word; + this.definition = definition; + } + } + + private static final Dictionary sInstance = new Dictionary(); + + public static Dictionary getInstance() { + return sInstance; + } + + private final Map<String, List<Word>> mDict = new ConcurrentHashMap<String, List<Word>>(); + + private Dictionary() { + } + + private boolean mLoaded = false; + + /** + * Loads the words and definitions if they haven't been loaded already. + * + * @param resources Used to load the file containing the words and definitions. + */ + public synchronized void ensureLoaded(final Resources resources) { + if (mLoaded) return; + + new Thread(new Runnable() { + public void run() { + try { + loadWords(resources); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + }).start(); + } + + private synchronized void loadWords(Resources resources) throws IOException { + if (mLoaded) return; + + Log.d("dict", "loading words"); + InputStream inputStream = resources.openRawResource(R.raw.definitions); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); + + try { + String line; + while((line = reader.readLine()) != null) { + String[] strings = TextUtils.split(line, "-"); + if (strings.length < 2) continue; + addWord(strings[0].trim(), strings[1].trim()); + } + } finally { + reader.close(); + } + mLoaded = true; + } + + + public List<Word> getMatches(String query) { + List<Word> list = mDict.get(query); + return list == null ? Collections.EMPTY_LIST : list; + } + + private void addWord(String word, String definition) { + final Word theWord = new Word(word, definition); + + final int len = word.length(); + for (int i = 0; i < len; i++) { + final String prefix = word.substring(0, len - i); + addMatch(prefix, theWord); + } + } + + private void addMatch(String query, Word word) { + List<Word> matches = mDict.get(query); + if (matches == null) { + matches = new ArrayList<Word>(); + mDict.put(query, matches); + } + matches.add(word); + } +} diff --git a/samples/SearchableDictionary/src/com/example/android/searchabledict/DictionaryProvider.java b/samples/SearchableDictionary/src/com/example/android/searchabledict/DictionaryProvider.java new file mode 100644 index 000000000..db626e84e --- /dev/null +++ b/samples/SearchableDictionary/src/com/example/android/searchabledict/DictionaryProvider.java @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.searchabledict; + +import android.app.SearchManager; +import android.content.ContentProvider; +import android.content.ContentValues; +import android.content.UriMatcher; +import android.content.res.Resources; +import android.database.Cursor; +import android.database.MatrixCursor; +import android.net.Uri; +import android.text.TextUtils; + +import java.util.List; + +/** + * Provides search suggestions for a list of words and their definitions. + */ +public class DictionaryProvider extends ContentProvider { + + public static String AUTHORITY = "dictionary"; + + private static final int SEARCH_SUGGEST = 0; + private static final int SHORTCUT_REFRESH = 1; + private static final UriMatcher sURIMatcher = buildUriMatcher(); + + /** + * The columns we'll include in our search suggestions. There are others that could be used + * to further customize the suggestions, see the docs in {@link SearchManager} for the details + * on additional columns that are supported. + */ + private static final String[] COLUMNS = { + "_id", // must include this column + SearchManager.SUGGEST_COLUMN_TEXT_1, + SearchManager.SUGGEST_COLUMN_TEXT_2, + SearchManager.SUGGEST_COLUMN_INTENT_DATA, + }; + + + /** + * Sets up a uri matcher for search suggestion and shortcut refresh queries. + */ + private static UriMatcher buildUriMatcher() { + UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH); + matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH_SUGGEST); + matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST); + matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT, SHORTCUT_REFRESH); + matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/*", SHORTCUT_REFRESH); + return matcher; + } + + @Override + public boolean onCreate() { + Resources resources = getContext().getResources(); + Dictionary.getInstance().ensureLoaded(resources); + return true; + } + + @Override + public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, + String sortOrder) { + if (!TextUtils.isEmpty(selection)) { + throw new IllegalArgumentException("selection not allowed for " + uri); + } + if (selectionArgs != null && selectionArgs.length != 0) { + throw new IllegalArgumentException("selectionArgs not allowed for " + uri); + } + if (!TextUtils.isEmpty(sortOrder)) { + throw new IllegalArgumentException("sortOrder not allowed for " + uri); + } + switch (sURIMatcher.match(uri)) { + case SEARCH_SUGGEST: + String query = null; + if (uri.getPathSegments().size() > 1) { + query = uri.getLastPathSegment().toLowerCase(); + } + return getSuggestions(query, projection); + case SHORTCUT_REFRESH: + String shortcutId = null; + if (uri.getPathSegments().size() > 1) { + shortcutId = uri.getLastPathSegment(); + } + return refreshShortcut(shortcutId, projection); + default: + throw new IllegalArgumentException("Unknown URL " + uri); + } + } + + private Cursor getSuggestions(String query, String[] projection) { + String processedQuery = query == null ? "" : query.toLowerCase(); + List<Dictionary.Word> words = Dictionary.getInstance().getMatches(processedQuery); + + MatrixCursor cursor = new MatrixCursor(COLUMNS); + for (Dictionary.Word word : words) { + cursor.addRow(columnValuesOfWord(word)); + } + + return cursor; + } + + private Object[] columnValuesOfWord(Dictionary.Word word) { + return new String[] { + word.word, // _id + word.word, // text1 + word.definition, // text2 + word.word, // intent_data (included when clicking on item) + }; + } + + /** + * Note: this is unused as is, but if we included + * {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column in our results, we + * could expect to receive refresh queries on this uri for the id provided, in which case we + * would return a cursor with a single item representing the refreshed suggestion data. + */ + private Cursor refreshShortcut(String shortcutId, String[] projection) { + return null; + } + + /** + * All queries for this provider are for the search suggestion and shortcut refresh mime type. + */ + public String getType(Uri uri) { + switch (sURIMatcher.match(uri)) { + case SEARCH_SUGGEST: + return SearchManager.SUGGEST_MIME_TYPE; + case SHORTCUT_REFRESH: + return SearchManager.SHORTCUT_MIME_TYPE; + default: + throw new IllegalArgumentException("Unknown URL " + uri); + } + } + + public Uri insert(Uri uri, ContentValues values) { + throw new UnsupportedOperationException(); + } + + public int delete(Uri uri, String selection, String[] selectionArgs) { + throw new UnsupportedOperationException(); + } + + public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { + throw new UnsupportedOperationException(); + } +} diff --git a/samples/SearchableDictionary/src/com/example/android/searchabledict/SearchableDictionary.java b/samples/SearchableDictionary/src/com/example/android/searchabledict/SearchableDictionary.java new file mode 100644 index 000000000..4d2747025 --- /dev/null +++ b/samples/SearchableDictionary/src/com/example/android/searchabledict/SearchableDictionary.java @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.searchabledict; + +import android.app.Activity; +import android.app.SearchManager; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.text.TextUtils; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.AdapterView; +import android.widget.BaseAdapter; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.TwoLineListItem; + +import java.util.List; + +/** + * The main activity for the dictionary. Also displays search results triggered by the search + * dialog. + */ +public class SearchableDictionary extends Activity { + + private static final int MENU_SEARCH = 1; + + private TextView mTextView; + private ListView mList; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + Intent intent = getIntent(); + + setContentView(R.layout.main); + mTextView = (TextView) findViewById(R.id.textField); + mList = (ListView) findViewById(R.id.list); + + if (Intent.ACTION_VIEW.equals(intent.getAction())) { + // from click on search results + Dictionary.getInstance().ensureLoaded(getResources()); + String word = intent.getDataString(); + Dictionary.Word theWord = Dictionary.getInstance().getMatches(word).get(0); + launchWord(theWord); + finish(); + } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { + String query = intent.getStringExtra(SearchManager.QUERY); + mTextView.setText(getString(R.string.search_results, query)); + WordAdapter wordAdapter = new WordAdapter(Dictionary.getInstance().getMatches(query)); + mList.setAdapter(wordAdapter); + mList.setOnItemClickListener(wordAdapter); + } + + Log.d("dict", intent.toString()); + if (intent.getExtras() != null) { + Log.d("dict", intent.getExtras().keySet().toString()); + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + menu.add(0, MENU_SEARCH, 0, R.string.menu_search) + .setIcon(android.R.drawable.ic_search_category_default) + .setAlphabeticShortcut(SearchManager.MENU_KEY); + + return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case MENU_SEARCH: + onSearchRequested(); + return true; + } + return super.onOptionsItemSelected(item); + } + + private void launchWord(Dictionary.Word theWord) { + Intent next = new Intent(); + next.setClass(this, WordActivity.class); + next.putExtra("word", theWord.word); + next.putExtra("definition", theWord.definition); + startActivity(next); + } + + class WordAdapter extends BaseAdapter implements AdapterView.OnItemClickListener { + + private final List<Dictionary.Word> mWords; + private final LayoutInflater mInflater; + + public WordAdapter(List<Dictionary.Word> words) { + mWords = words; + mInflater = (LayoutInflater) SearchableDictionary.this.getSystemService( + Context.LAYOUT_INFLATER_SERVICE); + } + + public int getCount() { + return mWords.size(); + } + + public Object getItem(int position) { + return position; + } + + public long getItemId(int position) { + return position; + } + + public View getView(int position, View convertView, ViewGroup parent) { + TwoLineListItem view = (convertView != null) ? (TwoLineListItem) convertView : + createView(parent); + bindView(view, mWords.get(position)); + return view; + } + + private TwoLineListItem createView(ViewGroup parent) { + TwoLineListItem item = (TwoLineListItem) mInflater.inflate( + android.R.layout.simple_list_item_2, parent, false); + item.getText2().setSingleLine(); + item.getText2().setEllipsize(TextUtils.TruncateAt.END); + return item; + } + + private void bindView(TwoLineListItem view, Dictionary.Word word) { + view.getText1().setText(word.word); + view.getText2().setText(word.definition); + } + + public void onItemClick(AdapterView<?> parent, View view, int position, long id) { + launchWord(mWords.get(position)); + } + } +} diff --git a/samples/SearchableDictionary/src/com/example/android/searchabledict/WordActivity.java b/samples/SearchableDictionary/src/com/example/android/searchabledict/WordActivity.java new file mode 100644 index 000000000..1c4b8b4aa --- /dev/null +++ b/samples/SearchableDictionary/src/com/example/android/searchabledict/WordActivity.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2009 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.android.searchabledict; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; +import android.content.Intent; + +/** + * Displays a word and its definition. + */ +public class WordActivity extends Activity { + + private TextView mWord; + private TextView mDefinition; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.word); + + mWord = (TextView) findViewById(R.id.word); + mDefinition = (TextView) findViewById(R.id.definition); + + Intent intent = getIntent(); + + String word = intent.getStringExtra("word"); + String definition = intent.getStringExtra("definition"); + + mWord.setText(word); + mDefinition.setText(definition); + } +} |