Android Open Source - tennis-charting-android Match Review Activity






From Project

Back to project page tennis-charting-android.

License

The source code is released under:

GNU General Public License

If you think the Android project tennis-charting-android 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 com.inklily.tennischarting;
/*  w w  w . j a  v a  2s.co  m*/
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

/**
 * Activity to display a list of matches.
 */
public class MatchReviewActivity extends Activity implements MatchStorage.OnStorageAvailableListener {
    private SQLiteMatchStorage mStorage;

    @Override
    public void onStorageAvailable(MatchStorage storage) {
        ((ListView)findViewById(R.id.match_list)).setAdapter(storage);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_match_review);

        ListView match_list = (ListView)findViewById(R.id.match_list);
        match_list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Intent it = new Intent(MatchReviewActivity.this, MatchDetailActivity.class);
                it.putExtra("match_id", id);
                startActivity(it);
            }
        });
        match_list.setOnItemLongClickListener(new ListView.OnItemLongClickListener() {
            @Override
            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, final long id) {
                AlertDialog.Builder builder = new AlertDialog.Builder(MatchReviewActivity.this);
                builder.setMessage("Really delete this match?");
                builder.setNegativeButton("Not yet", null);
                builder.setPositiveButton("Do it", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        try {
                            mStorage.deleteMatch(id);
                        } catch (MatchStorage.MatchStorageNotAvailableException e) {
                            e.printStackTrace();
                        }
                    }
                });
                builder.show();
                return false;
            }
        });

        mStorage = SQLiteMatchStorage.getGlobalInstance(this.getApplication());
    }

    @Override
    protected void onResume() {
        super.onResume();

        mStorage.addOnStorageAvailableListener(this);
    }
}




Java Source Code List

com.inklily.tennischarting.HelpActivity.java
com.inklily.tennischarting.MainActivity.java
com.inklily.tennischarting.MatchChartActivity.java
com.inklily.tennischarting.MatchDetailActivity.java
com.inklily.tennischarting.MatchInfoActivity.java
com.inklily.tennischarting.MatchReviewActivity.java
com.inklily.tennischarting.MatchStorage.java
com.inklily.tennischarting.Match.java
com.inklily.tennischarting.PointEndDialog.java
com.inklily.tennischarting.Point.java
com.inklily.tennischarting.SQLiteMatchStorage.java
com.inklily.tennischarting.Score.java
com.inklily.tennischarting.SettingsActivity.java
com.inklily.tennischarting.util.SystemUiHiderBase.java
com.inklily.tennischarting.util.SystemUiHiderHoneycomb.java
com.inklily.tennischarting.util.SystemUiHider.java