本文整理汇总了Java中android.support.wearable.view.WatchViewStub类的典型用法代码示例。如果您正苦于以下问题:Java WatchViewStub类的具体用法?Java WatchViewStub怎么用?Java WatchViewStub使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WatchViewStub类属于android.support.wearable.view包,在下文中一共展示了WatchViewStub类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_track);
//Set this to allow activity to enable the ambient mode
setAmbientEnabled();
//Get the watch view stub
mWatchViewStub = (WatchViewStub) findViewById(R.id.watch_view_stub);
mWatchViewStub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub watchViewStub) {
init(watchViewStub);
}
});
//Connect Google api client to communicate with phone
connectGoogleApiClient();
}
示例2: onCreate
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_page_control);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(s -> {
mButtonToggle = (Button) s.findViewById(R.id.button_toggle_link);
mButtonToggle.setOnClickListener(
v -> sendMessageToAllNodes(PageControlMessage.TOGGLE_LINK));
mButtonPrev = (Button) s.findViewById(R.id.button_prev);
mButtonPrev.setOnClickListener(
v -> sendMessageToAllNodes(PageControlMessage.PREV_PAGE));
mButtonNext = (Button) s.findViewById(R.id.button_next);
mButtonNext.setOnClickListener(
v -> sendMessageToAllNodes(PageControlMessage.NEXT_PAGE));
});
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.build();
}
示例3: onCreate
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_souliss_main);
Log.i("SoulissWear", "onCreate");
notfHelper = new NotificationPresets();
// buildWearableOnlyNotification("Massimo", "casino", true);
Notification brick = notfHelper.buildPagedNotification(this);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(Constants.NOTIFICATION_ID, brick);
displaySpeechRecognizer();
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
/* stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
mTextView = (TextView) stub.findViewById(R.id.text);
//displaySpeechRecognizer();
//displaySpeechRecognizer();
}
});*/
}
示例4: onLayoutInflated
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
public void onLayoutInflated(WatchViewStub watchViewStub) {
Log.e("control stub inflated");
background = (ImageView) findViewById(R.id.watchBackground);
mVolUpButton = watchViewStub.findViewById(R.id.vol_up);
mVolDownButton = watchViewStub.findViewById(R.id.vol_down);
mPrevButton = watchViewStub.findViewById(R.id.prev);
mNextButotn = watchViewStub.findViewById(R.id.next);
mPlayButton = (ImageButton) watchViewStub.findViewById(R.id.playPause);
mVolUpButton.setOnClickListener(this);
mVolDownButton.setOnClickListener(this);
mPrevButton.setOnClickListener(this);
mNextButotn.setOnClickListener(this);
mPlayButton.setOnClickListener(this);
updateBackground(getIntent().<Bitmap>getParcelableExtra(DataLayerListenerService.DATA_COVER_BLURED));
}
示例5: onLayoutInflated
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
public void onLayoutInflated(WatchViewStub watchViewStub) {
mTextView = (TextView) watchViewStub.findViewById(R.id.text);
CircledImageView mCircleBtn = (CircledImageView) watchViewStub.findViewById(R.id.btn_circle);
mCircleBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!isStart) {
startGame();
} else {
if (mGame != null) {
endGame();
}
}
}
});
}
示例6: onCreate
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_imu_live_screen);
stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
/*
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
mTextView = (TextView) stub.findViewById(R.id.text);
}
});
*/
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
this.accTimestamps = new LinkedList<Long>();
this.gyroTimestamps = new LinkedList<Long>();
this.magTimestamps = new LinkedList<Long>();
}
示例7: init
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
/**
* Initialize the UI.
*/
private void init(WatchViewStub watchViewStub) {
mHeaderIv = (ImageView) watchViewStub.findViewById(R.id.header_icon);
mHeaderIv.setColorFilter(ContextCompat.getColor(this, R.color.icon_red));
mStepCountTv = (TextView) watchViewStub.findViewById(R.id.step_count_tv);
}
示例8: onCreate
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
mGoogleApiClient = WearApp.getInstance().getGoogleApiClient();
mGoogleApiClient.connect();
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(this);
}
示例9: onLayoutInflated
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
public void onLayoutInflated(WatchViewStub stub) {
mPlayButton = (ImageButton) stub.findViewById(R.id.playPause);
mNextButton = (ImageButton) stub.findViewById(R.id.next);
mPrevButton = (ImageButton) stub.findViewById(R.id.prev);
mArtistText = (TextView) stub.findViewById(R.id.artist_text);
mSongText = (TextView) stub.findViewById(R.id.song_text);
coverView = (ImageView) findViewById(R.id.watchBackground);
mPlayButton.setOnClickListener(this);
mNextButton.setOnClickListener(this);
mPrevButton.setOnClickListener(this);
String artistData = getIntent().getStringExtra(DataLayerListenerService.DATA_ARTIST);
String songData = getIntent().getStringExtra(DataLayerListenerService.DATA_SONG);
if (artistData != null) mArtistText.setText(artistData);
if(songData != null) mSongText.setText(songData);
Bitmap cover = getIntent().getParcelableExtra(DataLayerListenerService.DATA_COVER_BLURED);
if(cover == null) {
coverView.setImageResource(R.drawable.albumblured);
} else {
coverView.setImageBitmap(cover);
}
}
示例10: onCreate
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_control);
Log.e("On create control acitivty");
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.activity_control_stub);
stub.setOnLayoutInflatedListener(this);
}
示例11: initView
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
private void initView() {
WatchViewStub stub = (WatchViewStub) findViewById(R.id.stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub watchViewStub) {
lv = (WearableListView) findViewById(R.id.listView);
llLoading = findViewById(R.id.llLoading);
tv = (TextView) findViewById(R.id.tv);
initEvent();
}
});
}
示例12: onCreate
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setAmbientEnabled();
mData = "0.0";
mWatchInflatedListener = new WatchInflatedListener();
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(mWatchInflatedListener);
}
示例13: onLayoutInflated
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
public void onLayoutInflated(WatchViewStub watchViewStub) {
mTextView = (TextView) watchViewStub.findViewById(R.id.text);
mBackground = (RelativeLayout) watchViewStub.findViewById(R.id.background);
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL);
connect();
}
示例14: onCreate
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_game);
setAmbientEnabled();
final WatchViewStub viewStub = (WatchViewStub) findViewById(R.id.watch_view_stub);
viewStub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
mContainer = (RelativeLayout) stub.findViewById(R.id.container_game_screen);
mGameScreen = (GameScreen) stub.findViewById(R.id.game_screen_view);
updateDisplay();
}
});
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult result) {
Log.e(TAG, "onConnectionFailed " + result.toString());
}
})
.build();
}
示例15: onCreateView
import android.support.wearable.view.WatchViewStub; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_main, container, false);
mViewStub = (WatchViewStub) root.findViewById(R.id.watch_view_stub);
mViewStub.setOnLayoutInflatedListener(this);
return root;
}