@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.animations_main_screen);

    mPhotosList = (ListView) findViewById(android.R.id.list);
    mImageView = (ImageView) findViewById(R.id.picture);
    mContainer = (ViewGroup) findViewById(R.id.container);

    // Prepare the ListView
    final ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, PHOTOS_NAMES);

    mPhotosList.setAdapter(adapter);
    mPhotosList.setOnItemClickListener(this);

    // Prepare the ImageView
    mImageView.setClickable(true);
    mImageView.setFocusable(true);
    mImageView.setOnClickListener(this);

    // Since we are caching large views, we want to keep their cache
    // between each animation
    mContainer.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);
  }
    public FacebookSetting(String title, String key) {
      this.key = key;
      view = LayoutInflater.from(SettingsActivity.this).inflate(R.layout.list_item_setting, null);
      TextView titleView = (TextView) view.findViewById(R.id.textview_setting);
      titleView.setText(title);
      LayoutParams iconParams = new LayoutParams(64, 64);

      icon = new ImageView(SettingsActivity.this);
      icon.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ic_facebook));
      icon.setLayoutParams(iconParams);

      loginDetails = new TextView(SettingsActivity.this);

      icon.setFocusable(false);
      loginDetails.setFocusable(false);
      titleView.setFocusable(false);

      loginDetails.setPadding(
          0, 0, (int) SettingsActivity.this.getResources().getDimension(R.dimen.default_margin), 0);

      ((ViewGroup) view).addView(loginDetails);
      ((ViewGroup) view).addView(icon);

      saveState();
    }
 public View getView(int position, View convertView, ViewGroup parent) {
   ImageView i = new ImageView(mContext);
   i.setFocusable(true);
   i.setFocusableInTouchMode(true);
   i.setImageResource(myCards[position]);
   i.setScaleType(ImageView.ScaleType.FIT_XY);
   i.setAdjustViewBounds(true);
   i.bringToFront();
   return i;
 }
 protected void a(View paramView, a parama, int paramInt) {
   parama.a(paramView);
   ImageView localImageView = (ImageView) paramView.findViewById(2131362474);
   paramView = (TextView) paramView.findViewById(2131362475);
   localImageView.setImageDrawable(parama.getIcon());
   paramView.setText(parama.getTitle());
   paramView.setEnabled(false);
   paramView.setFocusable(false);
   localImageView.setEnabled(false);
   localImageView.setFocusable(false);
   if (parama.d() == null) {
     parama.a(new ir(this));
   }
 }
  /**
   * Constructs a layout for the specified InfoBar. After calling this, be sure to set the message,
   * the buttons, and/or the custom content using setMessage(), setButtons(), and
   * setCustomContent().
   *
   * @param context The context used to render.
   * @param infoBarView InfoBarView that listens to events.
   * @param iconResourceId ID of the icon to use for the InfoBar.
   * @param iconBitmap Bitmap for the icon to use, if the resource ID wasn't passed through.
   * @param message The message to show in the infobar.
   */
  public InfoBarLayout(
      Context context,
      InfoBarView infoBarView,
      int iconResourceId,
      Bitmap iconBitmap,
      CharSequence message) {
    super(context);
    mInfoBarView = infoBarView;

    // Grab the dimensions.
    Resources res = getResources();
    mMargin = res.getDimensionPixelOffset(R.dimen.infobar_margin);
    mIconSize = res.getDimensionPixelSize(R.dimen.infobar_icon_size);
    mMinWidth = res.getDimensionPixelSize(R.dimen.infobar_min_width);
    mAccentColor = ApiCompatibilityUtils.getColor(res, R.color.infobar_accent_blue);

    // Set up the close button. Apply padding so it has a big touch target.
    mCloseButton = new ImageButton(context);
    mCloseButton.setId(R.id.infobar_close_button);
    mCloseButton.setImageResource(R.drawable.btn_close);
    TypedArray a = getContext().obtainStyledAttributes(new int[] {R.attr.selectableItemBackground});
    Drawable closeButtonBackground = a.getDrawable(0);
    a.recycle();
    mCloseButton.setBackground(closeButtonBackground);
    mCloseButton.setPadding(mMargin, mMargin, mMargin, mMargin);
    mCloseButton.setOnClickListener(this);
    mCloseButton.setContentDescription(res.getString(R.string.infobar_close));
    mCloseButton.setLayoutParams(new LayoutParams(0, -mMargin, -mMargin, -mMargin));

    // Set up the icon.
    if (iconResourceId != 0 || iconBitmap != null) {
      mIconView = new ImageView(context);
      if (iconResourceId != 0) {
        mIconView.setImageResource(iconResourceId);
      } else if (iconBitmap != null) {
        mIconView.setImageBitmap(iconBitmap);
      }
      mIconView.setLayoutParams(new LayoutParams(0, 0, mMargin / 2, 0));
      mIconView.getLayoutParams().width = mIconSize;
      mIconView.getLayoutParams().height = mIconSize;
      mIconView.setFocusable(false);
    }

    // Set up the message view.
    mMessageTextView = (TextView) LayoutInflater.from(context).inflate(R.layout.infobar_text, null);
    mMessageTextView.setText(message, TextView.BufferType.SPANNABLE);
    mMessageTextView.setMovementMethod(LinkMovementMethod.getInstance());
    mMessageTextView.setLinkTextColor(mAccentColor);
    mMessageView = mMessageTextView;
  }
 private void addIconTab(final int position, int resId) {
   ImageView tab = new ImageView(getContext());
   tab.setFocusable(true);
   tab.setImageResource(resId);
   tab.setScaleType(ImageView.ScaleType.CENTER);
   tab.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           pager.setCurrentItem(position);
         }
       });
   tabsContainer.addView(tab);
   tab.setSelected(position == currentPosition);
 }
  @Override
  public View getChildView(
      int groupPosition,
      int childPosition,
      boolean isLastChild,
      View convertView,
      ViewGroup parent) {
    View v = null;
    if (convertView != null) v = convertView;
    else v = inflater.inflate(R.layout.favoris_item_view, parent, false);
    LigneModel ligneModel = (LigneModel) getChild(groupPosition, childPosition);

    ImageView imgNumLigne = (ImageView) v.findViewById(R.id.imgNumLigne);

    int imageResource;
    Drawable image;

    if (imgNumLigne != null) {
      imageResource =
          ctx.getResources()
              .getIdentifier(
                  LigneModelService.getNumLigneImage(
                      ligneModel.getTypeLigne(), ligneModel.getNumLigne()),
                  "drawable",
                  ctx.getPackageName());

      if (imageResource != 0) {
        image = ctx.getResources().getDrawable(imageResource);
        imgNumLigne.setImageDrawable(image);
        imgNumLigne.setPadding(60, 0, 0, 0);
      } else {
        imgNumLigne.setImageDrawable(null);
      }
    }

    ImageButton btnFavorite = (ImageButton) v.findViewById(R.id.btnFavorite);

    btnFavorite.setFocusable(false);
    imgNumLigne.setFocusable(false);

    if (ligneModel.isFavoris()) {
      btnFavorite.setImageDrawable(ctx.getResources().getDrawable(android.R.drawable.star_big_on));
    } else {
      btnFavorite.setImageDrawable(ctx.getResources().getDrawable(android.R.drawable.star_big_off));
    }

    return v;
  }
Example #8
0
  public ToolbarMenuItem(
      Context context,
      ToolbarMenuItem.ToolbarMenuItemCallback callback,
      Object id,
      int order,
      Drawable drawable) {
    this.id = id;
    this.order = order;
    this.callback = callback;

    if (drawable != null) {
      imageView = new ImageView(context);
      imageView.setOnClickListener(this);
      imageView.setFocusable(true);
      imageView.setScaleType(ImageView.ScaleType.CENTER);
      imageView.setLayoutParams(new LinearLayout.LayoutParams(dp(56), dp(56)));
      int p = dp(16);
      imageView.setPadding(p, p, p, p);

      imageView.setImageDrawable(drawable);

      setRoundItemBackground(imageView);
    }
  }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    if (values.get(position).isSection()) {
      ImageView view = new ImageView(context);
      if (m.theme1 == 0) view.setImageResource(R.color.divider);
      else view.setImageResource(R.color.divider_dark);
      view.setClickable(false);
      view.setFocusable(false);
      if (m.theme1 == 0) view.setBackgroundColor(Color.WHITE);
      else view.setBackgroundResource(R.color.background_material_dark);
      view.setLayoutParams(
          new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, m.dpToPx(17)));
      view.setPadding(0, m.dpToPx(8), 0, m.dpToPx(8));
      return view;
    } else {
      View view = inflater.inflate(R.layout.drawerrow, parent, false);
      final TextView txtTitle = (TextView) view.findViewById(R.id.firstline);
      final ImageView imageView = (ImageView) view.findViewById(R.id.icon);
      if (m.theme1 == 0) {
        view.setBackgroundResource(R.drawable.safr_ripple_white);
      } else {
        view.setBackgroundResource(R.drawable.safr_ripple_black);
      }
      view.setOnClickListener(
          new View.OnClickListener() {

            public void onClick(View p1) {
              m.selectItem(position);
            }
            // TODO: Implement this method

          });
      view.setOnLongClickListener(
          new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
              if (!getItem(position).isSection())
                // not to remove the first bookmark (storage) and permanent bookmarks
                if (position > m.storage_count && position < values.size() - 7) {
                  EntryItem item = (EntryItem) getItem(position);
                  String path = (item).getPath();
                  if (m.mainActivityHelper.contains(path, m.books) != -1) {
                    m.renameBookmark(((EntryItem) getItem(position)).getTitle(), path);
                  } else if (path.startsWith("smb:/")) {
                    m.showSMBDialog(item.getTitle(), path, true);
                  }
                } else if (position < m.storage_count) {
                  String path = ((EntryItem) getItem(position)).getPath();
                  if (!path.equals("/"))
                    new Futils()
                        .showProps(RootHelper.generateBaseFile(new File(path), true), m, m.theme1);
                }

              // return true to denote no further processing
              return true;
            }
          });

      txtTitle.setText(((EntryItem) (values.get(position))).getTitle());
      imageView.setImageDrawable(getDrawable(position));
      imageView.clearColorFilter();
      if (myChecked.get(position)) {
        if (m.theme1 == 0) view.setBackgroundColor(Color.parseColor("#ffeeeeee"));
        else view.setBackgroundColor(Color.parseColor("#ff424242"));
        imageView.setColorFilter(fabskin);
        txtTitle.setTextColor(Color.parseColor(m.fabskin));
      } else {
        if (m.theme1 == 0) {
          imageView.setColorFilter(Color.parseColor("#666666"));
          txtTitle.setTextColor(m.getResources().getColor(android.R.color.black));
        } else {
          imageView.setColorFilter(Color.WHITE);
          txtTitle.setTextColor(m.getResources().getColor(android.R.color.white));
        }
      }

      return view;
    }
  }
Example #10
0
  protected void onCreateBeforeSurface(ResourceManager mResourceManager) {
    Log.d("Python", "onCreateBeforeSurface()");

    // Create the basic frame layout
    mFrameLayout = new FrameLayout(this);
    mFrameLayout.setBackgroundColor(0xFF212121);

    // Load animated image from resource and put it on screen
    mSplashLayout = new FrameLayout(this);

    // Load animated image from resource and put it on screen
    mAnimView = new ImageView(this);

    // don't show splash zoom
    // InputStream is = this.getClass().getResourceAsStream("/res/splashlogo.png");
    // mAnimView.setImageDrawable(Drawable.createFromStream(is, ""));

    // int logow = mAnimView.getDrawable().getIntrinsicWidth();
    // int logoh = mAnimView.getDrawable().getIntrinsicHeight();
    // float fact = 0.1f*(float)mDisplaySize.x/720.0f;
    mAnimView.setFocusable(false);
    FrameLayout.LayoutParams animlayoutparams =
        new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    animlayoutparams.gravity = Gravity.CENTER;

    // Load fixed splash screen
    imageItem = new ImageView(this);

    // don't show splash zoom
    // int presplashId = mResourceManager.getIdentifier("presplash", "drawable");
    // imageItem.setImageResource(presplashId);

    imageItem.setFocusable(false);
    FrameLayout.LayoutParams itemlayoutparams =
        new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
    itemlayoutparams.gravity = Gravity.BOTTOM;
    itemlayoutparams.setMargins(0, 0, 0, mDisplaySize.y / 8);

    // alpha-rgb background - because our image is scaled to height not width
    mSplashLayout.setBackgroundColor(0xFF212121);
    mAnimView.setLayoutParams(animlayoutparams);
    imageItem.setLayoutParams(itemlayoutparams);
    mSplashLayout.addView(imageItem);
    mSplashLayout.addView(mAnimView);
    mFrameLayout.addView(mSplashLayout);
    mAnimView.setVisibility(View.VISIBLE);

    // Set animation
    ScaleAnimation anim =
        new ScaleAnimation(
            0.1f,
            3.0f,
            0.1f,
            3.0f,
            Animation.RELATIVE_TO_SELF,
            0.5f,
            Animation.RELATIVE_TO_SELF,
            0.5f);

    // don't show splash zoom
    // anim.setDuration(3000);
    anim.setDuration(1);

    anim.setAnimationListener(
        new AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {
            Log.d("Python", "Animation started");
          }

          @Override
          public void onAnimationRepeat(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            Log.d("Python", "Animation ended");
            if (!skipProgress) {
              // don't compensate for not showing splash zoom
              int aDelayProgress = 2000 + 3000;
              if (MyAppActivity.mShowTutotrial) {
                // CarouselScreenActivity.Create(mFrameLayout, (Activity)MyAppActivity.myActivity);
                aDelayProgress = 15000 + 3000;
              }

              // create progress frame
              {
                Log.d("Python", "creating progress");
                ProgressScreen.Create(
                    mFrameLayout, (Activity) MyAppActivity.myActivity, aDelayProgress);
                Log.d("Python", "progress created");
              }
            }
            mFrameLayout.removeView(mSplashLayout);
            mAnimView.setImageBitmap(null);
            imageItem.setImageBitmap(null);
            mSplashLayout = null;
          }
        });
    mAnimView.startAnimation(anim);
  }
Example #11
0
 protected void onPostExecute(Bitmap result) {
   bmImage.setImageBitmap(result);
   bmImage.setFocusable(false);
   bmImage.setFocusableInTouchMode(false);
 }
      @Override
      public boolean setViewValue(View view, Cursor cursor, int columnIndex) {

        if (cursor.getColumnName(columnIndex).equals(PromptResponses.PROMPT_RESPONSE_VALUE)) {
          final String value = cursor.getString(columnIndex);

          if (view.getTag() instanceof ImageView) {
            String campaignUrn = cursor.getString(cursor.getColumnIndex(Responses.CAMPAIGN_URN));
            final File file = Response.getTemporaryResponsesMedia(value);
            final ImageView imageView = (ImageView) view.getTag();

            if (file != null && file.exists()) {
              try {
                BitmapDrawable d = (BitmapDrawable) imageView.getDrawable();
                if (d != null) d.getBitmap().recycle();
                Bitmap img = Utilities.decodeImage(file, 600);
                imageView.setImageBitmap(img);
                imageView.setOnClickListener(
                    new View.OnClickListener() {

                      @Override
                      public void onClick(View v) {
                        Analytics.widget(v, "View Local Fullsize Image");
                        Intent intent = new Intent(Intent.ACTION_VIEW);
                        intent.setDataAndType(Uri.fromFile(file), "image/jpeg");
                        mContext.startActivity(intent);
                      }
                    });
                return true;
              } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              } catch (IOException e) {
                Log.e(TAG, "Error decoding image", e);
              }
            }

            String url = OhmageApi.defaultImageReadUrl(value, campaignUrn, "small");
            final String largeUrl = OhmageApi.defaultImageReadUrl(value, campaignUrn, null);
            imageView.setOnClickListener(
                new View.OnClickListener() {

                  @Override
                  public void onClick(View v) {
                    Analytics.widget(v, "View Fullsize Image");
                    Intent intent =
                        new Intent(OhmageApplication.ACTION_VIEW_REMOTE_IMAGE, Uri.parse(largeUrl));
                    mContext.startActivity(intent);
                  }
                });

            mImageLoader.clearErrors();
            BindResult bindResult =
                mImageLoader.bind(
                    (ImageView) view.getTag(),
                    url,
                    new Callback() {

                      @Override
                      public void onImageLoaded(ImageView view, String url) {
                        imageView.setVisibility(View.VISIBLE);
                        imageView.setClickable(true);
                        imageView.setFocusable(true);
                      }

                      @Override
                      public void onImageError(ImageView view, String url, Throwable error) {
                        imageView.setVisibility(View.VISIBLE);
                        imageView.setImageResource(android.R.drawable.ic_dialog_alert);
                        imageView.setClickable(false);
                        imageView.setFocusable(false);
                      }
                    });
            if (bindResult == ImageLoader.BindResult.ERROR) {
              imageView.setImageResource(android.R.drawable.ic_dialog_alert);
              imageView.setClickable(false);
              imageView.setFocusable(false);
            } else if (bindResult == ImageLoader.BindResult.LOADING) {
              imageView.setVisibility(View.GONE);
            }
          } else if (view.getTag() instanceof TextView) {
            String prompt_type = getItemPromptType(cursor);
            if ("multi_choice_custom".equals(prompt_type) || "multi_choice".equals(prompt_type)) {
              try {
                JSONArray choices = new JSONArray(value);
                StringBuilder builder = new StringBuilder();
                for (int i = 0; i < choices.length(); i++) {
                  if (i != 0) builder.append("<br\\>");
                  builder.append("&bull; ");
                  builder.append(OhmageMarkdown.parseHtml(choices.get(i).toString()));
                }
                ((TextView) view.getTag()).setText(Html.fromHtml(builder.toString()));
                return true;
              } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
            } else if ("single_choice_custom".equals(prompt_type)
                || "single_choice".equals(prompt_type)) {
              ((TextView) view.getTag()).setText(OhmageMarkdown.parse(value));
              return true;
            } else if ("timestamp".equals(prompt_type)) {
              SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
              try {
                long time = format.parse(value).getTime();
                StringBuilder timeDisplay =
                    new StringBuilder(
                        DateUtils.formatDateTime(mContext, time, DateUtils.FORMAT_SHOW_YEAR));
                timeDisplay.append(" at ");
                timeDisplay.append(
                    DateUtils.formatDateTime(mContext, time, DateUtils.FORMAT_SHOW_TIME));

                ((TextView) view.getTag()).setText(timeDisplay);
                return true;
              } catch (ParseException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
            }
            ((TextView) view.getTag()).setText(value);
          }
          return true;
        }

        return false;
      }