Improved external player layout
This commit is contained in:
parent
257913196b
commit
d0b620fdc5
|
@ -4,23 +4,23 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone" >
|
android:visibility="gone">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1.5dp"
|
android:layout_height="2dp"
|
||||||
android:background="#AAAAAA" />
|
android:background="@color/bright_blue"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" >
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/layoutInfo"
|
android:id="@+id/layoutInfo"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:background="?attr/borderless_button" >
|
android:background="?attr/borderless_button">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imgvCover"
|
android:id="@+id/imgvCover"
|
||||||
|
@ -28,9 +28,10 @@
|
||||||
android:layout_width="@dimen/external_player_height"
|
android:layout_width="@dimen/external_player_height"
|
||||||
android:layout_height="@dimen/external_player_height"
|
android:layout_height="@dimen/external_player_height"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
|
android:padding="4dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:cropToPadding="true"
|
android:cropToPadding="true"
|
||||||
android:scaleType="fitXY" />
|
android:scaleType="fitXY"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/txtvTitle"
|
android:id="@+id/txtvTitle"
|
||||||
|
@ -42,37 +43,9 @@
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_toRightOf="@id/imgvCover"
|
android:layout_toRightOf="@id/imgvCover"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:maxLines="1"
|
android:maxLines="2"
|
||||||
android:textStyle="bold" />
|
android:textSize="18sp"
|
||||||
|
android:fontFamily="sans-serif-condensed"/>
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtvPosition"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/txtvTitle"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_toRightOf="@id/imgvCover"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textSize="@dimen/text_size_micro" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtvStatus"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_below="@id/txtvTitle"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_toRightOf="@id/txtvPosition"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:textSize="@dimen/text_size_micro" />
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
|
@ -80,7 +53,7 @@
|
||||||
android:contentDescription="@string/pause_label"
|
android:contentDescription="@string/pause_label"
|
||||||
android:layout_width="@dimen/external_player_height"
|
android:layout_width="@dimen/external_player_height"
|
||||||
android:layout_height="@dimen/external_player_height"
|
android:layout_height="@dimen/external_player_height"
|
||||||
android:background="?attr/borderless_button" />
|
android:background="?attr/borderless_button"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -4,7 +4,7 @@
|
||||||
<dimen name="widget_margin">8dp</dimen>
|
<dimen name="widget_margin">8dp</dimen>
|
||||||
<dimen name="thumbnail_length">70dp</dimen>
|
<dimen name="thumbnail_length">70dp</dimen>
|
||||||
<dimen name="dragview_length">54dp</dimen>
|
<dimen name="dragview_length">54dp</dimen>
|
||||||
<dimen name="external_player_height">55dp</dimen>
|
<dimen name="external_player_height">70dp</dimen>
|
||||||
<dimen name="enc_icons_size">20dp</dimen>
|
<dimen name="enc_icons_size">20dp</dimen>
|
||||||
<dimen name="text_size_micro">12sp</dimen>
|
<dimen name="text_size_micro">12sp</dimen>
|
||||||
<dimen name="text_size_small">14sp</dimen>
|
<dimen name="text_size_small">14sp</dimen>
|
||||||
|
|
|
@ -91,22 +91,20 @@ public class MainActivity extends ActionBarActivity {
|
||||||
|
|
||||||
drawerLayout.setDrawerListener(drawerToogle);
|
drawerLayout.setDrawerListener(drawerToogle);
|
||||||
FragmentManager fm = getSupportFragmentManager();
|
FragmentManager fm = getSupportFragmentManager();
|
||||||
|
|
||||||
FragmentTransaction transaction = fm.beginTransaction();
|
FragmentTransaction transaction = fm.beginTransaction();
|
||||||
externalPlayerFragment = new ExternalPlayerFragment();
|
|
||||||
transaction.replace(R.id.playerFragment, externalPlayerFragment);
|
|
||||||
|
|
||||||
|
|
||||||
transaction.commit();
|
|
||||||
|
|
||||||
Fragment mainFragment = fm.findFragmentByTag("main");
|
Fragment mainFragment = fm.findFragmentByTag("main");
|
||||||
if (mainFragment != null) {
|
if (mainFragment != null) {
|
||||||
transaction = fm.beginTransaction();
|
|
||||||
transaction.replace(R.id.main_view, mainFragment);
|
transaction.replace(R.id.main_view, mainFragment);
|
||||||
transaction.commit();
|
|
||||||
} else {
|
} else {
|
||||||
loadFragment(NavListAdapter.VIEW_TYPE_NAV, NavListAdapter.POS_NEW, null);
|
loadFragment(NavListAdapter.VIEW_TYPE_NAV, NavListAdapter.POS_NEW, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
externalPlayerFragment = new ExternalPlayerFragment();
|
||||||
|
transaction.replace(R.id.playerFragment, externalPlayerFragment);
|
||||||
|
transaction.commit();
|
||||||
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
getSupportActionBar().setHomeButtonEnabled(true);
|
getSupportActionBar().setHomeButtonEnabled(true);
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,6 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
private ImageView imgvCover;
|
private ImageView imgvCover;
|
||||||
private ViewGroup layoutInfo;
|
private ViewGroup layoutInfo;
|
||||||
private TextView txtvTitle;
|
private TextView txtvTitle;
|
||||||
private TextView txtvPosition;
|
|
||||||
private TextView txtvStatus;
|
|
||||||
private ImageButton butPlay;
|
private ImageButton butPlay;
|
||||||
|
|
||||||
private PlaybackController controller;
|
private PlaybackController controller;
|
||||||
|
@ -48,9 +46,7 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
imgvCover = (ImageView) root.findViewById(R.id.imgvCover);
|
imgvCover = (ImageView) root.findViewById(R.id.imgvCover);
|
||||||
layoutInfo = (ViewGroup) root.findViewById(R.id.layoutInfo);
|
layoutInfo = (ViewGroup) root.findViewById(R.id.layoutInfo);
|
||||||
txtvTitle = (TextView) root.findViewById(R.id.txtvTitle);
|
txtvTitle = (TextView) root.findViewById(R.id.txtvTitle);
|
||||||
txtvPosition = (TextView) root.findViewById(R.id.txtvPosition);
|
|
||||||
butPlay = (ImageButton) root.findViewById(R.id.butPlay);
|
butPlay = (ImageButton) root.findViewById(R.id.butPlay);
|
||||||
txtvStatus = (TextView) root.findViewById(R.id.txtvStatus);
|
|
||||||
|
|
||||||
layoutInfo.setOnClickListener(new OnClickListener() {
|
layoutInfo.setOnClickListener(new OnClickListener() {
|
||||||
|
|
||||||
|
@ -84,12 +80,6 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPositionObserverUpdate() {
|
public void onPositionObserverUpdate() {
|
||||||
int duration = controller.getDuration();
|
|
||||||
int position = controller.getPosition();
|
|
||||||
if (duration != PlaybackController.INVALID_TIME
|
|
||||||
&& position != PlaybackController.INVALID_TIME) {
|
|
||||||
txtvPosition.setText(getPositionString(position, duration));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,12 +117,10 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postStatusMsg(int msg) {
|
public void postStatusMsg(int msg) {
|
||||||
txtvStatus.setText(msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearStatusMsg() {
|
public void clearStatusMsg() {
|
||||||
txtvStatus.setText("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -223,8 +211,6 @@ public class ExternalPlayerFragment extends Fragment {
|
||||||
(int) getActivity().getResources().getDimension(
|
(int) getActivity().getResources().getDimension(
|
||||||
R.dimen.external_player_height));
|
R.dimen.external_player_height));
|
||||||
|
|
||||||
txtvPosition.setText(getPositionString(media.getPosition(),
|
|
||||||
media.getDuration()));
|
|
||||||
fragmentLayout.setVisibility(View.VISIBLE);
|
fragmentLayout.setVisibility(View.VISIBLE);
|
||||||
if (controller.isPlayingVideo()) {
|
if (controller.isPlayingVideo()) {
|
||||||
butPlay.setVisibility(View.GONE);
|
butPlay.setVisibility(View.GONE);
|
||||||
|
|
Loading…
Reference in New Issue