-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for changing sensitivity of shake detector
Sensitivity of shake detector can now be changed by going to settings.
- Loading branch information
1 parent
d59af43
commit cfb6042
Showing
14 changed files
with
496 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
282 changes: 231 additions & 51 deletions
282
app/src/main/java/in/basulabs/shakealarmclock/Activity_Settings.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
app/src/main/java/in/basulabs/shakealarmclock/AlertDialog_TestShakeSensitivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package in.basulabs.shakealarmclock; | ||
|
||
import android.app.Dialog; | ||
import android.content.Context; | ||
import android.os.Bundle; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AlertDialog; | ||
import androidx.fragment.app.DialogFragment; | ||
|
||
public class AlertDialog_TestShakeSensitivity extends DialogFragment { | ||
|
||
private AlertDialog_TestShakeSensitivity.DialogListener listener; | ||
|
||
public interface DialogListener { | ||
|
||
void onDialogNegativeClick(DialogFragment dialogFragment); | ||
|
||
} | ||
|
||
@Override | ||
public void onAttach(@NonNull Context context) { | ||
super.onAttach(context); | ||
if (context instanceof AlertDialog_TestShakeSensitivity.DialogListener) { | ||
listener = (AlertDialog_TestShakeSensitivity.DialogListener) context; | ||
} else { | ||
throw new ClassCastException(context.getClass() + " must implement AlertDialog_TestShakeSensitivity.DialogListener"); | ||
} | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { | ||
|
||
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity()); | ||
builder.setTitle(R.string.title_shakeDetectionTest) | ||
.setMessage(getResources().getString(R.string.message_shakeDetectionTest)) | ||
.setNegativeButton(getResources().getString(R.string.negative_shakeDetectionTest), (dialogInterface, i) -> { | ||
listener.onDialogNegativeClick(AlertDialog_TestShakeSensitivity.this); | ||
dismiss(); | ||
}) | ||
.setCancelable(false); | ||
|
||
return builder.create(); | ||
} | ||
|
||
@Override | ||
public void onDetach() { | ||
super.onDetach(); | ||
listener = null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.