本文整理汇总了Java中android.support.wearable.view.BoxInsetLayout类的典型用法代码示例。如果您正苦于以下问题:Java BoxInsetLayout类的具体用法?Java BoxInsetLayout怎么用?Java BoxInsetLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BoxInsetLayout类属于android.support.wearable.view包,在下文中一共展示了BoxInsetLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
containerView = (BoxInsetLayout) findViewById(R.id.container);
inputImageButton = (ImageButton) findViewById(R.id.inputImageButton);
inputImageButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
promptSpeechInput();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
示例2: setupUi
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
private void setupUi() {
setContentView(R.layout.main_activity_wear);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mainTextView = (TextView) findViewById(R.id.mainText);
preTextView = (TextView) findViewById(R.id.preText);
postTextView = (TextView) findViewById(R.id.postText);
logTextView = (TextView) findViewById(R.id.logText);
mContainerView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
updateStatusTexts();
}
});
updateDisplay();
}
示例3: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
radioGroup = (RadioGroup) findViewById(R.id.radioGroupLabels);
radioBtns[0] = (RadioButton) findViewById(R.id.radioStanding);
radioBtns[1] = (RadioButton) findViewById(R.id.radioWalking);
radioBtns[2] = (RadioButton) findViewById(R.id.radioRunning);
radioBtns[3] = (RadioButton) findViewById(R.id.radioOther);
btnDelete = (Button) findViewById(R.id.btnDeleteData);
mState = State.IDLE;
mFeatureFile = new File(getExternalFilesDir(null),
Globals.FEATURE_FILE_NAME);
mServiceIntent = new Intent(this, SensorsService.class);
}
示例4: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wear);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mTextView = (TextView) findViewById(R.id.text);
mClockView = (Button) findViewById(R.id.clock);
mClockView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sendMessage(PHONE_MESSAGE_PATH, "b " + mTextView.getText());
}
});
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
initGoogleApiClient();
}
示例5: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_picture_show);
mRootView = (BoxInsetLayout) findViewById(R.id.root_layout);
mImageView = (ImageView) findViewById(R.id.image_view);
Intent intent = getIntent();
if (intent.hasExtra("id")) {
mImageView.setImageResource(intent.getIntExtra("id", -1));
} else if (intent.hasExtra("uri")) {
mImageView.setImageURI(Uri.parse(intent.getStringExtra("uri")));
}
if (intent.hasExtra("background")) {
mRootView.setBackgroundColor(intent.getIntExtra("background", Color.WHITE));
}
}
示例6: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mTextView = (TextView) findViewById(R.id.text);
mClockView = (TextView) findViewById(R.id.clock);
}
示例7: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mTextView = (CircularSeekBar) findViewById(R.id.text);
mClockView = (TextView) findViewById(R.id.clock);
}
示例8: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mClockView = (TextView) findViewById(R.id.clock);
if (askForPermission(Manifest.permission.BODY_SENSORS,1))
initSensors();
}
示例9: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mTextView = (TextView) findViewById(R.id.text);
mClockView = (TextView) findViewById(R.id.clock);
}
示例10: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_building_layout);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mTextView = (TextView) findViewById(R.id.text);
mClockView = (TextView) findViewById(R.id.clock);
}
开发者ID:PacktPublishing,项目名称:Android-High-Performance-Programming,代码行数:11,代码来源:BuildingLayoutActivity.java
示例11: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
// Init files
mRawAccFile = new File(Environment.getExternalStorageDirectory(), "acc_raw.csv");
Log.d("ACC_DATA_PATH", mRawAccFile.getAbsolutePath());
try {
mRawAccOutputStream = new FileOutputStream(mRawAccFile);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
stepsView = (TextView) findViewById(R.id.stepCount);
calorieView = (TextView) findViewById(R.id.calorieCount);
//Set the buttons and the text accordingly
accelButton = (ToggleButton) findViewById(R.id.StartButton);
accelButton.setChecked(isAccelRunning);
accelButton.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton btn, boolean isChecked) {
if (!isAccelRunning) {
startAccelerometer();
accelButton.setChecked(true);
} else {
stopAccelerometer();
accelButton.setChecked(false);
}
}
}
);
}
示例12: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
mTxtAudio = (TextView)findViewById(R.id.textView);
//Set the buttons and the text accordingly
recordButton = (Button) findViewById(R.id.RecordButton);
recordButton.setText(MicrophoneRecorder.getInstance().isRecording() ? R.string.stop : R.string.record);
recordButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MicrophoneRecorder recorder = MicrophoneRecorder.getInstance();
if (recorder.isRecording()) {
Log.d(TAG, "stopping recording");
recorder.stopRecording();
recordButton.setText(R.string.record);
mTxtAudio.setText("");
//closeOutAudioFile();
} else {
Log.d(TAG, "starting recording");
recorder.registerListener(MainActivity.this);
recorder.startRecording();
recordButton.setText(R.string.stop);
}
}
});
}
示例13: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (ImageButton) findViewById(R.id.start_button);
listener = new GuardDogSensorListener(this);
listening = false;
setAmbientEnabled();
googleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
mContainerView = (BoxInsetLayout) findViewById(R.id.container);
}
示例14: onCreate
import android.support.wearable.view.BoxInsetLayout; //导入依赖的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 ) );
}
示例15: onCreateView
import android.support.wearable.view.BoxInsetLayout; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View rootView = inflater.inflate(R.layout.heart_rate_fragment, container, false);
heartbeat = (HeartBeatView)rootView.findViewById(R.id.heartbeat);
mContainerView = (BoxInsetLayout)rootView.findViewById(R.id.container);
mTextView = (TextView)rootView.findViewById(R.id.heart_rate);
mSensorManager = ((SensorManager)getActivity().getSystemService(SENSOR_SERVICE));
mHeartRateSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
mGoogleApiClient = new GoogleApiClient.Builder(getActivity()).addApi(Wearable.API).build();
mGoogleApiClient.connect();
requestSensorPermission();
return rootView;
}