Skip to content

Commit

Permalink
Added some screens
Browse files Browse the repository at this point in the history
  • Loading branch information
Willena committed Apr 15, 2017
1 parent cf6f2e3 commit 7245895
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.util.Log;
import android.widget.Button;

import com.github.willena.phoneinputview.CountryConfigurator;
import com.github.willena.phoneinputview.PhoneInputView;
import com.github.willena.phoneinputview.events.OnValidEntryListener;

Expand All @@ -21,7 +22,16 @@ protected void onCreate(Bundle savedInstanceState) {

b = (Button)findViewById(R.id.button_validate);


phoneView = (PhoneInputView) findViewById(R.id.phoneId);

CountryConfigurator config = new CountryConfigurator();
config.setDisplayFlag(true);
config.setDisplayCountryCode(true);
config.setDisplayDialingCode(true);

phoneView.setConfig(config);

phoneView.addOnValidEntryListener(new OnValidEntryListener() {
@Override
public void onValidEntry(Boolean valid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import android.widget.LinearLayout;
import android.widget.Spinner;

import com.github.willena.phoneinputview.events.OnCountryChangeListener;
import com.github.willena.phoneinputview.events.OnCountryChangedListener;
import com.github.willena.phoneinputview.events.OnValidEntryListener;
import com.google.i18n.phonenumbers.AsYouTypeFormatter;
import com.google.i18n.phonenumbers.NumberParseException;
Expand All @@ -31,7 +31,7 @@ public class PhoneInputView extends LinearLayout {
private Spinner spinnerView;
private ClearableEditText textInput;
private PhoneNumberUtil phoneUtil;
private ArrayList<OnCountryChangeListener> countryChangeListeners;
private ArrayList<OnCountryChangedListener> countryChangeListeners;
private ArrayList<OnValidEntryListener> validEntryListeners;
private String formatedNumber;
private boolean nextNumber;
Expand Down Expand Up @@ -175,11 +175,11 @@ private Boolean isValid(String number) {
return false;
}

public void addOnCountryChangeListener(OnCountryChangeListener listener) {
public void addOnCountryChangeListener(OnCountryChangedListener listener) {
countryChangeListeners.add(listener);
}

public ArrayList<OnCountryChangeListener> getCountryChangeListeners() {
public ArrayList<OnCountryChangedListener> getCountryChangeListeners() {
return countryChangeListeners;
}

Expand All @@ -192,7 +192,7 @@ public ArrayList<OnValidEntryListener> getValidEntryListeners() {
}

private void triggerCountryChange(String country) {
for (OnCountryChangeListener l : countryChangeListeners)
for (OnCountryChangedListener l : countryChangeListeners)
l.onCountryChange(country);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* Created by Guillaume on 26/02/2017.
*/

public interface OnCountryChangeListener {
public interface OnCountryChangedListener {
void onCountryChange(String country);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
android:layout_weight="1"
android:textColor="@android:color/secondary_text_dark_nodisable"
android:text="(+33)"
android:paddingLeft="8dp"
android:id="@+id/phone_input_spinner_item_dialcode"
android:layout_marginTop="3dp"
android:layout_marginEnd="4dp"
Expand Down
Binary file added screenshoot/demo_phone_number.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshoot/spinner_display_explain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7245895

Please sign in to comment.