use of com.melnykov.fab.FloatingActionButton in project Thrift-box by Sash0k.
the class InputFragment method onActivityCreated.
// ============================================================================
@Override
public void onActivityCreated(Bundle state) {
super.onActivityCreated(state);
final Activity context = getActivity();
Toolbar toolbar = (Toolbar) context.findViewById(R.id.toolbar);
valueTV = (TextView) toolbar.findViewById(R.id.enter_value);
valueTV.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (view instanceof TextView && ((TextView) view).length() != 0) {
showCommentDialog(commentTV.getText());
}
}
});
commentTV = (TextView) context.findViewById(R.id.comment_value);
commentTV.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
showCommentDialog(((TextView) view).getText());
}
});
categories = (Categories) context.findViewById(R.id.categories);
if (state != null) {
categories.setSelected(state.getInt(DB.CATEGORY));
valueTV.setText(state.getCharSequence(DB.VALUE));
CharSequence comment = state.getCharSequence(DB.COMMENT);
commentTV.setText(comment);
}
FloatingActionButton fab = (FloatingActionButton) context.findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
enterValue(context);
}
});
// обработка длинного нажатия
ImageButton clear = (ImageButton) context.findViewById(R.id.del);
clear.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
((MainActivity) context).clearAnimation(view);
return true;
}
});
}
use of com.melnykov.fab.FloatingActionButton in project Signal-Android by WhisperSystems.
the class ExperienceUpgradeActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStatusBarColor(getResources().getColor(R.color.signal_primary_dark));
final Optional<ExperienceUpgrade> upgrade = getExperienceUpgrade(this);
if (!upgrade.isPresent()) {
onContinue(upgrade);
return;
}
setContentView(R.layout.experience_upgrade_activity);
final ViewPager pager = ViewUtil.findById(this, R.id.pager);
final FloatingActionButton fab = ViewUtil.findById(this, R.id.fab);
pager.setAdapter(new IntroPagerAdapter(getSupportFragmentManager(), upgrade.get().getPages()));
fab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onContinue(upgrade);
}
});
getWindow().setBackgroundDrawable(new ColorDrawable(upgrade.get().getPage(0).backgroundColor));
ServiceUtil.getNotificationManager(this).cancel(NOTIFICATION_ID);
}
use of com.melnykov.fab.FloatingActionButton in project xabber-android by redsolution.
the class AccountActionButtonsAdapter method onChange.
@Override
public void onChange() {
Collections.sort(accounts);
for (int index = 0; index < accounts.size(); index++) {
View view = linearLayout.getChildAt(index);
final CircleImageView circleImageView = (CircleImageView) view.findViewById(R.id.account_avatar);
final AccountJid account = accounts.get(index);
circleImageView.setImageDrawable(AvatarManager.getInstance().getAccountAvatar(account));
FloatingActionButton backgroundActionButton = (FloatingActionButton) view.findViewById(R.id.fab);
final AccountPainter accountPainter = ColorManager.getInstance().getAccountPainter();
backgroundActionButton.setColorNormal(accountPainter.getAccountMainColor(account));
backgroundActionButton.setColorPressed(accountPainter.getAccountDarkColor(account));
backgroundActionButton.setColorRipple(accountPainter.getAccountRippleColor(account));
AccountJid selectedAccount = AccountManager.getInstance().getSelectedAccount();
int shadowVisibility;
if (selectedAccount == null) {
shadowVisibility = View.GONE;
} else {
shadowVisibility = View.VISIBLE;
if (selectedAccount.equals(account)) {
shadowVisibility = View.GONE;
}
}
view.findViewById(R.id.account_unselected_shadow).setVisibility(shadowVisibility);
int offlineShadowVisibility;
AccountItem accountItem = AccountManager.getInstance().getAccount(account);
StatusMode statusMode = null;
if (accountItem != null) {
statusMode = accountItem.getDisplayStatusMode();
}
if (statusMode != null && (statusMode == StatusMode.connection || statusMode == StatusMode.unavailable)) {
offlineShadowVisibility = View.VISIBLE;
} else {
offlineShadowVisibility = View.GONE;
}
view.findViewById(R.id.account_offline_shadow).setVisibility(offlineShadowVisibility);
}
}
use of com.melnykov.fab.FloatingActionButton in project Thrift-box by Sash0k.
the class ExpensesFragment method onCreateView.
// ============================================================================
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle state) {
View expandableListView = super.onCreateView(inflater, container, state);
CoordinatorLayout view = (CoordinatorLayout) inflater.inflate(R.layout.fragment_expenses, container, false);
// Удаляю заглушку и добавляю ExpandableListFragment
ListView lv = (ListView) view.findViewById(android.R.id.list);
ViewGroup parent = (ViewGroup) lv.getParent();
int lvIndex = parent.indexOfChild(lv);
parent.removeViewAt(lvIndex);
parent.addView(expandableListView, lvIndex, expandableListView.getLayoutParams());
// Привязываю fab к новому listView
lv = (ListView) view.findViewById(android.R.id.list);
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.expenses_fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent();
i.setClass(getContext(), StatisticsActivity.class);
startActivity(i);
}
});
fab.attachToListView(lv);
return view;
}
use of com.melnykov.fab.FloatingActionButton in project Signal-Android by signalapp.
the class ExperienceUpgradeActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStatusBarColor(getResources().getColor(R.color.signal_primary_dark));
final Optional<ExperienceUpgrade> upgrade = getExperienceUpgrade(this);
if (!upgrade.isPresent()) {
onContinue(upgrade);
return;
}
setContentView(R.layout.experience_upgrade_activity);
final ViewPager pager = ViewUtil.findById(this, R.id.pager);
final FloatingActionButton fab = ViewUtil.findById(this, R.id.fab);
pager.setAdapter(new IntroPagerAdapter(getSupportFragmentManager(), upgrade.get().getPages()));
fab.setOnClickListener(v -> onContinue(upgrade));
getWindow().setBackgroundDrawable(new ColorDrawable(upgrade.get().getPage(0).backgroundColor));
ServiceUtil.getNotificationManager(this).cancel(NOTIFICATION_ID);
}
Aggregations