diff --git a/demo/stock/src/main/AndroidManifest.xml b/demo/stock/src/main/AndroidManifest.xml index 5fbd21dc..c29ac97f 100644 --- a/demo/stock/src/main/AndroidManifest.xml +++ b/demo/stock/src/main/AndroidManifest.xml @@ -41,7 +41,6 @@ diff --git a/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeMiscCardFragment.java b/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeMiscCardFragment.java index 7b4f3c85..e3131fd5 100644 --- a/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeMiscCardFragment.java +++ b/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeMiscCardFragment.java @@ -79,11 +79,16 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa return inflater.inflate(R.layout.demo_fragment_native_misc_card, container, false); } + float mElevationCircle; + int mSizeCircle; + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mScrollView = (ScrollView) getActivity().findViewById(R.id.card_scrollview); + mElevationCircle = getResources().getDimension(R.dimen.circle_elevation); + mSizeCircle = getResources().getDimensionPixelSize(R.dimen.circle_size); initCard(); } @@ -165,15 +170,14 @@ public boolean applyBitmap(final View imageView, Bitmap bitmap) { imageView.setBackgroundDrawable(circle); - ViewCompat.setElevation(imageView, getResources().getDimension(R.dimen.circle_elevation)); + ViewCompat.setElevation(imageView, mElevationCircle); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ - final int size = getResources().getDimensionPixelSize(R.dimen.circle_size); imageView.setOutlineProvider( new ViewOutlineProvider(){ @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void getOutline(View view, Outline outline) { - outline.setOval(0, 0, size, size); + outline.setOval(0, 0, mSizeCircle, mSizeCircle); } }); imageView.setClipToOutline(true); diff --git a/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeRecyclerViewFragment.java b/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeRecyclerViewFragment.java index ea357d67..51eb5fb4 100644 --- a/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeRecyclerViewFragment.java +++ b/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/nativeview/NativeRecyclerViewFragment.java @@ -111,8 +111,11 @@ class LoaderAsyncTask extends AsyncTask> { protected ArrayList doInBackground(Void... params) { //elaborate images SystemClock.sleep(1000); //delay to simulate download, don't use it in a real app - ArrayList cards = initCard(); - return cards; + if (isAdded()) { + ArrayList cards = initCard(); + return cards; + }else + return null; } @Override diff --git a/demo/stock/src/main/java/it/gmariotti/cardslib/demo/ui/NativeMenuActivity.java b/demo/stock/src/main/java/it/gmariotti/cardslib/demo/ui/NativeMenuActivity.java index 02ed847e..27dfbff5 100644 --- a/demo/stock/src/main/java/it/gmariotti/cardslib/demo/ui/NativeMenuActivity.java +++ b/demo/stock/src/main/java/it/gmariotti/cardslib/demo/ui/NativeMenuActivity.java @@ -45,6 +45,9 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.carddemo_activity_native); + if (getSupportActionBar() != null) + getSupportActionBar().setTitle(R.string.navdrawer_item_native_cardslib); + if (null == savedInstanceState) { getFragmentManager().beginTransaction() .replace(R.id.container, NativeDashFragment.newInstance()) diff --git a/demo/stock/src/main/res/values/strings.xml b/demo/stock/src/main/res/values/strings.xml index abc628e0..55a6eb20 100644 --- a/demo/stock/src/main/res/values/strings.xml +++ b/demo/stock/src/main/res/values/strings.xml @@ -20,7 +20,7 @@ - CardsLibDemo + CardsLib Demo it.gmariotti.cardslib.demo.provider