Android Open Source - android_WallBox Wallpaper Adapter






From Project

Back to project page android_WallBox.

License

The source code is released under:

Apache License

If you think the Android project android_WallBox listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright 2014 Jeremie Long/* w  ww . j av a  2 s.co  m*/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.lithidsw.wallbox.app.wallsnap.adapters;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.lithidsw.wallbox.R;
import com.lithidsw.wallbox.loader.ImageLoader;
import com.lithidsw.wallbox.utils.C;

public class WallpaperAdapter extends BaseAdapter {

  private Activity activity;
  private List<String[]> mWallpapers = new ArrayList<String[]>();
  private static LayoutInflater inflater = null;
  public ImageLoader imageLoader;
  View vi;
  SharedPreferences prefs;

  public WallpaperAdapter(Activity a, List<String[]> b) {
    activity = a;
    mWallpapers = b;
    inflater = (LayoutInflater) activity
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    imageLoader = new ImageLoader(activity.getApplicationContext(), 500);
    prefs = activity.getSharedPreferences(C.PREF, Context.MODE_PRIVATE);
  }

  @Override
  public int getCount() {
    try {
      return mWallpapers.size();
    } catch (NullPointerException e) {
      return 0;
    }
  }

  @Override
  public Object getItem(int position) {
    return null;
  }

  @Override
  public long getItemId(int position) {
    return 0;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    vi = convertView;
    if (convertView == null) {
      vi = inflater.inflate(R.layout.wallpaper_item, null);
    }

    final String path = mWallpapers.get(position)[0];
    final String name = mWallpapers.get(position)[1];

    final ImageView imgpreview = (ImageView) vi.findViewById(R.id.preview);
    imageLoader.DisplayImage(path, imgpreview);

    final TextView txtname = (TextView) vi.findViewById(R.id.name);
    txtname.setText(name);


    return vi;
  }
}




Java Source Code List

com.lithidsw.wallbox.AboutActivity.java
com.lithidsw.wallbox.ActionReceiver.java
com.lithidsw.wallbox.MainActivity.java
com.lithidsw.wallbox.app.colorwall.ColorWallFrag.java
com.lithidsw.wallbox.app.randomizer.RandomizerFrag.java
com.lithidsw.wallbox.app.randomizer.adapter.RandomizerGridAdapter.java
com.lithidsw.wallbox.app.randomizer.db.DBHelper.java
com.lithidsw.wallbox.app.randomizer.db.TableHelper.java
com.lithidsw.wallbox.app.saturate.SaturateFrag.java
com.lithidsw.wallbox.app.theme.ThemeFragment.java
com.lithidsw.wallbox.app.theme.ThemesMainFragment.java
com.lithidsw.wallbox.app.wallsnap.WallSnapActivity.java
com.lithidsw.wallbox.app.wallsnap.WallSnapFragment.java
com.lithidsw.wallbox.app.wallsnap.WallpaperFragment.java
com.lithidsw.wallbox.app.wallsnap.adapters.WallpaperAdapter.java
com.lithidsw.wallbox.loader.ImageLoader.java
com.lithidsw.wallbox.loader.MemoryCache.java
com.lithidsw.wallbox.utils.BitMapBlur.java
com.lithidsw.wallbox.utils.C.java
com.lithidsw.wallbox.utils.ColorFilterGenerator.java
com.lithidsw.wallbox.utils.ContribDialog.java
com.lithidsw.wallbox.utils.CustomDialogs.java
com.lithidsw.wallbox.utils.DateBuilder.java
com.lithidsw.wallbox.utils.JsonHelper.java
com.lithidsw.wallbox.utils.MenuHelper.java
com.lithidsw.wallbox.utils.Utils.java