本文整理汇总了Java中net.yslibrary.android.keyboardvisibilityevent.util.UIUtil类的典型用法代码示例。如果您正苦于以下问题:Java UIUtil类的具体用法?Java UIUtil怎么用?Java UIUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIUtil类属于net.yslibrary.android.keyboardvisibilityevent.util包,在下文中一共展示了UIUtil类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewCreated
import net.yslibrary.android.keyboardvisibilityevent.util.UIUtil; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final EditText editText = (EditText) view.findViewById(R.id.mEtInput);
view.findViewById(R.id.mBtnSend).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mAction.send(editText.getText().toString());
dismiss();
}
});
KeyboardVisibilityEvent.setEventListener(getActivity(),
new KeyboardVisibilityEventListener() {
@Override
public void onVisibilityChanged(boolean isOpen) {
if (!isOpen) {
dismiss();
}
}
});
editText.post(new Runnable() {
@Override
public void run() {
UIUtil.showKeyboard(getContext(), editText);
}
});
}
示例2: setupRightDrawer
import net.yslibrary.android.keyboardvisibilityevent.util.UIUtil; //导入依赖的package包/类
private void setupRightDrawer() {
mTabListAdapter = new TabListAdapter(
mTimelineManager,
this,
this::onDeleteQuery,
this::onMoveTab,
this::onTabSelect);
mTabListTouchCallback = new TabListTouchHelperCallback(mTabListAdapter);
mTabList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mTabList.setHasFixedSize(true);
mTabList.setAdapter(mTabListAdapter);
mItemTouchHelper = new ItemTouchHelper(mTabListTouchCallback);
mItemTouchHelper.attachToRecyclerView(mTabList);
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close) {
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
UIUtil.hideKeyboard(MainActivity.this);
int newPosition = mCurrentTabPosition;
mDrawerToggle.syncState();
mHandler.postDelayed(() -> mViewPager.setCurrentItem(newPosition, false), 100);
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
}
示例3: setAddrValue
import net.yslibrary.android.keyboardvisibilityevent.util.UIUtil; //导入依赖的package包/类
private void setAddrValue(AutoCompleteTextView acc, final LatLng loc) {
// dapatkan nama tempat dari koordinat point
try {
List<Address> result=geoCoder.getFromLocation(loc.latitude, loc.longitude, 1);
if (result.size() > 0) {
Address addr=result.get(0);
String ll=String.format("%s, %s, %s, %s %s", addr.getAddressLine(0),
addr.getAddressLine(1), addr.getAddressLine(2), addr.getAddressLine(3), addr.getAddressLine(4));
acc.setTag(loc);
acc.setText(ll, false);
// beralih fokus antar Lokasi Jemput dan Tujuan
if (acc == addr_from && !isNavigationReady()) addr_to.requestFocus();
else if (acc == addr_to && !isNavigationReady()) addr_from.requestFocus();
}
} catch (Exception e) {
Toast.makeText(MainActivity.this, "Gagal menemukan lokasi, cek koneksi internet kamu.", 1).show();
return;
}
// dapatkan lokasi A dan B
LatLng[] na=getNaviagatePoint();
android.util.Log.d("lok", "start:" + na[0] + "----end:" + na[1]);
// saat rute siap (point A dan B sudah ditentukan)
if (isNavigationReady()) {
// cegah jarak yang terlalu jauh (batas 27Km)
// ini tidak akurat karena mengabaikan rute jalan yang ada
// tapi ini bekerja offline
if (Utils.distance(na[0], na[1]) > 27) {
//acc.setText("", false);
acc.setTag(new LatLng(0, 0));
Toast.makeText(this, "Jarak terlalu jauh, maksimal 27 Km", 1).show();
return;
}
// jika path (jalur navigasi) sudah dibuat
if (DirectionDrawHelper.anim != null) {
// hapus path serta marker A B
DirectionDrawHelper.anim.clearPolyline();
DirectionDrawHelper.add_startMarker.remove();
DirectionDrawHelper.add_endMarker.remove();
}
UIUtil.hideKeyboard(this);
// cari arah navigasi menggunakan DirectionDrawHelper dan membuat path (jalur navigasi) nya
DirectionDrawHelper pos=new DirectionDrawHelper(this, gmaps, na[0], na[1], vmargin);
pos.setOnNavigateReadyListener(this);
pos.start();
// saat navigasi belum siap (baru menentukan 1 point, A/B)
} else {
// jika belum di zoom, zoom kamera ke point pertama
if (!haszoom || gmaps.getCameraPosition().zoom <= 16f)
gmaps.animateCamera(CameraUpdateFactory.zoomBy(0.8f), 1000, new GoogleMap.CancelableCallback(){
@Override
public void onFinish() {
// geser kamera supaya tidak menutup/timpa marker pertama
gmaps.animateCamera(CameraUpdateFactory.scrollBy(Utils.dp2px(MainActivity.this, 50), Utils.dp2px(MainActivity.this, 50)));
}
@Override
public void onCancel() {
// TODO: Implement this method
}
});
if(firstMarker!=null){ firstMarker.remove();firstMarker=null;}
// buat marker di point pertama
if(firstMarker==null) firstMarker = gmaps.addMarker(new MarkerOptions().position(loc).icon(BitmapDescriptorFactory.fromResource(acc == addr_from ?R.drawable.ic_start_marker: R.drawable.ic_end_marker)));
haszoom = true;
}
// jika data dari addr_from
if (acc == addr_from) {
// hapus dan hilangkan semua drivers
for (Marker m:drivers) m.remove();
drivers.clear();
// buat driver (palsu) yang tersedia diradius 1km
// --for testing purpose only--
for (int i=0;i < (acc == addr_from ?7: 0);i++) {
LatLng rnd=Utils.getRandLocation(loc, 1000);
drivers.add(gmaps.addMarker(new MarkerOptions().position(rnd).icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_bajaj_driver))));
}
}
}