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


Java WearableListView.setClickListener方法代碼示例

本文整理匯總了Java中android.support.wearable.view.WearableListView.setClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java WearableListView.setClickListener方法的具體用法?Java WearableListView.setClickListener怎麽用?Java WearableListView.setClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.wearable.view.WearableListView的用法示例。


在下文中一共展示了WearableListView.setClickListener方法的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(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_config_wear_default);

    final Configuration parent = (Configuration) getIntent().getSerializableExtra(EXTRA_PARENT);
    final int selectedIndex = getIntent().getIntExtra(EXTRA_SELECTED_INDEX, 0);

    final WearableListView listView = (WearableListView) findViewById(R.id.list_config);
    listView.setAdapter(new SelectionAdapter(getItems(parent)));
    listView.scrollToPosition(selectedIndex);
    listView.setClickListener(new WearableListView.ClickListener() {
        @Override
        public void onClick(final WearableListView.ViewHolder viewHolder) {
            final Serializable selection = (Serializable) viewHolder.itemView.getTag();
            final Intent data = new Intent();
            data.putExtra(EXTRA_PARENT, parent);
            data.putExtra(EXTRA_RESULT, selection);
            setResult(RESULT_OK, data);
            finish();
        }

        @Override
        public void onTopEmptyRegionClick() { }
    });
}
 
開發者ID:rycus86,項目名稱:StringTheory,代碼行數:27,代碼來源:BaseWearableSubConfigurationActivity.java

示例4: 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

示例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,項目名稱:materialwatch,代碼行數: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: 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

示例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: onCreateView

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
/**
 * Creates the view by inflating the layout and assigning a custom adapter to the view to track the
 * list and setting a click listener to it.
 * @param inflater Inflater of the layout.
 * @param container Parent view of the fragment if available.
 * @param savedInstanceState Contains fragment's save state if available.
 * @return View of the fragment's ui.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    if (elements == null) {
        elements = getSensors();
    }
    View view=inflater.inflate(R.layout.fragment_one_layout, container,false);
    WearableListView listView =
            (WearableListView) view.findViewById(R.id.wearable_list);
    mAdapter = new WearableListAdapter(this, elements);
    listView.setAdapter(mAdapter);

    if (listView.getAdapter() == null) {
        Log.d("Nullcheck is null", "");
    }
    listView.setClickListener(this);
    return view;

}
 
開發者ID:OhtuWearable,項目名稱:WearableDataServer,代碼行數:29,代碼來源:FragmentOne.java

示例10: 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());
}
 
開發者ID:NordicSemiconductor,項目名稱:Android-nRF-Toolbox,代碼行數:18,代碼來源:ScannerActivity.java

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


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