當前位置: 首頁>>代碼示例>>Java>>正文


Java WearableListView.setAdapter方法代碼示例

本文整理匯總了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());
}
 
開發者ID:runtimeco,項目名稱:Android-DFU-App,代碼行數:18,代碼來源:ScannerActivity.java

示例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);
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:17,代碼來源:MenuListActivity.java

示例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();
}
 
開發者ID:sssemil,項目名稱:Advanced-Settings-for-Android-Wear,代碼行數:27,代碼來源:UserAppsSettingsActivity.java

示例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);
    }
}
 
開發者ID:DroidPlanner,項目名稱:tower-wear,代碼行數:18,代碼來源:FlightModesSelectionActivity.java

示例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);
}
 
開發者ID:FruitieX,項目名稱:iowatch,代碼行數:18,代碼來源:WatchFaceConfig.java

示例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();
}
 
開發者ID:sssemil,項目名稱:Advanced-Settings-for-Android-Wear,代碼行數:21,代碼來源:AllAppsSettingsActivity.java

示例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());
}
 
開發者ID:rycus86,項目名稱:StringTheory,代碼行數:18,代碼來源:BaseWearableConfigurationActivity.java

示例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();
        }
    });
}
 
開發者ID:florent37,項目名稱:WearMenu,代碼行數:23,代碼來源:WearMenu.java

示例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();
}
 
開發者ID:sssemil,項目名稱:Advanced-Settings-for-Android-Wear,代碼行數:21,代碼來源:RunningServicesActivity.java

示例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);
}
 
開發者ID:runtimeco,項目名稱:Android-DFU-App,代碼行數:28,代碼來源:UARTConfigurationsActivity.java

示例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);

}
 
開發者ID:CactusSoft,項目名稱:zabbkit-android,代碼行數:40,代碼來源:MainActivity.java

示例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);
}
 
開發者ID:LadyViktoria,項目名稱:wearDrip,代碼行數:13,代碼來源:ListChooserActivity.java

示例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);
}
 
開發者ID:chenkel,項目名稱:Lokalisierung-mit-Wearables,代碼行數:39,代碼來源:MainWatchActivity.java

示例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);
}
 
開發者ID:dps,項目名稱:wear-exchangerates,代碼行數:28,代碼來源:ConfigActivity.java

示例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;
}
 
開發者ID:tajchert,項目名稱:SpritzerWear,代碼行數:12,代碼來源:FragmentStorySelector.java


注:本文中的android.support.wearable.view.WearableListView.setAdapter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。