@Nullable @Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View res = inflater.inflate(R.layout.fragment_fab, container, false); FloatingActionButton fabRoot = (FloatingActionButton) res.findViewById(R.id.fab); fabRoot.setImageResource(R.drawable.ic_edit_white_24dp); fabRoot.setBackgroundTintList( new ColorStateList( new int[][] { new int[] {android.R.attr.state_pressed}, StateSet.WILD_CARD, }, new int[] { ActorSDK.sharedActor().style.getFabPressedColor(), ActorSDK.sharedActor().style.getFabColor(), })); fabRoot.setRippleColor(ActorSDK.sharedActor().style.getFabPressedColor()); fabRoot.setOnClickListener( v -> startActivity(new Intent(getActivity(), ComposeActivity.class))); return res; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_record); chronometer = (Chronometer) findViewById(R.id.chrono); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); int fileformat = Integer.parseInt(sharedPref.getString(SettingsActivity.KEY_FILE_FORMAT, "")); int codec = Integer.parseInt(sharedPref.getString(SettingsActivity.KEY_CODEC, "")); // Setting up chart setupTopChart(); final String TAG = "test"; mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout); mLayout.setTouchEnabled(false); mLayout.setMinFlingVelocity(100); mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); mLayout.setPanelHeight(600); ((TextView) findViewById(R.id.codec)) .setText(sharedPref.getString(SettingsActivity.KEY_CODEC, "")); myAudioRecorder = new MediaRecorder(); myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); myAudioRecorder.setOutputFormat(fileformat); myAudioRecorder.setAudioEncoder(codec); myAudioRecorder.setAudioEncodingBitRate(100000); FloatingActionButton mic = (FloatingActionButton) findViewById(R.id.record); mic.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#ffffff"))); mic.setRippleColor(getResources().getColor(R.color.colorAccent)); (findViewById(R.id.pause_record)) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (!drawDisplayed) { mLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); (findViewById(R.id.pause_record)) .animate() .rotationBy(180) .setDuration(400) .setInterpolator(new AccelerateDecelerateInterpolator()) .start(); drawDisplayed = true; } else { mLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN); (findViewById(R.id.pause_record)) .animate() .rotationBy(180) .setInterpolator(new AccelerateDecelerateInterpolator()) .setDuration(400) .start(); drawDisplayed = false; } } }); // Spinner spinner = (Spinner) findViewById(R.id.fileTypeSpinner); // Create an ArrayAdapter using the string array and a default spinner layout // ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, // R.array.filetypes, android.R.layout.simple_spinner_item); // Specify the layout to use when the list of choices appears // adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Apply the adapter to the spinner // spinner.setAdapter(adapter); (findViewById(R.id.stop_record)) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { stopRecording(v); } }); final LinearLayout bottomBar = (LinearLayout) findViewById(R.id.bottomBar); mic.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { stopRecording(v); } }); }