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


Java WearableListView.setHasFixedSize方法代碼示例

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


在下文中一共展示了WearableListView.setHasFixedSize方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

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


}
 
開發者ID:Lakkichand,項目名稱:AndroidDemoProjects,代碼行數:36,代碼來源:WatchFaceConfigActivity.java

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

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

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

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

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


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