当前位置: 首页>>代码示例>>Java>>正文


Java DismissOverlayView类代码示例

本文整理汇总了Java中android.support.wearable.view.DismissOverlayView的典型用法代码示例。如果您正苦于以下问题:Java DismissOverlayView类的具体用法?Java DismissOverlayView怎么用?Java DismissOverlayView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DismissOverlayView类属于android.support.wearable.view包,在下文中一共展示了DismissOverlayView类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
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);
}
 
开发者ID:googlesamples,项目名称:io2015-codelabs,代码行数:20,代码来源:MapActivity.java

示例2: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
@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;
//      }
    });
  }
 
开发者ID:Esri,项目名称:arcgis-runtime-demos-android,代码行数:26,代码来源:MainActivity.java

示例3: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
@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);
}
 
开发者ID:google,项目名称:TouchTime,代码行数:22,代码来源:TouchTimeActivity.java

示例4: OnCustomTouchListener

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
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?
}
 
开发者ID:sztyler,项目名称:sensordatacollector,代码行数:9,代码来源:OnCustomTouchListener.java

示例5: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
@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);
}
 
开发者ID:sztyler,项目名称:sensordatacollector,代码行数:37,代码来源:Chooser.java

示例6: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
@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);
}
 
开发者ID:sztyler,项目名称:sensordatacollector,代码行数:37,代码来源:ActivitySelector.java

示例7: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_headlines);

    int notifyId = getIntent().getIntExtra(WearRSSDataListenerService.NOTIFICATION_ID_EXTRA, -1);
    if (notifyId > 0) {
        NotificationManagerCompat.from(this).cancel(notifyId);
    }

    mHeadlinesPager = (GridViewPager)findViewById(R.id.headlines_pager);

    mDismissOverlay = (DismissOverlayView) findViewById(R.id.dismiss_overlay);
    mDismissOverlay.setIntroText(R.string.close_instructions);
    mDismissOverlay.showIntroIfNecessary();

    mGestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
        public void onLongPress(MotionEvent ev) {
            mDismissOverlay.show();
        }
    });

    mHeadlinesPager.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return mGestureDetector.onTouchEvent(event);
        }
    });
}
 
开发者ID:creativedrewy,项目名称:WeaRSS,代码行数:30,代码来源:ViewHeadlinesActivity.java

示例8: setUpLayout

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
private void setUpLayout() {
    SeekArc mSeekArc = (SeekArc) findViewById(R.id.seekarc);
    mSeekArc.setOnSeekArcChangeListener(this);
    mAmountTextView = (TextView) findViewById(R.id.amount);
    mAmountTextView.setOnClickListener(this);
    mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay);
    mGestureDetector = new GestureDetectorCompat(this, new LongPressListener());
}
 
开发者ID:hotchemi,项目名称:wearzaim,代码行数:9,代码来源:MainActivity.java

示例9: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
@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());
}
 
开发者ID:mauimauer,项目名称:AndroidWearable-Samples,代码行数:11,代码来源:MainActivity.java

示例10: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_view_image);

    mPanView = (PanView) findViewById(R.id.view_image_panview);
    mProgressBar = (ProgressBar) findViewById(R.id.view_image_progressbar);

    mDismissOverlay = (DismissOverlayView) findViewById(R.id.view_image_dismiss_overlay);
    mDismissOverlay.setIntroText(R.string.long_press_information);
    mDismissOverlay.showIntroIfNecessary();

    mPanView.setOnTouchListener(new View.OnTouchListener() {
        @Override public boolean onTouch(View v, MotionEvent event) {
            return mDetector.onTouchEvent(event);
        }
    });

    mDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
        @Override public void onLongPress(MotionEvent ev) {
            mDismissOverlay.show();
        }
    });

    mImageName = getIntent().getStringExtra(Constants.KEY_HIGHRES_IMAGE_NAME);

    getLoaderManager().initLoader(0, null, this);
}
 
开发者ID:emmaguy,项目名称:wear-notify-for-reddit,代码行数:29,代码来源:ViewImageActivity.java

示例11: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);

    // Set the layout. It only contains a MapFragment and a DismissOverlay.
    setContentView(R.layout.activity_maps);

    // 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 introductory 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.
    // 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);

    if (!hasGps()) {
        Log.d(TAG, "This hardware doesn't have GPS.");
        // Fall back to functionality that does not use location or
        // warn the user that location function is not available.
    }

    mDataSource = new MemoriesDataSource(this);
    getLoaderManager().initLoader(0,null,this);
}
 
开发者ID:PacktPublishing,项目名称:Android-Wear-Projects,代码行数:54,代码来源:MapsActivity.java

示例12: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);

    // Set the layout. It only contains a MapFragment and a DismissOverlay.
    setContentView(R.layout.activity_maps);

    // 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 introductory 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.
    // Obtain the MapFragment and set the async listener to be notified when the map is ready.
    mMapFragment = (MapFragment) getFragmentManager()
            .findFragmentById(map);
    mMapFragment.getMapAsync(this);

    if (!hasGps()) {
        Log.d(TAG, "This hardware doesn't have GPS.");
        // Fall back to functionality that does not use location or
        // warn the user that location function is not available.
    }

    mDataSource = new MemoriesDataSource(this);
    getLoaderManager().initLoader(0, null, this);
}
 
开发者ID:PacktPublishing,项目名称:Android-Wear-Projects,代码行数:54,代码来源:MapsActivity.java

示例13: onCreate

import android.support.wearable.view.DismissOverlayView; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:googlesamples,项目名称:io2015-codelabs,代码行数:64,代码来源:AttractionsActivity.java


注:本文中的android.support.wearable.view.DismissOverlayView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。