本文整理汇总了Java中android.support.wearable.view.DotsPageIndicator类的典型用法代码示例。如果您正苦于以下问题:Java DotsPageIndicator类的具体用法?Java DotsPageIndicator怎么用?Java DotsPageIndicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DotsPageIndicator类属于android.support.wearable.view包,在下文中一共展示了DotsPageIndicator类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:21,代码来源:CPPActivity.java
示例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
}
开发者ID:florent37,项目名称:TutosAndroidFrance,代码行数:19,代码来源:MainActivity.java
示例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
}
开发者ID:florent37,项目名称:MeetupWear_EmmetDavinci,代码行数:18,代码来源:MainActivity.java
示例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);
}
开发者ID:jbarr21,项目名称:gopro-remote,代码行数:21,代码来源:PagerActivity.java
示例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);
}
开发者ID:googlesamples,项目名称:android-DataLayer,代码行数:17,代码来源:MainActivity.java
示例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);
}
开发者ID:SimoneCasagranda,项目名称:android-wear-tutorial,代码行数:26,代码来源:BooksActivity.java
示例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);
}
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:36,代码来源:UARTCommandsActivity.java
示例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);
}
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:16,代码来源:TempTargetActivity.java
示例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);
}
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:14,代码来源:WizardActivity.java
示例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);
}
开发者ID:MilosKozak,项目名称:AndroidAPS,代码行数:12,代码来源:BolusActivity.java
示例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()));
}
开发者ID:florent37,项目名称:TutosAndroidFrance,代码行数:13,代码来源:MainActivity.java
示例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));
}
开发者ID:liangchenhe55,项目名称:konkeWatch,代码行数:13,代码来源:AtyDetail.java
示例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) {
}
});
}
开发者ID:florent37,项目名称:WearMenu,代码行数:35,代码来源:MainActivity.java
示例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);
}
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:36,代码来源:UARTCommandsActivity.java
示例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()));
}
开发者ID:florent37,项目名称:WearViewStub,代码行数:13,代码来源:MainActivity.java
示例16: 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);
}
开发者ID:florent37,项目名称:DaVinci,代码行数:14,代码来源:MainActivity.java
示例17: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
final Resources res = getResources();
final GridViewPager pager = (GridViewPager) findViewById(R.id.pager);
pager.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
// Adjust page margins:
// A little extra horizontal spacing between pages looks a bit
// less crowded on a round display.
final boolean round = insets.isRound();
int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin);
int colMargin = res.getDimensionPixelOffset(round ? R.dimen.page_column_margin_round : R.dimen.page_column_margin);
pager.setPageMargins(rowMargin, colMargin);
// GridViewPager relies on insets to properly handle
// layout for round displays. They must be explicitly
// applied since this listener has taken them over.
pager.onApplyWindowInsets(insets);
return insets;
}
});
pager.setAdapter(new RFHomeGridPagerAdapter(this, getFragmentManager()));
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
}
开发者ID:ffedoroff,项目名称:rfhome-android,代码行数:29,代码来源:MainActivity.java
示例18: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_comments);
final String stringComments = getIntent().getStringExtra(Constants.KEY_REDDIT_POSTS);
final ArrayList<Comment> comments = mGson.fromJson(stringComments,
new TypeToken<List<Comment>>() {
}.getType());
if (comments == null || comments.isEmpty()) {
Toast.makeText(this, R.string.thread_has_no_comments_yet, Toast.LENGTH_SHORT).show();
finish();
} else {
mGridViewPager = (GridViewPager) findViewById(R.id.pager);
mGridViewPager.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
// A little extra horizontal spacing between pages looks a bit less crowded on a round display
int rowMargin = getResources().getDimensionPixelOffset(R.dimen.page_row_margin);
int colMargin = getResources().getDimensionPixelOffset(insets.isRound() ? R.dimen.page_column_margin_round : R.dimen.page_column_margin);
mGridViewPager.setPageMargins(rowMargin, colMargin);
// GridViewPager relies on insets to properly handle layout for round displays
// They must be explicitly applied since this listener has taken them over
mGridViewPager.onApplyWindowInsets(insets);
return insets;
}
});
mGridViewPager.setAdapter(new CommentsGridPagerAdapter(CommentsActivity.this,
getFragmentManager(),
comments));
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(mGridViewPager);
}
}
开发者ID:emmaguy,项目名称:wear-notify-for-reddit,代码行数:36,代码来源:CommentsActivity.java
示例19: onCreate
import android.support.wearable.view.DotsPageIndicator; //导入依赖的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.DotsPageIndicator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论