Minor changes

This commit is contained in:
Martin Fietz 2016-01-26 11:50:49 +01:00
parent 59129c6c88
commit 150042e913
3 changed files with 14 additions and 22 deletions

View File

@ -6,11 +6,11 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout; import android.support.design.widget.AppBarLayout;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter; import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.app.ListFragment;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.ActionBarDrawerToggle;
@ -129,7 +129,6 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
if(mPager == null) { if(mPager == null) {
return; return;
} }
Log.d(TAG, "Saving preferences"); Log.d(TAG, "Saving preferences");
SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE);
prefs.edit() prefs.edit()
@ -172,7 +171,6 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
mPagerAdapter.onMediaChanged(media); mPagerAdapter.onMediaChanged(media);
} }
EventDistributor.getInstance().register(contentUpdate); EventDistributor.getInstance().register(contentUpdate);
loadData(); loadData();
} }
@ -258,13 +256,11 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
}); });
mPager = (ViewPager) findViewById(R.id.pager); mPager = (ViewPager) findViewById(R.id.pager);
if(mPager.getAdapter() == null) { mPagerAdapter = new AudioplayerPagerAdapter(getSupportFragmentManager());
mPagerAdapter = new AudioplayerPagerAdapter(getSupportFragmentManager()); mPager.setAdapter(mPagerAdapter);
mPager.setAdapter(mPagerAdapter); CirclePageIndicator pageIndicator = (CirclePageIndicator) findViewById(R.id.page_indicator);
CirclePageIndicator pageIndicator = (CirclePageIndicator) findViewById(R.id.page_indicator); pageIndicator.setViewPager(mPager);
pageIndicator.setViewPager(mPager); loadLastFragment();
loadLastFragment();
}
mPager.onSaveInstanceState(); mPager.onSaveInstanceState();
} }
@ -552,7 +548,6 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
} }
} }
@Override @Override
public int getCount() { public int getCount() {
return NUM_CONTENT_FRAGMENTS; return NUM_CONTENT_FRAGMENTS;

View File

@ -71,14 +71,12 @@ public class CoverFragment extends Fragment implements AudioplayerContentFragmen
Log.d(TAG, "episode title: " + media.getEpisodeTitle()); Log.d(TAG, "episode title: " + media.getEpisodeTitle());
txtvPodcastTitle.setText(media.getFeedTitle()); txtvPodcastTitle.setText(media.getFeedTitle());
txtvEpisodeTitle.setText(media.getEpisodeTitle()); txtvEpisodeTitle.setText(media.getEpisodeTitle());
imgvCover.post(() -> { Glide.with(this)
Glide.with(this) .load(media.getImageUri())
.load(media.getImageUri()) .diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY)
.diskCacheStrategy(ApGlideSettings.AP_DISK_CACHE_STRATEGY) .dontAnimate()
.dontAnimate() .fitCenter()
.fitCenter() .into(imgvCover);
.into(imgvCover);
});
} else { } else {
Log.w(TAG, "loadMediaInfo was called while media was null"); Log.w(TAG, "loadMediaInfo was called while media was null");
} }

View File

@ -21,7 +21,7 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.WebSettings.LayoutAlgorithm; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.Toast; import android.widget.Toast;
@ -67,7 +67,6 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
private ShownotesProvider shownotesProvider; private ShownotesProvider shownotesProvider;
private Playable media; private Playable media;
private Subscription webViewLoader; private Subscription webViewLoader;
/** /**
@ -124,7 +123,7 @@ public class ItemDescriptionFragment extends Fragment implements AudioplayerCont
ta.recycle(); ta.recycle();
webvDescription.setBackgroundColor(backgroundColor); webvDescription.setBackgroundColor(backgroundColor);
webvDescription.getSettings().setUseWideViewPort(false); webvDescription.getSettings().setUseWideViewPort(false);
webvDescription.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); webvDescription.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
webvDescription.getSettings().setLoadWithOverviewMode(true); webvDescription.getSettings().setLoadWithOverviewMode(true);
webvDescription.setOnLongClickListener(webViewLongClickListener); webvDescription.setOnLongClickListener(webViewLongClickListener);
webvDescription.setWebViewClient(new WebViewClient() { webvDescription.setWebViewClient(new WebViewClient() {