1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-06 03:50:19 +02:00

Network Dialogs layout changes + SignUp link background + Custom catalog examples

git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@1640 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
Vasiliy Bout 2010-08-02 12:28:23 +00:00
parent d729f6068d
commit d39563e28d
20 changed files with 216 additions and 235 deletions

View file

@ -7,7 +7,7 @@ DONE Комментарий к этому пункту = "Добавление O
** Какую-нибудь иконку к добавленным вручную каталогам ** Какую-нибудь иконку к добавленным вручную каталогам
DONE Звездочку к 2-м обязательным пунктам при добавлении каталога DONE Звездочку к 2-м обязательным пунктам при добавлении каталога
?? Убрать 3-й пункт при добавлении???? ?? Убрать 3-й пункт при добавлении????
** Может быть сделать примеры мелким шрифтом под полями??? DONE Может быть сделать примеры мелким шрифтом под полями
** Сразу (по нажатию Ok) проверять и говорить, верный ли URL (Ex: Это не OPDS-каталог) ** Сразу (по нажатию Ok) проверять и говорить, верный ли URL (Ex: Это не OPDS-каталог)
Это не должно мешать добавлению, но пользователь д.б. предупрежден Это не должно мешать добавлению, но пользователь д.б. предупрежден
(типа -- это не OPDS каталог -> Edit/Continue/Cancel) (типа -- это не OPDS каталог -> Edit/Continue/Cancel)

View file

@ -316,6 +316,9 @@
<node name="catalogTitle" toBeTranslated="true" value="Title" /> <node name="catalogTitle" toBeTranslated="true" value="Title" />
<node name="catalogUrl" toBeTranslated="true" value="URL" /> <node name="catalogUrl" toBeTranslated="true" value="URL" />
<node name="catalogSummary" toBeTranslated="true" value="Summary" /> <node name="catalogSummary" toBeTranslated="true" value="Summary" />
<node name="catalogTitleExample" toBeTranslated="true" value="Example: My OPDS catalog" />
<node name="catalogUrlExample" toBeTranslated="true" value="Example: http://my.library.address/opds" />
<node name="catalogSummaryExample" toBeTranslated="true" value="Example: OPDS catalog for my library" />
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" /> <node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" /> <node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" /> <node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />

View file

@ -315,6 +315,9 @@
<node name="catalogTitle" value="Title" /> <node name="catalogTitle" value="Title" />
<node name="catalogUrl" value="URL" /> <node name="catalogUrl" value="URL" />
<node name="catalogSummary" value="Summary" /> <node name="catalogSummary" value="Summary" />
<node name="catalogTitleExample" value="Example: My OPDS catalog" />
<node name="catalogUrlExample" value="Example: http://my.library.address/opds" />
<node name="catalogSummaryExample" value="Example: OPDS catalog for my library" />
<node name="titleIsEmpty" value="Title should be non-empty" /> <node name="titleIsEmpty" value="Title should be non-empty" />
<node name="urlIsEmpty" value="URL should be non-empty" /> <node name="urlIsEmpty" value="URL should be non-empty" />
<node name="invalidUrl" value="Invalid URL" /> <node name="invalidUrl" value="Invalid URL" />

View file

@ -316,6 +316,9 @@
<node name="catalogTitle" toBeTranslated="true" value="Title" /> <node name="catalogTitle" toBeTranslated="true" value="Title" />
<node name="catalogUrl" toBeTranslated="true" value="URL" /> <node name="catalogUrl" toBeTranslated="true" value="URL" />
<node name="catalogSummary" toBeTranslated="true" value="Summary" /> <node name="catalogSummary" toBeTranslated="true" value="Summary" />
<node name="catalogTitleExample" toBeTranslated="true" value="Example: My OPDS catalog" />
<node name="catalogUrlExample" toBeTranslated="true" value="Example: http://my.library.address/opds" />
<node name="catalogSummaryExample" toBeTranslated="true" value="Example: OPDS catalog for my library" />
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" /> <node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" /> <node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" /> <node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />

View file

@ -316,6 +316,9 @@
<node name="catalogTitle" toBeTranslated="true" value="Title" /> <node name="catalogTitle" toBeTranslated="true" value="Title" />
<node name="catalogUrl" toBeTranslated="true" value="URL" /> <node name="catalogUrl" toBeTranslated="true" value="URL" />
<node name="catalogSummary" toBeTranslated="true" value="Summary" /> <node name="catalogSummary" toBeTranslated="true" value="Summary" />
<node name="catalogTitleExample" toBeTranslated="true" value="Example: My OPDS catalog" />
<node name="catalogUrlExample" toBeTranslated="true" value="Example: http://my.library.address/opds" />
<node name="catalogSummaryExample" toBeTranslated="true" value="Example: OPDS catalog for my library" />
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" /> <node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" /> <node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" /> <node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />

View file

@ -316,6 +316,9 @@
<node name="catalogTitle" value="Titolo" /> <node name="catalogTitle" value="Titolo" />
<node name="catalogUrl" value="URL" /> <node name="catalogUrl" value="URL" />
<node name="catalogSummary" value="Sommario" /> <node name="catalogSummary" value="Sommario" />
<node name="catalogTitleExample" toBeTranslated="true" value="Example: My OPDS catalog" />
<node name="catalogUrlExample" toBeTranslated="true" value="Example: http://my.library.address/opds" />
<node name="catalogSummaryExample" toBeTranslated="true" value="Example: OPDS catalog for my library" />
<node name="titleIsEmpty" value="Il campo Titolo non può essere lasciato vuoto" /> <node name="titleIsEmpty" value="Il campo Titolo non può essere lasciato vuoto" />
<node name="urlIsEmpty" value="Il campo URL non può essere lasciato vuoto" /> <node name="urlIsEmpty" value="Il campo URL non può essere lasciato vuoto" />
<node name="invalidUrl" value="URL non valida" /> <node name="invalidUrl" value="URL non valida" />

View file

@ -315,6 +315,9 @@
<node name="catalogTitle" value="Название" /> <node name="catalogTitle" value="Название" />
<node name="catalogUrl" value="URL" /> <node name="catalogUrl" value="URL" />
<node name="catalogSummary" value="Описание" /> <node name="catalogSummary" value="Описание" />
<node name="catalogTitleExample" value="Пример: Мой OPDS каталог" />
<node name="catalogUrlExample" value="Пример: http://my.library.address/opds" />
<node name="catalogSummaryExample" value="Пример: OPDS каталог моей библиотеки" />
<node name="titleIsEmpty" value="Название не может быть пустым" /> <node name="titleIsEmpty" value="Название не может быть пустым" />
<node name="urlIsEmpty" value="URL не может быть пустым" /> <node name="urlIsEmpty" value="URL не может быть пустым" />
<node name="invalidUrl" value="Неверный URL" /> <node name="invalidUrl" value="Неверный URL" />

View file

@ -316,6 +316,9 @@
<node name="catalogTitle" toBeTranslated="true" value="Title" /> <node name="catalogTitle" toBeTranslated="true" value="Title" />
<node name="catalogUrl" toBeTranslated="true" value="URL" /> <node name="catalogUrl" toBeTranslated="true" value="URL" />
<node name="catalogSummary" toBeTranslated="true" value="Summary" /> <node name="catalogSummary" toBeTranslated="true" value="Summary" />
<node name="catalogTitleExample" toBeTranslated="true" value="Example: My OPDS catalog" />
<node name="catalogUrlExample" toBeTranslated="true" value="Example: http://my.library.address/opds" />
<node name="catalogSummaryExample" toBeTranslated="true" value="Example: OPDS catalog for my library" />
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" /> <node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" /> <node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" /> <node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />

View file

@ -316,6 +316,9 @@
<node name="catalogTitle" toBeTranslated="true" value="Title" /> <node name="catalogTitle" toBeTranslated="true" value="Title" />
<node name="catalogUrl" toBeTranslated="true" value="URL" /> <node name="catalogUrl" toBeTranslated="true" value="URL" />
<node name="catalogSummary" toBeTranslated="true" value="Summary" /> <node name="catalogSummary" toBeTranslated="true" value="Summary" />
<node name="catalogTitleExample" toBeTranslated="true" value="Example: My OPDS catalog" />
<node name="catalogUrlExample" toBeTranslated="true" value="Example: http://my.library.address/opds" />
<node name="catalogSummaryExample" toBeTranslated="true" value="Example: OPDS catalog for my library" />
<node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" /> <node name="titleIsEmpty" toBeTranslated="true" value="Title should be non-empty" />
<node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" /> <node name="urlIsEmpty" toBeTranslated="true" value="URL should be non-empty" />
<node name="invalidUrl" toBeTranslated="true" value="Invalid URL" /> <node name="invalidUrl" toBeTranslated="true" value="Invalid URL" />

6
icons/tree/link.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/link_pressed" />
<item android:state_focused="true" android:drawable="@drawable/link_selected" />
<item android:drawable="@drawable/link_default" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -7,54 +7,32 @@
android:paddingRight="10dp" android:paddingRight="10dp"
android:orientation="vertical" android:orientation="vertical"
> >
<LinearLayout <TextView
android:id="@+id/network_authentication_login_text"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:singleLine="true"
> />
<LinearLayout <EditText
android:layout_width="wrap_content" android:id="@+id/network_authentication_login"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:orientation="vertical" android:layout_height="wrap_content"
android:paddingRight="12dp" android:singleLine="true"
> />
<TextView <TextView
android:id="@+id/network_authentication_login_text" android:id="@+id/network_authentication_password_text"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:paddingTop="12sp" android:layout_marginTop="5dp"
/> />
<TextView <EditText
android:id="@+id/network_authentication_password_text" android:id="@+id/network_authentication_password"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:layout_marginTop="5dp" android:password="true"
android:paddingTop="12sp" />
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<EditText
android:id="@+id/network_authentication_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
/>
<EditText
android:id="@+id/network_authentication_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:password="true"
android:layout_marginTop="5dp"
/>
</LinearLayout>
</LinearLayout>
<TextView <TextView
android:id="@+id/network_authentication_error" android:id="@+id/network_authentication_error"
android:layout_width="fill_parent" android:layout_width="fill_parent"
@ -68,18 +46,19 @@
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="5dp"
android:paddingBottom="5dp"
> >
<TextView <TextView
android:id="@+id/network_authentication_register" android:id="@+id/network_authentication_register"
android:layout_width="fill_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:singleLine="true" android:singleLine="true"
android:textColor="#0000ff" android:textColor="#0000ff"
android:textStyle="bold" android:textStyle="bold"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:background="@drawable/link"
/> />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -11,101 +11,102 @@
android:paddingRight="10dp" android:paddingRight="10dp"
android:orientation="vertical" android:orientation="vertical"
> >
<LinearLayout <TextView
android:id="@+id/network_catalog_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
/>
<RelativeLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"
> >
<LinearLayout <TextView
android:id="@+id/network_catalog_title_star"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:text="*"
android:paddingRight="12dp" android:textColor="#ffff0000"
> android:layout_marginLeft="4dp"
<TextView android:layout_alignParentRight="true"
android:id="@+id/network_catalog_title_text" />
android:layout_width="wrap_content" <EditText
android:layout_height="wrap_content" android:id="@+id/network_catalog_title"
android:gravity="center_vertical"
android:maxLines="2"
/>
<TextView
android:id="@+id/network_catalog_url_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center_vertical"
android:maxLines="2"
/>
<TextView
android:id="@+id/network_catalog_summary_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center_vertical"
android:maxLines="2"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:singleLine="true"
> android:layout_alignParentLeft="true"
<RelativeLayout android:layout_toLeftOf="@id/network_catalog_title_star"
android:layout_width="fill_parent" />
android:layout_height="wrap_content" </RelativeLayout>
> <TextView
<TextView android:id="@+id/network_catalog_title_example"
android:id="@+id/network_catalog_title_star" android:layout_width="fill_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:singleLine="true"
android:text="*" android:gravity="right"
android:textColor="#ffff0000" />
android:layout_marginLeft="4dp"
android:layout_alignParentRight="true" <TextView
/> android:id="@+id/network_catalog_url_text"
<EditText android:layout_width="fill_parent"
android:id="@+id/network_catalog_title" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:singleLine="true"
android:layout_height="wrap_content" android:layout_marginTop="5dp"
android:singleLine="true" />
android:layout_alignParentLeft="true" <RelativeLayout
android:layout_toLeftOf="@id/network_catalog_title_star" android:layout_width="fill_parent"
/> android:layout_height="wrap_content"
</RelativeLayout> >
<RelativeLayout <TextView
android:layout_width="fill_parent" android:id="@+id/network_catalog_url_star"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:paddingTop="5dp" android:layout_height="wrap_content"
> android:text="*"
<TextView android:textColor="#ffff0000"
android:id="@+id/network_catalog_url_star" android:layout_marginLeft="4dp"
android:layout_width="wrap_content" android:layout_alignParentRight="true"
android:layout_height="wrap_content" />
android:text="*" <EditText
android:textColor="#ffff0000" android:id="@+id/network_catalog_url"
android:layout_marginLeft="4dp" android:layout_width="fill_parent"
android:layout_alignParentRight="true" android:layout_height="wrap_content"
/> android:singleLine="true"
<EditText android:inputType="textUri"
android:id="@+id/network_catalog_url" android:layout_alignParentLeft="true"
android:layout_width="fill_parent" android:layout_toLeftOf="@id/network_catalog_url_star"
android:layout_height="wrap_content" />
android:singleLine="true" </RelativeLayout>
android:inputType="textUri" <TextView
android:layout_alignParentLeft="true" android:id="@+id/network_catalog_url_example"
android:layout_toLeftOf="@id/network_catalog_url_star" android:layout_width="fill_parent"
/> android:layout_height="wrap_content"
</RelativeLayout> android:singleLine="true"
<EditText android:gravity="right"
android:id="@+id/network_catalog_summary" />
android:layout_width="fill_parent"
android:layout_height="wrap_content" <TextView
android:singleLine="true" android:id="@+id/network_catalog_summary_text"
android:layout_marginTop="5dp" android:layout_width="fill_parent"
/> android:layout_height="wrap_content"
</LinearLayout> android:singleLine="true"
</LinearLayout> android:layout_marginTop="5dp"
/>
<EditText
android:id="@+id/network_catalog_summary"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
/>
<TextView
android:id="@+id/network_catalog_summary_example"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:gravity="right"
/>
<TextView <TextView
android:id="@+id/network_catalog_error" android:id="@+id/network_catalog_error"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View file

@ -11,85 +11,59 @@
android:paddingRight="10dp" android:paddingRight="10dp"
android:orientation="vertical" android:orientation="vertical"
> >
<LinearLayout <TextView
android:id="@+id/network_register_login_text"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:singleLine="true"
> />
<LinearLayout <EditText
android:layout_width="wrap_content" android:id="@+id/network_register_login"
android:layout_height="wrap_content" android:layout_width="fill_parent"
android:orientation="vertical" android:layout_height="wrap_content"
android:paddingRight="12dp" android:singleLine="true"
> />
<TextView <TextView
android:id="@+id/network_register_login_text" android:id="@+id/network_register_password_text"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:singleLine="true"
android:maxLines="2" android:layout_marginTop="5dp"
/> />
<TextView <EditText
android:id="@+id/network_register_password_text" android:id="@+id/network_register_password"
android:layout_width="wrap_content" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="5dp" android:singleLine="true"
android:gravity="center_vertical" android:password="true"
android:maxLines="2" />
/> <TextView
<TextView android:id="@+id/network_register_confirm_password_text"
android:id="@+id/network_register_confirm_password_text" android:layout_width="fill_parent"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:singleLine="true"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:gravity="center_vertical" />
android:maxLines="2" <EditText
/> android:id="@+id/network_register_confirm_password"
<TextView android:layout_width="fill_parent"
android:id="@+id/network_register_email_text" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:singleLine="true"
android:layout_height="wrap_content" android:password="true"
android:layout_marginTop="5dp" />
android:gravity="center_vertical" <TextView
android:maxLines="2" android:id="@+id/network_register_email_text"
/> android:layout_width="fill_parent"
</LinearLayout> android:layout_height="wrap_content"
<LinearLayout android:singleLine="true"
android:layout_width="fill_parent" android:layout_marginTop="5dp"
android:layout_height="wrap_content" />
android:orientation="vertical" <EditText
> android:id="@+id/network_register_email"
<EditText android:layout_width="fill_parent"
android:id="@+id/network_register_login" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:singleLine="true"
android:layout_height="wrap_content" />
android:singleLine="true"
/>
<EditText
android:id="@+id/network_register_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:password="true"
android:layout_marginTop="5dp"
/>
<EditText
android:id="@+id/network_register_confirm_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:password="true"
android:layout_marginTop="5dp"
/>
<EditText
android:id="@+id/network_register_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_marginTop="5dp"
/>
</LinearLayout>
</LinearLayout>
<TextView <TextView
android:id="@+id/network_register_error" android:id="@+id/network_register_error"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View file

@ -48,8 +48,8 @@ class AuthenticationDialog extends NetworkDialog {
public View createLayout() { public View createLayout() {
final View layout = myActivity.getLayoutInflater().inflate(R.layout.network_authentication_dialog, null); final View layout = myActivity.getLayoutInflater().inflate(R.layout.network_authentication_dialog, null);
setupLabel(layout, R.id.network_authentication_login_text, "login", R.id.network_authentication_login); ((TextView) layout.findViewById(R.id.network_authentication_login_text)).setText(myResource.getResource("login").getValue());
setupLabel(layout, R.id.network_authentication_password_text, "password", R.id.network_authentication_password); ((TextView) layout.findViewById(R.id.network_authentication_password_text)).setText(myResource.getResource("password").getValue());
final TextView registerText = (TextView) layout.findViewById(R.id.network_authentication_register); final TextView registerText = (TextView) layout.findViewById(R.id.network_authentication_register);
registerText.setText(myResource.getResource("register").getValue()); registerText.setText(myResource.getResource("register").getValue());

View file

@ -53,9 +53,12 @@ class CustomCatalogDialog extends NetworkDialog {
protected View createLayout() { protected View createLayout() {
final View layout = myActivity.getLayoutInflater().inflate(R.layout.network_custom_catalog_dialog, null); final View layout = myActivity.getLayoutInflater().inflate(R.layout.network_custom_catalog_dialog, null);
setupLabel(layout, R.id.network_catalog_title_text, "catalogTitle", R.id.network_catalog_title); ((TextView) layout.findViewById(R.id.network_catalog_title_text)).setText(myResource.getResource("catalogTitle").getValue());
setupLabel(layout, R.id.network_catalog_url_text, "catalogUrl", R.id.network_catalog_url); ((TextView) layout.findViewById(R.id.network_catalog_url_text)).setText(myResource.getResource("catalogUrl").getValue());
setupLabel(layout, R.id.network_catalog_summary_text, "catalogSummary", R.id.network_catalog_summary); ((TextView) layout.findViewById(R.id.network_catalog_summary_text)).setText(myResource.getResource("catalogSummary").getValue());
((TextView) layout.findViewById(R.id.network_catalog_title_example)).setText(myResource.getResource("catalogTitleExample").getValue());
((TextView) layout.findViewById(R.id.network_catalog_url_example)).setText(myResource.getResource("catalogUrlExample").getValue());
((TextView) layout.findViewById(R.id.network_catalog_summary_example)).setText(myResource.getResource("catalogSummaryExample").getValue());
return layout; return layout;
} }
@ -145,6 +148,11 @@ class CustomCatalogDialog extends NetworkDialog {
((TextView) dialog.findViewById(R.id.network_catalog_url)).setText((myUrl != null) ? myUrl : ""); ((TextView) dialog.findViewById(R.id.network_catalog_url)).setText((myUrl != null) ? myUrl : "");
((TextView) dialog.findViewById(R.id.network_catalog_summary)).setText((mySummary != null) ? mySummary : ""); ((TextView) dialog.findViewById(R.id.network_catalog_summary)).setText((mySummary != null) ? mySummary : "");
final int examplesVisibility = (myLink == null) ? View.VISIBLE : View.GONE;
dialog.findViewById(R.id.network_catalog_title_example).setVisibility(examplesVisibility);
dialog.findViewById(R.id.network_catalog_url_example).setVisibility(examplesVisibility);
dialog.findViewById(R.id.network_catalog_summary_example).setVisibility(examplesVisibility);
final TextView error = (TextView) dialog.findViewById(R.id.network_catalog_error); final TextView error = (TextView) dialog.findViewById(R.id.network_catalog_error);
if (myErrorMessage == null) { if (myErrorMessage == null) {
error.setVisibility(View.GONE); error.setVisibility(View.GONE);

View file

@ -28,8 +28,6 @@ import android.content.DialogInterface;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import org.geometerplus.zlibrary.core.resources.ZLResource; import org.geometerplus.zlibrary.core.resources.ZLResource;
@ -187,13 +185,4 @@ abstract class NetworkDialog {
} }
public abstract void prepareDialog(Dialog dialog); public abstract void prepareDialog(Dialog dialog);
protected void setupLabel(View layout, int labelId, String key, int labelForId) {
final View viewFor = layout.findViewById(labelForId);
viewFor.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
final TextView label = (TextView) layout.findViewById(labelId);
label.setText(myResource.getResource(key).getValue());
label.getLayoutParams().height = viewFor.getMeasuredHeight();
}
} }

View file

@ -54,10 +54,10 @@ class RegisterUserDialog extends NetworkDialog {
public View createLayout() { public View createLayout() {
final View layout = myActivity.getLayoutInflater().inflate(R.layout.network_register_user_dialog, null); final View layout = myActivity.getLayoutInflater().inflate(R.layout.network_register_user_dialog, null);
setupLabel(layout, R.id.network_register_login_text, "login", R.id.network_register_login); ((TextView) layout.findViewById(R.id.network_register_login_text)).setText(myResource.getResource("login").getValue());
setupLabel(layout, R.id.network_register_password_text, "password", R.id.network_register_password); ((TextView) layout.findViewById(R.id.network_register_password_text)).setText(myResource.getResource("password").getValue());
setupLabel(layout, R.id.network_register_confirm_password_text, "confirmPassword", R.id.network_register_confirm_password); ((TextView) layout.findViewById(R.id.network_register_confirm_password_text)).setText(myResource.getResource("confirmPassword").getValue());
setupLabel(layout, R.id.network_register_email_text, "email", R.id.network_register_email); ((TextView) layout.findViewById(R.id.network_register_email_text)).setText(myResource.getResource("email").getValue());
return layout; return layout;
} }