List of usage examples for android.view View setFocusableInTouchMode
public void setFocusableInTouchMode(boolean focusableInTouchMode)
From source file:com.androzic.MapList.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.list_with_empty_view_and_progressbar, container, false); progressBar = (ProgressBar) view.findViewById(R.id.progressbar); view.setFocusableInTouchMode(true); view.requestFocus();/* ww w .j a v a 2s .c o m*/ view.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { if (currentTree != mapsTree) { currentTree = currentTree.parent; adapter.notifyDataSetChanged(); return true; } } return false; } }); return view; }
From source file:edu.cmu.android.restaurant.MapFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Intent intent = new Intent(getActivity(), MyMapActivity.class); final Window w = getLocalActivityManager().startActivity("tag", intent); final View wd = w != null ? w.getDecorView() : null; if (wd != null) { ViewParent parent = wd.getParent(); if (parent != null) { ViewGroup v = (ViewGroup) parent; v.removeView(wd);/* w ww. j av a 2s . com*/ } wd.setVisibility(View.VISIBLE); wd.setFocusableInTouchMode(true); if (wd instanceof ViewGroup) { ((ViewGroup) wd).setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); } } ((MyMapActivity) mLocalActivityManager.getActivity("tag")).registerListener(mListener); setHasOptionsMenu(true); // add menu in fragment sensorManager = (SensorManager) getActivity().getSystemService(Activity.SENSOR_SERVICE); vibrator = (Vibrator) getActivity().getSystemService(Service.VIBRATOR_SERVICE); dealList = mListener.onDealsRequested(); return wd; }
From source file:net.niyonkuru.koodroid.ui.PageFragment.java
@Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.plan_title: case R.id.bill_title: case R.id.tab_title: case R.id.billing_cycle_title: case R.id.airtime_title: case R.id.data_title: final View options = ((FrameLayout) v).getChildAt(2); AnimUtils.fade(options);/* ww w . j a v a2 s .co m*/ v.setFocusableInTouchMode(true); v.requestFocusFromTouch(); v.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { AnimUtils.fadeOut(options); v.setFocusableInTouchMode(false); } updateTimestamps(); } }); } /* give the user feedback as to how fresh the data is */ updateTimestamps(); }
From source file:org.puder.trs80.EmulatorActivity.java
private void initRootView() { setContentView(R.layout.emulator);/*from w w w . j a va 2 s . c o m*/ View top = this.findViewById(R.id.emulator); top.setFocusable(true); top.setFocusableInTouchMode(true); top.requestFocus(); logView = (TextView) findViewById(R.id.log); if (CastMessageSender.get().isReadyToSend()) { ImageView castIcon = (ImageView) findViewById(R.id.cast_icon); castIcon.setVisibility(View.VISIBLE); } else { Screen screen = (Screen) findViewById(R.id.screen); screen.setVisibility(View.VISIBLE); } initKeyboardView(); }
From source file:cn.jasonlv.siri.activity.MainActivity.java
@Override public void onResults(Bundle results) { long end2finish = System.currentTimeMillis() - speechEndTime; status = STATUS_None;// ww w . ja v a2s. c o m ArrayList<String> nbest = results.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION); print("?" + Arrays.toString(nbest.toArray(new String[nbest.size()]))); String json_res = results.getString("origin_result"); Log.e(LOG_TAG, json_res); View inputPanel = getLayoutInflater().inflate(R.layout.input_layout, null); TextView inputTextView = (TextView) inputPanel.findViewById(R.id.input_text); inputTextView.setText(nbest.get(0)); inputPanel.setFocusable(true); inputPanel.setFocusableInTouchMode(true); container.addView(inputPanel); //View fragmentContainer = getLayoutInflater().inflate(R.layout.fragment_container_layout, null); //container.addView(fragmentContainer); FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(fragmentConatainerId); fragmentContainer.setFocusable(true); fragmentContainer.setFocusableInTouchMode(true); container.addView(fragmentContainer); onProcessingResult(nbest, json_res, fragmentConatainerId); fragmentConatainerId++; scrollView.post(new Runnable() { @Override public void run() { scrollView.fullScroll(View.FOCUS_DOWN); } }); }
From source file:com.libreteam.driver.Driver_RideOffer.java
@SuppressLint("InflateParams") @SuppressWarnings({ "unchecked", "rawtypes" }) @Override//from w w w. j a v a2 s. com public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view = inflater.inflate(R.layout.driver_rideoffer, null); context = view.getContext(); ride_id = getArguments().getStringArray("rideid")[0]; customer_id = getArguments().getStringArray("rideid")[1]; address = getArguments().getStringArray("rideid")[2]; latlng = getArguments().getStringArray("rideid")[3]; ArrayList aList = new ArrayList(Arrays.asList(latlng.split(","))); driverLatLng = new LatLng(Driver_Status.getLatitude(), Driver_Status.getLongitude()); customerLatLng = new LatLng(Double.parseDouble(aList.get(0).toString()), Double.parseDouble(aList.get(1).toString())); if (savedInstanceState == null) initComponents(view); view.setFocusableInTouchMode(true); view.requestFocus(); view.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (((Driver_Fragment_Activity) getActivity()).isMenu) { ((Driver_Fragment_Activity) getActivity()).didHideMenu(); return true; } didSendMessage(); ((Driver_Fragment_Activity) getActivity()).didFinish(); return false; } else { return false; } } }); return view; }
From source file:com.alivenet.dmvtaxi.fragment.Fragment_ride_list.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_ride_list, container, false); mPref = getActivity().getSharedPreferences(MYPREF, Context.MODE_PRIVATE); mUserId = mPref.getString("userId", null); progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("Please wait..."); progressDialog.setCancelable(false); recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); recyclerView.setHasFixedSize(true);//from w w w. ja v a 2s. c om LinearLayoutManager llm = new LinearLayoutManager(getActivity()); llm.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.addItemDecoration(new SpacesItemDecoration(VERTICAL_ITEM_SPACE)); recyclerView.setLayoutManager(llm); recyclerView.setItemAnimator(new DefaultItemAnimator()); mnorides = (TextView) view.findViewById(R.id.tv_norides); RequestParams params = new RequestParams(); params.put("userId", mUserId); rideListWs(params); view.setFocusableInTouchMode(true); view.requestFocus(); view.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { // handle back button's click listener if (keyCode == KeyEvent.KEYCODE_BACK) { Fragment homeFragment = new FragmentMainScreen(); FragmentManager frgManager; frgManager = getFragmentManager(); frgManager.beginTransaction().replace(R.id.fragment_switch, homeFragment).commit(); return true; } return true; } return false; } }); return view; }
From source file:com.kccomy.orgar.ui.note.NoteFragment.java
private void initPopupWindow() { View popupWindowView = getActivity().getLayoutInflater().inflate(R.layout.popup_window_share, null); //??/*from w ww .jav a2s .c o m*/ Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.addCategory(Intent.CATEGORY_DEFAULT); shareIntent.setType("text/plain"); PackageManager packageManager = getContext().getPackageManager(); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(shareIntent, PackageManager.GET_RESOLVED_FILTER); // RecyclerAdapter RecyclerView recyclerView = (RecyclerView) popupWindowView.findViewById(R.id.popup_widow_share_recycler); ShareAdapter shareAdapter = new ShareAdapter(packageManager); shareAdapter.setData(resolveInfos); shareAdapter.setAppIconClickListener(shareListener); recyclerView.setAdapter(shareAdapter); recyclerView .setLayoutManager(new GridLayoutManager(getContext(), 2, LinearLayoutManager.HORIZONTAL, false)); // ?PopupWindow popupWindowView.setFocusable(true); popupWindowView.setFocusableInTouchMode(true); PopupWindow popupWindow = new PopupWindow(popupWindowView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); popupWindow.setFocusable(true); popupWindow.setOutsideTouchable(true); popupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000)); popupWindow.setAnimationStyle(R.style.anim_menu_bottombar); setWindowAlpha(0.5f); popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { setWindowAlpha(1f); } }); popupWindow.showAtLocation(getActivity().getLayoutInflater().inflate(R.layout.fragment_note, null), Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); }
From source file:com.alivenet.dmvtaxi.fragment.FragmentArriveDriver.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (view != null) { ViewGroup parent = (ViewGroup) view.getParent(); if (parent != null) parent.removeView(view);//from w w w. ja va2 s.c om } try { view = inflater.inflate(R.layout.fragment_time_estemet, container, false); } catch (InflateException e) { } if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } mPref = getActivity().getSharedPreferences(MYPREF, Context.MODE_PRIVATE); mUserId = mPref.getString("userId", null); gps = new GPSTracker(getActivity()); MyApplication.arrivedrivermarker = true; progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("Please wait..."); progressDialog.setCancelable(false); mlinerlayoutbottom = (LinearLayout) view.findViewById(R.id.ll_bottom); mphone = (ImageView) view.findViewById(R.id.iv_phone); mphonenumber = (TextView) view.findViewById(R.id.tv_phonenumber); marrivaltime = (TextView) view.findViewById(R.id.tv_textarrival); mname = (TextView) view.findViewById(R.id.tv_name); mlicence = (TextView) view.findViewById(R.id.tv_licence); mtaximodel = (TextView) view.findViewById(R.id.tv_model); muserImage = (ImageView) view.findViewById(R.id.imageView_close); getLatLong(); btnSplite = (Button) view.findViewById(R.id.btn_splite_rides); btnSplite.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(getActivity(), SplitAddFrnd.class); startActivity(in); } }); mphone.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String uri = "tel:" + mphonenumber.getText().toString().trim(); Intent intent = new Intent(Intent.ACTION_CALL); intent.setData(Uri.parse(uri)); startActivity(intent); } }); System.out.println("userId>>>>>>>>>>>>>>>>>>>>>" + mUserId); mname.setText(MyApplication.driverName); mlicence.setText(MyApplication.licenseId); mtaximodel.setText(MyApplication.vehicle); mphonenumber.setText(MyApplication.mobileNO); Picasso.with(getActivity()).load(MyApplication.imageUrl).error(R.mipmap.avtar).placeholder(R.mipmap.avtar) .into(muserImage); System.out.println("driverImageurl" + "chceck=" + MyApplication.imageUrl); mphonenumber.setText("Call To" + " " + MyApplication.driverName); final SinchClient sinchClient = Sinch.getSinchClientBuilder().context(getActivity()).userId(mUserId) .applicationKey("3b013f09-db1f-422e-ac7b-c6498e119612") .applicationSecret("LMhelEFYtUqms55VX1C7MQ==").environmentHost("sandbox.sinch.com").build(); sinchClient.setSupportCalling(true); sinchClient.start(); mphone.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (call == null) { if (MyApplication.mobileNO != null && !MyApplication.mobileNO.equals("")) { call = sinchClient.getCallClient().callPhoneNumber("+" + MyApplication.mobileNO); System.out.println("mobile_number" + MyApplication.mobileNO); //call = sinchClient.getCallClient().callPhoneNumber("+918510834641"); try { call.addCallListener(new SinchCallListener()); } catch (Exception e) { e.printStackTrace(); } mphonenumber.setText("Hang Up"); } } else { call.hangup(); } } }); view.setFocusableInTouchMode(true); view.requestFocus(); view.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { // handle back button's click listener if (keyCode == KeyEvent.KEYCODE_BACK) { Fragment homeFragment = new FragmentMainScreen(); FragmentManager frgManager; frgManager = getFragmentManager(); frgManager.beginTransaction().replace(R.id.fragment_switch, homeFragment).commit(); return true; } return true; } return false; } }); return view; }
From source file:com.Bhailal_Chauhan.retailapp.view.fragment.ContactUsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.frag_about, container, false); getActivity().setTitle("Contact Us"); mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar); if (mToolbar != null) { ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar); }/*from w w w. jav a2s .co m*/ if (mToolbar != null) { ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); mToolbar.setNavigationIcon(R.drawable.ic_drawer); } mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START); } }); mToolbar.setTitleTextColor(Color.WHITE); rootView.findViewById(R.id.locations).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { } }); rootView.findViewById(R.id.contact_num).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent callIntent = new Intent(Intent.ACTION_DIAL); callIntent.setData(Uri.parse("tel:" + "8347337366")); startActivity(callIntent); } }); rootView.setFocusableInTouchMode(true); rootView.requestFocus(); rootView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT, ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP); } return true; } }); rootView.findViewById(R.id.site_dev).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://bhailalchauhan.com/")); startActivity(browserIntent); } }); rootView.findViewById(R.id.email).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "hibhailal458@gmail.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here"); emailIntent.setType("message/rfc822"); try { startActivity(Intent.createChooser(emailIntent, "Send email using...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show(); } } }); return rootView; }