// Adds a reminder to the displayed list of reminders.
  // Returns true if successfully added reminder, false if no reminders can
  // be added.
  static boolean addReminder(
      Activity activity,
      View.OnClickListener listener,
      ArrayList<LinearLayout> items,
      ArrayList<Integer> values,
      ArrayList<String> labels,
      int minutes) {

    if (items.size() >= MAX_REMINDERS) {
      return false;
    }

    LayoutInflater inflater = activity.getLayoutInflater();
    LinearLayout parent = (LinearLayout) activity.findViewById(R.id.reminder_items_container);
    LinearLayout reminderItem = (LinearLayout) inflater.inflate(R.layout.edit_reminder_item, null);
    parent.addView(reminderItem);

    Spinner spinner = (Spinner) reminderItem.findViewById(R.id.reminder_value);
    Resources res = activity.getResources();
    spinner.setPrompt(res.getString(R.string.reminders_title));
    int resource = android.R.layout.simple_spinner_item;
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity, resource, labels);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);

    ImageButton reminderRemoveButton;
    reminderRemoveButton = (ImageButton) reminderItem.findViewById(R.id.reminder_remove);
    reminderRemoveButton.setOnClickListener(listener);

    int index = findMinutesInReminderList(values, minutes);
    spinner.setSelection(index);
    items.add(reminderItem);

    return true;
  }
  public void addRow(View view) {

    EditText editText = (EditText) _popPopupWindow.getContentView().findViewById(R.id.skillInput);

    if (!_newsTopics.contains(editText.getText().toString())) {
      LinearLayout linear = (LinearLayout) findViewById(R.id.LinearLayout1);

      LayoutInflater inflater =
          (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View rowView = (View) inflater.inflate(R.layout.row, null, false);

      TextView skillName = (TextView) rowView.findViewById(R.id.skillName);
      skillName.setText(editText.getText().toString());
      final Context mainActivity = this;

      rowView.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              Intent intent = new Intent(mainActivity, NewsActivity.class);

              TextView skillName = (TextView) v.findViewById(R.id.skillName);
              intent.putExtra(SKILL_NAME, skillName.getText().toString());
              startActivity(intent);
            }
          });

      linear.addView(rowView);
      linear.addView(getHorSep());
    }

    _popPopupWindow.dismiss();
    _popPopupWindow = null;
  }
Example #3
1
  /** Put a nice border on the bitmap. */
  private static View applyFrame(
      final PhotoTable table, final BitmapFactory.Options options, Bitmap decodedPhoto) {
    LayoutInflater inflater =
        (LayoutInflater) table.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View photo = inflater.inflate(R.layout.photo, null);
    ImageView image = (ImageView) photo;
    Drawable[] layers = new Drawable[2];
    int photoWidth = options.outWidth;
    int photoHeight = options.outHeight;
    if (decodedPhoto == null || options.outWidth <= 0 || options.outHeight <= 0) {
      photo = null;
    } else {
      decodedPhoto.setHasMipMap(true);
      layers[0] = new BitmapDrawable(table.mResources, decodedPhoto);
      layers[1] = table.mResources.getDrawable(R.drawable.frame);
      LayerDrawable layerList = new LayerDrawable(layers);
      layerList.setLayerInset(0, table.mInset, table.mInset, table.mInset, table.mInset);
      image.setImageDrawable(layerList);

      photo.setTag(R.id.photo_width, Integer.valueOf(photoWidth));
      photo.setTag(R.id.photo_height, Integer.valueOf(photoHeight));

      photo.setOnTouchListener(new PhotoTouchListener(table.getContext(), table));
    }
    return photo;
  }
Example #4
1
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    View v = convertView;

    if (v == null) {
      LayoutInflater vi;
      vi = LayoutInflater.from(getContext());
      v = vi.inflate(R.layout.itemlayout, null);
    }

    Item p = getItem(position);

    if (p != null) {
      TextView tt1 = (TextView) v.findViewById(R.id.name);
      TextView tt2 = (TextView) v.findViewById(R.id.content);

      if (tt1 != null) {
        tt1.setText(p.name);
      }

      if (tt2 != null) {
        tt2.setText(p.content);
      }
    }

    return v;
  }
 @Override
 protected void initView() {
   super.initView();
   View headerView =
       LayoutInflater.from(getActivity())
           .inflate(com.xuhai.telescopes.R.layout.em_contacts_header, null);
   HeaderItemClickListener clickListener = new HeaderItemClickListener();
   applicationItem =
       (ContactItemView) headerView.findViewById(com.xuhai.telescopes.R.id.application_item);
   applicationItem.setOnClickListener(clickListener);
   headerView.findViewById(com.xuhai.telescopes.R.id.group_item).setOnClickListener(clickListener);
   headerView
       .findViewById(com.xuhai.telescopes.R.id.chat_room_item)
       .setOnClickListener(clickListener);
   //
   // headerView.findViewById(com.xuhai.telescopes.R.id.robot_item).setOnClickListener(clickListener);
   // 添加headerview
   //        listView.addHeaderView(headerView);
   // 添加正在加载数据提示的loading view
   loadingView =
       LayoutInflater.from(getActivity())
           .inflate(com.xuhai.telescopes.R.layout.em_layout_loading_data, null);
   contentContainer.addView(loadingView);
   // 注册上下文菜单
   registerForContextMenu(listView);
 }
  private void init() {
    Log.d(TAG, "call TwitterSelectUserItemView init");
    LayoutInflater factory = LayoutInflater.from(mContext);
    removeAllViews();

    // container
    FrameLayout view =
        (FrameLayout) FrameLayout.inflate(getContext(), R.layout.sns_container_normal, null);
    FrameLayout.LayoutParams paras =
        new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
    view.setLayoutParams(paras);
    view.setVerticalScrollBarEnabled(true);
    addView(view);

    // child 1
    View v = factory.inflate(R.layout.sns_user_select_item, null);
    v.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    view.addView(v);

    chekbox = (CheckBox) v.findViewById(R.id.sns_user_select_checkbox);
    username = (TextView) v.findViewById(R.id.sns_user_name_item);
    chekbox.setOnClickListener(stOnClik);
    setUI();
  }
  public void showEditDialog(
      Context context, String hintText, String OKText, final DialogCallBack callBack) {
    final EditText et_search;
    AlertDialog.Builder dialog = new AlertDialog.Builder(context);
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dialog_view, null);
    dialog.setView(layout);
    et_search = (EditText) layout.findViewById(R.id.searchC);
    et_search.setHint(hintText);
    dialog.setPositiveButton(
        OKText,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {
            String s = et_search.getText().toString().trim();
            callBack.exectEditEvent(s);
          }
        });

    dialog.setNegativeButton(
        R.string.cancel,
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int which) {}
        });
    dialog.show();
  }
 public void addTrailerView() {
   LayoutInflater vi =
       (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   Log.d("vi", "Null " + Boolean.toString(vi == null));
   for (int i = 0; i < trailerVideo.size(); i++) {
     View trailerView = vi.inflate(R.layout.trailer_view, null);
     final TextView trailerTitleView = (TextView) trailerView.findViewById(R.id.trailer_title);
     trailerTitleView.setText(trailerVideo.get(i).getName());
     ImageButton imageButton = (ImageButton) trailerView.findViewById(R.id.trailer_play_button);
     final String source = trailerVideo.get(i).getSource();
     imageButton.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:" + source));
             startActivity(intent);
           }
         });
     insertTrailerPoint.addView(
         trailerView,
         0,
         new ViewGroup.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
   }
 }
Example #9
0
 @Override
 public ReviewViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
   LayoutInflater inflater =
       (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   View view = inflater.inflate(R.layout.review_recycler_linear_item, parent, false);
   return new ReviewViewHolder(view);
 }
  public void displayPopup(View view) {
    LayoutInflater inflater =
        (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View popView = (View) inflater.inflate(R.layout.add_popup, null, false);
    Button okButton = (Button) popView.findViewById(R.id.okButton);
    okButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            addRow(v);
          }
        });

    Button cancelButton = (Button) popView.findViewById(R.id.cancelButton);
    cancelButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            _popPopupWindow.dismiss();
            _popPopupWindow = null;
          }
        });

    _popPopupWindow = new PopupWindow(popView, 400, 300, true);
    _popPopupWindow.setBackgroundDrawable(new BitmapDrawable());
    _popPopupWindow.setOutsideTouchable(false);
    _popPopupWindow.setFocusable(true);

    _popPopupWindow.showAtLocation(this.findViewById(R.id.LinearLayout1), Gravity.CENTER, 0, 0);
  }
    public View getView(int position, View convertView, ViewGroup parent) {

      View v = convertView;

      if (v == null) {
        LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.purchaselistrow, null);
      }
      PurchaseHistoryEntity watchListAllEntity = items.get(position);

      if (watchListAllEntity != null) {
        // TextView nt = (TextView)
        // v.findViewById(R.id.fileNameTextView);
        TextView tv1 = (TextView) v.findViewById(R.id.tvProductInfo1);
        TextView tv2 = (TextView) v.findViewById(R.id.tvProductInfo2);
        TextView tv3 = (TextView) v.findViewById(R.id.tvProductInfo3);
        TextView tv4 = (TextView) v.findViewById(R.id.tvProductInfo4);
        TextView tv5 = (TextView) v.findViewById(R.id.tvProductInfo5);

        /*STATUS
        注文日 (order date)
        納品日 (delivery date)
        依頼枚数(no. of request)
        納品枚数(no. of delivery)*/

        tv1.setText("STATUS: " + watchListAllEntity.get_status_ja());
        tv2.setText("注文日: " + watchListAllEntity.get_order_created_at());
        tv3.setText("納品日: " + watchListAllEntity.get_order_created_at());
        tv4.setText("依頼枚数: " + watchListAllEntity.get_order_amount());
        tv5.setText("納品枚数: " + watchListAllEntity.get_order_amount());
      }

      return v;
    }
 /** 添加ViewFlipper的View */
 private View addTextView(String name, final int Id) {
   LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
   LinearLayout resultView =
       (LinearLayout) layoutInflater.inflate(R.layout.amap_viewflipper_context, null);
   ((TextView) resultView.findViewById(R.id.tv_viewflipper_context)).setText(name);
   return resultView;
 }
  @NonNull
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(getArguments().getString("title"));

    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_minutes, null, false);
    ButterKnife.bind(this, view);
    numberPicker.setMinValue(0);
    numberPicker.setMaxValue(300);
    numberPicker.setValue(getArguments().getInt("minutes"));
    builder.setView(view);

    builder.setPositiveButton(
        getArguments().getString("positiveBtn"),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int id) {
            numberPicker.clearFocus();
            int minutes = numberPicker.getValue();
            callback.onDialogMinutesPositiveClick(getArguments().getInt("dialogId"), minutes);
          }
        });

    Dialog dialog = builder.create();
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    return dialog;
  }
 private void initView(Context context) {
   timer = new MyTimer(new UpdateHandler());
   refreshView = LayoutInflater.from(context).inflate(R.layout.layout_refresh_head, this, false);
   loadMoreView = LayoutInflater.from(context).inflate(R.layout.layout_load_foot, this, false);
   addView(refreshView);
   addView(loadMoreView);
 }
  public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder = null;
    font = Typeface.createFromAsset(this.context.getAssets(), "lato_reg.ttf");
    MusicRowItem rowItem = getItem(position);

    LayoutInflater mInflater =
        (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    if (convertView == null) {
      convertView = mInflater.inflate(R.layout.music_list, null);
      holder = new ViewHolder();
      holder.txtTitle = (TextView) convertView.findViewById(R.id.title);
      holder.imageView = (ImageView) convertView.findViewById(R.id.icon);
      holder.Di = (TextView) convertView.findViewById(R.id.SelectedIcon);
      // TextView ListTitle = (TextView) convertView.findViewById(R.id.title);
      holder.txtTitle.setTypeface(font);
      convertView.setTag(holder);
    } else holder = (ViewHolder) convertView.getTag();

    //      holder.txtDesc.setText(rowItem.getDesc());
    holder.txtTitle.setText(rowItem.getTitle());
    holder.imageView.setImageResource(rowItem.getImageId());
    // holder.Di.setTypeface(font);
    /* if(rowItem.getDefault() == true)
    {*/
    holder.Di.setBackgroundResource(R.drawable.notify_pairing);
    holder.Di.setText("Selected");
    holder.Di.setTypeface(font);
    /*}*/

    return convertView;
  }
Example #16
0
  // Metodo donde sacaremos la información necesaria para crear la lista
  public View getView(int position, View convertView, ViewGroup parent) {

    Medicamento m = getItem(position);
    ViewHolder viewHolder;

    if (convertView == null) {
      LayoutInflater inflater = LayoutInflater.from(this.context);
      convertView = inflater.inflate(R.layout.fila_tratamiento, parent, false);
      viewHolder = new ViewHolder();
      viewHolder.medicamento = (TextView) convertView.findViewById(R.id.nTratamiento);
      viewHolder.tomasTotales = (TextView) convertView.findViewById(R.id.tvFechaInicio);
      viewHolder.tomasRestantes = (TextView) convertView.findViewById(R.id.tvFechaFinal);
      viewHolder.siguienteToma = (TextView) convertView.findViewById(R.id.tvRestantes);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    viewHolder.medicamento.setText(m.getnMedicamento());
    viewHolder.tomasTotales.setText("Total tomas: " + m.getTotalTomas());
    viewHolder.tomasRestantes.setText("Tomas restantes: " + m.getTomas());

    Date fecha = new Date(m.getSiguienteHora());
    SimpleDateFormat format = new SimpleDateFormat("HH:mm");

    viewHolder.siguienteToma.setText(String.valueOf("Siguiente Toma: " + format.format(fecha)));

    return convertView;
  }
  @Override
  public View getView(int position, View _view, ViewGroup parent) {
    View view = _view;
    Object menuItem = getItem(position);

    if (menuItem instanceof MenuCategory) {
      if (view == null) {
        view =
            LayoutInflater.from(mContext)
                .inflate(R.layout.view_navigation_drawer_item, parent, false);
      }
      ((TextView) view).setText(((MenuCategory) menuItem).mTitle);
    } else {
      if (view == null) {
        view =
            LayoutInflater.from(mContext)
                .inflate(R.layout.view_navigation_drawer_item, parent, false);
      }

      TextView itemTitle = (TextView) view;
      itemTitle.setText(((MenuActivity) menuItem).mTitle);

      // Setting icon menu item
      int iconResource = ((MenuActivity) menuItem).mIconResource;
      if (iconResource > 0) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
          itemTitle.setCompoundDrawablesRelativeWithIntrinsicBounds(iconResource, 0, 0, 0);
        } else {
          itemTitle.setCompoundDrawablesWithIntrinsicBounds(iconResource, 0, 0, 0);
        }
      }
    }
    return view;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    LayoutInflater vi;
    vi = LayoutInflater.from(mContext);
    v = vi.inflate(R.layout.categories_listview_items, null);
    Category c = getItem(position);

    if (c != null) {

      TextView name = (TextView) v.findViewById(R.id.categories_listview_items_name);
      ImageView icon = (ImageView) v.findViewById(R.id.categories_listview_items_icon);

      if (name != null) {

        name.setTypeface(typeface);
        name.setText(c.getName());
      }
      if (icon != null)
        icon.setImageResource(
            mContext
                .getResources()
                .getIdentifier(c.getIconFileName(), "drawable", mContext.getPackageName()));
    }

    return v;
  }
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // Changed to ViewHolder and Picasso error load as per feedback received
    ViewHolder holder = new ViewHolder();

    // Inflate view if it is null
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.grid_item, null);
      holder.imageView = (ImageView) convertView.findViewById(R.id.movie_poster);
      MovieDetailDO movie = movieList.get(position);
      convertView.setTag(holder);

      Picasso.with(context)
          .load(movie.getPoster_path())
          // .placeholder(R.drawable.def_pos)
          .error(R.drawable.def_pos)
          .into(holder.imageView);

    } else {
      holder.imageView = (ImageView) convertView.findViewById(R.id.movie_poster);
      MovieDetailDO movie = movieList.get(position);
      convertView.setTag(holder);

      Picasso.with(context)
          .load(movie.getPoster_path())
          // .placeholder(R.drawable.def_pos)
          .error(R.drawable.def_pos)
          .into(holder.imageView);
    }

    return convertView;
  }
Example #20
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    // Get the data item for this position
    File file = getItem(position);
    // Check if an existing view is being reused, otherwise inflate the view
    ViewHolder viewHolder; // view lookup cache stored in tag
    if (convertView == null) {
      viewHolder = new ViewHolder();
      LayoutInflater inflater = LayoutInflater.from(getContext());
      convertView = inflater.inflate(R.layout.contact_item, parent, false);
      viewHolder.name = (TextView) convertView.findViewById(R.id.name);
      viewHolder.createdAt = (TextView) convertView.findViewById(R.id.occupation);
      viewHolder.image = (ImageView) convertView.findViewById(R.id.image);
      convertView.setTag(viewHolder);
    } else {
      viewHolder = (ViewHolder) convertView.getTag();
    }
    // Populate the data into the template view using the data object
    viewHolder.name.setText(file.getFileName());
    SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
    try {
      Date date = isoFormat.parse(file.getCreatedAt());
      SimpleDateFormat outputDateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.US);
      viewHolder.createdAt.setText(outputDateFormat.format(date));
    } catch (ParseException e) {
      viewHolder.createdAt.setText(file.getCreatedAt());
    }

    int[] images = {R.drawable.file_icon, R.drawable.image_icon};
    int selected = images[file.getFileName().charAt(0) % 2];

    viewHolder.image.setImageBitmap(BitmapFactory.decodeResource(parent.getResources(), selected));
    // Return the completed view to render on screen
    return convertView;
  }
  @SuppressWarnings("deprecation")
  public ActionBarView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mContext = context;

    mOverflow = new ActionBarOverflow(mContext);
    mOverflow.setId(R.id.root_overflow_menu);

    LayoutInflater inflater = LayoutInflater.from(mContext);
    inflater.inflate(ACTIONBAR_FRAME, this);

    mControllerContainer = (ViewGroup) findViewById(R.id.cnt_actionbar_controller);
    mUpContainer = findViewById(R.id.cnt_up);
    mUpIndicator = (IconView) findViewById(R.id.icv_up_indicator);
    mUpIcon = findViewById(R.id.img_up_icon);

    // get the background drawable & make sure it repeats properly
    TypedValue typedValue = new TypedValue();
    mContext.getTheme().resolveAttribute(R.attr.actionBarBg, typedValue, true);
    Drawable d = getResources().getDrawable(typedValue.resourceId);
    ViewUtils.fixDrawableRepeat(d);
    setBackgroundDrawable(d);

    mLayoutFinished = true;
  }
Example #22
0
  /** 显示下载对话框 */
  private void showDownloadDialog() {
    Builder builder = new Builder(mContext);
    builder.setTitle("正在下载新版本");

    final LayoutInflater inflater = LayoutInflater.from(mContext);
    View v = inflater.inflate(R.layout.update_progress, null);
    mProgress = (ProgressBar) v.findViewById(R.id.update_progress);
    mProgressText = (TextView) v.findViewById(R.id.update_progress_text);

    builder.setView(v);
    builder.setNegativeButton(
        "取消",
        new OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            interceptFlag = true;
          }
        });
    builder.setOnCancelListener(
        new OnCancelListener() {
          @Override
          public void onCancel(DialogInterface dialog) {
            dialog.dismiss();
            interceptFlag = true;
          }
        });
    downloadDialog = builder.create();
    downloadDialog.setCanceledOnTouchOutside(false);
    downloadDialog.show();

    downloadApk();
  }
Example #23
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    TaskViewHolder holder;
    if (convertView == null) {
      LayoutInflater inflater =
          (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      convertView = inflater.inflate(row, null);
      holder = new TaskViewHolder();
      convertView.setTag(holder);
    } else {
      holder = (TaskViewHolder) convertView.getTag();
    }

    if ((tours == null) || ((position + 1) > tours.size()))
      return convertView; // Can't extract item

    Tour obj = tours.get(position);
    holder.image = (ImageView) convertView.findViewById(R.id.tourImage);
    Drawable img =
        mContext
            .getResources()
            .getDrawable(
                mContext
                    .getResources()
                    .getIdentifier(obj.getImage(), "drawable", mContext.getPackageName()));
    holder.image.setImageDrawable(img);
    holder.name = (TextView) convertView.findViewById(R.id.tourNameLbl);
    holder.name.setText(obj.getName());
    holder.totalHours = (TextView) convertView.findViewById(R.id.totalHoursLbl);
    holder.totalHours.setText(obj.getTotalHours() + "h");
    holder.totalKms = (TextView) convertView.findViewById(R.id.totalKmsLbl);
    holder.totalKms.setText(obj.getTotalKms() + "Km");

    return convertView;
  }
Example #24
0
 public static RelativeLayout getColorPanelLayout(Context context) {
   LayoutInflater inflater =
       (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   RelativeLayout layout =
       (RelativeLayout) inflater.inflate(R.layout.draw_panel_pen_color_layout, null);
   return layout;
 }
  @Override
  public void setRefreshActionItemState(boolean refreshing) {
    // On Honeycomb, we can set the state of the refresh button by giving it a custom
    // action view.
    if (mOptionsMenu == null) {
      return;
    }

    final MenuItem refreshItem = mOptionsMenu.findItem(R.id.menu_refresh);
    if (refreshItem != null) {
      if (refreshing) {
        if (mRefreshIndeterminateProgressView == null) {
          LayoutInflater inflater =
              (LayoutInflater)
                  getActionBarThemedContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          mRefreshIndeterminateProgressView =
              inflater.inflate(R.layout.actionbar_indeterminate_progress, null);
        }

        refreshItem.setActionView(mRefreshIndeterminateProgressView);
      } else {
        refreshItem.setActionView(null);
      }
    }
  }
    @Override
    protected void onCreate() {
      // inflate layout
      LayoutInflater inflater =
          (LayoutInflater)
              this.anchor.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      ViewGroup root = (ViewGroup) inflater.inflate(R.layout.popup_grid_layout, null);

      // setup button events
      for (int i = 0, icount = root.getChildCount(); i < icount; i++) {
        View v = root.getChildAt(i);

        if (v instanceof TableRow) {
          TableRow row = (TableRow) v;

          for (int j = 0, jcount = row.getChildCount(); j < jcount; j++) {
            View item = row.getChildAt(j);
            if (item instanceof Button) {
              Button b = (Button) item;
              b.setOnClickListener(this);
            }
          }
        }
      }

      // set the inflated view as what we want to display
      this.setContentView(root);
    }
Example #27
0
  @Override
  public View getView(int position, View bankView, ViewGroup parent) {
    // set the rowview
    View rowView = bankView;
    // reuse views
    if (rowView == null) {
      // if the row view is not null then inflate for display
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      rowView = inflater.inflate(R.layout.password_bank_item, null);
    }

    // get the text views and set the values to the values in the list
    TextView username = (TextView) rowView.findViewById(R.id.value_username);
    TextView website = (TextView) rowView.findViewById(R.id.value_website);
    TextView password = (TextView) rowView.findViewById(R.id.value_password);
    TextView expiration = (TextView) rowView.findViewById(R.id.value_expires);

    username.setText(PasswordInfoArrayList.get(position).getUsername());
    website.setText(PasswordInfoArrayList.get(position).getWebsite());
    password.setText(PasswordInfoArrayList.get(position).getPassword());

    DateHelper expires = PasswordInfoArrayList.get(position).getExpiration();
    boolean expired = expires.isLaterThan(DateHelper.getCurrentDate());
    if (expired) {
      expiration.setTextColor(Color.RED);
    }
    String expStr = PasswordInfoArrayList.get(position).getExpiration().toString();
    expiration.setText(expStr);

    return rowView;
  }
Example #28
0
  public static void Show(
      final Context context, final SimpleCommandConsole cli, final KActivityStatus mStatus) {
    // mChecked = 1;
    LayoutInflater mLI = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final LinearLayout mLL = (LinearLayout) mLI.inflate(R.layout.alert_dialog_kuaipan_create, null);

    final EditText meditText = (EditText) mLL.findViewById(R.id.new_filename);

    Builder mBuilder =
        new AlertDialog.Builder(context)
            .setTitle(R.string.CreateKPFileDialog_title)
            .setView(mLL)
            .setPositiveButton(
                R.string.m_New,
                new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                    String mNewFolderName = meditText.getText().toString().trim();
                    try {
                      cli.do_mkdir(mNewFolderName);
                      mStatus.KActivityResult(10, 1, 1, "");
                      Toast.makeText(context, "操作成功!", Toast.LENGTH_SHORT).show();
                    } catch (Exception e) {
                      e.printStackTrace();
                    }
                  }
                })
            .setNeutralButton(context.getString(R.string.cancel), null);
    mBuilder.show();
  }
  public void showIssue(final String issue) {
    LayoutInflater inflate =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflate.inflate(R.layout.touzhu_succe, null);
    final AlertDialog dialog = new AlertDialog.Builder(context).create();
    TextView textContent = (TextView) view.findViewById(R.id.touzhu_succe_text);
    Button ok = (Button) view.findViewById(R.id.touzhu_succe_button_sure);
    Button cancel = (Button) view.findViewById(R.id.touzhu_succe_button_share);
    ok.setBackgroundResource(R.drawable.loginselecter);
    cancel.setBackgroundResource(R.drawable.loginselecter);
    ok.setText(context.getString(R.string.dialog_issue_text_ok));
    cancel.setText(context.getString(R.string.dialog_issue_text_cancel));
    textContent.setText(context.getString(R.string.dialog_issue_text_content) + issue + "期。");
    ok.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            dialog.cancel();
            touzhuIssue(issue);
          }
        });
    cancel.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            dialog.cancel();
            finish();
          }
        });

    dialog.show();
    dialog.getWindow().setContentView(view);
  }
  private View createAlarmDaysStep() {
    LayoutInflater inflater = LayoutInflater.from(getBaseContext());
    daysStepContent =
        (LinearLayout) inflater.inflate(R.layout.step_days_of_week_layout, null, false);

    String[] weekDays = getResources().getStringArray(R.array.week_days);
    for (int i = 0; i < weekDays.length; i++) {
      final int index = i;
      final LinearLayout dayLayout = getDayLayout(index);
      if (index < 5) {
        activateDay(index, dayLayout, false);
      } else {
        deactivateDay(index, dayLayout, false);
      }

      dayLayout.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if ((boolean) v.getTag()) {
                deactivateDay(index, dayLayout, true);
              } else {
                activateDay(index, dayLayout, true);
              }
            }
          });

      final TextView dayText = (TextView) dayLayout.findViewById(R.id.day);
      dayText.setText(weekDays[index]);
    }
    return daysStepContent;
  }