2012-07-19 01:00:48 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 The Android Open Source Project
|
|
|
|
*
|
2013-01-21 12:52:57 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2012-07-19 01:00:48 +00:00
|
|
|
*
|
2013-01-21 12:52:57 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-07-19 01:00:48 +00:00
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
2013-01-21 12:52:57 +00:00
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2012-07-19 01:00:48 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
package com.android.inputmethod.research;
|
|
|
|
|
|
|
|
import android.app.Activity;
|
|
|
|
import android.app.Fragment;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View.OnClickListener;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.EditText;
|
|
|
|
|
|
|
|
import com.android.inputmethod.latin.R;
|
|
|
|
|
|
|
|
public class FeedbackFragment extends Fragment {
|
|
|
|
private EditText mEditText;
|
2012-08-23 17:42:38 +00:00
|
|
|
private CheckBox mIncludingHistoryCheckBox;
|
|
|
|
private CheckBox mIncludingAccountNameCheckBox;
|
2012-07-19 01:00:48 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
|
|
Bundle savedInstanceState) {
|
|
|
|
final View view = inflater.inflate(R.layout.research_feedback_fragment_layout, container,
|
|
|
|
false);
|
|
|
|
mEditText = (EditText) view.findViewById(R.id.research_feedback_contents);
|
2012-08-23 17:42:38 +00:00
|
|
|
mIncludingHistoryCheckBox = (CheckBox) view.findViewById(
|
|
|
|
R.id.research_feedback_include_history);
|
|
|
|
mIncludingAccountNameCheckBox = (CheckBox) view.findViewById(
|
|
|
|
R.id.research_feedback_include_account_name);
|
2012-07-19 01:00:48 +00:00
|
|
|
|
|
|
|
final Button sendButton = (Button) view.findViewById(
|
|
|
|
R.id.research_feedback_send_button);
|
|
|
|
sendButton.setOnClickListener(new OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
final Editable editable = mEditText.getText();
|
|
|
|
final String feedbackContents = editable.toString();
|
2012-08-23 17:42:38 +00:00
|
|
|
final boolean isIncludingHistory = mIncludingHistoryCheckBox.isChecked();
|
|
|
|
final boolean isIncludingAccountName = mIncludingAccountNameCheckBox.isChecked();
|
|
|
|
ResearchLogger.getInstance().sendFeedback(feedbackContents, isIncludingHistory,
|
|
|
|
isIncludingAccountName);
|
2012-07-19 01:00:48 +00:00
|
|
|
final Activity activity = FeedbackFragment.this.getActivity();
|
|
|
|
activity.finish();
|
|
|
|
ResearchLogger.getInstance().onLeavingSendFeedbackDialog();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
final Button cancelButton = (Button) view.findViewById(
|
|
|
|
R.id.research_feedback_cancel_button);
|
|
|
|
cancelButton.setOnClickListener(new OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
final Activity activity = FeedbackFragment.this.getActivity();
|
|
|
|
activity.finish();
|
|
|
|
ResearchLogger.getInstance().onLeavingSendFeedbackDialog();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
}
|