Example #1
0
  public static Bitmap matrixBmp(Bitmap bmp, int margin) {

    int width = bmp.getWidth();
    int height = bmp.getHeight();
    int px = UIUtils.dipToPx(margin);
    Matrix matrix = new Matrix();
    if (width > UIUtils.getWidth() - px) {
      float scale = ((float) (UIUtils.getWidth() - px) / width);
      matrix.postScale(scale, scale);
    } else {
      matrix.postScale(1, 1);
    }
    return Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true);
  }
Example #2
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   UIUtils.initDisplayMetrics(this, getWindowManager(), false);
   ResourceUtils.init(this);
   PathDefine.init();
   super.onCreate(savedInstanceState);
   registerReceiver(receiverClose, filterClose);
   if (!MiscUtils.isSDCardExists()) {
     new AlertDialog.Builder(this)
         .setTitle(R.string.hint)
         .setMessage(R.string.no_sdcard)
         .setPositiveButton(
             R.string.ok,
             new DialogInterface.OnClickListener() {
               @Override
               public void onClick(DialogInterface dialog, int which) {
                 finish();
               }
             })
         .show();
     return;
   }
   if (!YugiohDatabase.isDatabaseFileExists()) {
     UpdateInfo updateInfo = new UpdateInfo();
     updateInfo.setUpdateApk(0);
     updateInfo.setUpdateData(1);
     Intent inUpdate = new Intent(this, UpdateActivity.class);
     inUpdate.putExtra("update", updateInfo);
     startActivity(inUpdate);
     finish();
   } else {
     checkUpdate();
   }
 }
  @Override
  public void initComponents() {
    lstBusybox = (BlockListView) innerView.findViewById(R.id.lstBusybox);
    progressBusybox = (DataProgressBar) innerView.findViewById(R.id.progressBusybox);
    lstBusybox.setItemHeight(UIUtils.dipToPx(56));

    list = new ArrayList<BusyboxInfo>();
    adapter = new BusyboxAdapter(getActivity(), list);
    lstBusybox.setAdapter(adapter);
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   UIUtils.initDisplayMetrics(this, getWindowManager(), false);
   ResourceUtils.init(this);
   Global.autoRefreshTag = true;
   Global.canExit = false;
   super.onCreate(savedInstanceState);
   startService(new Intent(this, MessageService.class));
   getSlidingMenu().setOnOpenListener(this);
   getSlidingMenu().setOnCloseListener(this);
   doCheckUpdateT(this);
 }
  @Override
  public void initComponents() {
    lvPullDown = (PullDownListView) innerView.findViewById(R.id.lvPullDown);
    tvLoading = (TextView) innerView.findViewById(R.id.tvLoading);
    tvNodata = (TextView) innerView.findViewById(R.id.tvNodata);
    if (listMessage == null) {
      listMessage = new ArrayList<SbbsMeMessage>();
    }
    adapter = new SbbsMeMessageAdapter(getActivity(), listMessage);
    lvPullDown.getListView().setAdapter(adapter);
    loader = new SbbsMessageLoader(getActivity());
    lvPullDown.enableAutoFetchMore(true, 1);
    lvPullDown.setOnPullDownListener(this);

    int devide = UIUtils.dipToPx(8);
    lvPullDown.getListView().setDivider(null);
    lvPullDown.getListView().setDividerHeight(devide);
    lvPullDown.getListView().setPadding(devide, devide, devide, devide);
    lvPullDown.getListView().setOverScrollMode(View.OVER_SCROLL_NEVER);
    lvPullDown.getListView().setFocusableInTouchMode(false);
  }
Example #6
0
 private static Drawable resizeActionIcon(Drawable drawable) {
   int heightBase = UIUtils.dipToPx(24);
   int height = (int) (heightBase * UIUtils.getDensity());
   Drawable d = ImageUtils.zoomDrawable(drawable, height, height);
   return d;
 }
Example #7
0
 @Override
 public int getBehindOffset() {
   return UIUtils.dipToPx(150);
 }
 @Override
 public void initLogic() {
   UIUtils.makeListViewFullSize(lvMenu, UIUtils.dipToPx(49));
   UIUtils.makeListViewFullSize(lvExit, UIUtils.dipToPx(49));
 }