Android Open Source - soundheap Record Fragment






From Project

Back to project page soundheap.

License

The source code is released under:

Copyright (c) 2014, Nicholas Wertzberger All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are...

If you think the Android project soundheap 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.ideaheap.sound.ui;
//from  w  w w .  ja v  a2  s. c  o m
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageButton;

import com.actionbarsherlock.app.SherlockFragment;
import com.ideaheap.sound.R;
import com.ideaheap.sound.context.SoundheapContext;
import com.ideaheap.sound.context.SoundheapException;
import com.ideaheap.sound.control.RecordController;

/**
 * This class is responsible for one thing: tying event handlers to the proper
 * function inside the recordController.
 * 
 * @author nwertzberger
 *
 */
public class RecordFragment extends SherlockFragment {
  private static final String TAG = RecordFragment.class.toString();
  
  @Override
  public void onCreate(Bundle state) {
    super.onCreate(state);
  }

  @Override
  public View onCreateView(
      LayoutInflater inflater,
      ViewGroup container,
      Bundle savedInstance) {
    
    final View v = inflater.inflate(R.layout.record, container, false);
    try {
      final SoundheapContext ctx = SoundheapContext.getContext();
      
      addUserInterfaceHooks(v, ctx.recordController);
      
      // Task: set any required info about the current state
      ctx.recordController.setupView(v);
    } catch (SoundheapException e) {
      e.printStackTrace();
    }
    return v;
  }

  private void addUserInterfaceHooks(
      final View v,
      final RecordController recordController) {
    
    // Task: attach any UI elements to listeners.
    final ImageButton recButton = (ImageButton)
        v.findViewById(R.id.RecordButton);
    final CheckBox ignoreSilenceBox = (CheckBox) 
        v.findViewById(R.id.IgnoreSilenceBox);
    
    recButton.setOnClickListener(new OnClickListener() {
      @Override
      public void onClick(View parent) {
        recordController.toggleRecord(v);
      }
    });
    
    ignoreSilenceBox.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {
      @Override
      public void onCheckedChanged(
          CompoundButton buttonView,
          boolean isChecked) {
        recordController.setIgnoreSilence(isChecked);
      }
    });
  }
  
  @Override
  public void onPause() {
    super.onPause();
  }
}




Java Source Code List

com.ideaheap.sound.context.SoundheapContext.java
com.ideaheap.sound.context.SoundheapException.java
com.ideaheap.sound.control.MainController.java
com.ideaheap.sound.control.PlaybackController.java
com.ideaheap.sound.control.ProjectController.java
com.ideaheap.sound.control.RecordController.java
com.ideaheap.sound.control.TabController.java
com.ideaheap.sound.control.TabListener.java
com.ideaheap.sound.service.AudioLevelListener.java
com.ideaheap.sound.service.AudioPlayService.java
com.ideaheap.sound.service.AudioRecordService.java
com.ideaheap.sound.service.AudioUpdateListener.java
com.ideaheap.sound.service.RepositoryService.java
com.ideaheap.sound.ui.PlaybackFragment.java
com.ideaheap.sound.ui.ProjectFragment.java
com.ideaheap.sound.ui.RecordFragment.java
com.ideaheap.sound.ui.SoundheapActivity.java
com.ideaheap.sound.ui.tabs.PlaybackTab.java
com.ideaheap.sound.ui.tabs.ProjectTab.java