Fixes Queue not opening from the drawer, small podcasts images not scaling up and long URL not wrapping in the podcast info view

This commit is contained in:
Martin Fietz 2015-06-21 12:38:44 +02:00
parent e1b494ba05
commit 1e53df0f5f
3 changed files with 22 additions and 13 deletions

View File

@ -92,8 +92,8 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
private ActionBarDrawerToggle drawerToggle; private ActionBarDrawerToggle drawerToggle;
private CharSequence drawerTitle;
private CharSequence currentTitle; private CharSequence currentTitle;
private String currentFragment;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
@ -107,7 +107,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
getSupportActionBar().setElevation(3.0f); getSupportActionBar().setElevation(3.0f);
drawerTitle = currentTitle = getTitle(); currentTitle = getTitle();
drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
navList = (ListView) findViewById(R.id.nav_list); navList = (ListView) findViewById(R.id.nav_list);
@ -173,6 +173,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
} }
private void saveLastNavFragment(String tag) { private void saveLastNavFragment(String tag) {
Log.d(TAG, "saveLastNavFragment(tag: " + tag +")");
SharedPreferences prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE); SharedPreferences prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
SharedPreferences.Editor edit = prefs.edit(); SharedPreferences.Editor edit = prefs.edit();
if(tag != null) { if(tag != null) {
@ -180,12 +181,15 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
} else { } else {
edit.remove(PREF_LAST_FRAGMENT_TAG); edit.remove(PREF_LAST_FRAGMENT_TAG);
} }
currentFragment = tag;
edit.commit(); edit.commit();
} }
private String getLastNavFragment() { private String getLastNavFragment() {
SharedPreferences prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE); SharedPreferences prefs = getSharedPreferences(PREF_NAME, MODE_PRIVATE);
return prefs.getString(PREF_LAST_FRAGMENT_TAG, QueueFragment.TAG); String lastFragment = prefs.getString(PREF_LAST_FRAGMENT_TAG, QueueFragment.TAG);
Log.d(TAG, "getLastNavFragment() -> " + lastFragment);
return lastFragment;
} }
private void checkFirstLaunch() { private void checkFirstLaunch() {
@ -251,6 +255,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
} }
public void loadFragment(int index, Bundle args) { public void loadFragment(int index, Bundle args) {
Log.d(TAG, "loadFragment(index: " + index + ", args: " + args +")");
if (index < navAdapter.getSubscriptionOffset()) { if (index < navAdapter.getSubscriptionOffset()) {
String tag = navAdapter.getTags().get(index); String tag = navAdapter.getTags().get(index);
loadFragment(tag, args); loadFragment(tag, args);
@ -261,7 +266,7 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
} }
public void loadFragment(final String tag, Bundle args) { public void loadFragment(final String tag, Bundle args) {
Log.d(TAG, "loadFragment(\"" + tag + "\", " + args + ")"); Log.d(TAG, "loadFragment(tag: " + tag + ", args: " + args + ")");
Fragment fragment = null; Fragment fragment = null;
switch (tag) { switch (tag) {
case QueueFragment.TAG: case QueueFragment.TAG:
@ -543,10 +548,10 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
navAdapter.notifyDataSetChanged(); navAdapter.notifyDataSetChanged();
String lastFragment = getLastNavFragment(); String lastFragment = getLastNavFragment();
if(!ArrayUtils.contains(NAV_DRAWER_TAGS, lastFragment)) { if(currentFragment != lastFragment &&
!ArrayUtils.contains(NAV_DRAWER_TAGS, lastFragment)) {
long feedId = Long.valueOf(lastFragment); long feedId = Long.valueOf(lastFragment);
loadFeedFragmentById(feedId); loadFeedFragmentById(feedId);
saveLastNavFragment(null);
} }
if (handleIntent) { if (handleIntent) {

View File

@ -13,7 +13,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_gravity="center"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerInside" android:scaleType="fitCenter"
tools:src="@android:drawable/sym_def_app_icon" /> tools:src="@android:drawable/sym_def_app_icon" />
</RelativeLayout> </RelativeLayout>

View File

@ -20,8 +20,8 @@
<ImageView <ImageView
android:id="@+id/imgvCover" android:id="@+id/imgvCover"
android:contentDescription="@string/cover_label" android:contentDescription="@string/cover_label"
android:layout_width="70dp" android:layout_width="80dp"
android:layout_height="70dp" android:layout_height="80dp"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
tools:src="@drawable/ic_stat_antenna_default" tools:src="@drawable/ic_stat_antenna_default"
@ -33,7 +33,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="8dp" android:layout_marginLeft="8dp"
android:layout_alignTop="@id/imgvCover"
android:layout_toRightOf="@id/imgvCover" android:layout_toRightOf="@id/imgvCover"
android:layout_alignBottom="@id/imgvCover"
style="@style/AntennaPod.TextView.Heading" style="@style/AntennaPod.TextView.Heading"
tools:text="Feed title" tools:text="Feed title"
tools:background="@android:color/holo_green_dark"/> tools:background="@android:color/holo_green_dark"/>
@ -52,7 +54,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:scrollbarStyle="outsideInset" android:scrollbarStyle="outsideOverlay"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingBottom="8dp"> android:paddingBottom="8dp">
@ -119,7 +121,6 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:layout_row="2" app:layout_row="2"
app:layout_column="0" app:layout_column="0"
android:lines="1" android:lines="1"
@ -129,10 +130,13 @@
<TextView <TextView
android:id="@+id/txtvUrl" android:id="@+id/txtvUrl"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="4dp"
app:layout_row="2" app:layout_row="2"
app:layout_column="1" app:layout_column="1"
app:layout_gravity="fill"
android:maxLines="4"
tools:text="http://www.example.com/feed" tools:text="http://www.example.com/feed"
tools:background="@android:color/holo_green_dark"/> tools:background="@android:color/holo_green_dark"/>