Esempio n. 1
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == TAKE_PIC && resultCode == RESULT_OK) {
     if (nbPicture == 0) sliderShow.removeAllSliders();
     TextSliderView pic_test = new TextSliderView(this);
     pic_test.description("C'est bon ça").image(outPutfileUri.toString());
     sliderShow.addSlider(pic_test);
     nbPicture++;
   }
 }
Esempio n. 2
0
  private void initSlider() {

    if (mBanner != null) {

      for (Banner banner : mBanner) {

        TextSliderView textSliderView = new TextSliderView(this.getActivity());
        textSliderView.image(banner.getImgUrl());
        textSliderView.description(banner.getName());
        textSliderView.setScaleType(BaseSliderView.ScaleType.Fit);
        mSliderLayout.addSlider(textSliderView);
      }
    }

    mSliderLayout.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);

    mSliderLayout.setCustomAnimation(new DescriptionAnimation());
    mSliderLayout.setPresetTransformer(SliderLayout.Transformer.RotateUp);
    mSliderLayout.setDuration(3000);
  }
  @Override
  public void onActivityCreated2(Bundle savedInstanceState) {

    HashMap<String, String> url_maps = new HashMap<String, String>();
    url_maps.put(
        "Hannibal",
        "http://static2.hypable.com/wp-content/uploads/2013/12/hannibal-season-2-release-date.jpg");
    url_maps.put("Big Bang Theory", "http://tvfiles.alphacoders.com/100/hdclearart-10.png");
    url_maps.put("House of Cards", "http://cdn3.nflximg.net/images/3093/2043093.jpg");
    url_maps.put(
        "Game of Thrones",
        "http://images.boomsbeat.com/data/images/full/19640/game-of-thrones-season-4-jpg.jpg");
    for (String name : url_maps.keySet()) {
      DefaultSliderView defaultSliderView = new DefaultSliderView(getActivity());
      defaultSliderView.image(url_maps.get(name));
      TextSliderView textSliderView = new TextSliderView(getActivity());
      // initialize a SliderLayout
      textSliderView
          .description(name)
          .image(url_maps.get(name))
          .setScaleType(BaseSliderView.ScaleType.Fit)
          .setOnSliderClickListener(this);
      // add your extra information
      textSliderView.getBundle().putString("extra", name);
      mDemoSlider.addSlider(defaultSliderView);
    }
    mDemoSlider.setPresetTransformer(SliderLayout.Transformer.Accordion);
    mDemoSlider.setPresetIndicator(SliderLayout.PresetIndicators.Center_Bottom);
    mDemoSlider.setCustomAnimation(new DescriptionAnimation());
    mDemoSlider.setDuration(4000);
    mDemoSlider.setCustomIndicator(customIndicator);
  }
  public SlideLoader(SliderLayout slider, View parent) {
    mDemoSlider = slider;
    items = new ArrayList<>();
    final TextView textFeatured = (TextView) parent.findViewById(R.id.idFeatured);
    textFeatured.setText("");
    final ProgressDialog progressSlider =
        ProgressDialog.show(
            mDemoSlider.getContext(), "Please wait", "Loading product catalog...", false, false);

    AsyncTaskCompat.executeParallel(
        new AsyncTask<Void, Void, String>() {

          public void getFeaturedProducts() {
            for (final Item featuredItem : items) {
              CustomSlider customSlider = new CustomSlider(mDemoSlider.getContext());
              customSlider
                  .description(featuredItem.getName())
                  .image(featuredItem.getImageUrl())
                  .setScaleType(BaseSliderView.ScaleType.Fit)
                  .setOnSliderClickListener(sliderClick);
              customSlider.setPrice(featuredItem.getPrice());
              mDemoSlider.addSlider(customSlider);
            }

            mDemoSlider.setPresetTransformer(SliderLayout.Transformer.FlipHorizontal);
            mDemoSlider.addOnPageChangeListener(
                new ViewPagerEx.OnPageChangeListener() {
                  @Override
                  public void onPageScrolled(
                      int position, float positionOffset, int positionOffsetPixels) {}

                  @Override
                  public void onPageSelected(int position) {
                    index = position;
                  }

                  @Override
                  public void onPageScrollStateChanged(int state) {}
                });
          }

          private final BaseSliderView.OnSliderClickListener sliderClick =
              new BaseSliderView.OnSliderClickListener() {
                @Override
                public void onSliderClick(BaseSliderView slider) {
                  Intent intent = new Intent(mDemoSlider.getContext(), ItemDetailActivity.class);
                  intent.putExtra("itemName", items.get(index).getName());
                  intent.putExtra("itemImage", items.get(index).getImageUrl());
                  intent.putExtra("itemDetails", items.get(index).getDetails());
                  intent.putExtra("itemID", items.get(index).getId());
                  intent.putExtra("itemPrice", Utilities.getCurrency(items.get(index).getPrice()));
                  mDemoSlider.getContext().startActivity(intent);
                }
              };

          public void CheckNetworkConnection() {
            mDemoSlider.stopAutoCycle();
            CustomSlider customSlider = new CustomSlider(mDemoSlider.getContext());
            customSlider
                .description("Please check your internet connection.")
                .setScaleType(BaseSliderView.ScaleType.Fit)
                .image(R.drawable.warn);
            mDemoSlider.addSlider(customSlider);
            final TextView textSeeMore = (TextView) mDemoSlider.findViewById(R.id.idseeMoreContent);
            textFeatured.setText("Connection Error!");
            textSeeMore.setText("");
          }

          @Override
          protected String doInBackground(Void... params) {
            try {
              return Utilities.webServiceCall(
                  Constants.HostAddress + "/Api/GetFeatured?apiToken=" + Constants.ApiKey, items);
            } catch (Exception e) {
              return "Failed";
            }
          }

          @Override
          protected void onPostExecute(String result) {
            if (result.equals("Success")) {
              getFeaturedProducts();
              progressSlider.dismiss();
              textFeatured.setText("Featured Products");
            } else {
              CheckNetworkConnection();
              progressSlider.dismiss();
            }
            super.onPostExecute(result);
          }
        });
  }
Esempio n. 5
0
  @Override
  public void onDestroy() {
    super.onDestroy();

    mSliderLayout.stopAutoCycle();
  }
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ActivitiesFragmentBinding binding =
        DataBindingUtil.inflate(inflater, R.layout.activities_fragment, container, false);
    binding.setCategory(category);

    Toolbar toolbar = binding.toolbar;
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(toolbar);
    assert activity.getSupportActionBar() != null;
    final ActionBar ab = activity.getSupportActionBar();
    ab.setDisplayShowTitleEnabled(false);
    ab.setDisplayHomeAsUpEnabled(false);

    Spinner spinner = binding.spinner;
    spinner.setAdapter(
        new ArrayAdapter<>(
            ab.getThemedContext(), android.R.layout.simple_spinner_item, localizedCategory));
    spinner.setOnItemSelectedListener(
        new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            if (currentCategory != position) {
              currentCategory = position;
              category.set(localizedCategory[currentCategory]);
              activities.clear();
              list.getAdapter().notifyDataSetChanged();
            }
          }

          @Override
          public void onNothingSelected(AdapterView<?> parent) {}
        });

    slider = binding.slider;
    slider.setCustomIndicator(binding.customIndicator);
    slider.setDuration(3500);
    slider.setPresetTransformer(SliderLayout.Transformer.Fade);
    api.getActivities("recommendations", 0, 5)
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(
            new Action1<List<Activity>>() {
              @Override
              public void call(List<Activity> activities) {
                slider.stopAutoCycle();
                slider.removeAllSliders();
                for (Activity activity : activities) {
                  ActivitySliderView view = new ActivitySliderView(getContext(), activity);
                  view.bundle(new Bundle());
                  view.getBundle().putLong("id", activity.getId());
                  view.setOnSliderClickListener(sliderClickListener);
                  slider.addSlider(view);
                }
                slider.startAutoCycle();
              }
            },
            new Action1<Throwable>() {
              @Override
              public void call(Throwable throwable) {
                Timber.e("failed to fetch recommended activities", throwable);
                throwable.printStackTrace();
              }
            });

    list = binding.list;
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
    list.setLayoutManager(linearLayoutManager);
    list.addItemDecoration(new MarginDownDecoration(getContext()));
    list.setAdapter(new ActivitiesAdapter(activities));
    list.addOnScrollListener(
        new EndlessRecyclerOnScrollListener(linearLayoutManager) {
          @Override
          public void onLoadMore(int currentPage) {
            loadPage(currentPage);
          }
        });

    // loadPage(0);

    return binding.getRoot();
  }
 @Override
 public void onPause() {
   slider.stopAutoCycle();
   super.onPause();
 }
 @Override
 public void onResume() {
   super.onResume();
   slider.startAutoCycle();
 }
Esempio n. 9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_vue);

    addPhoto = (FloatingActionButton) findViewById(R.id.camera);

    /* Initialise toolbar */
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_keyboard_backspace_white_24dp);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Tool.reset_bellevue_dir(root);
            finish();
          }
        });

    TextView mTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
    mTitle.setTypeface(
        com.bellevue.starter.CustomFontsLoader.getTypeface(
            this, com.bellevue.starter.CustomFontsLoader.AlexBrush));

    toolbar.inflateMenu(R.menu.menu_add_view);

    /* Initialise slider */
    sliderShow = (SliderLayout) findViewById(R.id.slider);

    if (nbPicture == 0) {
      TextSliderView picture1 = new TextSliderView(this);
      picture1
          .description("Take some pictures !")
          .image("https://tedconfblog.files.wordpress.com/2014/12/8photography_tips.png");
      sliderShow.addSlider(picture1);
      sliderShow.stopAutoCycle();
    }

    /* Take Picture */
    takePhoto();

    /* Initialise select categorie */
    Resources res = getResources();
    int flat_blu_app = res.getColor(R.color.pri_dark);
    final int flat_blu = res.getColor(R.color.water_point);
    final int flat_green = res.getColor(R.color.garden_point);
    final int flat_yellow = res.getColor(R.color.landscape);
    final int flat_grey = res.getColor(R.color.place);

    /* Bubble help */
    final TextView categorie_info = (TextView) findViewById(R.id.info);
    /*
    Drawable[] bubble = categorie_info.getCompoundDrawables();
    if (bubble[0] != null) {
        bubble[0].setColorFilter(flat_blu_app, PorterDuff.Mode.MULTIPLY);
    }
    */

    /* ImageView Color */
    ImageView cat1 = (ImageView) findViewById(R.id.water_point);
    ImageView cat2 = (ImageView) findViewById(R.id.garden_point);
    ImageView cat3 = (ImageView) findViewById(R.id.landscape);
    ImageView cat4 = (ImageView) findViewById(R.id.place);

    Drawable dr =
        ContextCompat.getDrawable(getBaseContext(), R.drawable.ic_add_location_white_24dp);
    Bitmap bitmap = ((BitmapDrawable) dr).getBitmap();

    Drawable d =
        new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(bitmap, 100, 100, true));
    Drawable clone = d.getConstantState().newDrawable();
    Drawable clone2 = clone.getConstantState().newDrawable();
    Drawable clone3 = clone2.getConstantState().newDrawable();

    cat1.setImageDrawable(d);
    cat1.setColorFilter(flat_blu);
    cat2.setImageDrawable(clone);
    cat2.setColorFilter(flat_green);
    cat3.setImageDrawable(clone2);
    cat3.setColorFilter(flat_yellow);
    cat4.setImageDrawable(clone3);
    cat4.setColorFilter(flat_grey);

    m_one = (RadioButton) findViewById(R.id.rad1);
    m_two = (RadioButton) findViewById(R.id.rad2);
    m_three = (RadioButton) findViewById(R.id.rad3);
    m_four = (RadioButton) findViewById(R.id.rad4);

    t1 = (android.support.design.widget.TextInputLayout) findViewById(R.id.text1);
    t2 = (android.support.design.widget.TextInputLayout) findViewById(R.id.text2);

    botLay = (LinearLayout) findViewById(R.id.bottomLay);

    m_one.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            m_one.setChecked(true);
            m_two.setChecked(false);
            m_three.setChecked(false);
            m_four.setChecked(false);
            Toast.makeText(getBaseContext(), "Vous selectionnez Point d'eau", Toast.LENGTH_SHORT)
                .show();
            t1.setBackgroundColor(flat_blu);
            t2.setBackgroundColor(flat_blu);
            botLay.setBackgroundColor(flat_blu);
          }
        });

    m_two.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            m_one.setChecked(false);
            m_two.setChecked(true);
            m_three.setChecked(false);
            m_four.setChecked(false);
            Toast.makeText(getBaseContext(), "Vous selectionnez Jardin", Toast.LENGTH_SHORT).show();
            t1.setBackgroundColor(flat_green);
            t2.setBackgroundColor(flat_green);
            botLay.setBackgroundColor(flat_green);
          }
        });

    m_three.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            m_one.setChecked(false);
            m_two.setChecked(false);
            m_three.setChecked(true);
            m_four.setChecked(false);
            Toast.makeText(getBaseContext(), "Vous selectionnez Panorama ", Toast.LENGTH_SHORT)
                .show();
            t1.setBackgroundColor(flat_yellow);
            t2.setBackgroundColor(flat_yellow);
            botLay.setBackgroundColor(flat_yellow);
          }
        });

    m_four.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            m_one.setChecked(false);
            m_two.setChecked(false);
            m_three.setChecked(false);
            m_four.setChecked(true);
            Toast.makeText(getBaseContext(), "Vous selectionnez Places", Toast.LENGTH_SHORT).show();

            t1.setBackgroundColor(flat_grey);
            t2.setBackgroundColor(flat_grey);
            botLay.setBackgroundColor(flat_grey);
          }
        });
  }