本文整理汇总了Java中android.support.wearable.view.DotsPageIndicator类的典型用法代码示例。如果您正苦于以下问题:Java DotsPageIndicator类的具体用法?Java DotsPageIndicator怎么用?Java DotsPageIndicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DotsPageIndicator类属于android.support.wearable.view包,在下文中一共展示了DotsPageIndicator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle extras = getIntent().getExtras();
percentage = extras.getInt("percentage", -1);
timeshift = extras.getInt("timeshift", -1);
if (percentage ==-1 || timeshift ==-1){
finish(); return;
}
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = (GridViewPager) findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
}
示例2: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pager = (GridViewPager) findViewById(R.id.pager);
dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
//initialise Emmet
emmet = new Emmet();
emmet.onCreate(this);
emmet.registerReceiver(WearProtocol.class, this);
SmartphoneProtocol smartphoneProtocol = emmet.createSender(SmartphoneProtocol.class);
smartphoneProtocol.hello(); //envoie le message hello smartphone
}
示例3: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initialise Emmet
Emmet.onCreate(this);
pager = (GridViewPager) findViewById(R.id.pager);
dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
Emmet.registerReceiver(WearProtocol.class, this);
SmartphoneProtocol smartphoneProtocol = Emmet.createSender(SmartphoneProtocol.class);
smartphoneProtocol.pleaseSendMeVersions(); //envoie le message pleaseSendMeVersions smartphone
}
示例4: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pager);
setAmbientEnabled();
final Resources res = getResources();
final GridViewPager pager = ButterKnife.findById(this, R.id.pager);
pager.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin);
int colMargin = res.getDimensionPixelOffset(insets.isRound() ? R.dimen.page_column_margin_round : R.dimen.page_column_margin);
pager.setPageMargins(rowMargin, colMargin);
return insets;
}
});
adapter = new GridPagerAdapter(getFragmentManager());
pager.setAdapter(adapter);
((DotsPageIndicator) ButterKnife.findById(this, R.id.indicator)).setPager(pager);
}
示例5: setupViews
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
private void setupViews() {
mPager = (GridViewPager) findViewById(R.id.pager);
mPager.setOffscreenPageCount(2);
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setDotSpacing((int) getResources().getDimension(R.dimen.dots_spacing));
dotsPageIndicator.setPager(mPager);
mDataFragment = new DataFragment();
mAssetFragment = new AssetFragment();
DiscoveryFragment discoveryFragment = new DiscoveryFragment();
List<Fragment> pages = new ArrayList<>();
pages.add(mDataFragment);
pages.add(mAssetFragment);
pages.add(discoveryFragment);
final MyPagerAdapter adapter = new MyPagerAdapter(getFragmentManager(), pages);
mPager.setAdapter(adapter);
}
示例6: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_books);
// Getting UI references
mPageIndicator = (DotsPageIndicator) findViewById(R.id.pager_indicator);
mViewPager = (GridViewPager) findViewById(R.id.pager);
// Drawable used to make the UI more captivating
mCrossfadeDrawable = new CrossfadeDrawable();
mCrossfadeDrawable.setFading(getResources().getDrawable(R.drawable.fading_background));
findViewById(android.R.id.content).setBackground(mCrossfadeDrawable);
// Creating and Setting the Pager adapter
mAdapter = new BooksGridPagerAdapter(this);
mViewPager.setAdapter(mAdapter);
// Connecting the GridViewPager to the indicator
mPageIndicator.setPager(mViewPager);
// Adding the page change listener
mViewPager.setOnPageChangeListener(this);
// Creating the GoogleApiClient for the Wearable api (if available)
if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) {
mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this).addApi(Wearable.API).build();
}
// Initializing the loader
getLoaderManager().initLoader(LOADER_ID_SUGGESTIONS, null, this);
}
示例7: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@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);
}
示例8: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = (GridViewPager) findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
isMGDL = sp.getBoolean("units_mgdl", true);
isSingleTarget = sp.getBoolean("singletarget", true);
}
示例9: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = (GridViewPager) findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
hasPercentage = sp.getBoolean("wizardpercentage", false);
}
示例10: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = (GridViewPager) findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
}
示例11: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pager = (GridViewPager) findViewById(R.id.pager);
dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
//elementList = creerListElements();
//pager.setAdapter(new ElementGridPagerAdapter(elementList,getFragmentManager()));
}
示例12: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.aty_detail);
pager = (GridViewPager) findViewById(R.id.pager);
pageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
pageIndicator.setPager(pager);
List<Fragment> fragments = new ArrayList<>();
fragments.add(new FmSwitch());
pager.setAdapter(new MyAdapter(getFragmentManager(), fragments));
}
示例13: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pager = (GridViewPager) findViewById(R.id.pager);
dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
elementList = creerListElements();
pager.setAdapter(new ElementGridPagerAdapter(this,elementList,getFragmentManager()));
final WearMenu wearMenu = (WearMenu) findViewById(R.id.wear_menu);
wearMenu.setMenuElements(
new String[]{
"title 1",
"title 2",
"title 3",
"title 4"
},
new Drawable[]{
getResources().getDrawable(R.drawable.ic_car,null),
getResources().getDrawable(R.drawable.ic_notif,null),
getResources().getDrawable(R.drawable.ic_picture,null),
getResources().getDrawable(R.drawable.ic_speak,null)
}
);
wearMenu.setWearMenuListener(new WearMenu.WearMenuListener() {
@Override
public void onWearMenuListClicked(int position) {
}
});
}
示例14: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@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 = findViewById(R.id.pager);
pager.setAdapter(mAdapter = new UARTCommandsAdapter(configuration, this));
final 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);
}
示例15: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pager = (GridViewPager) findViewById(R.id.pager);
dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
elementList = creerListElements();
pager.setAdapter(new ElementGridPagerAdapter(elementList,getFragmentManager()));
}