-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TimePicker dialog with spinner mode. Add View with NumberPicker w…
…ith custom displayed values. (#28)
- Loading branch information
Showing
6 changed files
with
117 additions
and
2 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
54 changes: 54 additions & 0 deletions
54
app/src/main/java/io/appium/android/apis/view/CustomPicker1.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 @@ | ||
/* | ||
* Copyright (C) 2007 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.android.apis.view; | ||
|
||
// Need the following import to get access to the app resources, since this | ||
// class is in a sub-package. | ||
import io.appium.android.apis.R; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.widget.NumberPicker; | ||
import android.widget.TextView; | ||
|
||
public class CustomPicker1 extends Activity { | ||
|
||
private NumberPicker numberPicker1; | ||
private TextView textView1; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.custom_picker_1); | ||
numberPicker1= (NumberPicker) findViewById(R.id.numberPicker1); | ||
textView1 = (TextView) findViewById(R.id.textView1); | ||
final String values[] = { "परीक्षण", "测试", "テスト", "kupima", "การทดสอบ" }; | ||
|
||
numberPicker1.setMinValue(0); | ||
numberPicker1.setMaxValue(values.length - 1); | ||
numberPicker1.setDisplayedValues(values); | ||
|
||
NumberPicker.OnValueChangeListener myValChangedListener = new NumberPicker.OnValueChangeListener() { | ||
@Override | ||
public void onValueChange(NumberPicker picker, int oldVal, int newVal) { | ||
textView1.setText("Value: " + values[newVal]); | ||
} | ||
}; | ||
|
||
numberPicker1.setOnValueChangedListener(myValChangedListener); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright (C) 2007 The Android Open Source Project | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
<!-- Demonstrates defining custom views in a layout file. --> | ||
|
||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content"> | ||
|
||
<NumberPicker | ||
android:id="@+id/numberPicker1" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" /> | ||
|
||
<TextView | ||
android:id="@+id/textView1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" /> | ||
|
||
</LinearLayout> | ||
|
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