Java Code Examples for android.support.design.widget.FloatingActionButton

The following are top voted examples for showing how to use android.support.design.widget.FloatingActionButton. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: android_firebase_green_thumb   File: PlantDetailActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitle("");
    mItemDescription = (TextView) findViewById(R.id.text_view_item_description);
    mItemPrice = (TextView) findViewById(R.id.text_view_item_price);
    final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

    setSupportActionBar(mToolbar);
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) {
        supportActionBar.setDisplayHomeAsUpEnabled(true);
    }
    fab.setOnClickListener(this);

    mItemId = getIntent().getIntExtra(INTENT_EXTRA_ITEM, 0);

    getSupportLoaderManager().initLoader(PLANT_DETAIL_LOADER, null, this);
}
 
Example 2
Project: circle-menu-android   File: CircleMenuView.java   View source code 6 votes vote down vote up
private void initButtons(@NonNull Context context, @NonNull List<Integer> icons, @NonNull List<Integer> colors) {
    final int buttonsCount = Math.min(icons.size(), colors.size());
    for (int i = 0; i < buttonsCount; i++) {
        final FloatingActionButton button = new FloatingActionButton(context);
        button.setImageResource(icons.get(i));
        button.setBackgroundTintList(ColorStateList.valueOf(colors.get(i)));
        button.setClickable(true);
        button.setOnClickListener(new OnButtonClickListener());
        button.setOnLongClickListener(new OnButtonLongClickListener());
        button.setScaleX(0);
        button.setScaleY(0);
        button.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

        addView(button);
        mButtons.add(button);
    }
}
 
Example 3
Project: BrewBook   File: MapsActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);


    go = (Button) findViewById(R.id.button2);
    go.setOnClickListener(btGo);
    location = (EditText) findViewById(R.id.editLocation);
    progressBarSubject = (ProgressBar) findViewById(R.id.progressBar);
    SubjectListView = (ListView) findViewById(R.id.listview1);
    trendingBtm = (ImageButton) findViewById(R.id.imageBtmtrending);
    userBtm = (ImageButton) findViewById(R.id.imageBtmuser);
    locationBtm = (ImageButton) findViewById(R.id.imageBtmlocation);
    settingsBtm = (ImageButton) findViewById(R.id.imageBtmSettings);
    addReviewBtm = (FloatingActionButton) findViewById(R.id.addReview);
    trendingBtm.setOnClickListener(btTrending);
    userBtm.setOnClickListener(btUser);
    locationBtm.setOnClickListener(btlocation);
    settingsBtm.setOnClickListener(btSettings);
    addReviewBtm.setOnClickListener(btAdd);


}
 
Example 4
Project: Hands-On-Android-UI-Development   File: NavigationMenuActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_navigation_menu);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final 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();
        }
    });

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close
    );

    drawer.addDrawerListener(toggle);
    toggle.syncState();
    drawer.openDrawer(Gravity.START);
}
 
Example 5
Project: homeassist-builder   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    setTitle("HomeAssist Control Builder");

    mDataTextView = findViewById(R.id.text_data);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            showEntityAction();
        }
    });
}
 
Example 6
Project: Show_Chat   File: RegisterActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chat_activity_register);
    fab = (FloatingActionButton) findViewById(R.id.fab);
    cvAdd = (CardView) findViewById(R.id.cv_add);
    editTextUsername = (EditText) findViewById(R.id.et_username);
    editTextPassword = (EditText) findViewById(R.id.et_password);
    editTextRepeatPassword = (EditText) findViewById(R.id.et_repeatpassword);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ShowEnterAnimation();
    }
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            animateRevealClose();
        }
    });
}
 
Example 7
Project: JewelryUI   File: MainActivity.java   View source code 6 votes vote down vote up
private void findView() {
    rvRing =(RecyclerViewPager)findViewById(R.id.rv_ring);
    svContainer = (ObservableScrollView) findViewById(R.id.sv_container);
    svDetail = (ScrollView) findViewById(R.id.sv_detail);
    blurringView = (BlurringView) findViewById(R.id.blurring);
    vpModel = (JazzyViewPager) findViewById(R.id.vp_model);
    ivBlur = (ImageView) findViewById(R.id.iv_blur);
    tvName = (TextView) findViewById(R.id.tv_name);

    floatingActionButton = (FloatingActionButton)findViewById(R.id.fab);
    layoutContainer = (RelativeLayout) findViewById(R.id.layout_container);
    layoutFakeRipple = (RelativeLayout) findViewById(R.id.layout_fake_ripple);
    rvCheckOut = (RecyclerView) findViewById(R.id.rv_check_out);
    tvTitle = (TextView) findViewById(R.id.tv_title);
    btnPay = (MorphingButton) findViewById(R.id.btn_pay);
}
 
Example 8
Project: RetroMusicPlayer   File: ScrollAwareFABBehavior.java   View source code 6 votes vote down vote up
@Override
public void onNestedScroll(@NonNull CoordinatorLayout coordinatorLayout,
                           @NonNull FloatingActionButton child,
                           @NonNull View target,
                           int dxConsumed,
                           int dyConsumed,
                           int dxUnconsumed,
                           int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

    //child -> Floating Action Button
    if (dyConsumed > 0) {
        Log.d("Scrolling", "Up");
        CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
        int fab_bottomMargin = layoutParams.bottomMargin;
        child.animate().translationY(child.getHeight() + fab_bottomMargin).setInterpolator(new LinearInterpolator()).start();
    } else if (dyConsumed < 0) {
        Log.d("Scrolling", "down");
        child.animate().translationY(0).setInterpolator(new LinearInterpolator()).start();
    }
}
 
Example 9
Project: Channelize   File: TaskListFragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view = inflater.inflate(R.layout.fragment_task_list, container, false);

    mTextEmptyList = (TextView) view.findViewById(R.id.text_empty_list);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView_main);
    mFab = (FloatingActionButton) view.findViewById(R.id.fab_add);

    mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(mLayoutManager);
    RecyclerView.ItemDecoration itemDecoration = new
            DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL);
    mRecyclerView.addItemDecoration(itemDecoration);

    setClickListeners();
    setupBroadcastReceiver();

    return view;
}
 
Example 10
Project: Android_RuuvitagScannner   File: EditActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.activity_edit);
    textfield = (EditText) findViewById(R.id.input_name);
    handler = new DBHandler(this);
    db = handler.getWritableDatabase();

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            openAlarmEdit(view);
            save(null);
        }
    });

    if(getIntent().getExtras() != null) {
        index = getIntent().getExtras().getInt("index");
    }
}
 
Example 11
Project: natumassas-app   File: AddCliente.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_cliente);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    editNome = (EditText) findViewById(R.id.editNome);
    editTelefone = (EditText) findViewById(R.id.editTelefone);
    editEndereco = (EditText) findViewById(R.id.editEndereco);
    editEmail = (EditText) findViewById(R.id.editEmail);

    fab = (FloatingActionButton) findViewById(R.id.btnConfirmAddCliente);

    dbConnection = new DBConnection();
    dbConnection.createConnection(this);

}
 
Example 12
Project: Android-Development   File: PoiListFragment.java   View source code 6 votes vote down vote up
/**
 * Setup {@link PoiListFragment} static views and their click listeners
 */
private void setupView() {
    TextView osmCopyright = (TextView) getActivity().findViewById(R.id.osmCopyright);
    osmCopyright.setText(Html.fromHtml(getString(R.string.osm_copyright)));

    relativeLayout = (RelativeLayout) getActivity().findViewById(R.id.mapViewPoiListContainer);
    floatingActionButton = (FloatingActionButton) getActivity().findViewById(R.id.fabPoiList);
    floatingActionButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (!mapPreviewVisible) {
                floatingActionButton.setImageResource(R.drawable.ic_close_white);
                relativeLayout.setVisibility(View.VISIBLE);
                mapPreviewVisible = true;
            } else {
                floatingActionButton.setImageResource(R.drawable.ic_map_white);
                relativeLayout.setVisibility(View.GONE);
                mapPreviewVisible = false;
            }
        }
    });
}
 
Example 13
Project: TeamCSSS-Enactus   File: sampleReport.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample_report);
    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();
        }
    });
}
 
Example 14
Project: Gonnect   File: SecondActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);
    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();
        }
    });
}
 
Example 15
Project: ButterflyButton   File: ButterflyButton.java   View source code 6 votes vote down vote up
private void init(Context context, AttributeSet attributeSet) {
    this.model = new ButterflyModel(context);
    View root = inflate(context, R.layout.domlayout, this);
    this.screenMetrics = context.getResources().getDisplayMetrics();
    this.floatingActionButton = (FloatingActionButton) root.findViewById(R.id.fab);
    this.floatingActionButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (model.isOpened()) {
                closeBubble();
            } else {
                openBubble();
            }
        }
    });
    if (attributeSet != null)
        applyStyling(context.obtainStyledAttributes(attributeSet, R.styleable.ButterflyButton));
    setMinimumWidth((int) this.model.getMaxRadius());
    setMinimumHeight((int) this.model.getMaxRadius());
}
 
Example 16
Project: TeamCSSS-Enactus   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public 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) {
            Intent i=new Intent(getApplicationContext(),sampleReport.class);
            startActivity(i);
        }
    });
}
 
Example 17
Project: DebugOverlay-Android   File: ScrollingActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scrolling);

    ToolbarSupport.addTo(this);

    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();
        }
    });
}
 
Example 18
Project: HDImageView   File: MainActivity.java   View source code 6 votes vote down vote up
@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();

            mImage.setTranslateLimit(Translation.COUSTOM);
        }
    });

    mImage = (CropHDImageView) findViewById(R.id.image);

    mImage.setImageSource(ImageSourceBuilder.newBuilder()
                .setUri(ASSET_SCHEME+"girl.jpg").build());
}
 
Example 19
Project: civify-app   File: NavigateFragment.java   View source code 6 votes vote down vote up
private void setCenterButton(View v) {
    mFabLocation = (FloatingActionButton) v.findViewById(R.id.fab_location);
    mLocationListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            try {
                Float zoom = null;
                // Disable search
                if (mSarchCenterSnackbar != null) {
                    CivifyMap.getInstance().enable();
                    CivifyMap.getInstance().setAutoCenter(getSharedPreferencesAutoCenter());
                    mSarchCenterSnackbar.dismiss();
                    mSarchCenterSnackbar = null;
                    zoom = mLastZoom;
                }
                CivifyMap.getInstance()
                        .center(CivifyMap.getInstance().getCurrentLocation(), zoom, true);
            } catch (MapNotLoadedException ignore) {
                showMapLoadingWarning(view);
            }
        }
    };
    mFabLocation.setOnClickListener(mLocationListener);
}
 
Example 20
Project: FakeWeather   File: FloatingActionButtonScrollBehavior.java   View source code 6 votes vote down vote up
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final
FloatingActionButton child, final View target, final int dxConsumed, final int dyConsumed,
                           final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
            dxUnconsumed, dyUnconsumed);
    if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
        /** design lib 升级到 25.1.0 导致 child.hide() 效果失效,法克哟
         *  http://stackoverflow.com/questions/41761736/android-design-library-25-1-0-causes-floatingactionbutton-behavior-to-stop-worki
         */
        child.hide(new FloatingActionButton.OnVisibilityChangedListener() {
            @Override
            public void onHidden(FloatingActionButton fab) {
                super.onHidden(fab);
                fab.setVisibility(View.INVISIBLE);
            }
        });
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        child.show();
    }
}
 
Example 21
Project: Tusky   File: TimelineFragment.java   View source code 6 votes vote down vote up
@Override
public void onScrolled(RecyclerView view, int dx, int dy) {
    super.onScrolled(view, dx, dy);

    ActionButtonActivity activity = (ActionButtonActivity) getActivity();
    FloatingActionButton composeButton = activity.getActionButton();

    if (composeButton != null) {
        if (hideFab) {
            if (dy > 0 && composeButton.isShown()) {
                composeButton.hide(); // hides the button if we're scrolling down
            } else if (dy < 0 && !composeButton.isShown()) {
                composeButton.show(); // shows it if we are scrolling up
            }
        } else if (!composeButton.isShown()) {
            composeButton.show();
        }
    }
}
 
Example 22
Project: ankihelper   File: PlansManagerActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_plans_manager);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.add_plan);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (MyApplication.getAnkiDroid().isAnkiDroidRunning()) {
                Intent intent = new Intent(PlansManagerActivity.this, PlanEditorActivity.class);
                startActivity(intent);
            } else {
                DialogUtil.showStartAnkiDialog(PlansManagerActivity.this);
            }
        }
    });

}
 
Example 23
Project: Camera-Roll-Android-App   File: MainActivity.java   View source code 6 votes vote down vote up
public void fabClicked(View v) {
    if (v instanceof FloatingActionButton) {
        FloatingActionButton fab = (FloatingActionButton) v;
        Drawable drawable = fab.getDrawable();
        if (drawable instanceof Animatable) {
            ((Animatable) drawable).start();
        }
    }
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent i = new Intent();
            i.setAction(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
            if (i.resolveActivity(getPackageManager()) != null) {
                startActivity(i);
            } else {
                Toast.makeText(MainActivity.this, getString(R.string.error), Toast.LENGTH_SHORT).show();
            }
        }
    }, (int) (500 * Util.getAnimatorSpeed(this)));
}
 
Example 24
Project: wirtualnaApteczka   File: AddMedicineActivity.java   View source code 6 votes vote down vote up
private void initializeViewComponents() {
    nameEdit = (EditText) findViewById(R.id.medicine_name);
    nameEdit.setSelected(false);
    amountEdit = (EditText) findViewById(R.id.medicine_amount);
    amountEdit.setSelected(false);
    notesEdit = (EditText) findViewById(R.id.notes_text);
    notesEdit.setSelected(false);

    quantitySuffixLabel = (TextView) findViewById(R.id.medicine_quantity_suffix_label);
    dueDateCalendar = (TextView) findViewById(R.id.medicine_due_date_calendar);
    saveMedicineBtn = (FloatingActionButton) findViewById(R.id.save_new_medicine_btn);
    medicineTypeSpinner = (Spinner) findViewById(R.id.medicine_type_spinner);
    shareMedicineWithFriends = (CheckBox) findViewById(R.id.share_medicine_checkbox);

    addMedicinePhotoBtn = (ImageButton) findViewById(R.id.add_medicine_photo);
    voiceInputMedicineNameBtn = (ImageButton) findViewById(R.id.voice_input_medicine_name_btn);
    voiceInputMedicineNotesBtn = (ImageButton) findViewById(R.id.voice_input_medicine_notes_btn);
}
 
Example 25
Project: Kutuk   File: NamedListActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.named_list);
    realm = Realm.getDefaultInstance();
    RecyclerView namedView = (RecyclerView) findViewById(R.id.named_list_view);
    namedView.setLayoutManager(new LinearLayoutManager(this));
    namedView.setAdapter(getViewAdapter());

    FloatingActionButton addButton = (FloatingActionButton) findViewById(R.id.add_button);
    addButton.setImageDrawable(MaterialDrawableBuilder.with(this)
            .setIcon(MaterialDrawableBuilder.IconValue.PLUS)
            .setColorResource(R.color.text_light)
            .build()
    );
}
 
Example 26
Project: Android-Photo-Cell-POC   File: FlashActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_flash);
    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, "Starting Flash Light", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();

            runFlashSpeedTest();
        }
    });
}
 
Example 27
Project: gigreminder   File: ArtistsFragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_artists, container, false);
    ButterKnife.bind(this, rootView);

    adapter = new ListAdapter(getContext(), uiModel);
    adapter.setOnItemClickListener(createOnArtistClickListener());

    artistsView.setHasFixedSize(true);
    artistsView.setAdapter(adapter);
    artistsView.setLayoutManager(new LinearLayoutManager(getContext()));
    artistsView.addItemDecoration(new DividerItemDecoration(getContext(),
            LinearLayoutManager.VERTICAL));

    listHelper = new ListViewHelper(artistsView, emptyListView, loadingProgressView);

    FloatingActionButton addArtistButton = (FloatingActionButton) getActivity().findViewById(
            R.id.fab_add_artist);
    addArtistButton.setOnClickListener(v -> {
        presenter.sendUiEvent(OpenNewArtistEvent.INSTANCE);
    });

    return rootView;
}
 
Example 28
Project: boohee_v5.6   File: StepMainActivity$$ViewInjector.java   View source code 6 votes vote down vote up
public void inject(Finder finder, final T target, Object source) {
    target.mPullRefreshListView = (PullToRefreshListView) finder.castView((View) finder
            .findRequiredView(source, R.id.listview, "field 'mPullRefreshListView'"), R.id
            .listview, "field 'mPullRefreshListView'");
    View view = (View) finder.findRequiredView(source, R.id.fab_button, "field 'fabButton' " +
            "and method 'onClick'");
    target.fabButton = (FloatingActionButton) finder.castView(view, R.id.fab_button, "field " +
            "'fabButton'");
    view.setOnClickListener(new DebouncingOnClickListener() {
        public void doClick(View p0) {
            target.onClick(p0);
        }
    });
    target.tvIndicator = (View) finder.findRequiredView(source, R.id.tv_indicator, "field " +
            "'tvIndicator'");
}
 
Example 29
Project: Microsphere   File: MainActivity.java   View source code 6 votes vote down vote up
@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) {
            new DetectionTask().execute(path);
        }
    });
    add_log(stringFromJNI());
    TextView tv = (TextView) findViewById(R.id.sample_text);
    tv.setMovementMethod(new ScrollingMovementMethod());
    get_permission();
    init_system();
}
 
Example 30
Project: TeamCSSS-Enactus   File: homePage.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home_page);
    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.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
}
 
Example 31
Project: CoordinatorLayoutExample-master   File: MyBehaviorActivity.java   View source code 5 votes vote down vote up
private void initView(){
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    coordinatorLayout=(CoordinatorLayout)findViewById(R.id.behavior_demo_coordinatorLayout);

    recyclerview=(RecyclerView)findViewById(R.id.behavior_demo_recycler);
    mLayoutManager=new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    recyclerview.setLayoutManager(mLayoutManager);

    swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.behavior_demo_swipe_refresh) ;
    swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));//调整下拉控件位置

    fab=(FloatingActionButton) findViewById(R.id.fab);
}
 
Example 32
Project: stynico   File: WelcomeActivity.java   View source code 5 votes vote down vote up
private void initInstances() {
	fabBtn = (FloatingActionButton) findViewById(R.id.fab);
	fabBtn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				EditText editText = (EditText)findViewById(R.id.tv_no);
				String strurl = String.valueOf(editText.getText());
				ClipboardManager manager = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
				manager.setText(""+"\n");
				
			}
		});
}
 
Example 33
Project: CommonLibrary   File: Main2Activity.java   View source code 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityMain2Binding binding = DataBindingUtil.setContentView(this,R.layout.activity_main2);
        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();
            }
        });




        List<Test> data = new ArrayList<>();
        Test test;
        for (int i = 0; i < 100; i++) {
            test = new Test();
            test.name = i +"";
            test.time = System.currentTimeMillis() + "->"+i;
            data.add(test);
        }
        adapter.setData(data);


        binding.content.rc.setLayoutManager(new LinearLayoutManager(this));
        binding.content.rc.setAdapter(adapter);

    }
 
Example 34
Project: SecScanQR   File: GenerateActivity.java   View source code 5 votes vote down vote up
/**
 * Standard Android on create method that gets called when the activity
 * initialized.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_generate);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    text = (EditText) findViewById(R.id.txtQR);
    image = (ImageView) findViewById(R.id.image);

    //Setup the Spinner Menu for the different formats
    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    spinner.setOnItemSelectedListener(this);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
            R.array.formats_array, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);


    //If the device were rotated then restore information
    if(savedInstanceState != null){
        text2Qr = (String) savedInstanceState.get(STATE_TEXT);
        text.setText(text2Qr);
    }

    // Get intent, action and MINE type and check if the intent was started by a share to modul from an other app
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (Intent.ACTION_SEND.equals(action) && type != null){
        if("text/plain".equals(type)){
            handleSendText(intent); //call method to handle sended text
        }
    }

    //OnClickListener for the "+" Button and functionality
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            text2Qr = text.getText().toString().trim();
            if(text2Qr.equals("")){
                Toast.makeText(getApplicationContext(), getResources().getText(R.string.error_text_first), Toast.LENGTH_SHORT).show();
            } else {
                multiFormatWriter = new MultiFormatWriter();
                try{
                    BitMatrix bitMatrix = multiFormatWriter.encode(text2Qr, format, 500,500);
                    BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
                    bitmap = barcodeEncoder.createBitmap(bitMatrix);
                    image.setImageBitmap(bitmap);
                } catch (Exception e){
                    Toast.makeText(activity.getApplicationContext(), getResources().getText(R.string.error_generate), Toast.LENGTH_LONG).show();
                }
            }

        }
    });

}
 
Example 35
Project: fab-submenu   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    fabSettings = (FloatingActionButton) this.findViewById(R.id.fabSetting);

    layoutFabSave = (LinearLayout) this.findViewById(R.id.layoutFabSave);
    layoutFabEdit = (LinearLayout) this.findViewById(R.id.layoutFabEdit);
    layoutFabPhoto = (LinearLayout) this.findViewById(R.id.layoutFabPhoto);
    //layoutFabSettings = (LinearLayout) this.findViewById(R.id.layoutFabSettings);

    //When main Fab (Settings) is clicked, it expands if not expanded already.
    //Collapses if main FAB was open already.
    //This gives FAB (Settings) open/close behavior
    fabSettings.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (fabExpanded == true){
                closeSubMenusFab();
            } else {
                openSubMenusFab();
            }
        }
    });

    //Only main FAB is visible in the beginning
    closeSubMenusFab();
}
 
Example 36
Project: Oremus   File: ScrollingActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scrolling);
    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) {
            Intent i = new Intent(ScrollingActivity.this,MainActivity.class);
            startActivity(i);
        }
    });


    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    if (!prefs.getBoolean("firstTime", false)) {

        Intent alarmIntent = new Intent(this, AlarmReciever.class);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, 0);

        AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);

        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(System.currentTimeMillis());
        calendar.set(Calendar.HOUR_OF_DAY, 6);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 1);

        manager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
                AlarmManager.INTERVAL_DAY, pendingIntent);

        SharedPreferences.Editor editor = prefs.edit();
        editor.putBoolean("firstTime", true);
        editor.apply();
    }

}
 
Example 37
Project: Eye   File: HomeActivity.java   View source code 5 votes vote down vote up
/**
 * Starts the activity and gets the references to the
 * inflated UI components; also calculates the screen
 * dimensions, sets up the initial state of the app
 * and the camera.
 *
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    context = getApplicationContext();
    setContentView(R.layout.activity_home);

    try {
        getSupportActionBar().hide();
    } catch (NullPointerException ignored) {
        Log.d(TAG, "Null pointer exception while hiding the action bar.");
    } catch (Exception e) {
        Log.d(TAG, "Eexception while hiding the action bar : " + e.getMessage());
    }


    introHintView = findViewById(R.id.introHint);
    mFaceOverlays = (RelativeLayout) findViewById(R.id.facesOverlay);
    mSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
    mDetectedTextView = (TextView) findViewById(R.id.detectedTextView);
    mTrackingTextView = (TextView) findViewById(R.id.trackingTextView);
    mSelectorSwitch = (SelectorSwitch) findViewById(R.id.LODSwitch);
    previewFAB = (FloatingActionButton) findViewById(R.id.startPreviewBtn);
    activity = this;

    mSurfaceView.post(new Runnable() {
        @Override
        public void run() {
            screenMaxX = mSurfaceView.getWidth();
            screenMaxY = mSurfaceView.getHeight();
            setupInitialState();
            setupOutputSurfaces();
            status_OK = setupCamera();
        }
    });
}
 
Example 38
Project: apps_small   File: LoginActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    // The floating action button.
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Snackbar.make(view, "Please enter your username and password.", Snackbar.LENGTH_LONG)
                    .setAction("Action", null).show();
        }
    });

    // They should log in.
    logInBool = true;

    // Define our views.
    registerText = (TextView)findViewById(R.id.registerText);
    logInButton = (Button)findViewById(R.id.loginButton);
    passText = (EditText) findViewById(R.id.passwordEditText);
    nameText = (EditText)findViewById(R.id.nameEditText);
    linLogLay = (LinearLayout)findViewById(R.id.linLogLay);
    camLogo = (ImageView)findViewById(R.id.camLogo);

    // Define our listeners.
    camLogo.setOnClickListener(this);
    linLogLay.setOnClickListener(this);
    passText.setOnKeyListener(this);
    

    // Set the default values
    logInButton.setText("Log in!");
    registerText.setText("Register");

}
 
Example 39
Project: labtablet   File: ScrollAwareFabBehavior.java   View source code 5 votes vote down vote up
@Override
public void onNestedScroll(final CoordinatorLayout coordinatorLayout,
                           final FloatingActionButton child,
                           final View target, final int dxConsumed, final int dyConsumed,
                           final int dxUnconsumed, final int dyUnconsumed) {
    super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed,
            dxUnconsumed, dyUnconsumed);
    if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
        // User scrolled down and the FAB is currently visible -> hide the FAB
        child.hide();
    } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
        // User scrolled up and the FAB is currently not visible -> show the FAB
        child.show();
    }
}
 
Example 40
Project: Gallery-example   File: MediaBrowser.java   View source code 5 votes vote down vote up
@Override
public void onCompletion(EasyVideoPlayer player) {
    // TODO handle if needed

    fabPlay.show(new FloatingActionButton.OnVisibilityChangedListener() {
        @Override
        public void onShown(FloatingActionButton fab) {
            photoView.setVisibility(View.VISIBLE);
            videoView.setVisibility(View.GONE);

        }
    });
}