@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tiempo);
    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();
          }
        });

    try {
      inicializar();
      _tablas.setVisibility(View.INVISIBLE);
      descargarFichero();
      reload++;
    } catch (Exception e) {
      Toast.makeText(this, "Error al cargar los datos, intente recargar.", Toast.LENGTH_SHORT)
          .show();
    }
  }
Example #2
0
  // initView
  public void initView(View view) {

    final FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Animator animator =
                AnimatorInflater.loadAnimator(getActivity(), R.animator.animator_rotation);
            animator.setTarget(fab);
            animator.setInterpolator(new CycleInterpolator(2));
            animator.start();
            // bug here still
            changeTopic();
            onRefresh();
          }
        });

    // girlList = new ArrayList<>();
    recyclerView = (EasyRecyclerView) view.findViewById(R.id.recycler_view);
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setLayoutManager(linearLayoutManager);
    zhuanLanAdapter = new ZhuanLanAdapter(getActivity());
    doWithZhuanLan(zhuanLanAdapter);
    recyclerView.setRefreshListener(this);
    onRefresh();
  }
Example #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_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);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // init async handler
    asyncQuery = new MyAsyncQueryHandler(getContentResolver());

    setContentView(R.layout.activity_data_viewer);
    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) {
            DialogFragment newFragment = new DataEntryFragment();
            newFragment.show(getFragmentManager(), "dataentry");
          }
        });

    RecyclerView dataViewer = (RecyclerView) findViewById(R.id.viewer);
    LinearLayoutManager llm = new LinearLayoutManager(this);
    dataViewer.setLayoutManager(llm);
    mAdapter = new DataViewerAdapter();
    dataViewer.setAdapter(mAdapter);

    // Setup the loader
    getLoaderManager().initLoader(DATA_LOADER_ID, null, this);

    setUpTempDataDisplay();
    setUpTempDataUpdate_Del();
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // получаем плавающую кнопку из активити
    FloatingActionButton fab = ButterKnife.findById(getActivity(), R.id.fab);
    // получаем параметры Layout fab приведенные к родителю
    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
    // выставляем привязку якоря к appBarLayout
    params.setAnchorId(R.id.appbar_layout);
    // выставляем anchorGravity
    params.anchorGravity = Gravity.BOTTOM | Gravity.RIGHT;
    fab.setLayoutParams(params);
    // меняем иконку плавающей кнопки
    fab.setImageResource(R.drawable.ic_mode_edit_24dp);
    /*        fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) { //создаем и вешаем новый обработчик на fab
            //выбираем действие для fab в зависимости от текущего режима
            if (sCurrentFunctionality.equals(FUNCTIONALITY_PROFILE_VIEW)) {
                setupFuncionality(FUNCTIONALITY_PROFILE_EDIT);
            } else {
                setupFuncionality(FUNCTIONALITY_PROFILE_VIEW);
            }
        }
    });*/
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_item_app_bar);

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

    if (findViewById(R.id.item_detail_container) != null) {
      // The detail container view will be present only in the
      // large-screen layouts (res/values-large and
      // res/values-sw600dp). If this view is present, then the
      // activity should be in two-pane mode.
      tumbado = true;

      // In two-pane mode, list items should be given the
      // 'activated' state when touched.
      ((ItemListFragment) getSupportFragmentManager().findFragmentById(R.id.item_list))
          .setActivateOnItemClick(true);
    }

    // TODO: If exposing deep links into your app, handle intents here.
  }
  @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();
          }
        });

    mLinearListView = (LinearListView) findViewById(R.id.linearListView);

    mLinearListView.setAdapter(
        new ArrayAdapter<>(
            this,
            android.R.layout.simple_list_item_1,
            Arrays.asList("One", "Two", "Three", "Four", "Five", "Six", "Seven")));
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    Uri uri = Uri.parse("geo:0,0?q=東京駅");

    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    startActivity(intent);

    button_segue = (Button) findViewById(R.id.button_segue);
    button_segue.setOnClickListener(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();
          }
        });

    TextView textView = (TextView) findViewById(R.id.text);
    textView.setText("Hello, AS14 World!!");
  }
Example #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fikirinawesib7);

    toolbar = (Toolbar) findViewById(R.id.toolbar21);
    setSupportActionBar(toolbar);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    viewPager = (ViewPager) findViewById(R.id.viewpager21);
    setupViewPager(viewPager);

    tabLayout = (TabLayout) findViewById(R.id.tabs21);
    tabLayout.setupWithViewPager(viewPager);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("vnd.android-dir/mms-sms");
            intent.putExtra("address", "+251911202110");
            intent.putExtra("sms_body", "ሜሴጆን ይጻፉ!!!");
            startActivity(intent);
          }
        });
  }
Example #10
0
  @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();
          }
        });

    ToggleButton toggle = (ToggleButton) findViewById(R.id.toggleButton);

    toggle.setOnCheckedChangeListener(
        new CompoundButton.OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
              // 打开WIFI
            } else {
              // 关闭WIFI
            }
          }
        });
  }
  @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();
          }
        });

    nfcAdapter = NfcAdapter.getDefaultAdapter(this); // argument is "Context"
    if (nfcAdapter == null) {
      Toast.makeText(this, "Not a NFC device", Toast.LENGTH_SHORT).show();
      return;
    }

    // TODO go AsyncTask
    onNewIntent(getIntent());
  }
Example #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_form);
    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) {

            // create Intent to take a picture and return control to the calling application
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

            FileUri file = new FileUri();

            // fileUri = file.getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the
            // image
            // intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name

            // start the image capture Intent
            startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
          }
        });
  }
Example #13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // Create the adapter that will return a fragment for each of the three
    // primary sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Intent intent = new Intent(view.getContext(), StatisticsActivity.class);
            startActivity(intent);
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    DatabaseHandler dbHandler = new DatabaseHandler(this);

    // this will be moved into a service layer later
    if (dbHandler.getBookCount() == 0) {
      // if we have no books, then we must add the default ones
      BookService service = new BookService();
      Book bookToAdd = service.getDefaultEntry();
      dbHandler.addBook(bookToAdd);
    }

    List<Book> allBooksFromDb = dbHandler.getAllBooks();

    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) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });
  }
Example #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    RatingBar ratingBar = (RatingBar) findViewById(R.id.ratingbar);
    ratingBar.setOnRatingBarChangeListener(
        new RatingBar.OnRatingBarChangeListener() {
          @Override
          public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
            float f = ratingBar.getRating();
            Toast.makeText(MainActivity.this, "sucessfully Ratted " + f, Toast.LENGTH_SHORT).show();
          }
        });

    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 #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_favorites);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    Log.e("HudlU", "Here");

    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_favorites);

    mRecyclerView.setHasFixedSize(true);

    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);

    FavoriteUtil util = new FavoriteUtil();
    myFavorites = util.getAllFavorites(this);

    FavoriteAdapter adapter = new FavoriteAdapter(this, myFavorites);
    mRecyclerView.setAdapter(adapter);

    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 #17
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_application);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    activity = 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();
            Intent intent1 = new Intent(activity, RangeActivity.class);
            Intent intent2 = new Intent(activity, RangeCombinedActivity.class);
            Intent intent3 = new Intent(activity, RangeAreaActivity.class);
            Intent intent4 = new Intent(activity, DoubleRangeAreaActivity.class);
            startActivity(intent4);
          }
        });
  }
  @TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    inflaterFactory = new InjectPoolFactory(getLayoutInflater().getFactory2());
    // use introspection to allow a new Factory to be set
    try {
      Field field = LayoutInflater.class.getDeclaredField("mFactorySet");
      field.setAccessible(true);
      field.setBoolean(getLayoutInflater(), false);
      getLayoutInflater().setFactory2(inflaterFactory);
    } catch (NoSuchFieldException e) {
      // ...
    } catch (IllegalArgumentException e) {
      // ...
    } catch (IllegalAccessException e) {
      // ...
    }

    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);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    assert fab != null;
    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();
          }
        });

    mProductManager = new ProductManager(this);

    mButtonProductsAll = (Button) findViewById(R.id.button_products_all);
    mButtonProductsOnSale = (Button) findViewById(R.id.button_products_on_sale);
    mTextViewProductList = (TextView) findViewById(R.id.textview_product_list);

    setListeners();
  }
Example #20
0
 // Same animation that FloatingActionButton.Behavior uses to show the FAB when the AppBarLayout
 // enters
 private void animateIn(FloatingActionButton button) {
   button.setVisibility(View.VISIBLE);
   Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.abc_slide_in_bottom);
   anim.setDuration(600L);
   anim.setInterpolator(INTERPOLATOR);
   button.startAnimation(anim);
 }
  /**
   * Method used for performing a sample UPDATE and a DELETE on the content provider dataset This
   * caused the loader to update the recyclerview automatically with the updates
   */
  private void setUpTempDataUpdate_Del() {

    FloatingActionButton tempUpdate = (FloatingActionButton) findViewById(R.id.tempupdate);
    tempUpdate.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {

            // Sample UPDATE call
            ContentValues mNewValues = new ContentValues();
            mNewValues.put(DataEntryColumns.NAME, "my change at: " + new Date());
            String selectionClause = DataEntryColumns._ID + " = ?";
            String[] mSelectionArgs = {"2"};
            asyncQuery.startUpdate(
                ASYNC_UPDATE_TOKEN,
                null,
                DataEntryColumns.CONTENT_URI,
                mNewValues,
                selectionClause,
                mSelectionArgs);

            // Sample DELETE call. Deletes any rows with name containing "test"
            String delSelectionClause = DataEntryColumns.NAME + " LIKE ?";
            String[] delSelectionArgs = {"%test%"};
            asyncQuery.startDelete(
                ASYNC_DELETE_TOKEN,
                null,
                DataEntryColumns.CONTENT_URI,
                delSelectionClause,
                delSelectionArgs);
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display_message);
    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);

    Intent intent = getIntent();
    String message = intent.getStringExtra(MyActivity.EXTRA_MESSAGE);
    TextView textView = new TextView(this);
    textView.setTextSize(40);
    textView.setText(message);

    RelativeLayout layout = (RelativeLayout) findViewById(R.id.content);
    layout.addView(textView);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tarot_feedback);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(false);

    FloatingActionButton fablogin = (FloatingActionButton) findViewById(R.id.fab_login);
    fablogin.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (TextUtils.isEmpty(getUsername())) {
              facebookLogin();
            } else {
              addFeedback(getUsername());
            }
          }
        });
    RecyclerView rv = (RecyclerView) findViewById(R.id.recyclerview);
    rv.setHasFixedSize(true);
    LinearLayoutManager llm = new LinearLayoutManager(this);
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    rv.setLayoutManager(llm);
    updateList();
  }
Example #24
0
  @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();
          }
        });

    settingButton = (Button) findViewById(R.id.settingButton);
    settingButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            startActivity(accessibleIntent);
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.lista_socio_negocio_tab_fragment_lead, container, false);

    sideIndex = (LinearLayout) v.findViewById(R.id.sideIndex);
    lvSN = (ListView) v.findViewById(R.id.lvLstSocioLeadNeg);

    contexto = v.getContext();

    // Obtener el refreshLayout
    refreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swipeRefresh);

    // Seteamos los colores que se usar�n a lo largo de la animaci�n
    refreshLayout.setColorSchemeResources(R.color.s1, R.color.s2, R.color.s3, R.color.s4);

    // FLOATING BUTTON
    FloatingActionButton fab = (FloatingActionButton) v.findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            Intent registrarSN = new Intent(v.getContext(), MainSocioNegocio.class);
            startActivity(registrarSN);
          }
        });
    // FLOATING BUTTON

    lvSN.setOnItemLongClickListener(this);
    lvSN.setOnScrollListener(this);
    setHasOptionsMenu(true);
    return v;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // establish a connection to the database
    dbConn = new DatabaseConnection(this);

    // set up Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null) supportActionBar.setDisplayShowTitleEnabled(false);

    // set up ViewPager for the days
    calendar = new Calendar(this, (ViewPager) findViewById(R.id.dayPager), FoodDayFragment.class);
    TextView changeDateButton = (TextView) findViewById(R.id.changeDate);
    calendar.setChangeDateButton(
        changeDateButton, 0xFFFFFFFF, ContextCompat.getColor(this, R.color.colorAccent));

    // set up FAB
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            long dateLong = calendar.getDate().getTime();
            Intent intent = new Intent(MainActivity.this, SelectionActivity.class);
            intent.putExtra(SelectionActivity.DISPLAY_DATE, dateLong);
            startActivity(intent);
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    im1 = (ImageView) findViewById(R.id.im1);
    setSupportActionBar(toolbar);

    new AsyncTask<Void, Void, Void>() {
      @Override
      protected Void doInBackground(Void... params) {
        try {
          bitmap = Glide.with(MainActivity.this).load(url).asBitmap().into(500, 500).get();
        } catch (InterruptedException e) {
          e.printStackTrace();
        } catch (ExecutionException e) {
          e.printStackTrace();
        }
        return null;
      }
    }.execute();
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            im1.setImageBitmap(bitmap);
          }
        });
  }
Example #28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Firebase.setAndroidContext(this);
    myFirebaseRef = new Firebase("https://crudbuccola.firebaseio.com/");
    setPeople();
    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, "Created by Megan Buccola", Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });
    listView = (ListView) findViewById(R.id.lvPeople);
    Button add = (Button) findViewById(R.id.btnAdd);
    add.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            startActivity(new Intent(MainActivity.this, Add.class));
          }
        });
  }
Example #29
0
  private void initFloatingActionButton() {
    FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
    if (fab != null) {
      if (isMyAccount()) {
        // Own log, button opens window to add training
        fab.setVisibility(View.VISIBLE);
        fab.setImageResource(R.drawable.ic_playlist_add);
        fab.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                Activity activity = getActivity();
                Fragment fragment = TrainingFragment.newInstance();
                FragmentTransaction transaction = activity.getFragmentManager().beginTransaction();

                transaction.replace(R.id.fragment_container, fragment);
                transaction.addToBackStack(null);
                transaction.commit();
              }
            });
      } else {
        // Someone else's log, button opens window to add comment
        // TODO
        fab.setVisibility(View.GONE);
      }
    }
  }
Example #30
0
  @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();
          }
        });
    lvItems = (ListView) findViewById(R.id.lvItems);
    // items = new ArrayList<>();
    readItems();
    itemsAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items);
    lvItems.setAdapter(itemsAdapter);
    // items.add("First Item");
    // items.add("Second Item");
    setupListViewListener();
  }