Android Open Source - Keep-score Game Adapter






From Project

Back to project page Keep-score.

License

The source code is released under:

MIT License

If you think the Android project Keep-score 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

package gr.sv1jsb.kratascore.adapters;
/*from w w w. ja  v a 2 s  . com*/
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import gr.sv1jsb.kratascore.R;
import gr.sv1jsb.kratascore.persistance.KrataScoreContract;
import gr.sv1jsb.utils.ImageUtils;

/**
 * Created by andreas on 30/7/2014.
 */
public class GameAdapter extends  BaseCursorAdapter {

    private Bitmap mPlaceHolderBitmap;

    public GameAdapter(Context context, Cursor c, int flags, int layout) {
        super(context, c, flags, layout);
        mPlaceHolderBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.user);

    }

    @Override
    public View populateView(View view, Cursor cursor) {
        String playerName = cursor.getString(KrataScoreContract.ScoreEntry.NUM_PLAYER);
        String playerScore = cursor.getString(KrataScoreContract.ScoreEntry.NUM_SCORE);
        String playerPhoto = cursor.getString(KrataScoreContract.ScoreEntry.NUM_PLAYER_PHOTO);
        ((TextView) view.findViewById(R.id.playerName)).setText(playerName);
        TextView scoreView = ((TextView) view.findViewById(R.id.playerScore));
        scoreView.setText(playerScore);
        if(playerPhoto != null) {
            ImageView iv = (ImageView) view.findViewById(R.id.ivPlayerPhoto);
            ImageUtils.loadBitmap(mContext.getExternalFilesDir(null), playerPhoto, iv, mContext.getResources(), mPlaceHolderBitmap);
        }
        return view;
    }
}




Java Source Code List

gr.sv1jsb.cropimage.ApplicationTest.java
gr.sv1jsb.cropimage.BitmapManager.java
gr.sv1jsb.cropimage.CropImageView.java
gr.sv1jsb.cropimage.CropImage.java
gr.sv1jsb.cropimage.HighlightView.java
gr.sv1jsb.cropimage.ImageViewTouchBase.java
gr.sv1jsb.cropimage.MonitoredActivity.java
gr.sv1jsb.cropimage.RotateBitmap.java
gr.sv1jsb.cropimage.Util.java
gr.sv1jsb.kratascore.AboutFragment.java
gr.sv1jsb.kratascore.AddScoreDialog.java
gr.sv1jsb.kratascore.ApplicationTest.java
gr.sv1jsb.kratascore.Constants.java
gr.sv1jsb.kratascore.DateFragment.java
gr.sv1jsb.kratascore.DeleteConfirmDialog.java
gr.sv1jsb.kratascore.EndConfirmDialog.java
gr.sv1jsb.kratascore.GameFragment.java
gr.sv1jsb.kratascore.GameListFragment.java
gr.sv1jsb.kratascore.GenericAlertDialog.java
gr.sv1jsb.kratascore.HelpFragment.java
gr.sv1jsb.kratascore.KrataScoreActivity.java
gr.sv1jsb.kratascore.NewGameActivity.java
gr.sv1jsb.kratascore.PhotoPickDialog.java
gr.sv1jsb.kratascore.PlayerActivity.java
gr.sv1jsb.kratascore.PlayerListActivity.java
gr.sv1jsb.kratascore.SearchActivity.java
gr.sv1jsb.kratascore.SortDialog.java
gr.sv1jsb.kratascore.adapters.BaseCursorAdapter.java
gr.sv1jsb.kratascore.adapters.GameAdapter.java
gr.sv1jsb.kratascore.adapters.GameListAdapter.java
gr.sv1jsb.kratascore.adapters.PlayerListAdapter.java
gr.sv1jsb.kratascore.persistance.KrataScoreContract.java
gr.sv1jsb.kratascore.persistance.KrataScoreDB.java
gr.sv1jsb.kratascore.persistance.Player.java
gr.sv1jsb.kratascore.provider.KrataScoreProvider.java
gr.sv1jsb.utils.ImageCache.java
gr.sv1jsb.utils.ImageUtils.java
gr.sv1jsb.utils.RandomStringUtils.java