下面列出了android.app.TimePickerDialog.OnTimeSetListener#android.support.design.widget.FloatingActionButton 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@SuppressLint("RestrictedApi")
private void animateIn(FloatingActionButton button) {
button.setVisibility(View.VISIBLE);
if (Build.VERSION.SDK_INT >= 14) {
ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F)
.setInterpolator(INTERPOLATOR).withLayer().setListener(null)
.start();
}
else {
Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_in);
anim.setDuration(200L);
anim.setInterpolator(INTERPOLATOR);
button.startAnimation(anim);
}
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View res = inflater.inflate(R.layout.fragment_fab, container, false);
FloatingActionButton fabRoot = (FloatingActionButton) res.findViewById(R.id.fab);
fabRoot.setImageResource(R.drawable.ic_edit_white_24dp);
fabRoot.setBackgroundTintList(new ColorStateList(new int[][]{
new int[]{android.R.attr.state_pressed},
StateSet.WILD_CARD,
}, new int[]{
ActorSDK.sharedActor().style.getFabPressedColor(),
ActorSDK.sharedActor().style.getFabColor(),
}));
fabRoot.setRippleColor(ActorSDK.sharedActor().style.getFabPressedColor());
fabRoot.setOnClickListener(v -> startActivity(new Intent(getActivity(), ComposeActivity.class)));
return res;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final Context ctx = this;
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
ColorChooserDialog dialog = new ColorChooserDialog(ctx);
dialog.setColorListener(new ColorListener() {
@Override
public void OnColorClick(View v, int color) {
Snackbar.make(view, "Color: "+color, Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
dialog.show();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create);
ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
fabClick(view);
}
});
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
initTwoStage();
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, EventActivity.class));
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fan_menu_buttons1);
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.myFAB);
final FanMenuButtons sub = (FanMenuButtons) findViewById(R.id.myFABSubmenu);
if (sub != null) {
sub.setOnFanButtonClickListener(new FanMenuButtons.OnFanClickListener() {
@Override
public void onFanButtonClicked(int index) {
Toast.makeText(FanMenuButtons1Activity.this, "Button Clicked = " + index, Toast.LENGTH_SHORT).show();
//sub.setButtonSelected(index);
}
});
if (fab != null) {
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sub.toggleShow();
}
});
}
}
}
@Nullable
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
FloatingActionButton fab = getActivity().findViewById(R.id.fab_add_task);
mViews = new TasksViews(inflater, container, fab, mMenuEvents);
mController =
TasksInjector.createController(
createEffectHandler(getContext(), mViews, this::showAddTask, this::showTaskDetailsUi),
mEventSource,
resolveDefaultModel(savedInstanceState));
mController.connect(contramap(TasksListViewDataMapper::tasksListModelToViewData, mViews));
setHasOptionsMenu(true);
return mViews.getRootView();
}
private void initViews() {
container = findViewById(R.id.song_detail_container);
mClose = (ImageButton) findViewById(R.id.song_detail_close);
mSaveImage = (FloatingActionButton) findViewById(R.id.song_detail_save_image);
mImage = (ImageView) findViewById(R.id.song_detail_image);
mName = (TextView) findViewById(R.id.song_detail_name);
mArts = (TextView) findViewById(R.id.song_detail_arts);
mLine = findViewById(R.id.song_detail_ni_line);
mInfos = (TextView) findViewById(R.id.song_detail_infos);
mImage.setOnClickListener(this);
mClose.setOnClickListener(this);
mSaveImage.setOnClickListener(this);
}
/**
* Init view and bus provider.
*
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Mouse mouse = mouseMam.birth();
mouse.squeak();
Snackbar.make(view, "Birth a mouse and squeak ! " + mouse, Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
Timber.e("Haha, i am " + mouse);
}
});
RxBus.get().register(mouseMam);
RxBus.get().register(catMam.birth());
Timber.e("Moust Mam has registed? " + RxBus.get().hasRegistered(mouseMam));
}
private void animateIn(FloatingActionButton button) {
button.setVisibility(View.VISIBLE);
if (Build.VERSION.SDK_INT >= 14) {
ViewCompat.animate(button)
.scaleX(1.0F)
.scaleY(1.0F)
.alpha(1.0F)
.setInterpolator(INTERPOLATOR)
.withLayer()
.setListener(null)
.start();
} else {
Animation anim = AnimationUtils.loadAnimation(button.getContext(),
android.support.design.R.anim.design_fab_in);
anim.setDuration(200L);
anim.setInterpolator(INTERPOLATOR);
button.startAnimation(anim);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sso_all);
ButterKnife.bind(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
/**************************************************/
BusProvider.getInstance().register(this);
/**************************************************/
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
Boolean switchPref = sharedPref.getBoolean(SettingsActivity.KEY_PREF_EXAMPLE_SWITCH, false);
Toast.makeText(this, switchPref.toString(), Toast.LENGTH_SHORT).show();
}
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mBitmap = findViewById(R.id.iv_bitmap);
RxFile.setLoggingEnabled(true);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View view) {
pickFile();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.crop_and_rotate);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ViewCompat.setElevation(toolbar,10);
toolbar.setOnMenuItemClickListener(this);
Intent intent = getIntent();
message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
cropImageView = (CropImageView) findViewById(R.id.cropImageView);
cropImageView.setImageUriAsync(Uri.parse(message));
mFab = (FloatingActionButton) findViewById(R.id.nextStep);
mFab.setOnClickListener(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wd_ad);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_activty);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RecyclerView recyclerView = findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(new ListAdapter(this));
mPullToRefreshLayout = findViewById(R.id.pullToRefreshLayout);
mPullToRefreshLayout.setColorAnimationArray(new int[]{Color.CYAN, Color.RED, Color.YELLOW, Color.MAGENTA});
mPullToRefreshLayout.setOnRefreshListener(this);
/*
For FABRevealMenu checkout here:
https://github.com/HarinTrivedi/FABRevealMenu-master
*/
FloatingActionButton fab = findViewById(R.id.fab);
fabMenu = findViewById(R.id.fabMenu);
fabMenu.bindAncherView(fab);
fabMenu.setCustomView(addCustomView());
}
@Override
public void onStopNestedScroll(@NonNull CoordinatorLayout coordinatorLayout, @NonNull final FloatingActionButton child, @NonNull View target, int type) {
// If animation didn't start, we don't need to care about running the restore animation.
// i.e.: when the user swipes to another tab in a viewpager. The onNestedPreScroll is never called.
if (!fabAnimationStarted) {
return;
}
// Animate back when the fling ended (TYPE_NON_TOUCH:非手指触碰手势输入类型,通常是手指离开屏幕后的惯性滑动事件)
// or if the user made the touch up (TYPE_TOUCH:正常的屏幕触控驱动事件) but the fling didn't happen.
if (type == ViewCompat.TYPE_NON_TOUCH || (type == ViewCompat.TYPE_TOUCH && !flingHappened)) {
//ViewCompat.animate(child).translationY(0).start();
fabAnimationStarted = false;
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final FloatingActionButton button = findViewById(R.id.fab);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, NextActivity.class));
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
testKVStore();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
editTtsText = (EditText) findViewById(R.id.editTtsText);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String text = editTtsText.getText().toString().trim();
if (!text.isEmpty()) {
MaryLink.getInstance().startTTS(text);
}
}
});
h = new Handler();
pd = new TransparentProgressDialog(this, R.drawable.spinner);
r = new Runnable() {
@Override
public void run() {
if (pd.isShowing()) {
pd.dismiss();
}
}
};
if (MaryLink.getInstance() == null) {
pd.show();
h.postDelayed(r, 15000); //wait 15 sec. loading TTS voice models ...
}
//initialize MaryTTS and load modules, voice and language modules wait 15 sec.
MaryLink.load(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getComponent().inject(this);
long userId = getIntent().getLongExtra(EXTRA_USER_ID, -1);
mUserId = userId == -1 ? null : userId;
if (mUserId == null) {
setTitle(R.string.feed_title);
} else {
String name = getIntent().getStringExtra(EXTRA_USER_NAME);
setTitle(getString(R.string.user_feed_title, name));
}
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_feed);
boolean showInput = mUserId == null || mUserId == mDemoConfig.getUserId();
mBinding.inputText.setVisibility(showInput ? View.VISIBLE : View.GONE);
String predefinedInput = getIntent().getStringExtra(EXTRA_POST_TEXT);
if (StringUtils.isNotBlank(predefinedInput)) {
mBinding.inputText.setText(predefinedInput);
}
initRecyclerView();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
sendPost();
}
});
mBinding.swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mFeedController.fetchFeedAsync(true, mUserId);
}
});
}
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton child, View dependency) {
boolean returnValue = super.onDependentViewChanged(parent, child, dependency);
if (dependency instanceof AppBarLayout) {
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
int fabBottomMargin = lp.bottomMargin;
int distanceToScroll = child.getHeight() + fabBottomMargin;
float ratio = (float) dependency.getY() / (float) toolbarHeight;
child.setTranslationY(-distanceToScroll * ratio);
}
return returnValue;
}
private void initView(){
infos = new ArrayList<RedPocketGroup>();
fab_home = (FloatingActionButton)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_fab_home);
fab_home.setOnClickListener(this);
if (is_first_page==1){
fab_home.setVisibility(View.GONE);
}else{
fab_home.setVisibility(View.VISIBLE);
}
mapView = (MapView)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_mapview);
mBaiduMap = mapView.getMap();
rl_mark_info_container = (RelativeLayout)this.findViewById(R.id.id_nearby_group_with_redpocket_mapview_activity_mark_info_windows);
rl_mark_info_container.setVisibility(View.INVISIBLE);
mBaiduMap.setOnMapClickListener(new BaiduMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
rl_mark_info_container.setVisibility(View.INVISIBLE);
}
@Override
public boolean onMapPoiClick(MapPoi mapPoi) {
return false;
}
});
}
@Override
public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout,
FloatingActionButton child,
View directTargetChild,
View target,
int nestedScrollAxes) {
return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL ||
super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target,
nestedScrollAxes);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
// getting the simple name of the activity
final String CLASS_NAME = MainActivity.class.getSimpleName();
// adding the logs
Log.d(CLASS_NAME, "This is a debug log.");
Log.e(CLASS_NAME, "This is a error log");
Log.w(CLASS_NAME, "This is a warning log");
Log.i(CLASS_NAME, "This is a info log");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_album);
mAlbum = (Album)getIntent().getSerializableExtra("album");
mColTbLayout = (CollapsingToolbarLayout)findViewById(R.id.album_col_toolbar_layout);
mTb = (Toolbar)findViewById(R.id.album_toolbar);
mThumbIv = (ImageView)findViewById(R.id.album_thumb);
mRv = (RecyclerView)findViewById(R.id.album_rv);
mFab = (FloatingActionButton)findViewById(R.id.album_start);
mRv.setLayoutManager(new LinearLayoutManager(this));
mAdapter = new DelegateAdapter(this);
mRv.setAdapter(mAdapter);
mFab.setOnClickListener(mClickListener);
setSupportActionBar(mTb);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mColTbLayout.setTitle(mAlbum.getAlbum());
Glide.with(this).load(mAlbum.getAlbumArt()).into(mThumbIv);
List<Song> songList = PlayManager.getInstance(this).getAlbumSongList(mAlbum.getId());
if (songList != null) {
mAdapter.addAll(songList, new DelegateParser<Song>() {
@Override
public LayoutImpl parse(DelegateAdapter adapter, Song data) {
return new SongDelegate(data);
}
});
mAdapter.notifyDataSetChanged();
}
}
@Override
public void onNestedScroll(CoordinatorLayout coordinatorLayout,
FloatingActionButton child,
View target, int dxConsumed, int dyConsumed,
int dxUnconsumed, int dyUnconsumed) {
super.onNestedScroll(coordinatorLayout, child, target,
dxConsumed, dyConsumed, dxUnconsumed,dyUnconsumed);
if ((dyConsumed > 0) && (child.getVisibility() == View.VISIBLE)) {
child.hide();
} else if ((dyConsumed < 0) && (child.getVisibility() != View.VISIBLE)) {
child.show();
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "waht do you want", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}