Back to project page vocabulary-list.
The source code is released under:
Apache License
If you think the Android project vocabulary-list listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.rulych.vocabularylist.fragments; //from w ww.ja v a2 s.co m import com.google.android.gms.common.api.GoogleApiClient; import com.rulych.vocabularylist.R; import com.rulych.vocabularylist.VocabularyListApplication; import com.rulych.vocabularylist.model.Card; import com.rulych.vocabularylist.model.persistence.CardDAO; import android.app.DialogFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import javax.inject.Inject; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnClick; public abstract class BaseCardFragment extends DialogFragment implements DriveApiFragment { @Inject CardDAO mCardDAO; @InjectView(R.id.card_entry) EditText mEntry; @InjectView(R.id.card_pronunciation) EditText mPronunciation; @InjectView(R.id.card_translation) EditText mTranslation; @InjectView(R.id.card_delete) Button mDelete; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); VocabularyListApplication.get(getActivity()).inject(this); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_card, container, false); ButterKnife.inject(this, view); return view; } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.reset(this); } @OnClick(R.id.card_save) public void onSaveClicked() { Card card = new Card(); card.pronunciation = mPronunciation.getText().toString(); card.translation = mTranslation.getText().toString(); card.entry = mEntry.getText().toString(); mCardDAO.save(card); dismiss(); } @OnClick(R.id.card_cancel) public void onCancelClicked() { dismiss(); } @Override public void onApiClientReady(GoogleApiClient apiClient) { mCardDAO.start(apiClient); } }