List of usage examples for android.content Context LAYOUT_INFLATER_SERVICE
String LAYOUT_INFLATER_SERVICE
To view the source code for android.content Context LAYOUT_INFLATER_SERVICE.
Click Source Link
From source file:com.seatgeek.placesautocompletedemo.MainFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.fragment_main, container, false); mapActivity = getActivity();/*from w ww.j ava 2 s .c o m*/ dataProvider = new DataProvider(mapActivity); placePickerGoogle(placePickerIntent); tinydb = new TinyDB(getContext()); arrayListBookmark = tinydb.getListString("BOOKMARK"); recyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_cmt); scrollView = (NestedScrollView) rootView.findViewById(R.id.scrollView); mAdapter = new MessagesAdapter(getContext(), messages, this); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext()); recyclerView.setLayoutManager(mLayoutManager); recyclerView.setItemAnimator(new DefaultItemAnimator()); recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), LinearLayoutManager.VERTICAL)); recyclerView.setAdapter(mAdapter); recyclerView.setNestedScrollingEnabled(false); recyclerView.setFocusable(false); scrollView.scrollTo(0, 0); // mListView = (LockableRecyclerView) rootView.findViewById(android.R.id.list); // mListView.setOverScrollMode(ListView.OVER_SCROLL_NEVER); searchLocation = (CardView) rootView.findViewById(R.id.search_bar); searchLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); startActivityForResult(placePickerIntent, PLACE_AUTOCOMPLETE_REQUEST_CODE); } }); final LayoutInflater inflatera = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); customView = inflatera.inflate(R.layout.review, null); dialogReview = new MaterialStyledDialog.Builder(getActivity()).setHeaderDrawable(R.drawable.header_2) .setCustomView(customView, 20, 20, 20, 0).build(); btn_Rate = (Button) rootView.findViewById(R.id.btn_rate); btn_book = (Button) rootView.findViewById(R.id.btn_book); btn_Rate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // if (customView != null) { // ViewGroup parent = (ViewGroup) customView.getParent(); // if (parent != null) { // parent.removeView(customView); // } // } // try { // customView = inflatera.inflate(R.layout.review,null); // } catch (InflateException e) { // // } // dialogHeader_4.getBuilder().setCustomView(customView,20,20,20,0); dialogReview.show(); } }); btn_book.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (arrayListBookmark.contains(currentPos)) { btn_book.setBackgroundResource(R.drawable.star_off); arrayListBookmark.remove(currentPos); } else { btn_book.setBackgroundResource(R.drawable.star_on); arrayListBookmark.add(currentPos); } tinydb.putListString("BOOKMARK", arrayListBookmark); // btn_book.setBackgroundResource(R.drawable.star_on); } }); rating = (SmileRating) customView.findViewById(R.id.ratingsBar); final EditText ed_review = (EditText) customView.findViewById(R.id.reviewED); final EditText ed_title = (EditText) customView.findViewById(R.id.titleED); Button cancelDialog = (Button) customView.findViewById(R.id.cancelD); cancelDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialogReview.dismiss(); } }); Button submitDialog = (Button) customView.findViewById(R.id.submitD); submitDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Toast.makeText(getActivity().getApplicationContext(),""+rating.getRating(),Toast.LENGTH_SHORT).show(); sendComment(10, ed_review.getText().toString().trim(), ed_title.getText().toString().trim(), rating.getRating(), new ParkingCar()); } }); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mapActivity); latitude = sharedPreferences.getString("LATITUDE", null); longitude = sharedPreferences.getString("LONGITUDE", null); RADIUS = sharedPreferences.getString("RADIUS", "1000"); ViewPager pager = (ViewPager) rootView.findViewById(R.id.pager); pager.setAdapter(new ImageAdapter(getActivity())); pager.setCurrentItem(getArguments().getInt(Constants.Extra.IMAGE_POSITION, 0)); pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { for (int i = 0; i < dotsCount; i++) { dots[i].setTextColor(getResources().getColor(android.R.color.black)); } dots[position].setTextColor(Color.GREEN); } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } }); setUiPageViewController(rootView); mLayout = (SlidingUpPanelLayout) rootView.findViewById(R.id.sliding_layout); mLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); mLayout.setAnchorPoint(0.68f); mLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() { @Override public void onPanelSlide(View panel, float slideOffset) { Log.i("", "onPanelSlide, offset " + slideOffset); } @Override public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) { Log.i("", "onPanelStateChanged " + newState); if (newState == SlidingUpPanelLayout.PanelState.COLLAPSED) { scrollView.scrollTo(0, 0); } } }); mLayout.setFadeOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); } }); txt_Adress = (TextView) rootView.findViewById(R.id.name); txt_Scale = (TextView) rootView.findViewById(R.id.txt_Scale); txt_Add = (TextView) rootView.findViewById(R.id.textView3); txt_Type = (TextView) rootView.findViewById(R.id.textView4); txt_Rate = (TextView) rootView.findViewById(R.id.textView5); Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "font/UTM Avo.ttf"); Typeface tf1 = Typeface.createFromAsset(getActivity().getAssets(), "font/UTM Dax.ttf"); txt_Adress.setTypeface(tf, Typeface.BOLD); txt_Scale.setTypeface(tf1, Typeface.BOLD); txt_Add.setTypeface(tf1, Typeface.BOLD); txt_Type.setTypeface(tf1, Typeface.BOLD); txt_Rate.setTypeface(tf1, Typeface.BOLD); collapseMap(); return rootView; }
From source file:com.example.androidannotationtesttwo.widget.swiptlistview.SwipeListView.java
/** * init on bottom style, only init once/*w w w. j a va2 s.com*/ */ private void initOnBottomStyle() { if (footerLayout != null) { if (isOnBottomStyle) { addFooterView(footerLayout); } else { removeFooterView(footerLayout); } return; } if (!isOnBottomStyle) { return; } footerDefaultText = context.getString(R.string.drop_down_list_footer_default_text); footerLoadingText = context.getString(R.string.drop_down_list_footer_loading_text); footerNoMoreText = context.getString(R.string.drop_down_list_footer_no_more_text); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); footerLayout = (RelativeLayout) inflater.inflate(R.layout.drop_down_list_footer, this, false); footerButton = (Button) footerLayout.findViewById(R.id.drop_down_list_footer_button); footerButton.setDrawingCacheBackgroundColor(0); footerButton.setEnabled(true); footerProgressBar = (ProgressBar) footerLayout.findViewById(R.id.drop_down_list_footer_progress_bar); addFooterView(footerLayout); }
From source file:com.danielme.android.webviewdemo.WebViewDemoActivity.java
@Override protected Dialog onCreateDialog(int id) { Builder builder = new Builder(this); builder.setTitle(getString(R.string.history)); builder.setPositiveButton(getString(R.string.clear), new OnClickListener() { @Override/* ww w . ja v a2 s.co m*/ public void onClick(DialogInterface dialog, int which) { historyStack.clear(); } }); builder.setNegativeButton(R.string.close, null); dialogArrayAdapter = new ArrayAdapter<Link>(this, R.layout.history, historyStack) { @Override public View getView(int position, View convertView, ViewGroup parent) { //holder pattern LinkHolder holder = null; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.history, null); holder = new LinkHolder(); holder.setUrl((TextView) convertView.findViewById(R.id.textView1)); holder.setImageView((ImageView) convertView.findViewById(R.id.favicon)); convertView.setTag(holder); } else { holder = (LinkHolder) convertView.getTag(); } Link link = historyStack.get(position); //show title when available if (link.getTitle() != null) { holder.getUrl().setText(link.getTitle()); } else { holder.getUrl().setText(link.getUrl()); } Bitmap favicon = link.getFavicon(); if (favicon == null) { holder.getImageView().setImageDrawable( super.getContext().getResources().getDrawable(R.drawable.favicon_default)); } else { holder.getImageView().setImageBitmap(favicon); } return convertView; } }; builder.setAdapter(dialogArrayAdapter, new OnClickListener() { public void onClick(DialogInterface dialog, int item) { webview.loadUrl(historyStack.get(item).getUrl()); stopButton.setEnabled(true); } }); return builder.create(); }
From source file:com.stikyhive.stikyhive.ChattingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { getWindow().setBackgroundDrawableResource(R.drawable.chat_bg); // this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); recipientStkid = getIntent().getExtras().getString("recipientStkid"); chatRecipient = getIntent().getExtras().getString("chatRecipient"); chatRecipientUrl = getIntent().getExtras().getString("chatRecipientUrl"); senderToken = getIntent().getExtras().getString("senderToken"); recipientToken = getIntent().getExtras().getString("recipientToken"); noti = getIntent().getExtras().getBoolean("noti"); message = getIntent().getExtras().getString("message"); rows = getIntent().getExtras().getInt("rows"); flagChatting = true;/*from ww w . j av a 2s. c o m*/ pref = PreferenceManager.getDefaultSharedPreferences(this); offerId = 0; offerStatus = 0; ws = new JsonWebService(); dbHelper = new DBHelper(this); dialog = new ProgressDialog(this); listChatContact = new ArrayList<>(); listChatContact = dbHelper.getChatContact(); Log.i(" Chat Contact ", " " + listChatContact.size()); metrics = this.getResources().getDisplayMetrics(); //to change font faceSemi_bold = Typeface.createFromAsset(getAssets(), fontOSSemi_bold); Typeface faceLight = Typeface.createFromAsset(getAssets(), fontOSLight); faceRegular = Typeface.createFromAsset(getAssets(), fontOSRegular); imageLoader = ImageLoader.getInstance(); if (!imageLoader.isInited()) { imageLoader.init(ImageLoaderConfiguration.createDefault(this)); } start = new Date(); SimpleDateFormat oFormat = new SimpleDateFormat("dd MMM HH:mm"); timeSend = oFormat.format(start); super.onCreate(savedInstanceState); setContentView(R.layout.chat); layoutTalk = (LinearLayout) findViewById(R.id.layoutTalk); txtUserName = (TextView) findViewById(R.id.txtChatName); edTxtMsg = (EditText) findViewById(R.id.edTxtMsg); imgViewProfile = (ImageView) findViewById(R.id.imgViewChat); imgViewAddCon = (ImageView) findViewById(R.id.imgAddContact); lv = (ListView) findViewById(R.id.listView1); layoutLabel = (LinearLayout) findViewById(R.id.layoutLabel); txtLabel1 = (TextView) findViewById(R.id.txtLabel1); txtLabel2 = (TextView) findViewById(R.id.txtLabel2); txtLabel3 = (TextView) findViewById(R.id.txtLabel3); txtLabel2.setText(" " + chatRecipient + " "); txtLabel1.setTypeface(faceLight); txtLabel2.setTypeface(faceRegular); txtLabel3.setTypeface(faceLight); for (ChatContact contact : listChatContact) { if (contact.getContactId().equals(recipientStkid)) { imgViewAddCon.setVisibility(View.INVISIBLE); layoutLabel.setVisibility(View.GONE); break; } } Log.i(TAG, " come back again"); adapter = new ChatArrayAdapter(this, R.layout.chatting_listview, faceSemi_bold, faceRegular, recipientStkid, senderToken, recipientToken); lv.setAdapter(adapter); // adapter.add(new StikyChat(chatRecipientUrl, "Hello", false, "12.10.2015", "12.1.2014")); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh_layout); // BEGIN_INCLUDE (change_colors) // Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids swipeRefreshLayout.setColorScheme(R.color.swipe_color_1, R.color.swipe_color_2, R.color.swipe_color_3, R.color.swipe_color_4); limitMsg = 7; // END_INCLUDE (change_colors) swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { Log.i(" Refresh Layout ", "onRefresh called from SwipeRefreshLayout"); if (limitMsg < rows) { Log.i("Limit Message ", " " + limitMsg); limitMsg *= 2; fetchRecords(); } else if ((!(rows <= 7)) && limitMsg > rows && (limitMsg - rows < 7)) { fetchRecords(); } else { Log.i("No data ", "to refresh"); swipeRefreshLayout.setRefreshing(false); Toast.makeText(getApplicationContext(), "No data to refresh!", Toast.LENGTH_SHORT).show(); } // initiateRefresh(); } }); LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout headerLayout = (LinearLayout) findViewById(R.id.header); View header = inflator.inflate(R.layout.header, null); TextView textView = (TextView) header.findViewById(R.id.textView1); textView.setText("StikyChat"); textView.setTypeface(faceSemi_bold); textView.setVisibility(View.VISIBLE); headerLayout.addView(header); LinearLayout layoutRight = (LinearLayout) header.findViewById(R.id.layoutRight); layoutRight.setVisibility(View.GONE); txtUserName.setText(chatRecipient); Log.i(TAG, "Activity Name " + txtUserName.getText().toString()); txtUserName.setTypeface(faceSemi_bold); String url = ""; Log.i(TAG, " ^^^ " + chatRecipientUrl + " "); if (chatRecipientUrl != null) { if (chatRecipientUrl.contains("http")) { url = chatRecipientUrl; } else if (chatRecipientUrl != "null") { url = this.getResources().getString(R.string.url) + "/" + chatRecipientUrl; } } addAndroidUniversalImageLoader(imgViewProfile, url); // if (noti && (!message.equals(""))) { // adapter.add(new StikyChat(chatRecipientUrl, message, true, timeSend, "")); // lv.smoothScrollToPosition(adapter.getCount() - 1); // } //to show history chats between two users(sender & recipient) dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); dateFormat2 = new SimpleDateFormat("dd MMM HH:mm"); listHistory = dbHelper.getStikyChat(); if (listHistory.size() > 0) { Collections.reverse(listHistory); for (final StikyChatTb chatTb : listHistory) { String getDate = chatTb.getSendDate(); String durationStr = null; String fromStikyBee = chatTb.getSender(); try { final String createDate = dateFormat2.format(dateFormat.parse(getDate)); if (chatTb.getFileName().contains("voice")) { MediaPlayer mPlayer = new MediaPlayer(); String voiceFileName = getResources().getString(R.string.url) + "/" + chatTb.getFileName(); try { mPlayer.setDataSource(voiceFileName); mPlayer.prepare(); } catch (IOException e) { e.printStackTrace(); } //mPlayer.start(); int duration = mPlayer.getDuration(); mPlayer.release(); duration = (int) Math.ceil(duration / 1024); if (duration < 10) { durationStr = "00:0" + duration; } else { durationStr = "00:" + duration; } // Log.i(TAG, "Duration Srt " + durationStr); } if (fromStikyBee.equals(pref.getString("stkid", ""))) { //String url1 = getResources().getString(R.string.url) + "/" + chatTb.getFileName(); // Log.i(TAG, " Offer Id " + chatTb.getOfferId() + " Price " + chatTb.getPrice() + " Name " + chatTb.getName()); //first false = right, second false = Offer // Log.i(TAG, " Duration " + chatTb.getRate() + " File Name " + chatTb.getFileName()); if (!chatTb.getFileName().contains("voice")) { Log.i(TAG, " Voice is not "); adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), false, createDate, chatTb.getFileName(), chatTb.getOfferId(), chatTb.getOfferStatus(), chatTb.getPrice(), chatTb.getRate(), chatTb.getName(), null, chatTb.getOriFName())); } else { Log.i(TAG, " Voice is "); adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), false, createDate, chatTb.getFileName(), chatTb.getOfferId(), chatTb.getOfferStatus(), chatTb.getPrice(), chatTb.getRate(), durationStr, null, chatTb.getOriFName())); } } else { /* Bitmap bmImg = BitmapFactory.decodeFile(getResources().getString(R.string.url) + "/" + chatTb.getFileName()); Bitmap resBm = getResizedBitmap(bmImg, 500);*/ // String url1 = getResources().getString(R.string.url) + "/" + chatTb.getFileName(); if (!chatTb.getFileName().contains("voice")) { adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), true, createDate, chatTb.getFileName(), chatTb.getOfferId(), chatTb.getOfferStatus(), chatTb.getPrice(), chatTb.getRate(), chatTb.getName(), null, chatTb.getOriFName())); } else { adapter.add(new StikyChat(chatRecipientUrl, chatTb.getMessage(), true, createDate, chatTb.getFileName(), chatTb.getOfferId(), chatTb.getOfferStatus(), chatTb.getPrice(), chatTb.getRate(), durationStr, null, chatTb.getOriFName())); } } lv.smoothScrollToPosition(adapter.getCount() - 1); } catch (ParseException e) { e.printStackTrace(); } } } mRegistrationBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); fileNameGCM = sharedPreferences.getString("fileName", ""); messageGCM = sharedPreferences.getString("message", ""); offerIdGCM = sharedPreferences.getInt("offerId", 0); offerStatusGCM = sharedPreferences.getInt("offerStatus", 0); priceGCM = sharedPreferences.getString("price", ""); rateGCM = sharedPreferences.getString("rate", ""); nameGCM = sharedPreferences.getString("name", ""); recipientProfileGCM = sharedPreferences.getString("chatRecipientUrl", ""); recipientNameGCM = sharedPreferences.getString("chatRecipientName", ""); recipientStkidGCM = sharedPreferences.getString("recipientStkid", ""); recipientTokenGCM = sharedPreferences.getString("recipientToken", ""); senderTokenGCM = sharedPreferences.getString("senderToken", ""); Log.i(TAG, " FileName GCM " + fileNameGCM + " " + " Name Rate Price &&&&& *** " + messageGCM + " " + priceGCM + " " + rateGCM); if (firstConnect) { if (recipientStkidGCM.trim() == recipientStkid.trim() || recipientStkidGCM.equals(recipientStkid)) { MyGcmListenerService.flagSendNoti = false; Log.i(TAG, " " + message); // (1) get today's date start = new Date(); SimpleDateFormat oFormat = new SimpleDateFormat("dd MMM HH:mm"); timeSend = oFormat.format(start); Log.i(TAG, "First connect " + firstConnect); Log.i(TAG, " File Name GCMMMMMM " + fileNameGCM); /*if (!fileNameGCM.equals("") && !fileNameGCM.equals("null") && !fileNameGCM.equals(null)) { oriFName = saveFileAndImage(fileNameGCM); }*/ /*if (fileNameGCM.contains("voice")) { String durationStr; MediaPlayer mPlayer = new MediaPlayer(); String voiceFileName = getResources().getString(R.string.url) + "/" + fileNameGCM; try { mPlayer.setDataSource(voiceFileName); mPlayer.prepare(); } catch (IOException e) { e.printStackTrace(); } //mPlayer.start(); int duration = mPlayer.getDuration(); mPlayer.release(); duration = (int) Math.ceil(duration / 1024); if (duration < 10) { durationStr = "00:0" + duration; } else { durationStr = "00:" + duration; } StikyChat stikyChat = new StikyChat(recipientProfileGCM, messageGCM, true, timeSend, fileNameGCM.trim(), offerIdGCM, offerStatusGCM, priceGCM, rateGCM, durationStr, null, oriFName); adapter.add(stikyChat); } else {*/ StikyChat stikyChat = new StikyChat(recipientProfileGCM, messageGCM, true, timeSend, fileNameGCM.trim(), offerIdGCM, offerStatusGCM, priceGCM, rateGCM, nameGCM, null, oriFName); adapter.add(stikyChat); // } Log.i(TAG, " First " + message + " " + recipientProfileGCM + " " + timeSend); Log.i(TAG, "User " + txtUserName.getText().toString()); adapter.notifyDataSetChanged(); lv.setSelection(adapter.getCount() - 1); new regTask2().execute("Obj "); } else { /* if (!fileNameGCM.equals("") && !fileNameGCM.equals("null") && !fileNameGCM.equals(null)) { saveFileAndImage(fileNameGCM); }*/ Log.i(TAG, "..." + recipientStkidGCM.trim()); Log.i(TAG, "&&&" + recipientStkid.trim()); Log.i(TAG, "else casee"); //notificaton send flagNotifi = true; new regTask2().execute("Notification"); } firstConnect = false; } lv.setSelection(adapter.getCount() - 1); } }; /*edTxtMsg.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); layoutTalk.setLayoutParams(params); layoutTalk.setGravity(Gravity.CENTER); Toast.makeText(getBaseContext(), ((EditText) v).getId() + " has focus - " + hasFocus, Toast.LENGTH_LONG).show(); } });*/ getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); edTxtMsg.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, 0); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); layoutTalk.setLayoutParams(params); layoutTalk.setGravity(Gravity.CENTER); flagRecord = false; /*getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE );*/ Toast.makeText(getBaseContext(), "Touch ...", Toast.LENGTH_LONG).show(); return false; } }); }
From source file:com.housekeeper.ar.healthhousekeeper.RegisterActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /*// w ww. jav a 2 s. co m if (savedInstanceState != null) { String zcpsStr = savedInstanceState.getString("zcps"); zcpsET.setText(zcpsStr); } */ SysApplication.getInstance().addActivity(this); setContentView(R.layout.activity_register); toastCommom = ToastCommom.createToastConfig(); MyActivityManager.pushOneActivity(RegisterActivity.this); myApp = (MyApp) getApplication(); http = myApp.getHttp(); backBtn = (Button) findViewById(R.id.back_btn); backBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); //APP? Log.i(TAG, "filename oncreate "); String fileName = myApp.getJoStartPath(); Log.i(TAG, "fileName:" + fileName); if (fileName != null) { try { readFileCache = saveCache.read(fileName); joReadFileCache = new JSONObject(readFileCache); String result = joReadFileCache.getString("result"); String resultMessage = joReadFileCache.getString("resultMessage"); //?value JSONObject joValue = joReadFileCache.getJSONObject("value"); //?provinces jaProvinces = joValue.getJSONArray("provinces"); joProvinces = new JSONObject[jaProvinces.length()]; nameProvinces = new String[jaProvinces.length()]; //nameProvinces[0] = "-?-"; for (int i = 0; i < jaProvinces.length(); i++) { joProvinces[i] = jaProvinces.getJSONObject(i); nameProvinces[i] = joProvinces[i].getString("name"); Log.v(TAG, "nameProvinces:" + nameProvinces[i]); } jaPros = joValue.getJSONArray("jobTitles"); joPros = new JSONObject[jaPros.length()]; namePros = new String[jaPros.length()]; idJobTitles = new int[namePros.length]; for (int i = 0; i < jaPros.length(); i++) { joPros[i] = jaPros.getJSONObject(i); namePros[i] = joPros[i].getString("name"); idJobTitles[i] = joPros[i].getInt("id"); Log.v(TAG, "namePros:" + namePros[i]); Log.v(TAG, "idJobTitles:" + idJobTitles[i]); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { nameProvinces = new String[] { "" }; nameCities = new String[] { "" }; nameHospitals = new String[] { "" }; nameDepartments = new String[] { "" }; namePros = new String[] { "" }; } // prePageBtn = (Button)findViewById(R.id.pre_btn); firstPageLayout = (RelativeLayout) findViewById(R.id.first_layout); // nextPageBtn = (Button)findViewById(R.id.next_btn); // secondPageLayout = (RelativeLayout)findViewById(R.id.second_layout); yanzhengmaLayout = (LinearLayout) findViewById(R.id.yanzhengma_layout); yanzhengmaRegBtn = (Button) findViewById(R.id.yanzhengma_regbtn); titleTextView = (TextView) findViewById(R.id.title); yanzhengmaPsdEditText = (EditText) findViewById(R.id.password_et); yanzhengmaZhangHuEditText = (EditText) findViewById(R.id.zhanghu_et); workIdEditText = (EditText) findViewById(R.id.work_id_et); usernameET = (TextView) findViewById(R.id.username_et); psdET = (TextView) findViewById(R.id.psd_et); psdaET = (EditText) findViewById(R.id.psd_again_et); nameET = (EditText) findViewById(R.id.name_et); idET = (EditText) findViewById(R.id.id_et); // yszET = (EditText)findViewById(R.id.zyys_et); // zczET = (EditText)findViewById(R.id.yszc_et); // zcpsET = (EditText)findViewById(R.id.zcps_et); // skillET = (EditText)findViewById(R.id.zs_et); // detailET = (EditText)findViewById(R.id.xxxx_et); telET = (EditText) findViewById(R.id.tel_et); mailET = (EditText) findViewById(R.id.mail_et); photo = (ImageView) findViewById(R.id.photo_image); // meetplacET = (EditText)findViewById(R.id.address_et); regBtn = (Button) findViewById(R.id.regbtn); photoBtn = (Button) findViewById(R.id.photoBtn); // zcpsBtn = (Button)findViewById(R.id.zcps_btn); // zyysBtn = (Button)findViewById(R.id.zyys_btn); // yszcBtn = (Button)findViewById(R.id.yszc_btn); signBtn = (Button) findViewById(R.id.sign_btn); //birthday birthdayStr = yearStr + "-" + monthStr + "-" + dayStr; year = (Spinner) findViewById(R.id.yearspinner); month = (Spinner) findViewById(R.id.monthspinner); day = (Spinner) findViewById(R.id.dayspinner); //sex sex = (Spinner) findViewById(R.id.sex_spinner); //province-city-hospital sheng = (Spinner) findViewById(R.id.sheng_spinner); shi = (Spinner) findViewById(R.id.shi_spinner); yy = (Spinner) findViewById(R.id.yy_spinner); //? // pro = (Spinner)findViewById(R.id.pro_spinner); //- // ks = (Spinner)findViewById(R.id.ks_spinner); //ksfl = (Spinner)findViewById(R.id.ksfl_spinner); // departmentTypeTv = (TextView)findViewById(R.id.ksfl_tv); final List<String> yearList = getYearData(); final List<String> monthList = getMonthData(); final List<String> dayList = getDayData(); yanzhengmaLayout.setVisibility(View.VISIBLE); firstPageLayout.setVisibility(View.GONE); yanzhengmaRegBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { yanzhengmaLayout.setVisibility(View.GONE); firstPageLayout.setVisibility(View.VISIBLE); titleTextView.setText(" "); usernameET.setText(yanzhengmaZhangHuEditText.getText().toString()); psdET.setText(yanzhengmaPsdEditText.getText().toString()); psdaET.setText(yanzhengmaPsdEditText.getText().toString()); telET.setText(yanzhengmaZhangHuEditText.getText().toString()); } }); // final String yearArray[] = new String[yearList.size()]; // if(yearList != null){ // for(int i = 0 ;i<yearList.size();i++){ // yearArray[i] = yearList.get(i); // } // } // // ArrayAdapter?? // ArrayAdapter<String> yearAdapter = new ArrayAdapter<String> // (RegisterActivity.this, android.R.layout.simple_spinner_item,getYearData()); // ArrayAdapter<String> monthAdapter = new ArrayAdapter<String> // (RegisterActivity.this, android.R.layout.simple_spinner_item,getMonthData()); // ArrayAdapter<String> dayAdapter = new ArrayAdapter<String> // (RegisterActivity.this, android.R.layout.simple_spinner_item,getDayData()); // // final List<String> sexList = getSexData(); // ArrayAdapter<String> sexAdapter = new ArrayAdapter<String> // (RegisterActivity.this, android.R.layout.simple_spinner_item,getSexData()); // ArrayAdapter?? ArrayAdapter<String> yearAdapter = new ArrayAdapter<String>(RegisterActivity.this, R.layout.spinner_item, yearList) { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.spinner_item_layout, null); TextView label = (TextView) view.findViewById(R.id.spinner_item_label); label.setText(yearList.get(position)); return view; //return super.getDropDownView(position, convertView, parent); } }; ArrayAdapter<String> monthAdapter = new ArrayAdapter<String>(RegisterActivity.this, R.layout.spinner_item, getMonthData()) { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.spinner_item_layout, null); TextView label = (TextView) view.findViewById(R.id.spinner_item_label); label.setText(monthList.get(position)); return view; //return super.getDropDownView(position, convertView, parent); } }; ArrayAdapter<String> dayAdapter = new ArrayAdapter<String>(RegisterActivity.this, R.layout.spinner_item, getDayData()) { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.spinner_item_layout, null); TextView label = (TextView) view.findViewById(R.id.spinner_item_label); label.setText(dayList.get(position)); return view; //return super.getDropDownView(position, convertView, parent); } }; final List<String> sexList = getSexData(); ArrayAdapter<String> sexAdapter = new ArrayAdapter<String>(RegisterActivity.this, R.layout.spinner_item, getSexData()) { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.spinner_item_layout, null); TextView label = (TextView) view.findViewById(R.id.spinner_item_label); label.setText(sexList.get(position)); return view; //return super.getDropDownView(position, convertView, parent); } }; //? yearAdapter.setDropDownViewResource(R.layout.spinner_item_layout); //? monthAdapter.setDropDownViewResource(R.layout.spinner_item_layout); //? dayAdapter.setDropDownViewResource(R.layout.spinner_item_layout); //? sexAdapter.setDropDownViewResource(R.layout.spinner_item_layout); year.setAdapter(yearAdapter); month.setAdapter(monthAdapter); day.setAdapter(dayAdapter); sex.setAdapter(sexAdapter); year.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { Log.i(TAG, "year touch "); closeSoftKeyboard(); return false; } }); month.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { Log.i(TAG, "year touch "); closeSoftKeyboard(); return false; } }); day.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { Log.i(TAG, "year touch "); closeSoftKeyboard(); return false; } }); sex.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { Log.i(TAG, "year touch "); closeSoftKeyboard(); return false; } }); getShared(); setSpinner(); regBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub if (usernameET.getText().toString().equals("")) { // Toast.makeText(RegisterActivity.this, "??", // Toast.LENGTH_LONG).show(); toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root), "??"); return; } if (psdET.getText().toString().equals("")) { // Toast.makeText(RegisterActivity.this, "?", // Toast.LENGTH_LONG).show(); toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root), "?"); return; } if (psdaET.getText().toString().equals("")) { // Toast.makeText(RegisterActivity.this, "?", // Toast.LENGTH_LONG).show(); toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root), "?"); return; } if (!psdaET.getText().toString().equals(psdET.getText().toString())) { Log.v(TAG, "??"); // Toast.makeText(RegisterActivity.this, "??", // Toast.LENGTH_LONG).show(); toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root), "??"); return; } if (nameET.getText().toString().equals("")) { // Toast.makeText(RegisterActivity.this, "??", // Toast.LENGTH_LONG).show(); toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root), "??"); return; } pDialog = new ProgressDialog(RegisterActivity.this); pDialog.setTitle(""); pDialog.setMessage("?......"); pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); pDialog.show(); new RegisterThread().run(); } }); photoBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub picKind = 0; Intent intent = new Intent(RegisterActivity.this, SelectPictureActivity.class); intent.putExtra("from", "register"); startActivityForResult(intent, REQUEST_PICK); //RegisterActivity.this.finish(); } }); signBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub picKind = 1; Intent intent = new Intent(RegisterActivity.this, SelectPictureActivity.class); intent.putExtra("from", "register"); startActivityForResult(intent, REQUEST_PICK); } }); }
From source file:ca.ualberta.cmput301w14t08.geochan.adapters.ThreadViewAdapter.java
/** * Assign convertview to layout.// w w w . j av a 2s . co m * * @param convertView * The View to inflate * @param layout * An R.Layout resource. * @return convertView The inflated View. */ private View setConvertView(View convertView, int layout) { if (convertView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(layout, null); } return convertView; }
From source file:com.android.settings.HWSettings.java
@Override protected void onCreate(Bundle savedInstanceState) { mVoiceCapable = getResources().getBoolean(com.android.internal.R.bool.config_voice_capable); if (getIntent().hasExtra(EXTRA_UI_OPTIONS)) { getWindow().setUiOptions(getIntent().getIntExtra(EXTRA_UI_OPTIONS, 0)); }/*from w w w . j a v a2s .c om*/ mAuthenticatorHelper = new AuthenticatorHelper(); mAuthenticatorHelper.updateAuthDescriptions(this); mAuthenticatorHelper.onAccountsUpdated(this, null); mDevelopmentPreferences = getSharedPreferences(DevelopmentSettings.PREF_FILE, Context.MODE_PRIVATE); getMetaData(); mInLocalHeaderSwitch = true; super.onCreate(savedInstanceState); setContentView(R.layout.settings_main); mInLocalHeaderSwitch = false; /** * SPRD:Optimization to erase the animation on click. @{ */ ListView list = getListView(); list.setSelector(R.drawable.list_selector_holo_dark); /** @} */ if (!onIsHidingHeaders() && onIsMultiPane()) { highlightHeader(mTopLevelHeaderId); // Force the title so that it doesn't get overridden by a direct launch of // a specific settings screen. setTitle(R.string.settings_label); } // Retrieve any saved state if (savedInstanceState != null) { mCurrentHeader = savedInstanceState.getParcelable(SAVE_KEY_CURRENT_HEADER); mParentHeader = savedInstanceState.getParcelable(SAVE_KEY_PARENT_HEADER); if (HW_SETTINGS) { //wangkaifeng tab settings curTabIndex = savedInstanceState.getInt(SAVE_KEY_CURRENT_TAB); } } // If the current header was saved, switch to it if (savedInstanceState != null && mCurrentHeader != null) { //switchToHeaderLocal(mCurrentHeader); showBreadCrumbs(mCurrentHeader.title, null); } if (mParentHeader != null) { setParentTitle(mParentHeader.title, null, new OnClickListener() { @Override public void onClick(View v) { switchToParent(mParentHeader.fragment); } }); } // Override up navigation for multi-pane, since we handle it in the fragment breadcrumbs if (onIsMultiPane()) { getActionBar().setDisplayHomeAsUpEnabled(false); getActionBar().setHomeButtonEnabled(false); } /* SPRD: add for tab style @{ */ mInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); /* @} */ /* hw settings {@ */ if (HW_SETTINGS) { //wangkaifeng tab settings createFragments(); if (this.toString().contains(".HWSettings@")) { mActionBar = getActionBar(); int tabHeight = 80;//(int) getResources().getDimensionPixelSize(R.dimen.universe_ui_tab_height); //revo lyq int TYPELCD = SystemProperties.getInt("qemu.sf.lcd_density", SystemProperties.getInt("ro.sf.lcd_density", 240)); if (TYPELCD == 160) { tabHeight = 52; } mActionBar.setAlternativeTabStyle(false); mActionBar.setTabHeight(tabHeight); setupGeneral(mActionBar); setupAll(mActionBar); mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mActionBar.setDisplayShowTitleEnabled(false); mActionBar.setDisplayShowHomeEnabled(false); } } /* @} */ //liangbo add 20141231 if (FeatureOption.PRJ_FEATURE_SHOW_MENU_FOR_DEVOLOPMENT_SETTINGS) { getSharedPreferences(DevelopmentSettings.PREF_FILE, Context.MODE_PRIVATE).edit() .putBoolean(DevelopmentSettings.PREF_SHOW, true).apply(); } }
From source file:com.lifehackinnovations.siteaudit.FloorPlanActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try {//from ww w.j a va 2s.c om Tabs1.db.showfulldblog(Tabs1.db.TABLE_MCR_METERINGLIST); } catch (Throwable e) { } ctx = this; try { if (Tabs1.foldername.contains("_")) { tempfoldername = Tabs1.foldername.substring(0, Tabs1.foldername.indexOf("_")); } else { tempfoldername = Tabs1.foldername; } Log.d("foldername", tempfoldername); dbtablename = "floorplan"; if (Tabs1.db.checktableindb(dbtablename)) { // } else { try { Tabs1.db.createfloorplandb(dbtablename); } catch (Throwable e) { e.printStackTrace(); } } try { MULTILEVEL = ReadBoolean(this, "multilevel", false); } catch (Throwable e) { System.out.println("couldn't read multilevel value from preferences on start"); MULTILEVEL = false; } try { NGBICONS = ReadBoolean(this, "ngbicons", false); } catch (Throwable e) { System.out.println("couldn't read autorenumber temp sensors value from preferences on start"); NGBICONS = true; } try { DRAWSAMREFERENCE = ReadBoolean(this, "drawsamreferencetable", true); } catch (Throwable e) { } try { RAPIDPLACEMENT = ReadBoolean(this, "rapidplacement", false); } catch (Throwable e) { } // Remove title bar this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Remove notification bar this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); Intent intent = getIntent(); FloorPlanActivity.floorplannumber = intent.getExtras().getInt("floorplannumber"); try { FloorPlanActivity.floorplancount = Tabs1.FloorPlanCount; } catch (Throwable e) { FloorPlanActivity.floorplancount = new File(Tabs1.inputfloorplandirectory).list().length; } MODE = MODE_DONOTHING; progressDialog = new ProgressDialog(this); progressDialog.setIndeterminate(true); if (tempfoldername.equals("Paul")) { progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.paul_animation)); } else if (tempfoldername.equals("Will")) { progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.will_animation)); } else if (tempfoldername.equals("Bill")) { progressDialog.setIndeterminateDrawable(getResources().getDrawable(R.anim.bill_animation)); } else { progressDialog.setIndeterminateDrawable( getResources().getDrawable(R.anim.progress_dialog_icon_drawable_animation)); } progressDialog.setIcon(R.drawable.ic_launcher); progressDialog.setTitle("Loading"); progressDialog.setMessage("Please Wait"); progressDialog.setCancelable(false); rl = new RelativeLayout(this); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); rl.setLayoutParams(rllp); toolbar = new View(this); LayoutInflater inflater = (LayoutInflater) getBaseContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); toolbar = inflater.inflate(R.layout.toolbar, null); toptoolbar = (View) toolbar.findViewById(R.id.toptoolbar); righttoolbar = (View) toolbar.findViewById(R.id.righttoolbar); righttoolbarbuttonparent = (View) toolbar.findViewById(R.id.righttoolbarbuttonparent); righttoolbarscrollview = (ScrollView) toolbar.findViewById(R.id.righttoolbarscrollview); floorplanprevious = (ImageView) toolbar.findViewById(R.id.floorplanprevious); floorplannext = (ImageView) toolbar.findViewById(R.id.floorplannext); fullscreen = (ImageView) toolbar.findViewById(R.id.fullscreen); unfullscreen = (ImageView) toolbar.findViewById(R.id.unfullscreen); showlayers = (ImageView) toolbar.findViewById(R.id.layers); resizeicons = (ImageView) toolbar.findViewById(R.id.resizeicons); metersperpixelbutton = (ImageView) toolbar.findViewById(R.id.metersperpixelbutton); resizeiconsseekbar = (SeekBar) toolbar.findViewById(R.id.resizeiconsseekbar); resizeiconsseekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub view.invalidate(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } }); resizeiconscancel = (Button) toolbar.findViewById(R.id.resizeiconscancel); resizeiconsfinished = (Button) toolbar.findViewById(R.id.resizeiconsfinished); preferences = (ImageView) toolbar.findViewById(R.id.preferences); floorplantitle = (TextView) toolbar.findViewById(R.id.floorplantitle); BMS = (ImageView) toolbar.findViewById(R.id.bms); ELC = (ImageView) toolbar.findViewById(R.id.elc); Gateway = (ImageView) toolbar.findViewById(R.id.gateway); SAM = (ImageView) toolbar.findViewById(R.id.sam); tempsensor = (ImageView) toolbar.findViewById(R.id.tempsensor); ethernetport = (ImageView) toolbar.findViewById(R.id.ethernetport); distributionboard = (ImageView) toolbar.findViewById(R.id.distributionboard); samarray = (ImageView) toolbar.findViewById(R.id.samarray); datahub = (ImageView) toolbar.findViewById(R.id.datahub); AddText = (ImageView) toolbar.findViewById(R.id.addtexttofloorplan); legend = (ImageView) toolbar.findViewById(R.id.legend); hiddenaddpicturebutton = new Button(this); hiddenaddpicturebutton.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { int tabforpicture = view.gettabofitemselected(view.itemselectednumber); String foldername = view.getGenericDisplayText(view.itemselectednumber); // System.out.println("this is the name of the new file to be saved."+imageF.getAbsolutePath()); //takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, // Uri.fromFile(imageF)); Intent takePictureIntent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); u.log("starting activity camera"); PICTURESTARTTIME = System.currentTimeMillis(); TABFORGETPICTURE = tabforpicture; FOLDERNAMEFORGETPICTURE = foldername; startActivityForResult(takePictureIntent, FLOORPLANGETPICFROMCAMERA); } }); hiddeneditpicturebutton = new Button(this); hiddeneditpicturebutton.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { Intent intent = u.openpicture(editpicturelocation); System.out.println("this is the name of the file to be edited." + editpicturelocation); startActivityForResult(intent, EDITPICTUREACTIVITY); } }); floorplantitle.setTextColor(view.presentableblue); floorplantitle.setText(Tabs1.floorplanname); floorplanprevious.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_FLOORPLANPREVIOUS; view.invalidate(); } }); floorplannext.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_FLOORPLANNEXT; view.invalidate(); } }); fullscreen.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_FULLSCREEN; toptoolbar.setVisibility(View.INVISIBLE); righttoolbar.setVisibility(View.INVISIBLE); unfullscreen.setVisibility(View.VISIBLE); } }); unfullscreen.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_UNFULLSCREEN; toptoolbar.setVisibility(View.VISIBLE); righttoolbar.setVisibility(View.VISIBLE); unfullscreen.setVisibility(View.INVISIBLE); } }); showlayers.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { Log.d("show layers selected", "true"); if (!(ACTION == ACTION_SHOWLAYERS)) { ACTION = ACTION_SHOWLAYERS; } else { ACTION = ACTION_DONOTHING; } view.invalidate(); } }); metersperpixelbutton.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { //show dialog asking if you want scale from google maps, or from 2 points on map getscaledialog(); //startActivity(u.intent("Getscalefromgooglemaps")); } }); resizeicons.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { view.resizeboolean = true; ACTION = ACTION_RESIZEICONS; toptoolbar.setVisibility(View.INVISIBLE); righttoolbar.setVisibility(View.INVISIBLE); resizeiconsseekbar.setVisibility(View.VISIBLE); resizeiconscancel.setVisibility(View.VISIBLE); resizeiconsfinished.setVisibility(View.VISIBLE); } }); resizeiconscancel.setOnClickListener(new Button.OnClickListener() { public void onClick(View arg0) { //restore size //resizeiconsseekbar.setProgress((int)((float)resizeiconsseekbar.getMax()/(float)4)); view.invalidate(); ACTION = ACTION_DONOTHING; toptoolbar.setVisibility(View.VISIBLE); righttoolbar.setVisibility(View.VISIBLE); resizeiconsseekbar.setVisibility(View.INVISIBLE); resizeiconscancel.setVisibility(View.INVISIBLE); resizeiconsfinished.setVisibility(View.INVISIBLE); } }); resizeiconsfinished.setOnClickListener(new Button.OnClickListener() { public void onClick(View arg0) { if (ACTION == ACTION_RESIZEICON) { writeonedbitem(view.itemselectednumber); } else { rewritewholedb(); } ACTION = ACTION_DONOTHING; toptoolbar.setVisibility(View.VISIBLE); righttoolbar.setVisibility(View.VISIBLE); resizeiconsseekbar.setVisibility(View.INVISIBLE); resizeiconscancel.setVisibility(View.INVISIBLE); resizeiconsfinished.setVisibility(View.INVISIBLE); } }); preferences.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { ACTION = ACTION_PREFERENCES; //preferences(); startActivityForResult(u.intent("FloorPlanPrefs"), PREFS); } }); BMS.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_BMS; Log.d("mode", u.s(MODE)); } }); ELC.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_ELC; Log.d("mode", u.s(MODE)); } }); Gateway.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_GATEWAY; Log.d("mode", u.s(MODE)); } }); SAM.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); //MODE = MODE_SAM; //Log.d("mode", u.s(MODE)); int itemnum = -1; for (int k = 0; k < view.i; k++) { if (view.ITEMtype[k] == view.TYPE_ELC) { itemnum = k; } } if (!(itemnum == -1)) { view.addsamsdialog("ELC# " + u.s(view.ELCdisplaynumber[itemnum]) + ": SAMs Menu", itemnum); } } }); tempsensor.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_TEMPSENSOR; Log.d("mode", u.s(MODE)); } }); ethernetport.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_ETHERNETPORT; Log.d("mode", u.s(MODE)); } }); distributionboard.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_DISTRIBUTIONBOARD; Log.d("mode", u.s(MODE)); } }); samarray.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_SAMARRAY; Log.d("mode", u.s(MODE)); } }); datahub.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_DATAHUB; Log.d("mode", u.s(MODE)); } }); AddText.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_ADDTEXT; getaddtextdialog("ADD TEXT", view.i, FloorPlanActivity.this).show(); Log.d("mode", u.s(MODE)); } }); legend.setOnClickListener(new ImageView.OnClickListener() { public void onClick(View arg0) { highlightbutton(arg0); MODE = MODE_LEGEND; Log.d("mode", u.s(MODE)); } }); view = new FloorPlanView(this); view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); rl.addView(view); rl.addView(toolbar); setContentView(rl); //readexcel(); AUTORENUMBERTEMPS = !Tabs1.db.tableexists(dbtablename); WriteBoolean(this, "autorenumbertemps", AUTORENUMBERTEMPS); System.out.println("auto number=" + AUTORENUMBERTEMPS); readdb(); grabsamcounts(); grabelccount(); System.out.println("item" + " " + "type" + " " + "tempcount"); for (int h = 0; h < view.i; h++) { System.out.println(h + " " + view.ITEMtype[h] + " " + view.ITEMtempsensorcount[h]); } } catch (Throwable e) { e.printStackTrace(); finish(); } }
From source file:com.i2max.i2smartwork.common.conference.ConferenceDetailViewFragment.java
public void setFilesLayout(String title, LinearLayout targetLayout, Object object) { final List<LinkedTreeMap<String, String>> filesList = (List<LinkedTreeMap<String, String>>) object; if (filesList == null || (filesList != null && filesList.size() <= 0)) { targetLayout.setVisibility(View.GONE); } else {//from w ww . ja v a2s . c o m Log.e(TAG, "fileList size =" + filesList.size()); targetLayout.setVisibility(View.VISIBLE); targetLayout.removeAllViews(); //addTitleView LinearLayout.LayoutParams tvParam = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); tvParam.setMargins(0, DisplayUtil.dip2px(getActivity(), 12), 0, DisplayUtil.dip2px(getActivity(), 10)); TextView tvTitle = new TextView(getActivity()); tvTitle.setLayoutParams(tvParam); if (Build.VERSION.SDK_INT < 23) { tvTitle.setTextAppearance(getActivity(), android.R.style.TextAppearance_Material_Medium); } else { tvTitle.setTextAppearance(android.R.style.TextAppearance_Material_Medium); } tvTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15); tvTitle.setTextColor(getResources().getColor(R.color.text_color_black)); tvTitle.setText(title); targetLayout.addView(tvTitle); //addFilesView for (int i = 0; i < filesList.size(); i++) { final LinkedTreeMap<String, String> fileMap = filesList.get(i); LayoutInflater inflater = (LayoutInflater) getActivity() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View fileView = inflater.inflate(R.layout.view_item_file, null); ImageView ivIcFileExt = (ImageView) fileView.findViewById(R.id.iv_ic_file_ext); TextView tvFileNm = (TextView) fileView.findViewById(R.id.tv_file_nm); //?? ? ivIcFileExt.setImageResource(R.drawable.ic_file_doc); String fileNm = FormatUtil.getStringValidate(fileMap.get("file_nm")); tvFileNm.setText(fileNm); FileUtil.setFileExtIcon(ivIcFileExt, fileNm); final String fileExt = FileUtil.getFileExtsion(fileNm); final String downloadURL = I2UrlHelper.File .getDownloadFile(FormatUtil.getStringValidate(fileMap.get("file_id"))); fileView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { Intent intent = null; if ("Y".equals(FormatUtil.getStringValidate(fileMap.get("conv_yn")))) { //i2viewer ? ( conv_yn='Y') intent = IntentUtil.getI2ViewerIntent( FormatUtil.getStringValidate(fileMap.get("file_id")), FormatUtil.getStringValidate(fileMap.get("file_nm"))); getActivity().startActivity(intent); } else if ("mp4".equalsIgnoreCase(fileExt) || "fla".equalsIgnoreCase(fileExt) || "wmv".equalsIgnoreCase(fileExt) || "avi".equalsIgnoreCase(fileExt)) { //video intent = IntentUtil.getVideoPlayIntent(downloadURL); } else { //? ?? intent = new Intent(Intent.ACTION_VIEW, Uri.parse(downloadURL)); Bundle bundle = new Bundle(); bundle.putString("Authorization", I2UrlHelper.getTokenAuthorization()); intent.putExtra(Browser.EXTRA_HEADERS, bundle); Log.d(TAG, "intent:" + intent.toString()); } getActivity().startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(getActivity(), "I2Viewer? ? .\n ? ?.", Toast.LENGTH_LONG).show(); //TODO ? ? ? URL } } }); targetLayout.addView(fileView); } } }
From source file:com.github.omadahealth.slidepager.lib.views.ProgressView.java
/** * Bind the views and load attributes/* w ww .j a v a2 s . co m*/ * * @param context */ private void bindViews(Context context) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); mBinding = DataBindingUtil.inflate(inflater, R.layout.view_progress, this, true); mDefaultProgressTypeface = mBinding.progressText.getCurrentTypeface(); mBinding.circularBar.setStartLineEnabled(false); mBinding.progressText.setTypeface(TypefaceTextView.getFont(context, TypefaceType.getTypeface(TypefaceType.getDefaultTypeface(getContext())).getAssetFileName())); loadStyledAttributes(mAttributes, mProgressAttr); }