Search in sources :

Example 1 with FloatingActionButton

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;
        }
    });
}
Also used : ImageButton(android.widget.ImageButton) MainActivity(ru.sash0k.thriftbox.MainActivity) Activity(android.app.Activity) FloatingActionButton(com.melnykov.fab.FloatingActionButton) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with FloatingActionButton

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);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) FloatingActionButton(com.melnykov.fab.FloatingActionButton) OnClickListener(android.view.View.OnClickListener) ViewPager(android.support.v4.view.ViewPager) View(android.view.View)

Example 3 with FloatingActionButton

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);
    }
}
Also used : CircleImageView(de.hdodenhof.circleimageview.CircleImageView) AccountPainter(com.xabber.android.ui.color.AccountPainter) StatusMode(com.xabber.android.data.account.StatusMode) AccountItem(com.xabber.android.data.account.AccountItem) AccountJid(com.xabber.android.data.entity.AccountJid) FloatingActionButton(com.melnykov.fab.FloatingActionButton) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View)

Example 4 with FloatingActionButton

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;
}
Also used : CoordinatorLayout(android.support.design.widget.CoordinatorLayout) StatisticsActivity(ru.sash0k.thriftbox.StatisticsActivity) ListView(android.widget.ListView) ExpandableListView(android.widget.ExpandableListView) ViewGroup(android.view.ViewGroup) FloatingActionButton(com.melnykov.fab.FloatingActionButton) Intent(android.content.Intent) View(android.view.View) ListView(android.widget.ListView) ExpandableListView(android.widget.ExpandableListView)

Example 5 with FloatingActionButton

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);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) FloatingActionButton(com.melnykov.fab.FloatingActionButton) ViewPager(android.support.v4.view.ViewPager)

Aggregations

FloatingActionButton (com.melnykov.fab.FloatingActionButton)6 View (android.view.View)4 ColorDrawable (android.graphics.drawable.ColorDrawable)2 ViewPager (android.support.v4.view.ViewPager)2 Activity (android.app.Activity)1 Intent (android.content.Intent)1 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)1 Toolbar (android.support.v7.widget.Toolbar)1 OnClickListener (android.view.View.OnClickListener)1 ViewGroup (android.view.ViewGroup)1 ExpandableListView (android.widget.ExpandableListView)1 ImageButton (android.widget.ImageButton)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 AccountItem (com.xabber.android.data.account.AccountItem)1 StatusMode (com.xabber.android.data.account.StatusMode)1 AccountJid (com.xabber.android.data.entity.AccountJid)1 AccountPainter (com.xabber.android.ui.color.AccountPainter)1 CircleImageView (de.hdodenhof.circleimageview.CircleImageView)1 Card (it.gmariotti.cardslib.library.internal.Card)1