-

   rss_rss_hh_new

 - e-mail

 

 -

 LiveInternet.ru:
: 17.03.2011
:
:
: 51

:


, Android- ,

, 03 2017 . 15:49 +
, . , . . , . .

: , , , , , .

, . , . , .



, , , , , .


, . , , . , // / ( ). / , ?

, , , . , , , , .

, . , .

, , .

-
() -, ()
() ( , ) . ! !
() ( ) ! !
() (, - ) . ?
() ?
() !
() ?
() () , ! !
() . , . , , !
() ( ) ! !
() ( ) ! !!! !!!
() ( , ) !!! !!! !!! (....)

.


, , . ? .

, . , , ( ) , . . (/ ).

, - Excel, . , , . .

. . , . - Android , ?

- ,
() , , .
() , .
() .
() () ! !
()
() ? , !
() -
( )
() ,
() (, ) ! ?!!! ?!!!
() , . (...)


, , , .

. : , , , , -.

, - .

, .

, .

-
() ( , , ). . , .
() !!! ?!!! !!! !!!
() ( ) ߅
() !!! !!! ?!!! ?! ?!!!
() ( ) -
() . , !
() , .

.


. ListView. . -, .




, . ( , ).

, , . .

, , 90-. .
, . , .

5000 , .
( ), , . , . , , .

. , , , .

:




, / / :



, , , . , .

-
() . ( ). - . ?
()
() ?
() .
() (....) , ?
() .
() -
() () ?!!!
()

5.


. , ListView, , (, ) , , .

, ListView , .




, , . . (amountList)

ListView lvAmounts = (ListView)mView.findViewById(R.id.lv_newAmount_Amount);        insertAmountAdapter insertAmountAdapter = new insertAmountAdapter(getActivity(), amountList);        
lvAmounts.setAdapter(insertAmountAdapter);

( AmountTextWatcher):

public class insertAmountAdapter extends BaseAdapter {

    Context mContext;
    ArrayList amountList;
    LayoutInflater mLayoutInflater;
    EditText etAmount, etTariff;
    TextView tvTariffTitle;


    public insertAmountAdapter(Context mContext, ArrayList amountList) {
        this.mContext = mContext;
        this.amountList = amountList;
        mLayoutInflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return amountList.size();
    }

    @Override
    public Object getItem(int position) {
        return amountList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = convertView;
        if(view == null){
            view = mLayoutInflater.inflate(R.layout.item_insertamount, parent, false);

            etTariff = (EditText)view.findViewById(R.id.et_amount_tariffInfo);
            etTariff.addTextChangedListener(new AmountTextWatcher(view, etTariff, amountList));

            etAmount = (EditText)view.findViewById(R.id.et_amount_Amount);
            etAmount.addTextChangedListener(new AmountTextWatcher(view, etAmount, amountList));
        }
        etAmount.setTag(position);
        etAmount.setText(String.valueOf(amountList.get(position).getAmount()));
        etAmount.setFilters(new InputFilter[]{new DigitalFilter(3)});

        tvTariffTitle = (TextView)view.findViewById(R.id.tv_amount_tariffTitle);
        tvTariffTitle.setText(amountList.get(position).getTariffTitle()+", "+amountList.get(position).getUnit());

        etTariff.setTag(position);

        etTariff.setText(amountList.get(position).getTariffValue());
        etTariff.setFilters(new InputFilter[]{new DigitalFilter(2)});
        return view;
    }
}

class AmountTextWatcher implements TextWatcher {

    private View view;
    private EditText editText;
    private ArrayList amountList;

    public AmountTextWatcher(View view, EditText editText, ArrayList amountList) {
        this.view = view;
        this.editText = editText;
        this.amountList = amountList;
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {
        if(editText.equals(view.findViewById(R.id.et_amount_Amount))){
            amountList.get(Integer.parseInt(editText.getTag().toString())).setAmount(Double.valueOf(s.toString().isEmpty()?"0":s.toString()));
        } else if(editText.equals(view.findViewById(R.id.et_amount_tariffInfo))){
            amountList.get(Integer.parseInt(editText.getTag().toString())).setTariffValue(s.toString().isEmpty()?"0":s.toString());
        }
        return;
    }
}


, , setTag getTag.

, , . html-. , .

strings.xml:


        



, , , drawables ( : add_btn_instruction.png open_btn_instruction.png).

, TextView ImageGetter:

String instructionHTML = getString(R.string.instructionText);
TextView tvInstruction = (TextView)findViewById(R.id.tv_instruction);
tvInstruction.setText(Html.fromHtml(instructionHTML, htmlImageGetter, null));
Html.ImageGetter htmlImageGetter = new Html.ImageGetter() {
        public Drawable getDrawable(String source) {
            int resId = getResources().getIdentifier(source, "drawable", getPackageName());
            Drawable ret = InstructionActivity.this.getResources().getDrawable(resId);
            ret.setBounds(0, 0, ret.getIntrinsicWidth(), ret.getIntrinsicHeight());
            return ret;
        }
    };

- ,
() ?!
() ?
()
() , ? !
() ( ) , ! (...)

6. --.


, . . , . , .

, . , . , , ( , ), , .

, ( , ), (, , , ).

.

-
() . ?
() , , .
(....)

. - . - , .
Original source: habrahabr.ru (comments, light).

https://habrahabr.ru/post/332190/

:  

: [1] []
 

:
: 

: ( )

:

  URL