android.support.wearable.view.DismissOverlayView Java Examples
The following examples show how to use
android.support.wearable.view.DismissOverlayView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapActivity.java From io2015-codelabs with Apache License 2.0 | 6 votes |
public void onCreate(Bundle savedState) { super.onCreate(savedState); // Set the layout. It only contains a SupportMapFragment and a DismissOverlay. setContentView(R.layout.activity_map); // Obtain the Attraction that we need to display. mAttraction = getIntent().getParcelableExtra(Constants.EXTRA_ATTRACTION); // Obtain the DismissOverlayView and display the intro help text. mDismissOverlay = (DismissOverlayView) findViewById(R.id.map_dismiss_overlay); mDismissOverlay.setIntroText(R.string.exit_intro_text); mDismissOverlay.showIntroIfNecessary(); // Obtain the MapFragment and set the async listener to be notified when the map is ready. MapFragment mapFragment = (MapFragment) getFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); }
Example #2
Source File: MainActivity.java From arcgis-runtime-demos-android with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initGoogleApiClient(); mDismissOverlayView = (DismissOverlayView)findViewById(R.id.dismiss); mGestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() { @Override public void onLongPress(MotionEvent e) { mDismissOverlayView.show(); } // @Override // public boolean onScroll(final MotionEvent e1, final MotionEvent e2, final float distanceX, final float distanceY) { // int pointers = e2.getPointerCount(); // float x = e2.getX(); // float y = e2.getY(); //// sendMessage(String.format("Finger count: %d\nPosX: %f\nPosY: %f", pointers, x, y).getBytes()); // return true; // } }); }
Example #3
Source File: TouchTimeActivity.java From TouchTime with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_touch_time); final DismissOverlayView dov = (DismissOverlayView) findViewById(R.id.dismiss); dov.setIntroText(R.string.long_press_intro); dov.showIntroIfNecessary(); GestureDetector gd = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() { public void onLongPress(MotionEvent ev) { dov.show(); } }); TouchTimeView ttv = (TouchTimeView) findViewById(R.id.touch_time); ttv.setGestureDetector (gd); mVibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); }
Example #4
Source File: OnCustomTouchListener.java From sensordatacollector with GNU General Public License v2.0 | 5 votes |
public OnCustomTouchListener(Context context) { this.context = context; this.dismissOverlay = (DismissOverlayView) ((MainActivity) context).findViewById(R.id.dismiss_overlay); this.dismissOverlay.setIntroText(R.string.welcome_long_press_exit); // this.dismissOverlay.showIntroIfNecessary(); TODO - do I realy need this line? }
Example #5
Source File: Chooser.java From sensordatacollector with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // init super.onCreate(savedInstanceState); setContentView(R.layout.round_chooser); detector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() { public void onLongPress(MotionEvent e) { DismissOverlayView dismissOverlay = (DismissOverlayView) (Chooser.this).findViewById(R.id.dismiss_overlay); dismissOverlay.setIntroText(R.string.welcome_long_press_exit); dismissOverlay.showIntroIfNecessary(); dismissOverlay.show(); } }); // register activity ActivityController.getInstance().add("Chooser", this); // adapter this.adapterPosture = new ItemListViewAdapter(Chooser.this, true); this.adapterPosition = new ItemListViewAdapter(Chooser.this, true); // view TextView tv = (TextView) findViewById(R.id.posture_posture_headline); tv.setText(R.string.posture_headline); WearableListView view = (WearableListView) findViewById(R.id.posture_posture_list); view.setAdapter(this.adapterPosture); view.setClickListener(new PostureClickListener()); // send database request String query = "SELECT name FROM " + SQLTableName.POSTURES; BroadcastService.getInstance().sendMessage("/database/request/posture", query); }
Example #6
Source File: ActivitySelector.java From sensordatacollector with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // init super.onCreate(savedInstanceState); setContentView(R.layout.round_chooser); detector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() { public void onLongPress(MotionEvent e) { DismissOverlayView dismissOverlay = (DismissOverlayView) (ActivitySelector.this).findViewById(R.id.dismiss_overlay); dismissOverlay.setIntroText(R.string.welcome_long_press_exit); dismissOverlay.showIntroIfNecessary(); dismissOverlay.show(); } }); // register activity ActivityController.getInstance().add("ActivitySelector", this); // adapter this.adapterActivity = new ItemListViewAdapter(ActivitySelector.this, false); this.adapterActivity.setSelectedElements(selectedActivites); // view TextView tv = (TextView) findViewById(R.id.posture_posture_headline); tv.setText(R.string.activity_headline); this.mainView = (WearableListView) findViewById(R.id.posture_posture_list); this.mainView.setAdapter(this.adapterActivity); this.mainView.setClickListener(new ActivityClickListener()); // send database request String query = "SELECT t1.name, t2.name FROM " + SQLTableName.ACTIVITIES + " t1 LEFT OUTER JOIN " + SQLTableName.SUBACTIVITIES + " t2 ON t1.id == t2.activityid"; BroadcastService.getInstance().sendMessage("/database/request/activity", query); }
Example #7
Source File: MainActivity.java From AndroidWearable-Samples with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main_activity); mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(R.string.intro_text); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); }
Example #8
Source File: MainActivity.java From android-SkeletonWearableApp with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.main_activity); mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(R.string.intro_text); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); }
Example #9
Source File: AttractionsActivity.java From wear-os-samples with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final FrameLayout topFrameLayout = (FrameLayout) findViewById(R.id.topFrameLayout); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mGridViewPager = (GridViewPager) findViewById(R.id.gridViewPager); mDotsPageIndicator = (DotsPageIndicator) findViewById(R.id.dotsPageIndicator); mAdapter = new AttractionsGridPagerAdapter(this, mAttractions); mAdapter.setOnChromeFadeListener(this); mGridViewPager.setAdapter(mAdapter); mDotsPageIndicator.setPager(mGridViewPager); mDotsPageIndicator.setOnPageChangeListener(mAdapter); topFrameLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Call through to super implementation insets = topFrameLayout.onApplyWindowInsets(insets); boolean round = insets.isRound(); // Store system window insets regardless of screen shape mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); if (round) { // On a round screen calculate the square inset to use. // Alternatively could use BoxInsetLayout, although calculating // the inset ourselves lets us position views outside the center // box. For example, slightly lower on the round screen (by giving // up some horizontal space). mInsets = Utils.calculateBottomInsetsOnRoundDevice( getWindowManager().getDefaultDisplay(), mInsets); // Boost the dots indicator up by the bottom inset FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mDotsPageIndicator.getLayoutParams(); params.bottomMargin = mInsets.bottom; mDotsPageIndicator.setLayoutParams(params); } mAdapter.setInsets(mInsets); return insets; } }); // Set up the DismissOverlayView mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(getString(R.string.exit_intro_text)); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); Uri attractionsUri = getIntent().getParcelableExtra(Constants.EXTRA_ATTRACTIONS_URI); if (attractionsUri != null) { new FetchDataAsyncTask(this).execute(attractionsUri); UtilityService.clearNotification(this); UtilityService.clearRemoteNotifications(this); } else { finish(); } }
Example #10
Source File: AttractionsActivity.java From io2015-codelabs with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final FrameLayout topFrameLayout = (FrameLayout) findViewById(R.id.topFrameLayout); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mGridViewPager = (GridViewPager) findViewById(R.id.gridViewPager); mDotsPageIndicator = (DotsPageIndicator) findViewById(R.id.dotsPageIndicator); mAdapter = new AttractionsGridPagerAdapter(this, mAttractions); mAdapter.setOnChromeFadeListener(this); mGridViewPager.setAdapter(mAdapter); topFrameLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Call through to super implementation insets = topFrameLayout.onApplyWindowInsets(insets); boolean round = insets.isRound(); // Store system window insets regardless of screen shape mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); if (round) { // On a round screen calculate the square inset to use. // Alternatively could use BoxInsetLayout, although calculating // the inset ourselves lets us position views outside the center // box. For example, slightly lower on the round screen (by giving // up some horizontal space). mInsets = Utils.calculateBottomInsetsOnRoundDevice( getWindowManager().getDefaultDisplay(), mInsets); // Boost the dots indicator up by the bottom inset FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mDotsPageIndicator.getLayoutParams(); params.bottomMargin = mInsets.bottom; mDotsPageIndicator.setLayoutParams(params); } mAdapter.setInsets(mInsets); return insets; } }); // Set up the DismissOverlayView mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(getString(R.string.exit_intro_text)); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); Uri attractionsUri = getIntent().getParcelableExtra(Constants.EXTRA_ATTRACTIONS_URI); if (attractionsUri != null) { new FetchDataAsyncTask(this).execute(attractionsUri); UtilityService.clearNotification(this); UtilityService.clearRemoteNotifications(this); } else { finish(); } }
Example #11
Source File: AttractionsActivity.java From io2015-codelabs with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final FrameLayout topFrameLayout = (FrameLayout) findViewById(R.id.topFrameLayout); mProgressBar = (ProgressBar) findViewById(R.id.progressBar); mGridViewPager = (GridViewPager) findViewById(R.id.gridViewPager); mDotsPageIndicator = (DotsPageIndicator) findViewById(R.id.dotsPageIndicator); mAdapter = new AttractionsGridPagerAdapter(this, mAttractions); mAdapter.setOnChromeFadeListener(this); mGridViewPager.setAdapter(mAdapter); topFrameLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Call through to super implementation insets = topFrameLayout.onApplyWindowInsets(insets); boolean round = insets.isRound(); // Store system window insets regardless of screen shape mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); if (round) { // On a round screen calculate the square inset to use. // Alternatively could use BoxInsetLayout, although calculating // the inset ourselves lets us position views outside the center // box. For example, slightly lower on the round screen (by giving // up some horizontal space). mInsets = Utils.calculateBottomInsetsOnRoundDevice( getWindowManager().getDefaultDisplay(), mInsets); // Boost the dots indicator up by the bottom inset FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mDotsPageIndicator.getLayoutParams(); params.bottomMargin = mInsets.bottom; mDotsPageIndicator.setLayoutParams(params); } mAdapter.setInsets(mInsets); return insets; } }); // Set up the DismissOverlayView mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlayView.setIntroText(getString(R.string.exit_intro_text)); mDismissOverlayView.showIntroIfNecessary(); mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); Uri attractionsUri = getIntent().getParcelableExtra(Constants.EXTRA_ATTRACTIONS_URI); if (attractionsUri != null) { new FetchDataAsyncTask(this).execute(attractionsUri); UtilityService.clearNotification(this); UtilityService.clearRemoteNotifications(this); } else { finish(); } }
Example #12
Source File: MainActivity.java From android-samples with Apache License 2.0 | 4 votes |
public void onCreate(Bundle savedState) { super.onCreate(savedState); // Set the layout. It only contains a SupportMapFragment and a DismissOverlay. setContentView(R.layout.activity_main); // Enable ambient support, so the map remains visible in simplified, low-color display // when the user is no longer actively using the app but the app is still visible on the // watch face. setAmbientEnabled(); // Retrieve the containers for the root of the layout and the map. Margins will need to be // set on them to account for the system window insets. final FrameLayout topFrameLayout = (FrameLayout) findViewById(R.id.root_container); final FrameLayout mapFrameLayout = (FrameLayout) findViewById(R.id.map_container); // Set the system view insets on the containers when they become available. topFrameLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Call through to super implementation and apply insets insets = topFrameLayout.onApplyWindowInsets(insets); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mapFrameLayout.getLayoutParams(); // Add Wearable insets to FrameLayout container holding map as margins params.setMargins( insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); mapFrameLayout.setLayoutParams(params); return insets; } }); // Obtain the DismissOverlayView and display the intro help text. mDismissOverlay = (DismissOverlayView) findViewById(R.id.dismiss_overlay); mDismissOverlay.setIntroText(R.string.intro_text); mDismissOverlay.showIntroIfNecessary(); // Obtain the MapFragment and set the async listener to be notified when the map is ready. mMapFragment = (MapFragment) getFragmentManager() .findFragmentById(R.id.map); mMapFragment.getMapAsync(this); }