Search in sources :

Example 41 with ImageView

use of android.widget.ImageView in project Float-Bar by tianzhijiexian.

the class AppAdapter method getView.

/**
	 * 自定义view
	 */
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    LayoutInflater mInflater = LayoutInflater.from(mContext);
    View infoView = mInflater.inflate(R.layout.app_item, null);
    ImageView mImageView = (ImageView) infoView.findViewById(R.id.icon);
    TextView mTextView = (TextView) infoView.findViewById(R.id.title);
    mTextView.setTextColor(prefs.getDrawTextColor());
    String title = (String) mAppInfos.get(position).get("title");
    Drawable icon = (Drawable) mAppInfos.get(position).get("icon");
    Intent singleIntent = (Intent) mAppInfos.get(position).get("tag");
    infoView.setTag(singleIntent);
    mImageView.setImageDrawable(icon);
    mTextView.setText(title);
    // 绑定点击事件,用来进行应用间的跳转
    infoView.setOnClickListener(new SingleAppClickListener());
    return infoView;
}
Also used : LayoutInflater(android.view.LayoutInflater) Drawable(android.graphics.drawable.Drawable) TextView(android.widget.TextView) Intent(android.content.Intent) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View)

Example 42 with ImageView

use of android.widget.ImageView in project QiDict by timqi.

the class GuidePager method initViews.

private void initViews() {
    LayoutInflater inflater = LayoutInflater.from(this);
    mViews = new ArrayList<View>();
    ImageView mImageView;
    mImageView = (ImageView) inflater.inflate(R.layout.guide_item, null);
    ImageSize imageSize = new ImageSize(mImageView.getWidth(), mImageView.getHeight());
    String imgUri = "drawable://" + R.drawable.pager1;
    Bitmap bitmap = ImageLoader.getInstance().loadImageSync(imgUri, imageSize);
    mImageView.setBackgroundDrawable(new BitmapDrawable(bitmap));
    mViews.add(mImageView);
    mImageView = (ImageView) inflater.inflate(R.layout.guide_item, null);
    imgUri = "drawable://" + R.drawable.pager2;
    bitmap = ImageLoader.getInstance().loadImageSync(imgUri, imageSize);
    mImageView.setBackgroundDrawable(new BitmapDrawable(bitmap));
    mViews.add(mImageView);
    mImageView = (ImageView) inflater.inflate(R.layout.guide_item, null);
    imgUri = "drawable://" + R.drawable.pager3;
    bitmap = ImageLoader.getInstance().loadImageSync(imgUri, imageSize);
    mImageView.setBackgroundDrawable(new BitmapDrawable(bitmap));
    mViews.add(mImageView);
    mView = inflater.inflate(R.layout.guide_item_button, null);
    mImageView = (ImageView) mView.findViewById(R.id.img_guide_item);
    imgUri = "drawable://" + R.drawable.pager4;
    bitmap = ImageLoader.getInstance().loadImageSync(imgUri, imageSize);
    mImageView.setBackgroundDrawable(new BitmapDrawable(bitmap));
    mButton = (Button) mView.findViewById(R.id.img_btn_guide);
    mButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    mViews.add(mView);
    mViewPagerAdapter = new ViewPagerAdapter(mViews, this);
    mViewPager = (ViewPager) findViewById(R.id.viewpager);
    mViewPager.setAdapter(mViewPagerAdapter);
    mViewPager.setOnPageChangeListener(this);
}
Also used : Bitmap(android.graphics.Bitmap) ImageSize(com.nostra13.universalimageloader.core.assist.ImageSize) LayoutInflater(android.view.LayoutInflater) ImageView(android.widget.ImageView) BitmapDrawable(android.graphics.drawable.BitmapDrawable) ImageView(android.widget.ImageView) View(android.view.View)

Example 43 with ImageView

use of android.widget.ImageView in project PreLollipopTransition by takahirom.

the class MainActivityTest method testFragmentTransition.

public void testFragmentTransition() throws InterruptedException {
    Spoon.screenshot(getActivity(), "init");
    final ImageView imageView = (ImageView) getActivity().findViewById(R.id.support_fragment_start_imageview);
    final ImageView imageView2 = (ImageView) getActivity().findViewById(R.id.fragment_start_imageview);
    instrumentation.waitForIdleSync();
    instrumentation.runOnMainSync(new Runnable() {

        @Override
        public void run() {
            assertTrue(imageView.performClick());
            assertTrue(imageView2.performClick());
        }
    });
    // Wait for animation
    Thread.sleep(2000l);
    instrumentation.waitForIdleSync();
    Spoon.screenshot(getActivity(), "support_fragment_transition");
    sendKeys(KeyEvent.KEYCODE_BACK);
    instrumentation.waitForIdleSync();
    Thread.sleep(2000l);
    Spoon.screenshot(getActivity(), "support_fragment_transition_backpress1");
    sendKeys(KeyEvent.KEYCODE_BACK);
    instrumentation.waitForIdleSync();
    Thread.sleep(3000l);
    Spoon.screenshot(getActivity(), "support_fragment_transition_backpress2");
}
Also used : ImageView(android.widget.ImageView)

Example 44 with ImageView

use of android.widget.ImageView in project PreLollipopTransition by takahirom.

the class MainActivityTest method testGoSubActivity.

public void testGoSubActivity() throws InterruptedException {
    Spoon.screenshot(getActivity(), "init");
    Instrumentation.ActivityMonitor monitor = instrumentation.addMonitor(SubActivity.class.getName(), null, false);
    final ImageView imageView = (ImageView) getActivity().findViewById(R.id.imageView);
    instrumentation.waitForIdleSync();
    instrumentation.runOnMainSync(new Runnable() {

        @Override
        public void run() {
            assertTrue(imageView.performClick());
        }
    });
    Activity activity = instrumentation.waitForMonitor(monitor);
    // Verify new activity was shown.
    ANDROID.assertThat(monitor).hasHits(1);
    // Wait for animation
    Thread.sleep(2000l);
    Spoon.screenshot(activity, "sub_activity_shown");
    // subactivity -> mainactivity
    sendKeys(KeyEvent.KEYCODE_BACK);
    // Wait for animation
    Thread.sleep(2000l);
    instrumentation.waitForIdleSync();
    Spoon.screenshot(getActivity(), "main_activity_backed");
}
Also used : Instrumentation(android.app.Instrumentation) Activity(android.app.Activity) ImageView(android.widget.ImageView)

Example 45 with ImageView

use of android.widget.ImageView in project PreLollipopTransition by takahirom.

the class MainActivityTest method testGoSubActivity2.

public void testGoSubActivity2() throws InterruptedException {
    Spoon.screenshot(getActivity(), "init");
    Instrumentation.ActivityMonitor monitor = instrumentation.addMonitor(SubActivity2.class.getName(), null, false);
    final ImageView imageView = (ImageView) getActivity().findViewById(R.id.imageView2);
    instrumentation.waitForIdleSync();
    instrumentation.runOnMainSync(new Runnable() {

        @Override
        public void run() {
            assertTrue(imageView.performClick());
        }
    });
    Activity activity = instrumentation.waitForMonitor(monitor);
    // Verify new activity was shown.
    ANDROID.assertThat(monitor).hasHits(1);
    // Wait for animation
    Thread.sleep(2000l);
    Spoon.screenshot(activity, "sub_activity_shown");
    // subactivity -> mainactivity
    sendKeys(KeyEvent.KEYCODE_BACK);
    // Wait for animation
    Thread.sleep(2000l);
    instrumentation.waitForIdleSync();
    Spoon.screenshot(getActivity(), "main_activity_backed");
}
Also used : Instrumentation(android.app.Instrumentation) Activity(android.app.Activity) ImageView(android.widget.ImageView)

Aggregations

ImageView (android.widget.ImageView)2260 View (android.view.View)1147 TextView (android.widget.TextView)1005 Intent (android.content.Intent)201 Drawable (android.graphics.drawable.Drawable)197 LinearLayout (android.widget.LinearLayout)194 Bitmap (android.graphics.Bitmap)178 ViewGroup (android.view.ViewGroup)163 LayoutInflater (android.view.LayoutInflater)159 OnClickListener (android.view.View.OnClickListener)145 AdapterView (android.widget.AdapterView)111 ListView (android.widget.ListView)103 RecyclerView (android.support.v7.widget.RecyclerView)102 FrameLayout (android.widget.FrameLayout)97 Button (android.widget.Button)83 Bundle (android.os.Bundle)81 BitmapDrawable (android.graphics.drawable.BitmapDrawable)80 RelativeLayout (android.widget.RelativeLayout)72 Test (org.junit.Test)70 Context (android.content.Context)69