Back to project page timestatistic.
The source code is released under:
GNU General Public License
If you think the Android project timestatistic listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package maximsblog.blogspot.com.timestatistic; /*from www.j a v a 2 s . c o m*/ import maximsblog.blogspot.com.timestatistic.AreYouSureResetAllDialogFragment.ResetAllDialog; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.os.Bundle; import android.support.v4.app.DialogFragment; public class PeriodSetupDialogFragment extends DialogFragment implements OnClickListener { private IPeriodSetupDialog mListener; private long mPeriod; public interface IPeriodSetupDialog { void setupNewPeriod(long time); } public void setPeriodSetupDialog(IPeriodSetupDialog listener) { mListener = listener; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { mPeriod = getArguments().getLong(PeriodAnalyseActivity.PERIOD); int index=0; if(mPeriod == 1000*60*60) index = 0; else if(mPeriod == 1000*60*60*24) index = 1; else if(mPeriod == 1000*60*60*24 * 7) index = 2; else if(mPeriod == 1000*60*60 * 12) index = 3; return new AlertDialog.Builder(getActivity()) .setTitle(R.string.interval) .setSingleChoiceItems(R.array.periods, index, this) .create(); } @Override public void onClick(DialogInterface dialog, int which) { long time; switch (which) { case 0: time = 1000*60*60; break; case 1: time = 1000*60*60*24; break; case 2: time = 1000*60*60*24 * 7; break; case 3: time = 1000*60*60 * 12; break; default: time = 1000*60*60; break; } mListener.setupNewPeriod(time); this.dismiss(); } }