Commit f4482779 authored by CallisteHanriat's avatar CallisteHanriat

Merge branch 'calliste-undo' into calliste-differenciation-dialog

parents 6b711b0c 0de789f2
......@@ -57,7 +57,7 @@ public class ThumbRespeakFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.thumb_respeak_fragment, container, false);
v = inflater.inflate(R.layout.thumb_respeak_fragment, container, false);
installButtonBehaviour(v);
textTimeProgression = (TextView) v.findViewById(R.id.respeak_current_time);
totalTime = (TextView) v.findViewById(R.id.respeak_total_time);
......@@ -67,7 +67,7 @@ public class ThumbRespeakFragment extends Fragment {
@Override
public void onClick(View v) {
//if undo is enabled, we disabled because we want to undo one time.
onUndiAction();
onUndoAction();
}
});
......@@ -154,10 +154,9 @@ public class ThumbRespeakFragment extends Fragment {
@Override
public boolean onTouch(View view, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if(count > 0) {
if(count > 0 && undo.isEnabled()) {
respeaker.saveRespeaking();
}
// Color change
//playButton.setBackgroundColor(0xff00d500);
long previousGestureTime = gestureTime;
......@@ -298,7 +297,6 @@ public class ThumbRespeakFragment extends Fragment {
public void run() {
// TODO Auto-generated method stub
textTimeProgression.setText(respeaker.getSimplePlayer().getCurrentMsec()/1000 + "s");
}
});
seekBar.setProgress(
......@@ -372,10 +370,17 @@ public class ThumbRespeakFragment extends Fragment {
/**
* called when we need to return one state before.
*/
private void onUndiAction() {
if (count == 1 || undo.isEnabled()) {
private void onUndoAction() {
if (count == 1){
final ImageButton okButton = (ImageButton)
v.findViewById(R.id.saveButton);
okButton.setImageResource(R.drawable.ok_disabled_48);
okButton.setEnabled(false);
undo.setEnabled(false);
} else if (undo.isEnabled()) {
undo.setEnabled(false);
}
setPreviousPlayerToListenFragment();
deleteLastTempFile();
respeaker.goToPreviousSample();
......@@ -493,6 +498,8 @@ public class ThumbRespeakFragment extends Fragment {
private boolean isCommented = true;
private int count = 0;
private View v;
private Button undo;
public static final String TAG = "ThumbRespeakFragment";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment