Search in sources :

Example 21 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project HotFix by dodola.

the class MainActivity method onCreate.

@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();
        }
    });
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 22 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project Pokemap by omkarmoghe.

the class MapWrapperFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    locationManager = LocationManager.getInstance(getContext());
    nianticManager = NianticManager.getInstance();
    locationManager.register(new LocationManager.Listener() {

        @Override
        public void onLocationChanged(Location location) {
            if (mLocation == null) {
                mLocation = location;
                initMap(true, true);
            } else {
                mLocation = location;
            }
        }

        @Override
        public void onLocationFetchFailed(@Nullable ConnectionResult connectionResult) {
            showLocationFetchFailed();
        }
    });
    // Inflate the layout for this fragment if the view is not null
    if (mView == null)
        mView = inflater.inflate(R.layout.fragment_map_wrapper, container, false);
    else {
    }
    // build the map
    if (mSupportMapFragment == null) {
        mSupportMapFragment = SupportMapFragment.newInstance();
        getChildFragmentManager().beginTransaction().replace(R.id.map, mSupportMapFragment).commit();
        mSupportMapFragment.setRetainInstance(true);
    }
    if (mGoogleMap == null) {
        mSupportMapFragment.getMapAsync(this);
    }
    FloatingActionButton locationFab = (FloatingActionButton) mView.findViewById(R.id.location_fab);
    locationFab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (mLocation != null && mGoogleMap != null) {
                mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(mLocation.getLatitude(), mLocation.getLongitude()), 15));
            } else {
                showLocationFetchFailed();
            }
        }
    });
    mView.findViewById(R.id.closeSuggestions).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            hideMapSuggestion();
        }
    });
    if (!mPref.getShowMapSuggestion()) {
        hideMapSuggestion();
    }
    return mView;
}
Also used : LocationManager(com.omkarmoghe.pokemap.controllers.map.LocationManager) ConnectionResult(com.google.android.gms.common.ConnectionResult) FloatingActionButton(android.support.design.widget.FloatingActionButton) LatLng(com.google.android.gms.maps.model.LatLng) View(android.view.View) Location(android.location.Location)

Example 23 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project dev-summit-architecture-demo by yigit.

the class FeedActivity method onCreate.

@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);
        }
    });
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) Toolbar(android.support.v7.widget.Toolbar)

Example 24 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project Synthese_2BIN by TheYoungSensei.

the class ItemListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_item_list);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitle(getTitle());
    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();
        }
    });
    View recyclerView = findViewById(R.id.item_list);
    assert recyclerView != null;
    setupRecyclerView((RecyclerView) recyclerView);
    if (findViewById(R.id.item_detail_container) != null) {
        // The detail container view will be present only in the
        // large-screen layouts (res/values-w900dp).
        // If this view is present, then the
        // activity should be in two-pane mode.
        mTwoPane = true;
    }
    model = ((Builder) getApplication()).getModel();
    model.registerObserver(this);
    ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
    task = new MyTask();
    if (networkInfo != null && networkInfo.isConnected()) {
        //fetch data
        task.execute("http://ws.audioscrobbler.com/2.0/?method=geo.gettopartists&country=belgium&api_key=32ef5df0e36797b605e205529058f3b8&format=json&limit=" + INT);
    } else {
    //ERROR
    }
}
Also used : NetworkInfo(android.net.NetworkInfo) ConnectivityManager(android.net.ConnectivityManager) FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar)

Example 25 with FloatingActionButton

use of android.support.design.widget.FloatingActionButton in project Synthese_2BIN by TheYoungSensei.

the class MainActivity method onCreate.

@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();
        }
    });
}
Also used : FloatingActionButton(android.support.design.widget.FloatingActionButton) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

FloatingActionButton (android.support.design.widget.FloatingActionButton)84 View (android.view.View)58 Toolbar (android.support.v7.widget.Toolbar)28 TextView (android.widget.TextView)20 ImageView (android.widget.ImageView)16 Intent (android.content.Intent)13 RecyclerView (android.support.v7.widget.RecyclerView)12 ColorStateList (android.content.res.ColorStateList)9 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)9 Bundle (android.os.Bundle)7 NavigationView (android.support.design.widget.NavigationView)7 TabLayout (android.support.design.widget.TabLayout)7 ViewPager (android.support.v4.view.ViewPager)7 ActionBar (android.support.v7.app.ActionBar)7 UiController (android.support.test.espresso.UiController)6 ViewAction (android.support.test.espresso.ViewAction)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)5 DrawerLayout (android.support.v4.widget.DrawerLayout)4 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)4