本文整理汇总了Java中android.support.wearable.view.DotsPageIndicator.setPager方法的典型用法代码示例。如果您正苦于以下问题:Java DotsPageIndicator.setPager方法的具体用法?Java DotsPageIndicator.setPager怎么用?Java DotsPageIndicator.setPager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.wearable.view.DotsPageIndicator
的用法示例。
在下文中一共展示了DotsPageIndicator.setPager方法的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: 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);
}
示例5: 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);
}
示例6: 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);
}
示例7: 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);
}
示例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);
hasPercentage = sp.getBoolean("wizardpercentage", false);
}
示例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);
}
示例10: 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()));
}
示例11: 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));
}
示例12: 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) {
}
});
}
示例13: 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);
}
示例14: 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()));
}
示例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);
mImageView = (ImageView) findViewById(R.id.imageWithTransparency);
DaVinci.with(this).load("http://www.seomofo.com/downloads/new-google-logo-knockoff.png").into(mImageView);
}