Here are the examples of the java api class android.support.wearable.view.DotsPageIndicator taken from open source projects.
1. MainActivity#onCreate()
Project: runnerup
File: MainActivity.java
File: MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (GridViewPager) findViewById(R.id.pager); FragmentGridPagerAdapter pageAdapter = new PagerAdapter(getFragmentManager()); pager.setAdapter(pageAdapter); LinearLayout verticalDotsPageIndicator = (LinearLayout) findViewById(R.id.vert_page_indicator); MyDotsPageIndicator dot2 = new MyDotsPageIndicator(verticalDotsPageIndicator); DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); dotsPageIndicator.setDotFadeWhenIdle(false); dotsPageIndicator.setDotFadeOutDelay(1000 * 3600 * 24); dotsPageIndicator.setOnPageChangeListener(dot2); dotsPageIndicator.setOnAdapterChangeListener(dot2); dot2.setPager(pager); }
2. UARTCommandsActivity#onCreate()
Project: Android-nRF-Toolbox
File: UARTCommandsActivity.java
File: UARTCommandsActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_grid_pager); final Intent intent = getIntent(); final UartConfiguration configuration = intent.getParcelableExtra(CONFIGURATION); mConfigurationId = configuration.getId(); // Check if the WEAR device is connected to the UART device itself, or by the phone. // Binding will fail if we are using phone as proxy as the service has not been started before. final Intent service = new Intent(this, BleProfileService.class); bindService(service, mServiceConnection, 0); // Set up tht grid final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setAdapter(mAdapter = new UARTCommandsAdapter(configuration, this)); final DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator); dotsPageIndicator.setPager(pager); // Configure Google API client mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(Wearable.API).addConnectionCallbacks(this).addOnConnectionFailedListener(this).build(); // Register the broadcast receiver that will listen for events from the device final IntentFilter filter = new IntentFilter(); filter.addAction(BleProfileService.BROADCAST_CONNECTION_STATE); filter.addAction(BleProfileService.BROADCAST_ERROR); filter.addAction(UARTProfile.BROADCAST_DATA_RECEIVED); LocalBroadcastManager.getInstance(this).registerReceiver(mServiceBroadcastReceiver, filter); }