本文整理匯總了Java中android.support.wearable.view.WearableListView.setAdapter方法的典型用法代碼示例。如果您正苦於以下問題:Java WearableListView.setAdapter方法的具體用法?Java WearableListView.setAdapter怎麽用?Java WearableListView.setAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.wearable.view.WearableListView
的用法示例。
在下文中一共展示了WearableListView.setAdapter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
elements = getElements();
setContentView(R.layout.actions_list_activity);
// Get the list component from the layout of the activity
WearableListView listView =
(WearableListView) findViewById(R.id.wearable_list);
// Assign an adapter to the list
listView.setAdapter(new Adapter(this, elements));
// Set a click listener
listView.setClickListener(this);
}
示例3: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_settings);
mContext = getApplicationContext();
mNoAppsView = (TextView) findViewById(R.id.noapps);
// Get the list component from the layout of the activity
mListView =
(WearableListView) findViewById(R.id.wearable_list);
mListAppInfo = Utils.getInstalledApps(this);
// Assign an adapter to the list
mListView.setAdapter(new Adapter(this, mListAppInfo, getPackageManager()));
if (mListAppInfo.size() == 0) {
mNoAppsView.setVisibility(View.VISIBLE);
}
// Set a click listener
mListView.setClickListener(this);
mThread = new Thread(new Task());
mThread.start();
}
示例4: handleIntent
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
private void handleIntent(Intent intent) {
VehicleMode flightMode = intent.getParcelableExtra(WearReceiverService.EXTRA_EVENT_DATA);
if(flightMode == null)
flightMode = VehicleMode.UNKNOWN;
List<VehicleMode> vehicleModes = VehicleMode.getVehicleModePerDroneType(flightMode.getDroneType());
WearableListView listView = (WearableListView) findViewById(R.id.wear_list);
listView.setAdapter(new VehicleModeAdapter(vehicleModes));
listView.setClickListener(this);
RecyclerView.LayoutManager layoutMgr = listView.getLayoutManager();
if (layoutMgr != null) {
int currentPos = vehicleModes.indexOf(flightMode);
if (currentPos != -1)
layoutMgr.scrollToPosition(currentPos);
}
}
示例5: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_watch_face_config);
val = new Values(getApplicationContext());
// Get the list component from the layout of the activity
WearableListView listView =
(WearableListView) findViewById(R.id.wearable_list);
// Assign an adapter to the list
listView.setAdapter(new ListAdapter(this, elements));
// Set a click listener
listView.setClickListener(this);
}
示例6: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_settings);
mContext = getApplicationContext();
// Get the list component from the layout of the activity
mListView =
(WearableListView) findViewById(R.id.wearable_list);
mListAppInfo = Utils.getAllApps(this);
// Assign an adapter to the list
mListView.setAdapter(new Adapter(this, mListAppInfo, getPackageManager()));
// Set a click listener
mListView.setClickListener(this);
mThread = new Thread(new Task());
mThread.start();
}
示例7: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_config_wear_default);
apiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wearable.API)
.build();
onBeforeListViewSetup(apiClient);
final WearableListView listView = (WearableListView) findViewById(R.id.list_config);
listView.setAdapter(getListAdapter());
listView.setClickListener(getListClickListener());
}
示例8: setMenuElements
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
public void setMenuElements(List<String> titles, List<Drawable> drawables){
setContentView(R.layout.wearmenu_list);
if(mListBackgroundId > 0)
findViewById(R.id.wearmenu_listview_container).setBackgroundResource(mListBackgroundId);
WearableListView listView = (WearableListView) findViewById(R.id.wearmenu_listview);
listView.setAdapter(new WearMenuListListViewAdapter(getContext(), titles, drawables, mListTextColor, mListSelectedColor));
listView.setClickListener(new WearableListView.ClickListener() {
@Override
public void onClick(WearableListView.ViewHolder viewHolder) {
if(mWearMenuListener != null)
mWearMenuListener.onWearMenuListClicked(viewHolder.getPosition());
toggle();
}
@Override
public void onTopEmptyRegionClick() {
toggle();
}
});
}
示例9: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_settings);
mContext = getApplicationContext();
// Get the list component from the layout of the activity
mListView =
(WearableListView) findViewById(R.id.wearable_list);
mListAppInfo = Utils.getRunningServices(this);
// Assign an adapter to the list
mListView.setAdapter(new Adapter(this, mListAppInfo, getPackageManager()));
// Set a click listener
mListView.setClickListener(this);
mThread = new Thread(new Task());
mThread.start();
}
示例10: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
// 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);
final WearableListView listView = (WearableListView) findViewById(R.id.list);
listView.setClickListener(this);
listView.setAdapter(mAdapter = new UARTConfigurationsAdapter(this));
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);
LocalBroadcastManager.getInstance(this).registerReceiver(mServiceBroadcastReceiver, filter);
}
示例11: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
loadingLayout = (RelativeLayout) findViewById(R.id.alert_layout);
WearableListView listView =
(WearableListView) findViewById(R.id.triggers_list);
// Assign an adapter to the list
eventsAdapter = new EventsAdapter(this, triggersDataSet);
listView.setAdapter(eventsAdapter);
googleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle connectionHint) {
Log.d("Error!", "onConnected: " + connectionHint);
sendTriggersRequest();
}
@Override
public void onConnectionSuspended(int cause) {
Log.d("Error!", "onConnectionSuspended: " + cause);
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
Log.d("Error!", "onConnectionFailed: " + result);
}
})
.addApi(Wearable.API)
.build();
// Set a click listener
//listView.setClickListener(this);
}
示例12: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.preference_list);
loadIntentExtras();
checkRequiredExtras();
final WearableListView list = (WearableListView) findViewById(android.R.id.list);
list.setAdapter(new PreferenceEntriesAdapter());
list.scrollToPosition(getIntent().getIntExtra(EXTRA_CURRENT_VALUE, 0));
list.setClickListener(this);
}
示例13: 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);
}
示例14: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_config);
// Get the list component from the layout of the activity
WearableListView listView =
(WearableListView) findViewById(R.id.wearable_list);
mElements = getResources().getStringArray(R.array.currency_names);
mSymbols = getResources().getStringArray(R.array.currency_symbols);
mTickers = getResources().getStringArray(R.array.currency_tickers);
mInvert = getResources().getIntArray(R.array.currency_invert);
// Assign an adapter to the list
listView.setAdapter(new Adapter(this, mElements));
// Set a click listener
listView.setClickListener(this);
mComplicationId = getIntent().getIntExtra(
android.support.wearable.complications.ComplicationProviderService.EXTRA_CONFIG_COMPLICATION_ID, -1);
int selected = getSharedPreferences("config", 0).getInt(mComplicationId + "_selected_position", 0);
listView.scrollToPosition(selected);
}
示例15: onCreateView
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_story_selector, container, false);
listView = (WearableListView) view.findViewById(R.id.story_listview);
stories = new ArrayList<>();
adapter = new Adapter(getActivity(), stories);
listView.setAdapter(adapter);
listView.setClickListener(this);
return view;
}