David Morrissey | 00cce30 | 2014-06-10 00:28:49 +0100 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2014 David Morrissey |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.davemorrissey.labs.subscaleview.sample.extension; |
| 18 | |
| 19 | import android.os.Bundle; |
| 20 | import android.support.v4.app.Fragment; |
| 21 | import android.view.LayoutInflater; |
| 22 | import android.view.View; |
| 23 | import android.view.View.OnClickListener; |
| 24 | import android.view.ViewGroup; |
David Morrissey | 59a6c8b | 2015-03-03 22:36:16 +0000 | [diff] [blame^] | 25 | |
| 26 | import com.davemorrissey.labs.subscaleview.ImageSource; |
David Morrissey | 00cce30 | 2014-06-10 00:28:49 +0100 | [diff] [blame] | 27 | import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; |
| 28 | import com.davemorrissey.labs.subscaleview.sample.R.id; |
| 29 | import com.davemorrissey.labs.subscaleview.sample.R.layout; |
| 30 | |
| 31 | public class ExtensionCircleFragment extends Fragment { |
| 32 | |
| 33 | @Override |
| 34 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
| 35 | View rootView = inflater.inflate(layout.extension_circle_fragment, container, false); |
| 36 | rootView.findViewById(id.next).setOnClickListener(new OnClickListener() { |
| 37 | @Override |
| 38 | public void onClick(View view) { |
| 39 | ((ExtensionActivity)getActivity()).next(); |
| 40 | } |
| 41 | }); |
| 42 | rootView.findViewById(id.previous).setOnClickListener(new OnClickListener() { |
| 43 | @Override |
| 44 | public void onClick(View view) { |
| 45 | ((ExtensionActivity)getActivity()).previous(); |
| 46 | } |
| 47 | }); |
| 48 | SubsamplingScaleImageView imageView = (SubsamplingScaleImageView)rootView.findViewById(id.imageView); |
David Morrissey | 59a6c8b | 2015-03-03 22:36:16 +0000 | [diff] [blame^] | 49 | imageView.setImage(ImageSource.asset("squirrel.jpg")); |
David Morrissey | 00cce30 | 2014-06-10 00:28:49 +0100 | [diff] [blame] | 50 | return rootView; |
| 51 | } |
| 52 | |
| 53 | } |