package com.pf.testalarm;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;
import java.lang.ref.SoftReference;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private EditText etNumber;
private CheckBox cbIsloop;
private Button btnClock;
private Button btnCancleClock;
private static SoftReference<Handler> handlerSoftReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etNumber = findViewById(R.id.et_number);
cbIsloop = findViewById(R.id.cb_isloop);
btnClock = findViewById(R.id.btn_clock);
btnCancleClock = findViewById(R.id.btn_cancle_clock);
btnClock.setOnClickListener(this);
btnCancleClock.setOnClickListener(this);
handlerSoftReference = new SoftReference<Handler>(new MHandler());
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_clock:
String etContent = etNumber.getText().toString();
if (TextUtils.isEmpty(etContent)) {
Toast.makeText(this, "请输入时间间隔", Toast.LENGTH_SHORT).show();
return;
}
int number = Integer.valueOf(etContent);
boolean checked = cbIsloop.isChecked();
AlarmHelper.startAlarm(this, number, checked);
break;
case R.id.btn_cancle_clock:
AlarmHelper.cancenAlarm();
break;
default:
break;
}
}
private class MHandler extends Handler {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (null == msg) {
return;
}
int what = msg.what;
if (what == AlarmDialogUtil.DialogUtil_FLAG) {
// 显示弹框
AlarmDialogUtil.showDialog(MainActivity.this);
// 震动
AlarmVibrateUtil.vibrate(MainActivity.this, new long[]{500, 500}, 0);
// 铃声
AlarmMediaPlayer.playing(MainActivity.this);
}
}
}
public static SoftReference<Handler> getHandlerSoftReference() {
return handlerSoftReference;
}
}
资源文件列表
TestAlarm-master/.gitignore , 86
TestAlarm-master/.gradle/4.1/fileChanges/last-build.bin , 1
TestAlarm-master/.gradle/4.1/fileContent/fileContent.lock , 17
TestAlarm-master/.gradle/4.1/fileHashes/fileHashes.bin , 160083
TestAlarm-master/.gradle/4.1/fileHashes/fileHashes.lock , 17
TestAlarm-master/.gradle/4.1/fileHashes/resourceHashesCache.bin , 19517
TestAlarm-master/.gradle/4.1/javaCompile/classAnalysis.bin , 766849
TestAlarm-master/.gradle/4.1/javaCompile/jarAnalysis.bin , 321993
TestAlarm-master/.gradle/4.1/javaCompile/javaCompile.lock , 17
TestAlarm-master/.gradle/4.1/javaCompile/taskHistory.bin , 64347
TestAlarm-master/.gradle/4.1/javaCompile/taskJars.bin , 20939
TestAlarm-master/.gradle/4.1/taskHistory/fileSnapshots.bin , 654033
TestAlarm-master/.gradle/4.1/taskHistory/taskHistory.bin , 53291
TestAlarm-master/.gradle/4.1/taskHistory/taskHistory.lock , 17
TestAlarm-master/.gradle/buildOutputCleanup/built.bin , 0
TestAlarm-master/.gradle/buildOutputCleanup/cache.properties , 49
TestAlarm-master/.gradle/buildOutputCleanup/cache.properties.lock , 2
TestAlarm-master/.idea/caches/build_file_checksums.ser , 544
TestAlarm-master/.idea/caches/gradle_models.ser , 85731
TestAlarm-master/.idea/codeStyles/Project.xml , 4855
TestAlarm-master/.idea/gradle.xml , 634
TestAlarm-master/.idea/libraries/Gradle__android_arch_core_common_1_0_0_jar.xml , 531
TestAlarm-master/.idea/libraries/Gradle__android_arch_lifecycle_common_1_0_0_jar.xml , 546
TestAlarm-master/.idea/libraries/Gradle__android_arch_lifecycle_runtime_1_0_0_aar.xml , 659
TestAlarm-master/.idea/libraries/Gradle__com_android_support_animated_vector_drawable_26_1_0_aar.xml , 743
TestAlarm-master/.idea/libraries/Gradle__com_android_support_appcompat_v7_26_1_0_aar.xml , 683
TestAlarm-master/.idea/libraries/Gradle__com_android_support_constraint_constraint_layout_1_0_2_aar.xml , 504
TestAlarm-master/.idea/libraries/Gradle__com_android_support_constraint_constraint_layout_solver_1_0_2_jar.xml , 389
TestAlarm-master/.idea/libraries/Gradle__com_android_support_support_annotations_26_1_0_jar.xml , 606
TestAlarm-master/.idea/libraries/Gradle__com_android_support_support_compat_26_1_0_aar.xml , 693
TestAlarm-master/.idea/libraries/Gradle__com_android_support_support_core_ui_26_1_0_aar.xml , 698
TestAlarm-master/.idea/libraries/Gradle__com_android_support_support_core_utils_26_1_0_aar.xml , 713
TestAlarm-master/.idea/libraries/Gradle__com_android_support_support_fragment_26_1_0_aar.xml , 703
TestAlarm-master/.idea/libraries/Gradle__com_android_support_support_media_compat_26_1_0_aar.xml , 723
TestAlarm-master/.idea/libraries/Gradle__com_android_support_support_v4_26_1_0_aar.xml , 673
TestAlarm-master/.idea/libraries/Gradle__com_android_support_support_vector_drawable_26_1_0_aar.xml , 738
TestAlarm-master/.idea/libraries/Gradle__com_android_support_test_espresso_espresso_core_3_0_1_aar.xml , 711
TestAlarm-master/.idea/libraries/Gradle__com_android_support_test_espresso_espresso_idling_resource_3_0_1_aar.xml , 766
TestAlarm-master/.idea/libraries/Gradle__com_android_support_test_rules_1_0_1_aar.xml , 653
TestAlarm-master/.idea/libraries/Gradle__com_android_support_test_runner_1_0_1_aar.xml , 658
TestAlarm-master/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml , 359
TestAlarm-master/.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml , 536
TestAlarm-master/.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml , 526
TestAlarm-master/.idea/libraries/Gradle__junit_junit_4_12_jar.xml , 485
TestAlarm-master/.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml , 508
TestAlarm-master/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml , 541
TestAlarm-master/.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml , 576
TestAlarm-master/.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml , 555
TestAlarm-master/.idea/misc.xml , 357
TestAlarm-master/.idea/modules.xml , 369
TestAlarm-master/.idea/runConfigurations.xml , 564
TestAlarm-master/.idea/workspace.xml , 9664
TestAlarm-master/app/.gitignore , 7
TestAlarm-master/app/app.iml , 10660
TestAlarm-master/app/build/generated/res/pngs/debug/drawable-anydpi-v21/ic_launcher_background.xml , 5606
TestAlarm-master/app/build/generated/res/pngs/debug/drawable-hdpi/ic_launcher_background.png , 834
TestAlarm-master/app/build/generated/res/pngs/debug/drawable-ldpi/ic_launcher_background.png , 338
TestAlarm-master/app/build/generated/res/pngs/debug/drawable-mdpi/ic_launcher_background.png , 414
TestAlarm-master/app/build/generated/res/pngs/debug/drawable-xhdpi/ic_launcher_background.png , 1255
TestAlarm-master/app/build/generated/res/pngs/debug/drawable-xxhdpi/ic_launcher_background.png , 2886
TestAlarm-master/app/build/generated/res/pngs/debug/drawable-xxxhdpi/ic_launcher_background.png , 4763
TestAlarm-master/app/build/generated/source/buildConfig/debug/com/pf/testalarm/BuildConfig.java , 439
TestAlarm-master/app/build/generated/source/r/debug/android/arch/lifecycle/R.java , 242
TestAlarm-master/app/build/generated/source/r/debug/android/support/compat/R.java , 7610
TestAlarm-master/app/build/generated/source/r/debug/android/support/constraint/R.java , 15252
TestAlarm-master/app/build/generated/source/r/debug/android/support/coreui/R.java , 7610
TestAlarm-master/app/build/generated/source/r/debug/android/support/coreutils/R.java , 7613
TestAlarm-master/app/build/generated/source/r/debug/android/support/fragment/R.java , 7612
TestAlarm-master/app/build/generated/source/r/debug/android/support/graphics/drawable/animated/R.java , 7630
TestAlarm-master/app/build/generated/source/r/debug/android/support/graphics/drawable/R.java , 7621
TestAlarm-master/app/build/generated/source/r/debug/android/support/mediacompat/R.java , 9442
TestAlarm-master/app/build/generated/source/r/debug/android/support/v4/R.java , 9433
TestAlarm-master/app/build/generated/source/r/debug/android/support/v7/appcompat/R.java , 115275
TestAlarm-master/app/build/generated/source/r/debug/com/pf/testalarm/R.java , 555577
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/debug.json , 148434
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-af.json , 1084
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-am.json , 1081
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ar.json , 1085
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-az.json , 1065
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-b+sr+Latn.json , 1114
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-be.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-bg.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-bn.json , 1089
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-bs.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ca.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-cs.json , 1085
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-da.json , 1083
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-de.json , 1085
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-el.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-en-rAU.json , 1099
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-en-rGB.json , 1099
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-en-rIN.json , 1099
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-es-rUS.json , 1103
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-es.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-et.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-eu.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-fa.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-fi.json , 1083
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-fr-rCA.json , 1104
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-fr.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-gl.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-gu.json , 1085
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-h720dp-v13.json , 767
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-hdpi-v4.json , 796
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-hi.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-hr.json , 1085
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-hu.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-hy.json , 1084
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-in.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-is.json , 1082
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-it.json , 1084
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-iw.json , 1082
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ja.json , 1079
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ka.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-kk.json , 1085
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-km.json , 1084
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-kn.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ko.json , 1077
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ky.json , 1085
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-land.json , 788
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-large-v4.json , 882
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ldltr-v21.json , 764
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-lo.json , 1083
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-lt.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-lv.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-mk.json , 1048
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ml.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-mn.json , 1084
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-mr.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ms.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-my.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-nb.json , 1081
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ne.json , 1089
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-night-v8.json , 851
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-nl.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-pa.json , 1083
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-pl.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-port.json , 743
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-pt-rBR.json , 1104
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-pt-rPT.json , 1104
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-pt.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ro.json , 1088
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-ru.json , 1087
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-si.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-sk.json , 1084
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-sl.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-sq.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-sr.json , 1086
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-sv.json , 1085
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-sw.json , 1084
TestAlarm-master/app/build/intermediates/blame/res/debug/multi-v2/values-sw600dp-v13.json , 876
最多只能显示150条信息!
