Permalink
Browse files

work on trim ui

work on trim ui
  • Loading branch information...
1 parent 849e81a commit dde8f7c0d72f5d9b22fdcdb8eeb6ae93851131a2 @vitriolix vitriolix committed Mar 30, 2013
@@ -4,81 +4,87 @@
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:orientation="vertical" >
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="#000000" >
- <ImageView
- android:id="@+id/imageView1"
- android:layout_width="fill_parent"
- android:layout_height="200dip"
- android:adjustViewBounds="true"
- android:src="@drawable/cliptype_long" />
- <info.guardianproject.mrapp.PreviewVideoView
- android:id="@+id/previewVideoView"
- android:layout_width="match_parent"
- android:layout_height="200dip"
- android:visibility="gone"
- android:adjustViewBounds="true"
-
- />
-</LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#000000"
+ android:orientation="vertical" >
+
+ <ImageView
+ android:id="@+id/imageView1"
+ android:layout_width="fill_parent"
+ android:layout_height="200dip"
+ android:adjustViewBounds="true"
+ android:src="@drawable/cliptype_long" />
+
+ <info.guardianproject.mrapp.PreviewVideoView
+ android:id="@+id/previewVideoView"
+ android:layout_width="match_parent"
+ android:layout_height="200dip"
+ android:adjustViewBounds="true"
+ android:visibility="gone" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/llControlBar"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#000000" >
+
+ <Button
+ android:id="@+id/buttonPlay"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="wrap_content"
+ android:layout_height="30dp"
+ android:text="@string/play_recording" />
+
+ <SeekBar
+ android:id="@+id/seekBar1"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:layout_weight="1" />
+ </LinearLayout>
+
<LinearLayout
+ android:id="@+id/llRangeSeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
+ android:visibility="gone"
>
+ </LinearLayout>
+
- <Button
- android:id="@+id/buttonPlay"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="wrap_content"
- android:layout_height="30dp"
- android:text="@string/play_recording" />
-
- <SeekBar
- android:id="@+id/seekBar1"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
-
- android:layout_weight="1" />
-
- </LinearLayout>
- <com.animoto.android.views.DraggableGridView
+ <com.animoto.android.views.DraggableGridView
android:id="@+id/DraggableGridView01"
android:layout_width="fill_parent"
- android:layout_height="150dp">
+ android:layout_height="150dp" >
</com.animoto.android.views.DraggableGridView>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:orientation="horizontal"
- >
-
- <Button
- android:id="@+id/buttonAddNarration"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/button_add_narration"
- android:layout_weight="1"
-
- android:enabled="false"
- />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:orientation="horizontal" >
+
+ <Button
+ android:id="@+id/buttonAddNarration"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:enabled="false"
+ android:text="@string/button_add_narration" />
+
+ <Button
+ android:id="@+id/buttonPlayNarration"
+ style="?android:attr/buttonStyleSmall"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:enabled="false"
+ android:text="@string/button_play_narration" />
+ </LinearLayout>
- <Button
- android:id="@+id/buttonPlayNarration"
- style="?android:attr/buttonStyleSmall"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/button_play_narration"
- android:layout_weight="1"
- android:enabled="false"
- />
- </LinearLayout>
-
-</LinearLayout>
+</LinearLayout>
@@ -0,0 +1,3 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:id="@+id/item1" android:title="Trim clip"></item>
+</menu>
@@ -13,6 +13,7 @@
import org.holoeverywhere.widget.SeekBar.OnSeekBarChangeListener;
import org.json.JSONException;
+import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -34,10 +35,12 @@
import com.animoto.android.views.DraggableGridView;
import com.animoto.android.views.OnRearrangeListener;
+import com.efor18.rangeseekbar.RangeSeekBar;
/**
*
*/
+@SuppressLint("ValidFragment") // FIXME don't do this
public class OrderClipsFragment extends Fragment {
private final static String TAG = "OrderClipsFragment";
int layout;
@@ -48,6 +51,7 @@
private ImageView mImageViewMedia;
private PreviewVideoView mPreviewVideoView = null;
private SeekBar mSeekBar = null;
+ RangeSeekBar<Integer> mRangeSeekBar = null;
public MediaProjectManager mMPM;
private Handler mHandlerPub;
@@ -122,6 +126,11 @@ public void onStopTrackingTouch(SeekBar seekBar) {
});
+ mRangeSeekBar = new RangeSeekBar<Integer>(0, 99, getActivity());
+
+ ViewGroup layout = (ViewGroup) view.findViewById(R.id.llRangeSeekBar);
+ layout.addView(mRangeSeekBar);
+
if (mMPM.mProject.getStoryType() == Project.STORY_TYPE_ESSAY)
{
@@ -480,6 +489,15 @@ private void renderPreview ()
mHandlerPub.sendMessage(msgErr);
Log.e(AppConstants.TAG, "error posting", e);
}
+ }
+ public void enableTrim(boolean enable) {
+ if (enable) {
+// mSeekBar.setVisibility(View.GONE);
+ mRangeSeekBar.setVisibility(View.VISIBLE);
+ } else {
+// mSeekBar.setVisibility(View.VISIBLE);
+ mRangeSeekBar.setVisibility(View.GONE);
+ }
}
}
@@ -39,7 +39,9 @@
import android.widget.Toast;
import com.actionbarsherlock.app.ActionBar;
+import com.actionbarsherlock.view.ActionMode;
import com.actionbarsherlock.view.Menu;
+import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
public class SceneEditorActivity extends EditorBaseActivity implements ActionBar.TabListener {
@@ -185,11 +187,55 @@ public boolean onOptionsItemSelected(MenuItem item) {
addShotToScene();
return true;
+ case R.id.itemTrim:
+ if (mFragmentTab1!= null) {
+ ((OrderClipsFragment) mFragmentTab1).enableTrim(true);
+ startActionMode(mActionModeCallback);
+ }
+ return true;
}
return super.onOptionsItemSelected(item);
}
+ private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
+
+ // Called when the action mode is created; startActionMode() was called
+ @Override
+ public boolean onCreateActionMode(ActionMode mode, Menu menu) {
+ // Inflate a menu resource providing context menu items
+ MenuInflater inflater = mode.getMenuInflater();
+ inflater.inflate(R.menu.context_menu_trim, menu);
+ return true;
+ }
+
+ // Called each time the action mode is shown. Always called after onCreateActionMode, but
+ // may be called multiple times if the mode is invalidated.
+ @Override
+ public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
+ return false; // Return false if nothing is done
+ }
+
+ // Called when the user selects a contextual menu item
+ @Override
+ public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
+ switch (item.getItemId()) {
+// case R.id.menu_share:
+// shareCurrentItem();
+// mode.finish(); // Action picked, so close the CAB
+// return true;
+ default:
+ return false;
+ }
+ }
+
+ // Called when the user exits the action mode
+ @Override
+ public void onDestroyActionMode(ActionMode mode) {
+// mActionMode = null;
+ }
+ };
+
// FIXME move this into AddClipsFragment?
public void addShotToScene ()
{

0 comments on commit dde8f7c

Please sign in to comment.