|
| 1 | +/* |
| 2 | + * The MIT License (MIT) |
| 3 | + * |
| 4 | + * Copyright (c) 2017 skydoves |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + * of this software and associated documentation files (the "Software"), to deal |
| 8 | + * in the Software without restriction, including without limitation the rights |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + * copies of the Software, and to permit persons to whom the Software is |
| 11 | + * furnished to do so, subject to the following conditions: |
| 12 | + * |
| 13 | + * The above copyright notice and this permission notice shall be included in |
| 14 | + * all copies or substantial portions of the Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | + * THE SOFTWARE. |
| 23 | +*/ |
| 24 | +packagecom.skydoves.elasticviewsdemo |
| 25 | + |
| 26 | +importandroid.graphics.Color |
| 27 | +importandroid.os.Bundle |
| 28 | +importandroid.view.View |
| 29 | +importandroid.widget.Toast |
| 30 | +importandroidx.appcompat.app.AppCompatActivity |
| 31 | +importcom.google.android.material.snackbar.Snackbar |
| 32 | +importcom.skydoves.elasticviews.ElasticCheckButton |
| 33 | + |
| 34 | +classExampleActivity0 :AppCompatActivity() { |
| 35 | + |
| 36 | +overridefunonCreate(savedInstanceState:Bundle?) { |
| 37 | +super.onCreate(savedInstanceState) |
| 38 | + setContentView(R.layout.activity_example0) |
| 39 | + } |
| 40 | + |
| 41 | +funcheckButtons(v:View) { |
| 42 | +val elasticCheckButton= vasElasticCheckButton |
| 43 | +Snackbar.make( |
| 44 | + v, |
| 45 | +"[Change checked state]"+ |
| 46 | + elasticCheckButton.text.toString()+ |
| 47 | +" :"+ |
| 48 | + elasticCheckButton.isChecked, |
| 49 | +200) |
| 50 | + .setActionTextColor(Color.WHITE) |
| 51 | + .show() |
| 52 | + } |
| 53 | + |
| 54 | +funlayout(v:View) { |
| 55 | +Snackbar.make(v,"Pop-up likes 'TimePickerDialog'",200).setActionTextColor(Color.WHITE).show() |
| 56 | + } |
| 57 | + |
| 58 | +funimageViews(v:View) { |
| 59 | +when (v.id) { |
| 60 | +R.id.example0_ibtn_q_timeset01->Snackbar.make(v,"Alarm goes off between start-time and end-time",200) |
| 61 | + .setActionTextColor(Color.WHITE) |
| 62 | + .show() |
| 63 | +R.id.example0_ibtn_q_timeset02->Snackbar.make(v,"This is time interval description",200) |
| 64 | + .setActionTextColor(Color.WHITE) |
| 65 | + .show() |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | +funaddNewAlarm(v:View) { |
| 70 | +Toast.makeText(baseContext,"a new Alarm added!",Toast.LENGTH_SHORT).show() |
| 71 | + finish() |
| 72 | + } |
| 73 | +} |