Android Open Source - Keep-score Search Activity






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;
/* w ww .j a  v  a  2  s.  c om*/
import android.app.Activity;
import android.app.DialogFragment;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class SearchActivity extends Activity implements
        DateFragment.OnDateFragmentInteractionListener {

    public static final String DATE = "DATE";
    public static final String MILLIS = "MILLIS";
    public static final String GAME = "GAME";
    public static final String WINNER = "WINNER";
    private TextView mDateText;
    private EditText mSearchGame;
    private EditText mSearchWinner;
    private long mDateMillis;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.search);
        mDateText = (TextView) findViewById(R.id.searchDateText);
        mSearchGame = (EditText) findViewById(R.id.searchName);
        mSearchWinner = (EditText) findViewById(R.id.searchWinner);
        if(savedInstanceState != null){
            mDateText.setText(savedInstanceState.getString(DATE));
            mDateMillis = savedInstanceState.getLong(MILLIS);
            mSearchGame.setText(savedInstanceState.getString(GAME));
            mSearchWinner.setText(savedInstanceState.getString(WINNER));
        }
        Button dateBtn = (Button) findViewById(R.id.searchDate);
        dateBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                DialogFragment newFragment = DateFragment.newInstance();
                newFragment.show(getFragmentManager(), "datePicker");
            }
        });
        Button searchBtn = (Button) findViewById(R.id.searchBtn);
        searchBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent resultIntent = new Intent();
                resultIntent.putExtra(Constants.SEARCH_GAME_NAME, mSearchGame.getText().toString());
                resultIntent.putExtra(Constants.SEARCH_WINNER_NAME, mSearchWinner.getText().toString());
                resultIntent.putExtra(Constants.SEARCH_DATE, mDateMillis);
                setResult(RESULT_OK, resultIntent);
                finish();
            }
        });
        try {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
                getActionBar().setDisplayHomeAsUpEnabled(true);
            getActionBar().setSubtitle(getString(R.string.search_menu_entry));
        } catch (NullPointerException e) {

        }
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        outState.putString(DATE, mDateText.getText().toString());
        outState.putString(GAME, mSearchGame.getText().toString());
        outState.putString(WINNER, mSearchWinner.getText().toString());
        outState.putLong(MILLIS, mDateMillis);
        super.onSaveInstanceState(outState);
    }

    @Override
    public void onDateFragmentInteraction(String date, long dateMillis) {
        mDateText.setText(date);
        mDateMillis = dateMillis;
    }

}




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