Android Open Source - misound Feedback Fragment






From Project

Back to project page misound.

License

The source code is released under:

Apache License

If you think the Android project misound 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.xiaomi.mitv.soundbarapp.fragment;
/*from www . jav a2  s  .  c  om*/
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.xiaomi.mitv.idata.client.app.AppData;
import com.xiaomi.mitv.idata.util.iDataCenterORM;
import com.xiaomi.mitv.soundbarapp.R;
import com.xiaomi.mitv.soundbar.provider.SoundBarORM;

public class FeedbackFragment extends BaseFragment {
    View mMainView;
  View mSubmitBtn;
  Toast mToast;
  EditText mMsg;
  EditText mPhone;
    public static FeedbackFragment newInstance() {
        return new FeedbackFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mMainView = inflater.inflate(R.layout.fragment_feedback, container, false);
        return mMainView;
    }
    
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        ((TextView)mMainView.findViewById(R.id.action_bar_text)).setText(R.string.fb_title);
        mSubmitBtn = findViewbyId(R.id.submit);
        mSubmitBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              sendFeedback();
            }
        });
        
      mMsg = findViewbyId(R.id.msg);
      mPhone = findViewbyId(R.id.phone);
    }
    
    private void sendFeedback(){
        String str = getString(R.string.fb_tost);
      if(mMsg.getText().length()==0){
            // Tell the user about what we did.
            if (mToast != null) {
                mToast.cancel();
            }
            String newstr = str.replace("xxx", getActivity().getText(R.string.fb_msg));
            mToast = Toast.makeText(getActivity(), newstr,
                    Toast.LENGTH_LONG);
            mToast.show();
            return;
      }
      if(mPhone.getText().length()==0){
            // Tell the user about what we did.
            if (mToast != null) {
                mToast.cancel();
            }

            mToast = Toast.makeText(getActivity(), getActivity().getText(R.string.fb_contact),
                    Toast.LENGTH_LONG);
            mToast.show();
            return;
      }

      
      String tag = "feedback";
        String body = mMsg.getText().toString();
        body += "\n\n soundbar version="+ SoundBarORM.getSettingValue(this.getActivity(), SoundBarORM.dfuCurrentVersion) +
                "\n\n addr version="+ SoundBarORM.getSettingValue(this.getActivity(), SoundBarORM.addressName);

      iDataCenterORM.getInstance(getActivity()).sendFeedback(this.getActivity().getPackageName(), AppData.appKey,
                tag, "", body,
          mPhone.getText().toString(), "", "");
        mToast = Toast.makeText(getActivity(), R.string.fb_submit_finish,
                Toast.LENGTH_LONG);
        mToast.show();
        getActivity().onBackPressed();
    }
}




Java Source Code List

com.xiaomi.mitv.soundbar.DefaultMisoundDevice.java
com.xiaomi.mitv.soundbarapp.BarInfoUtils.java
com.xiaomi.mitv.soundbarapp.ConnectingActivity.java
com.xiaomi.mitv.soundbarapp.MainActivity2.java
com.xiaomi.mitv.soundbarapp.SoundBarApplication.java
com.xiaomi.mitv.soundbarapp.TestActivity.java
com.xiaomi.mitv.soundbarapp.TypefaceManager.java
com.xiaomi.mitv.soundbarapp.WrapperActivity.java
com.xiaomi.mitv.soundbarapp.diagnosis.DiagnosisFragment.java
com.xiaomi.mitv.soundbarapp.diagnosis.Engine.java
com.xiaomi.mitv.soundbarapp.diagnosis.ViewWrapper.java
com.xiaomi.mitv.soundbarapp.diagnosis.data.Entry.java
com.xiaomi.mitv.soundbarapp.diagnosis.data.Node.java
com.xiaomi.mitv.soundbarapp.diagnosis.data.OrderedList.java
com.xiaomi.mitv.soundbarapp.diagnosis.data.QAElement.java
com.xiaomi.mitv.soundbarapp.eq.EQManager.java
com.xiaomi.mitv.soundbarapp.eq.EQSettingsFragment.java
com.xiaomi.mitv.soundbarapp.eq.EQStyleResource.java
com.xiaomi.mitv.soundbarapp.eq.EQStyle.java
com.xiaomi.mitv.soundbarapp.eq.UserEQControlFragment.java
com.xiaomi.mitv.soundbarapp.faq.FaqDataStore.java
com.xiaomi.mitv.soundbarapp.faq.FaqFragment.java
com.xiaomi.mitv.soundbarapp.fragment.A2dpDlg.java
com.xiaomi.mitv.soundbarapp.fragment.BaseFragment.java
com.xiaomi.mitv.soundbarapp.fragment.FeedbackFragment.java
com.xiaomi.mitv.soundbarapp.fragment.MainEntryFragment.java
com.xiaomi.mitv.soundbarapp.fragment.PanelFragment.java
com.xiaomi.mitv.soundbarapp.fragment.SettingsFragment.java
com.xiaomi.mitv.soundbarapp.player.MediaButtonIntentReceiver.java
com.xiaomi.mitv.soundbarapp.player.MusicUtils.java
com.xiaomi.mitv.soundbarapp.player.PlayListFragment.java
com.xiaomi.mitv.soundbarapp.player.PlayerFragment.java
com.xiaomi.mitv.soundbarapp.player.PlayerService.java
com.xiaomi.mitv.soundbarapp.player.Player.java
com.xiaomi.mitv.soundbarapp.provider.DataProvider.java
com.xiaomi.mitv.soundbarapp.upgrade.FirmwareManager.java
com.xiaomi.mitv.soundbarapp.upgrade.FirmwareZipFile.java
com.xiaomi.mitv.soundbarapp.upgrade.UpdateActivity.java
com.xiaomi.mitv.soundbarapp.upgrade.UpgradeFragment.java
com.xiaomi.mitv.soundbarapp.upgrade.VersionSelectFragment.java
com.xiaomi.mitv.soundbarapp.util.ConfirmActivityDlg.java
com.xiaomi.mitv.soundbarapp.util.Worker.java
com.xiaomi.mitv.widget.GainView.java
com.xiaomi.mitv.widget.GifView.java
com.xiaomi.mitv.widget.LetterIndexSilderBar.java
com.xiaomi.mitv.widget.MiSwitch.java
com.xiaomi.mitv.widget.RoundAnimationView.java
com.xiaomi.mitv.widget.RoundProgressBar.java
com.xiaomi.mitv.widget.RoundSeekBar.java