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;
}
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);
}
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");
}
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");
}
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");
}
Aggregations