/** * 外界调用 * * @param scanResult */ public void setResultText(String scanResult) { mNumberInfoString = scanResult; MySpan.formatTextView(mContext, mResultTextView, scanResult, false); if (!TextUtils.isEmpty(scanResult)) { if (scanResult.matches(Patterns.URL_PATTERN)) { Util.openUrl(scanResult); } } }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (isViewCreated()) { return mView; } View rootView = inflater.inflate(R.layout.number_layout, container, false); mResultTextView = (TextView) rootView.findViewById(R.id.result); MySpan.formatTextView(mContext, mResultTextView, mNumberInfoString, false); mSearchView = new SearchView(mContext, rootView.findViewById(R.id.search_view)); mFoodListLayout = (LinearLayout) rootView.findViewById(R.id.foodlistBtn); mFoodListLayout.setOnClickListener(this); mHouseListLayout = (LinearLayout) rootView.findViewById(R.id.houselistBtn); mHouseListLayout.setOnClickListener(this); mExpressListLayout = (LinearLayout) rootView.findViewById(R.id.expresslistBtn); mExpressListLayout.setOnClickListener(this); mServiceListLayout = (LinearLayout) rootView.findViewById(R.id.servicelistBtn); mServiceListLayout.setOnClickListener(this); mSearchExpressBtn = (Button) rootView.findViewById(R.id.searchExpressBtn); mSearchExpressBtn.setOnClickListener(this); mWeatherList = (LinearLayout) rootView.findViewById(R.id.weatherList); mWeatherCity = (TextView) rootView.findViewById(R.id.weather_city); mToday = (TextView) rootView.findViewById(R.id.today); rootView.findViewById(R.id.history).setOnClickListener(this); rootView.findViewById(R.id.news).setOnClickListener(this); rootView.findViewById(R.id.qiushi).setOnClickListener(this); rootView.findViewById(R.id.yisi).setOnClickListener(this); rootView.findViewById(R.id.zhihu).setOnClickListener(this); rootView.findViewById(R.id.scan).setOnClickListener(this); rootView.findViewById(R.id.mylove).setOnClickListener(this); // 显示农历和天气 handlerNongli(SharedPreferencesHelper.getInstance().getString(SharedPreferencesHelper.NONGLI)); handlerWeather( SharedPreferencesHelper.getInstance().getString(SharedPreferencesHelper.WEATHER)); handlerAir(SharedPreferencesHelper.getInstance().getString(SharedPreferencesHelper.AIR)); return rootView; }