本文整理匯總了Java中android.support.wearable.view.WearableListView.addOnScrollListener方法的典型用法代碼示例。如果您正苦於以下問題:Java WearableListView.addOnScrollListener方法的具體用法?Java WearableListView.addOnScrollListener怎麽用?Java WearableListView.addOnScrollListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.wearable.view.WearableListView
的用法示例。
在下文中一共展示了WearableListView.addOnScrollListener方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_with_header);
// Get the list component from the layout of the activity
final WearableListView listView = (WearableListView) findViewById(R.id.devices_list);
listView.setAdapter(mDeviceAdapter = new DevicesAdapter(listView));
listView.setClickListener(mOnRowClickListener);
listView.addOnScrollListener(mOnScrollListener);
// The header will be moved as the list is scrolled
mHeader = findViewById(R.id.header);
// Register a broadcast receiver that will listen for events from the service.
LocalBroadcastManager.getInstance(this).registerReceiver(mServiceBroadcastReceiver, BleProfileService.makeIntentFilter());
}
示例2: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_with_header);
// Get the list component from the layout of the activity
final WearableListView listView = findViewById(R.id.devices_list);
listView.setAdapter(mDeviceAdapter = new DevicesAdapter(listView));
listView.setClickListener(mOnRowClickListener);
listView.addOnScrollListener(mOnScrollListener);
// The header will be moved as the list is scrolled
mHeader = findViewById(R.id.header);
// Register a broadcast receiver that will listen for events from the service.
LocalBroadcastManager.getInstance(this).registerReceiver(mServiceBroadcastReceiver, BleProfileService.makeIntentFilter());
}
示例3: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.w(TAG, "onCreate");
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
ArrayList<Integer> mIcons = new ArrayList<>();
mIcons.add(R.drawable.ic_red_door);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_action_select_all);
mIcons.add(R.drawable.ic_action_delete);
// This is our list header
mHeader = (TextView) findViewById(R.id.header);
mMeasureClass = new MeasureClass(this) {
@Override
public void updateMeasurementsCount() {}
};
WearableListView wearableListView =
(WearableListView) findViewById(R.id.wearable_List);
WearableAdapter wa = new WearableAdapter(this, mIcons);
wearableListView.setAdapter(wa);
wearableListView.setClickListener(mClickListener);
wearableListView.addOnScrollListener(mOnScrollListener);
}
示例4: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_background_selector);
mImageResourceList = getResources().obtainTypedArray( R.array.background_resource_ids );
mHeader = (TextView) findViewById( R.id.header );
WearableListView listView = (WearableListView) findViewById( R.id.background_picker );
BoxInsetLayout content = (BoxInsetLayout) findViewById( R.id.content );
content.setOnApplyWindowInsetsListener( new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if( !insets.isRound() ) {
v.setPaddingRelative( (getResources().getDimensionPixelSize( R.dimen.content_padding_start ) ),
v.getPaddingTop(),
v.getPaddingEnd(),
v.getPaddingBottom() );
}
return v.onApplyWindowInsets( insets );
}
});
listView.setHasFixedSize( true );
listView.setClickListener( this );
listView.addOnScrollListener( this );
String[] backgrounds = getResources().getStringArray( R.array.background_array );
listView.setAdapter( new BackgroundListAdapter( backgrounds ) );
}
示例5: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_digital_config);
mHeader = (TextView) findViewById(R.id.header);
WearableListView listView = (WearableListView) findViewById(R.id.color_picker);
BoxInsetLayout content = (BoxInsetLayout) findViewById(R.id.content);
// BoxInsetLayout adds padding by default on round devices. Add some on square devices.
content.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if (!insets.isRound()) {
v.setPaddingRelative(
(int) getResources().getDimensionPixelSize(R.dimen.content_padding_start),
v.getPaddingTop(),
v.getPaddingEnd(),
v.getPaddingBottom());
}
return v.onApplyWindowInsets(insets);
}
});
listView.setHasFixedSize(true);
listView.setClickListener(this);
listView.addOnScrollListener(this);
String[] colors = getResources().getStringArray(R.array.gradients_face_array);
listView.setAdapter(new ColorListAdapter(colors));
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle connectionHint) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnected: " + connectionHint);
}
}
@Override
public void onConnectionSuspended(int cause) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionSuspended: " + cause);
}
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionFailed: " + result);
}
}
})
.addApi(Wearable.API)
.build();
}
示例6: onFinishInflate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override protected void onFinishInflate() {
super.onFinishInflate();
heading = (TextView) findViewById(R.id.heading);
list = (WearableListView) findViewById(android.R.id.list);
list.addOnScrollListener(this);
}
示例7: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_background_config);
mHeader = (TextView) findViewById(R.id.header);
WearableListView listView = (WearableListView) findViewById(R.id.color_picker);
BoxInsetLayout content = (BoxInsetLayout) findViewById(R.id.content);
// BoxInsetLayout adds padding by default on round devices. Add some on square devices.
content.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if (!insets.isRound()) {
v.setPaddingRelative(
(int) getResources().getDimensionPixelSize(R.dimen.content_padding_start),
v.getPaddingTop(),
v.getPaddingEnd(),
v.getPaddingBottom());
}
return v.onApplyWindowInsets(insets);
}
});
listView.setHasFixedSize(true);
listView.setClickListener(this);
listView.addOnScrollListener(this);
String[] colors = getResources().getStringArray(R.array.bitmap_face_array);
listView.setAdapter(new ColorListAdapter(colors));
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle connectionHint) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnected: " + connectionHint);
}
}
@Override
public void onConnectionSuspended(int cause) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionSuspended: " + cause);
}
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionFailed: " + result);
}
}
})
.addApi(Wearable.API)
.build();
}
開發者ID:marcouberti,項目名稱:american_sunsets_watch_face,代碼行數:58,代碼來源:SunsetsBackgroundWearableConfigActivity.java
示例8: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_general_config);
colors = new String[]{getResources().getString(R.string.image),getResources().getString(R.string.fluid_motion)};
mHeader = (TextView) findViewById(R.id.header);
listView = (WearableListView) findViewById(R.id.color_picker);
BoxInsetLayout content = (BoxInsetLayout) findViewById(R.id.content);
// BoxInsetLayout adds padding by default on round devices. Add some on square devices.
content.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if (!insets.isRound()) {
v.setPaddingRelative(
(int) getResources().getDimensionPixelSize(R.dimen.content_padding_start),
v.getPaddingTop(),
v.getPaddingEnd(),
v.getPaddingBottom());
}
return v.onApplyWindowInsets(insets);
}
});
listView.setHasFixedSize(true);
listView.setClickListener(this);
listView.addOnScrollListener(this);
listView.setAdapter(new ColorListAdapter(colors));
mPeerId = getIntent().getStringExtra(WatchFaceCompanion.EXTRA_PEER_ID);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle connectionHint) {
Log.d(TAG, "onConnected: " + connectionHint);
//Uri.Builder builder = new Uri.Builder();
//Uri uri = builder.scheme("wear").path(PATH_WITH_FEATURE).build();
//Wearable.DataApi.getDataItem(mGoogleApiClient, uri).setResultCallback(SunsetsGeneralWearableConfigActivity.this);
new Thread() {
@Override
public void run() {
PendingResult<DataItemBuffer> results = Wearable.DataApi.getDataItems(mGoogleApiClient,getUriForDataItem());
results.setResultCallback(new ResultCallback<DataItemBuffer>() {
@Override
public void onResult(DataItemBuffer dataItems) {
if (dataItems.getCount() != 0) {
for(int i=0; i<dataItems.getCount(); i++) {
DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItems.get(i));
DataMap config = dataMapItem.getDataMap();
Log.d(TAG, "startup setup UI...");
updateUiForConfigDataMap(config);
}
}
dataItems.release();
}
});
}
}.start();
Wearable.DataApi.addListener(mGoogleApiClient, SunsetsGeneralWearableConfigActivity.this);
}
@Override
public void onConnectionSuspended(int cause) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionSuspended: " + cause);
}
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionFailed: " + result);
}
}
})
.addApi(Wearable.API)
.build();
}
開發者ID:marcouberti,項目名稱:american_sunsets_watch_face,代碼行數:81,代碼來源:SunsetsGeneralWearableConfigActivity.java
示例9: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_general_config);
colors = new String[]{getResources().getString(R.string.sfondo),getResources().getString(R.string.fluid_motion)};
mHeader = (TextView) findViewById(R.id.header);
listView = (WearableListView) findViewById(R.id.color_picker);
BoxInsetLayout content = (BoxInsetLayout) findViewById(R.id.content);
// BoxInsetLayout adds padding by default on round devices. Add some on square devices.
content.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if (!insets.isRound()) {
v.setPaddingRelative(
(int) getResources().getDimensionPixelSize(R.dimen.content_padding_start),
v.getPaddingTop(),
v.getPaddingEnd(),
v.getPaddingBottom());
}
return v.onApplyWindowInsets(insets);
}
});
listView.setHasFixedSize(true);
listView.setClickListener(this);
listView.addOnScrollListener(this);
listView.setAdapter(new ColorListAdapter(colors));
mPeerId = getIntent().getStringExtra(WatchFaceCompanion.EXTRA_PEER_ID);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle connectionHint) {
Log.d(TAG, "onConnected: " + connectionHint);
//Uri.Builder builder = new Uri.Builder();
//Uri uri = builder.scheme("wear").path(PATH_WITH_FEATURE).build();
//Wearable.DataApi.getDataItem(mGoogleApiClient, uri).setResultCallback(SunsetsGeneralWearableConfigActivity.this);
new Thread() {
@Override
public void run() {
PendingResult<DataItemBuffer> results = Wearable.DataApi.getDataItems(mGoogleApiClient,getUriForDataItem());
results.setResultCallback(new ResultCallback<DataItemBuffer>() {
@Override
public void onResult(DataItemBuffer dataItems) {
if (dataItems.getCount() != 0) {
for(int i=0; i<dataItems.getCount(); i++) {
DataMapItem dataMapItem = DataMapItem.fromDataItem(dataItems.get(i));
DataMap config = dataMapItem.getDataMap();
Log.d(TAG, "startup setup UI...");
updateUiForConfigDataMap(config);
}
}
dataItems.release();
}
});
}
}.start();
Wearable.DataApi.addListener(mGoogleApiClient, SunsetsGeneralWearableConfigActivity.this);
}
@Override
public void onConnectionSuspended(int cause) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionSuspended: " + cause);
}
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionFailed: " + result);
}
}
})
.addApi(Wearable.API)
.build();
}
開發者ID:marcouberti,項目名稱:african_sunsets_watch_face,代碼行數:81,代碼來源:SunsetsGeneralWearableConfigActivity.java
示例10: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_digital_config);
mHeader = (TextView) findViewById(R.id.header);
WearableListView listView = (WearableListView) findViewById(R.id.color_picker);
BoxInsetLayout content = (BoxInsetLayout) findViewById(R.id.content);
// BoxInsetLayout adds padding by default on round devices. Add some on square devices.
content.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
if (!insets.isRound()) {
v.setPaddingRelative(
(int) getResources().getDimensionPixelSize(R.dimen.content_padding_start),
v.getPaddingTop(),
v.getPaddingEnd(),
v.getPaddingBottom());
}
return v.onApplyWindowInsets(insets);
}
});
listView.setHasFixedSize(true);
listView.setClickListener(this);
listView.addOnScrollListener(this);
String[] colors = getResources().getStringArray(R.array.color_array);
listView.setAdapter(new ColorListAdapter(colors));
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle connectionHint) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnected: " + connectionHint);
}
}
@Override
public void onConnectionSuspended(int cause) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionSuspended: " + cause);
}
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "onConnectionFailed: " + result);
}
}
})
.addApi(Wearable.API)
.build();
}