Android Open Source - OBS-Translation-App Translation Fragment






From Project

Back to project page OBS-Translation-App.

License

The source code is released under:

MIT License

If you think the Android project OBS-Translation-App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.door43.obt.ata;
/*from www  .j av  a2  s  . c o m*/


import android.app.Fragment;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;


/**
 * A simple {@link android.support.v4.app.Fragment} subclass.
 *
 */
public class TranslationFragment extends Fragment {


    private EditText mTranslation;
    private EditText mTranslationNotes;
    private int mPosition;
    private String mKeyword;

    public TranslationFragment() {
        // Required empty public constructor
    }

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

        if (getArguments() != null) {
            mPosition = getArguments().getInt("Position");
            mKeyword = getArguments().getString("Section");
        }
        //Todo:  allocate data storage variable here
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootView = inflater.inflate(R.layout.fragment_translation, container, false);

        int id = getResources().getIdentifier((mKeyword+Integer.toString(mPosition)), "string", rootView.getContext().getPackageName());


        String value = id == 0 ? "" : (String) getResources().getText(id);
        TextView text = (TextView) rootView.findViewById(R.id.AddSource);
        text.setText(value);

        mTranslation = (EditText)rootView.findViewById(R.id.AddTranslation);
        //todo:  needs to add what happen to the translation text entered
        mTranslation.addTextChangedListener(new TextWatcher() {
            @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) {
            }
        });

        mTranslationNotes = (EditText)rootView.findViewById(R.id.AddNotes);
        //todo:  needs to add what happen to the translation notes text entered
        mTranslationNotes.addTextChangedListener(new TextWatcher() {
            @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) {

            }
        });
        return rootView;
    }


}




Java Source Code List

com.door43.obt.ata.MenuListActivity.java
com.door43.obt.ata.MenuListFragment.java
com.door43.obt.ata.RowAdapter.java
com.door43.obt.ata.SplashActivity.java
com.door43.obt.ata.TranslationDetailActivity.java
com.door43.obt.ata.TranslationFragment.java
org.door43.obs.mta.ConstApp.java
org.door43.obs.mta.db.AbstractDBHelper.java
org.door43.obs.mta.db.ConstTranslations.java
org.door43.obs.mta.db.TranslationDBHelper.java
org.door43.obs.mta.model.Frame.java
org.door43.obs.mta.model.IFrame.java
org.door43.obs.mta.model.IPersistenceObject.java
org.door43.obs.mta.model.ITerm.java
org.door43.obs.mta.model.IText.java
org.door43.obs.mta.model.ITranslationNotes.java
org.door43.obs.mta.model.ITranslation.java
org.door43.obs.mta.model.PersistenceObject.java
org.door43.obs.mta.model.Term.java
org.door43.obs.mta.model.Text.java
org.door43.obs.mta.model.TranslationNotes.java
org.door43.obs.mta.model.Translation.java
org.door43.obs.mta.service.FakeTranslationService.java
org.door43.obs.mta.service.ITranslationService.java
org.door43.obs.mta.service.TranslationService.java
org.door43.obs.mta.util.AssetsUtil.java
org.door43.obs.mta.util.StringUtils.java