本文整理汇总了Java中com.google.android.glass.widget.CardScrollView类的典型用法代码示例。如果您正苦于以下问题:Java CardScrollView类的具体用法?Java CardScrollView怎么用?Java CardScrollView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CardScrollView类属于com.google.android.glass.widget包,在下文中一共展示了CardScrollView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createView
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
private void createView() {
CardScrollView mCardScrollView = new CardScrollView(this);
MyCardScrollAdapter mAdapter = new MyCardScrollAdapter();
mCardScrollView.setAdapter(mAdapter);
mCardScrollView.activate();
mCardScrollView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audio.playSoundEffect(Sounds.TAP);
if (invalid)
finish();
else
openOptionsMenu();
}
});
setContentView(mCardScrollView);
}
示例2: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mCardScroller = new CardScrollView(this);
mCardScroller.setAdapter(new CardAdapter(createCards(this)));
setContentView(mCardScroller);
setCardScrollerListener();
/**
* The Measure Class gets instantiated and the
* UI interface {@link MeasureClass#updateMeasurementsCount()}
* gets ignored, since it is not relevant for Google Glass
*/
mMeasureClass = new MeasureClass(this){
@Override
public void updateMeasurementsCount() {}
};
mAverageMeasuresClass = new AverageMeasuresClass(this);
}
示例3: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
// create the adapter
ScrollerAdapter adapter = new ScrollerAdapter();
// create each card
adapter.cards().add(new CardBuilder(this, CardBuilder.Layout.MENU).setText("Save").setFootnote("Save taken photo/video"));
adapter.cards().add(new CardBuilder(this, CardBuilder.Layout.MENU).setText("Discard").setFootnote("Discard taken photo/video"));
adapter.cards().add(new CardBuilder(this, CardBuilder.Layout.MENU).setText("Share").setFootnote("Share taken photo/video"));
// setup the view
_view = new CardScrollView(this);
_view.setAdapter(adapter);
_view.activate();
setContentView(_view);
setOnClickListener();
}
示例4: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
// Ensure screen stays on during demo.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mCardScroller = new CardScrollView(this);
mCardScroller.setAdapter(new CardAdapter(createCards(this), getBaseContext()));
mCardScroller.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Plays sound.
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
am.playSoundEffect(Sounds.TAP);
processSliderRequest(position);
}
});
setContentView(mCardScroller);
mSlider = Slider.from(mCardScroller);
}
示例5: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
// get data from OCRActivity
Bundle b = getIntent().getExtras();
allWords = b.getStringArrayList("ocrResults");
mAdapter = new CardAdapter(createCards(this), getBaseContext(), allWords);
mCardScroller = new CardScrollView(this);
mCardScroller.setAdapter(mAdapter);
setContentView(mCardScroller);
setCardScrollerListener();
mSpellChecker = SpellCheck.getInstance(getApplicationContext());
Log.d(TAG, "Done loading Jazzy");
}
示例6: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
for (int i = 0; i < mlsText.size(); i++)
{
Card newCard = new Card(this);
newCard.setImageLayout(Card.ImageLayout.FULL);
newCard.setText(mlsText.get(i));
mlcCards.add(newCard);
}
CardScrollView csvCardsView = new CardScrollView(this);
csaAdapter cvAdapter = new csaAdapter();
csvCardsView.setAdapter(cvAdapter);
csvCardsView.activate();
setContentView(csvCardsView);
}
示例7: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
// START:onCreate
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// END:onCreate
getWindow().requestFeature( WindowUtils.FEATURE_VOICE_COMMANDS );
// START:onCreate
setupManagers();
mNotes = new NoteList( this );
mCards = new ArrayList<>();
for( Note note : mNotes ) {
addNoteCardToAdapter( note );
}
// END:onCreate
if( mEmptyCardsList ) {
mCards.add( new CardBuilder(this, Layout.TEXT).setText("[tap to add a note]") );
}
// START:onCreate
mAdapter = new NotesScrollAdapter();
mAdapter.notifyDataSetChanged();
mScrollView = new CardScrollView( this );
mScrollView.setAdapter( mAdapter );
mScrollView.setHorizontalScrollBarEnabled( true );
mScrollView.activate();
setContentView( mScrollView );
}
示例8: createView
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
void createView() {
mCardScrollView = new CardScrollView(this);
mAdapter = new MyCardScrollAdapter();
mCardScrollView.setAdapter(mAdapter);
mCardScrollView.activate();
mCardScrollView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audio.playSoundEffect(Sounds.TAP);
if (invalid)
finish();
else
openOptionsMenu();
}
});
setContentView(mCardScrollView);
}
示例9: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
// Ensure screen stays on during demo.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mCardScroller = new CardScrollView(this);
mCardScroller.setAdapter(new CardAdapter(createCards(this)));
mCardScroller.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// Plays sound.
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
am.playSoundEffect(Sounds.TAP);
processSliderRequest(position);
}
});
setContentView(mCardScroller);
mSlider = Slider.from(mCardScroller);
}
示例10: displayNotes
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
private void displayNotes(String notes){
mScrollView = new CardScrollView(this);
// Create the adapter and set it, allow interaction
mAdapter = new NoteAdapter(this, notes);
mScrollView.setAdapter(mAdapter);
// Set the OnClickListener
mScrollView.setOnItemClickListener(this);
// Show the CardScrollView
mScrollView.activate();
setContentView(mScrollView);
mNotesShown = true;
}
示例11: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mView = new CardScrollView(this) {
@Override
public final boolean dispatchGenericFocusedEvent(MotionEvent event) {
if (mDetector.onMotionEvent(event)) {
return true;
}
return super.dispatchGenericFocusedEvent(event);
}
};
mView.setHorizontalScrollBarEnabled(true);
setAdapter(mView);
setContentView(mView);
mDetector = new GestureDetector(this).setBaseListener(this);
}
示例12: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mAdapter = new SelectValueScrollAdapter(
this, getIntent().getIntExtra(EXTRA_COUNT, DEFAULT_COUNT));
mView = new CardScrollView(this) {
@Override
public final boolean dispatchGenericFocusedEvent(MotionEvent event) {
if (mDetector.onMotionEvent(event)) {
return true;
}
return super.dispatchGenericFocusedEvent(event);
}
};
mView.setAdapter(mAdapter);
setContentView(mView);
mDetector = new GestureDetector(this).setBaseListener(this);
}
示例13: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mAdapter = new SetTimerScrollAdapter(this);
mAdapter.setDurationMillis(getIntent().getLongExtra(EXTRA_DURATION_MILLIS, 0));
mView = new CardScrollView(this) {
@Override
public final boolean dispatchGenericFocusedEvent(MotionEvent event) {
if (mDetector.onMotionEvent(event)) {
return true;
}
return super.dispatchGenericFocusedEvent(event);
}
};
mView.setAdapter(mAdapter);
setContentView(mView);
mDetector = new GestureDetector(this).setBaseListener(this);
}
示例14: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMapImageManager = MapImageManager.getInstance();
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mDetector = new GestureDetector(SetMapZoomActivity.this).setBaseListener(mBaseListener);
mCardScrollView = new CardScrollView(SetMapZoomActivity.this) {
@Override
public final boolean dispatchGenericFocusedEvent(MotionEvent event) {
return mDetector.onMotionEvent(event) ||
super.dispatchGenericFocusedEvent(event);
}
};
SetMapZoomScrollAdapter adapter = new SetMapZoomScrollAdapter();
mCardScrollView.setAdapter(adapter);
}
示例15: onCreate
import com.google.android.glass.widget.CardScrollView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(mReceiver, filter);
Log.d("onCreate", "Got default BT adapter and registered receiver.");
mBluetoothAdapter.startDiscovery();
Log.d("onCreate", "Started BT discovery...");
mCardScrollView = new CardScrollView(this);
mCardScrollView.activate();
mCardScrollView.setOnItemClickListener(this);
setContentView(mCardScrollView);
mDevices = new ArrayList<>();
}