Ejemplo n.º 1
0
 Class<?> getPluginClass(String packageName, String className)
     throws NameNotFoundException, ClassNotFoundException {
   Context pluginContext =
       this.mAppContext.createPackageContext(
           packageName, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
   ClassLoader pluginCL = pluginContext.getClassLoader();
   return pluginCL.loadClass(className);
 }
  /**
   * Shows <tt>AuthorizationRequestedDialog</tt> for the request with given <tt>id</tt>.
   *
   * @param id request identifier for which new dialog will be displayed.
   */
  public static void showDialog(Long id) {
    Context ctx = JitsiApplication.getGlobalContext();

    Intent showIntent = new Intent(ctx, AuthorizationRequestedDialog.class);

    showIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

    showIntent.putExtra(EXTRA_REQUEST_ID, id);

    ctx.startActivity(showIntent);
  }
Ejemplo n.º 3
0
  private View getWorkingView(final View convertView) {
    View workingView = null;

    if (null == convertView) {
      final Context context = getContext();
      final LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      workingView = inflater.inflate(itemsItemLayoutResource, null);
    } else {
      workingView = convertView;
    }

    return workingView;
  }
 public ReservationAdapter(Context context, Cursor cursor)
 {
     Log.d("smali", "Lcom/samsung/sec/mtv/ui/channelguide/MtvUiFragReservationList$ReservationAdapter;-><init>(Lcom/samsung/sec/mtv/ui/channelguide/MtvUiFragReservationList;Landroid/content/Context;Landroid/database/Cursor;)V");
     this$0 = MtvUiFragReservationList.this;
     super(context, cursor);
     int ai[] = new int[2];
     ai[0] = 2;
     ai[1] = 2;
     mIcon = (Drawable[][])Array.newInstance(android/graphics/drawable/Drawable, ai);
     mInflater = (LayoutInflater)context.getSystemService("layout_inflater");
     mIcon[1][0] = context.getResources().getDrawable(0x7f0200c0);
     mIcon[0][0] = context.getResources().getDrawable(0x7f0200bd);
     mIcon[1][1] = context.getResources().getDrawable(0x7f0200c1);
     mIcon[0][1] = context.getResources().getDrawable(0x7f0200be);
 }
Ejemplo n.º 5
0
  public MapView(Context ctx, boolean allowNetAccess, int mode) {
    super(ctx);

    Display display;

    this.allowNetAccess = allowNetAccess;

    geoUtils = new GeoUtils(mode);

    setBackgroundColor(0xFF555570);
    display = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    scrWidth = display.getWidth();
    scrHeight = display.getHeight();
    setMinimumHeight(scrWidth);
    setMinimumWidth(scrHeight);
    tileWidth = (int) Math.ceil(scrWidth / 256.0) + 1;
    tileHeight = (int) Math.ceil(scrHeight / 256.0) + 1;
    gestureDetector = new GestureDetector(ctx, new GestureListener());

    zoomOutButton = new Button(ctx);
    zoomOutButton.setText("  -  ");
    zoomOutButton.setOnClickListener(this);

    zoomInButton = new Button(ctx);
    zoomInButton.setText("  +  ");
    zoomInButton.setOnClickListener(this);

    updateUI(true);
    addView(zoomOutButton);
    addView(zoomInButton);
  }
Ejemplo n.º 6
0
  public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    /* BR에서 BR을 호출할 수 없다.
    Intent bat = context.registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
    String s = bat.getIntExtra("level", -1) + "%";

    RemoteViews views = new RemoteViews(context.getPackageName(),
    		R.layout.batterygauge);
    views.setTextViewText(R.id.gauge, s);
    appWidgetManager.updateAppWidget(appWidgetIds, views);
    */
    Intent intent = new Intent(context, BatteryGaugeService.class);
    context.startService(intent);
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View row = convertView;
      PhotoGridHolder holder = null;

      if (row == null) {
        LayoutInflater inflater = ((Activity) context).getLayoutInflater();
        row = inflater.inflate(layoutResourceId, parent, false);
        holder = new PhotoGridHolder();
        holder.itemImageView = (ImageView) row.findViewById(R.id.galleryGridImage);
        row.setTag(holder);
      } else {
        holder = (PhotoGridHolder) row.getTag();
      }
      String filename = getItem(position);
      String path = context.getFilesDir().getAbsolutePath() + "/images/" + filename;

      holder.itemImageView.setImageURI(Uri.parse(path));
      return row;
    }
Ejemplo n.º 8
0
  private Bitmap getAppDrawable(String path) throws OutOfMemoryError {
    Bitmap bitsat;
    try {
      PackageManager pm = mContext.getPackageManager();
      PackageInfo pi = pm.getPackageArchiveInfo(path, 0);
      // // the secret are these two lines....
      pi.applicationInfo.sourceDir = path;
      pi.applicationInfo.publicSourceDir = path;
      // //
      Drawable d = pi.applicationInfo.loadIcon(pm);

      Bitmap d1 = null;
      d1 = ((BitmapDrawable) d).getBitmap();
      bitsat = d1;
    } catch (Exception e) {
      Drawable apk = ContextCompat.getDrawable(mContext, R.drawable.ic_doc_apk_grid);
      Bitmap apk1 = ((BitmapDrawable) apk).getBitmap();
      bitsat = apk1;
    }
    return bitsat;
  }
Ejemplo n.º 9
0
 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
   View v = convertView;
   if (v == null) {
     LayoutInflater vi =
         (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
     v = vi.inflate(R.layout.row, null);
   }
   Message m = items.get(position);
   // if (m != null) {
   m.createColorFromString(m.from);
   TextView tt = (TextView) v.findViewById(R.id.username);
   TextView bt = (TextView) v.findViewById(R.id.message);
   if (isMonospaced) {
     tt.setTypeface(Typeface.MONOSPACE);
     bt.setTypeface(Typeface.MONOSPACE);
   }
   tt.setText(m.getFrom());
   tt.setTextColor(m.color);
   bt.setText(m.getMessage());
   // }
   return v;
 }
Ejemplo n.º 10
0
  public IconHolder(Context context, boolean useThumbs, boolean grid) {
    super();
    this.mContext = context;
    this.mUseThumbs = useThumbs;
    this.mRequests = new HashMap<ImageView, String>();
    this.mIcons = new HashMap<String, Bitmap>();
    this.mAppIcons =
        new LinkedHashMap<String, Bitmap>(MAX_CACHE, .75F, true) {
          private static final long serialVersionUID = 1L;

          @Override
          protected boolean removeEldestEntry(Entry<String, Bitmap> eldest) {
            return size() > MAX_CACHE;
          }
        };
    this.mAlbums = new HashMap<String, Long>();
    this.grid = grid;
    Resources res = mContext.getResources();
    int dp = 50;
    if (grid) {
      dp = 150;
    }
    px = (int) (dp * (res.getDisplayMetrics().densityDpi / 160));
  }
Ejemplo n.º 11
0
    @Override
    public void bindView(View view, Context context, Cursor cursor) {
      TextView tv1 = (TextView) view.findViewById(R.id.line1);
      TextView tv2 = (TextView) view.findViewById(R.id.line2);
      ImageView iv = (ImageView) view.findViewById(R.id.icon);
      ViewGroup.LayoutParams p = iv.getLayoutParams();
      if (p == null) {
        // seen this happen, not sure why
        DatabaseUtils.dumpCursor(cursor);
        return;
      }
      p.width = ViewGroup.LayoutParams.WRAP_CONTENT;
      p.height = ViewGroup.LayoutParams.WRAP_CONTENT;

      String mimeType =
          cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.MIME_TYPE));
      if ("artist".equals(mimeType)) {
        iv.setImageResource(R.drawable.ic_mp_artist_list);
        String name =
            cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.ARTIST));
        String displayname = name;
        boolean isunknown = false;
        if (name == null || name.equals(MediaStore.UNKNOWN_STRING)) {
          displayname = context.getString(R.string.unknown_artist_name);
          isunknown = true;
        }
        tv1.setText(displayname);

        int numalbums = cursor.getInt(cursor.getColumnIndexOrThrow("data1"));
        int numsongs = cursor.getInt(cursor.getColumnIndexOrThrow("data2"));

        String songs_albums =
            MusicUtils.makeAlbumsSongsLabel(context, numalbums, numsongs, isunknown);

        tv2.setText(songs_albums);
      } else if ("album".equals(mimeType)) {
        iv.setImageResource(R.drawable.albumart_mp_unknown_list);
        String name = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM));
        String displayname = name;
        if (name == null || name.equals(MediaStore.UNKNOWN_STRING)) {
          displayname = context.getString(R.string.unknown_album_name);
        }
        tv1.setText(displayname);

        name = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.ARTIST));
        displayname = name;
        if (name == null || name.equals(MediaStore.UNKNOWN_STRING)) {
          displayname = context.getString(R.string.unknown_artist_name);
        }
        tv2.setText(displayname);
      } else if (isSong(mimeType)) {
        iv.setImageResource(R.drawable.ic_mp_song_list);
        String name =
            cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.AudioColumns.TITLE));
        tv1.setText(name);

        String displayname =
            cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Artists.ARTIST));
        if (displayname == null || displayname.equals(MediaStore.UNKNOWN_STRING)) {
          displayname = context.getString(R.string.unknown_artist_name);
        }
        name = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM));
        if (name == null || name.equals(MediaStore.UNKNOWN_STRING)) {
          name = context.getString(R.string.unknown_album_name);
        }
        tv2.setText(displayname + " - " + name);
      }
    }
 public MyGalleryAdapter(Context context) {
   this.context = context;
   TypedArray array = context.obtainStyledAttributes(R.styleable.gallery);
   itemBacklground = array.getResourceId(R.styleable.gallery_android_galleryItemBackground, 0);
   array.recycle();
 }
Ejemplo n.º 13
0
 public AcctInfoAdapter(Context mContext, ServiceAcctInfo[] accts) {
   context = mContext;
   acctList = accts;
   msgsetNames = context.getResources().getStringArray(R.array.acct_types);
 }
Ejemplo n.º 14
0
 public void onDeleted(Context context) {
   Intent intent = new Intent(context, BatteryGaugeService.class);
   context.stopService(intent);
 }