From d0b620fdc53a985acb16beac77171ec5584ddb3c Mon Sep 17 00:00:00 2001 From: daniel oeh Date: Fri, 18 Apr 2014 21:12:10 +0200 Subject: [PATCH] Improved external player layout --- res/layout/external_player_fragment.xml | 57 +++++-------------- res/values/dimens.xml | 2 +- .../antennapod/activity/MainActivity.java | 12 ++-- .../fragment/ExternalPlayerFragment.java | 14 ----- 4 files changed, 21 insertions(+), 64 deletions(-) diff --git a/res/layout/external_player_fragment.xml b/res/layout/external_player_fragment.xml index d619d7a77..401127148 100644 --- a/res/layout/external_player_fragment.xml +++ b/res/layout/external_player_fragment.xml @@ -1,26 +1,26 @@ + android:id="@+id/fragmentLayout" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:visibility="gone"> + android:layout_height="2dp" + android:background="@color/bright_blue"/> + android:layout_height="wrap_content"> + android:background="?attr/borderless_button"> + android:scaleType="fitXY"/> - - - - + android:maxLines="2" + android:textSize="18sp" + android:fontFamily="sans-serif-condensed"/> + android:background="?attr/borderless_button"/> \ No newline at end of file diff --git a/res/values/dimens.xml b/res/values/dimens.xml index f059f9814..5fe4a3207 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -4,7 +4,7 @@ 8dp 70dp 54dp - 55dp + 70dp 20dp 12sp 14sp diff --git a/src/de/danoeh/antennapod/activity/MainActivity.java b/src/de/danoeh/antennapod/activity/MainActivity.java index 1a4138d35..36f6089de 100644 --- a/src/de/danoeh/antennapod/activity/MainActivity.java +++ b/src/de/danoeh/antennapod/activity/MainActivity.java @@ -91,22 +91,20 @@ public class MainActivity extends ActionBarActivity { drawerLayout.setDrawerListener(drawerToogle); FragmentManager fm = getSupportFragmentManager(); + FragmentTransaction transaction = fm.beginTransaction(); - externalPlayerFragment = new ExternalPlayerFragment(); - transaction.replace(R.id.playerFragment, externalPlayerFragment); - - - transaction.commit(); Fragment mainFragment = fm.findFragmentByTag("main"); if (mainFragment != null) { - transaction = fm.beginTransaction(); transaction.replace(R.id.main_view, mainFragment); - transaction.commit(); } else { loadFragment(NavListAdapter.VIEW_TYPE_NAV, NavListAdapter.POS_NEW, null); } + externalPlayerFragment = new ExternalPlayerFragment(); + transaction.replace(R.id.playerFragment, externalPlayerFragment); + transaction.commit(); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); diff --git a/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java b/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java index 47cd3f244..db47cd8a4 100644 --- a/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java +++ b/src/de/danoeh/antennapod/fragment/ExternalPlayerFragment.java @@ -29,8 +29,6 @@ public class ExternalPlayerFragment extends Fragment { private ImageView imgvCover; private ViewGroup layoutInfo; private TextView txtvTitle; - private TextView txtvPosition; - private TextView txtvStatus; private ImageButton butPlay; private PlaybackController controller; @@ -48,9 +46,7 @@ public class ExternalPlayerFragment extends Fragment { imgvCover = (ImageView) root.findViewById(R.id.imgvCover); layoutInfo = (ViewGroup) root.findViewById(R.id.layoutInfo); txtvTitle = (TextView) root.findViewById(R.id.txtvTitle); - txtvPosition = (TextView) root.findViewById(R.id.txtvPosition); butPlay = (ImageButton) root.findViewById(R.id.butPlay); - txtvStatus = (TextView) root.findViewById(R.id.txtvStatus); layoutInfo.setOnClickListener(new OnClickListener() { @@ -84,12 +80,6 @@ public class ExternalPlayerFragment extends Fragment { @Override 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 @@ -127,12 +117,10 @@ public class ExternalPlayerFragment extends Fragment { @Override public void postStatusMsg(int msg) { - txtvStatus.setText(msg); } @Override public void clearStatusMsg() { - txtvStatus.setText(""); } @Override @@ -223,8 +211,6 @@ public class ExternalPlayerFragment extends Fragment { (int) getActivity().getResources().getDimension( R.dimen.external_player_height)); - txtvPosition.setText(getPositionString(media.getPosition(), - media.getDuration())); fragmentLayout.setVisibility(View.VISIBLE); if (controller.isPlayingVideo()) { butPlay.setVisibility(View.GONE);