Improved dialogs
This commit is contained in:
parent
6388141572
commit
9cd759b5cf
9 changed files with 123 additions and 156 deletions
Binary file not shown.
Before Width: | Height: | Size: 391 B |
|
@ -32,17 +32,6 @@
|
||||||
android:src="@drawable/event_gray"
|
android:src="@drawable/event_gray"
|
||||||
android:scaleType="fitXY"/>
|
android:scaleType="fitXY"/>
|
||||||
|
|
||||||
<!--<TextView
|
|
||||||
android:id="@+id/event_date"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textStyle="italic"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text=" - "/>-->
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/event_text"
|
android:id="@+id/event_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -1,47 +1,107 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center">
|
android:gravity="center">
|
||||||
|
|
||||||
<TextView
|
<ImageView
|
||||||
android:id="@+id/customText"
|
android:id="@+id/icon"
|
||||||
style="@style/font14"
|
android:visibility="gone"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:src="@drawable/security_alert_indicator"
|
||||||
android:padding="20dp"/>
|
android:layout_margin="15dp"/>
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/customText"
|
||||||
android:layout_height="wrap_content"
|
style="@style/font14"
|
||||||
android:layout_gravity="center"
|
android:layout_width="match_parent"
|
||||||
android:gravity="center"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:text="Lorem ipsum dolor sit amet"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:layout_margin="15dp"/>
|
||||||
|
|
||||||
<Button
|
<EditText
|
||||||
android:id="@+id/cancel"
|
android:id="@+id/password"
|
||||||
android:text="@string/cancel"
|
android:visibility="gone"
|
||||||
android:background="@drawable/resizable_cancel_button"
|
android:background="@drawable/resizable_textfield"
|
||||||
style="@style/font8"
|
android:textColor="@color/colorB"
|
||||||
android:layout_width="wrap_content"
|
android:inputType="textPassword"
|
||||||
android:layout_height="wrap_content"
|
android:hint="@string/password"
|
||||||
android:layout_margin="10dp"
|
android:textCursorDrawable="@null"
|
||||||
android:padding="10dp"/>
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_margin="15dp"
|
||||||
|
android:maxLines="1"/>
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/delete_button"
|
android:id="@+id/doNotAskAgainLayout"
|
||||||
android:text="@string/delete"
|
android:visibility="gone"
|
||||||
android:background="@drawable/resizable_confirm_delete_button"
|
android:layout_width="wrap_content"
|
||||||
style="@style/font15"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_gravity="center"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="horizontal"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="5dp">
|
||||||
android:padding="10dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
<CheckBox
|
||||||
|
android:id="@+id/doNotAskAgain"
|
||||||
|
android:button="@drawable/checkbox"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/doNotAskAgainLabel"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
style="@style/font14"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:text="@string/do_not_ask_again"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_margin="15dp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/cancel"
|
||||||
|
android:text="@string/cancel"
|
||||||
|
android:background="@drawable/resizable_assistant_button"
|
||||||
|
style="@style/font8"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:padding="10dp"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/delete_button"
|
||||||
|
android:text="@string/delete"
|
||||||
|
android:background="@drawable/resizable_assistant_button"
|
||||||
|
android:backgroundTint="@color/colorI"
|
||||||
|
style="@style/font15"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:padding="10dp"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/ok_button"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:text="@string/ok"
|
||||||
|
android:background="@drawable/resizable_assistant_button"
|
||||||
|
android:backgroundTint="@color/colorL"
|
||||||
|
style="@style/font15"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:padding="10dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,59 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/customText"
|
|
||||||
style="@style/font14"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:padding="20dp"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/password"
|
|
||||||
android:background="@drawable/resizable_textfield"
|
|
||||||
android:textColor="@color/colorB"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:hint="@string/password"
|
|
||||||
android:textCursorDrawable="@null"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_margin="20dp"
|
|
||||||
android:maxLines="1"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/cancel"
|
|
||||||
android:text="@string/cancel"
|
|
||||||
android:background="@drawable/resizable_cancel_button"
|
|
||||||
style="@style/font8"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:padding="10dp"/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/retry"
|
|
||||||
android:text="@string/retry"
|
|
||||||
android:background="@drawable/resizable_confirm_delete_button"
|
|
||||||
style="@style/font15"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:padding="10dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -1,43 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/toastRoot"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@color/colorB"
|
|
||||||
android:orientation="vertical" >
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/toastMessage"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/toastNotOK"
|
|
||||||
android:src="@drawable/security_pending"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/toastOK"
|
|
||||||
android:src="@drawable/security_ok"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -52,6 +52,7 @@
|
||||||
<string name="yes">Yes</string>
|
<string name="yes">Yes</string>
|
||||||
<string name="link_account">Link your account</string>
|
<string name="link_account">Link your account</string>
|
||||||
<string name="update_available">An update is available</string>
|
<string name="update_available">An update is available</string>
|
||||||
|
<string name="do_not_ask_again">Do not ask again</string>
|
||||||
|
|
||||||
<!-- Launch screen -->
|
<!-- Launch screen -->
|
||||||
<string name="app_description">the <i>libre</i> SIP client</string>
|
<string name="app_description">the <i>libre</i> SIP client</string>
|
||||||
|
|
|
@ -51,6 +51,7 @@ import android.provider.Settings.SettingNotFoundException;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.linphone.activities.LinphoneActivity;
|
import org.linphone.activities.LinphoneActivity;
|
||||||
|
@ -1519,18 +1520,31 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
}
|
}
|
||||||
|
|
||||||
private void askLinkWithPhoneNumber() {
|
private void askLinkWithPhoneNumber() {
|
||||||
|
if (!LinphonePreferences.instance().isLinkPopupEnabled()) return;
|
||||||
|
|
||||||
long now = new Timestamp(new Date().getTime()).getTime();
|
long now = new Timestamp(new Date().getTime()).getTime();
|
||||||
|
if (LinphonePreferences.instance().getLinkPopupTime() != null && Long.parseLong(LinphonePreferences.instance().getLinkPopupTime()) >= now) return;
|
||||||
|
|
||||||
long future = new Timestamp(LinphoneActivity.instance().getResources().getInteger(R.integer.popup_time_interval)).getTime();
|
long future = new Timestamp(LinphoneActivity.instance().getResources().getInteger(R.integer.popup_time_interval)).getTime();
|
||||||
long newDate = now + future;
|
long newDate = now + future;
|
||||||
|
|
||||||
LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
|
LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
|
||||||
|
|
||||||
final Dialog dialog = LinphoneActivity.instance().displayDialog(String.format(getString(R.string.link_account_popup), LinphoneManager.getLc().getDefaultProxyConfig().getIdentityAddress().asStringUriOnly()));
|
final Dialog dialog = LinphoneActivity.instance().displayDialog(String.format(getString(R.string.link_account_popup), LinphoneManager.getLc().getDefaultProxyConfig().getIdentityAddress().asStringUriOnly()));
|
||||||
Button delete = (Button) dialog.findViewById(R.id.delete_button);
|
Button delete = dialog.findViewById(R.id.delete_button);
|
||||||
delete.setText(getString(R.string.link));
|
delete.setText(getString(R.string.link));
|
||||||
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
Button cancel = dialog.findViewById(R.id.cancel);
|
||||||
cancel.setText(getString(R.string.maybe_later));
|
cancel.setText(getString(R.string.maybe_later));
|
||||||
|
|
||||||
|
dialog.findViewById(R.id.doNotAskAgainLayout).setVisibility(View.VISIBLE);
|
||||||
|
final CheckBox doNotAskAgain = dialog.findViewById(R.id.doNotAskAgain);
|
||||||
|
dialog.findViewById(R.id.doNotAskAgainLabel).setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
doNotAskAgain.setChecked(!doNotAskAgain.isChecked());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
delete.setOnClickListener(new View.OnClickListener() {
|
delete.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -1543,11 +1557,12 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
LinphonePreferences.instance().setLinkPopupTime(String.valueOf(newDate));
|
|
||||||
|
|
||||||
cancel.setOnClickListener(new View.OnClickListener() {
|
cancel.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
if (doNotAskAgain.isChecked()) {
|
||||||
|
LinphonePreferences.instance().enableLinkPopup(false);
|
||||||
|
}
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1532,8 +1532,12 @@ public class LinphonePreferences {
|
||||||
return getConfig().getString("app", "link_popup_time", null);
|
return getConfig().getString("app", "link_popup_time", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getXmlRpcServerUrl() {
|
public boolean isLinkPopupEnabled() {
|
||||||
return getConfig().getString("app", "server_url", null);
|
return getConfig().getBool("app", "link_popup_enabled", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableLinkPopup(boolean enable) {
|
||||||
|
getConfig().setBool("app", "link_popup_enabled", enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDebugPopupAddress() {
|
public String getDebugPopupAddress() {
|
||||||
|
|
|
@ -993,7 +993,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
||||||
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
dialog.getWindow().setBackgroundDrawable(d);
|
dialog.getWindow().setBackgroundDrawable(d);
|
||||||
|
|
||||||
TextView customText = (TextView) dialog.findViewById(R.id.customText);
|
TextView customText = dialog.findViewById(R.id.customText);
|
||||||
customText.setText(text);
|
customText.setText(text);
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue