mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
ok/cancel buttons standatization; better work with FixBooksDirectoryActivity
This commit is contained in:
parent
b483946d4d
commit
ea4a66ab7f
9 changed files with 46 additions and 96 deletions
|
@ -136,29 +136,6 @@
|
|||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<Button
|
||||
android:id="@+id/add_custom_catalog_ok_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/add_custom_catalog_cancel_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/ok_cancel_buttons" android:id="@+id/add_custom_catalog_buttons" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -67,33 +67,6 @@
|
|||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<Button
|
||||
android:id="@+id/authentication_ok_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:minWidth="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/authentication_cancel_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:minWidth="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/ok_cancel_buttons" android:id="@+id/authentication_buttons" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
|
@ -23,33 +23,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<Button
|
||||
android:id="@+id/books_directory_fix_ok_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:minWidth="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/books_directory_fix_cancel_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:minWidth="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
<include layout="@layout/ok_cancel_buttons" android:id="@+id/books_directory_fix_buttons" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
|
28
res/layout/ok_cancel_buttons.xml
Normal file
28
res/layout/ok_cancel_buttons.xml
Normal file
|
@ -0,0 +1,28 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<Button
|
||||
android:id="@+id/ok_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:minWidth="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="fill_parent"
|
||||
android:minWidth="75dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
/>
|
||||
</LinearLayout>
|
|
@ -51,7 +51,8 @@ public class FixBooksDirectoryActivity extends Activity {
|
|||
final EditText directoryView = (EditText)findViewById(R.id.books_directory_fix_directory);
|
||||
directoryView.setText(Paths.BooksDirectoryOption().getValue());
|
||||
|
||||
final Button okButton = (Button)findViewById(R.id.books_directory_fix_ok_button);
|
||||
final View buttonsView = findViewById(R.id.books_directory_fix_buttons);
|
||||
final Button okButton = (Button)buttonsView.findViewById(R.id.ok_button);
|
||||
okButton.setText(buttonResource.getResource("ok").getValue());
|
||||
okButton.setOnClickListener(new Button.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
@ -61,7 +62,7 @@ public class FixBooksDirectoryActivity extends Activity {
|
|||
}
|
||||
});
|
||||
|
||||
final Button cancelButton = (Button)findViewById(R.id.books_directory_fix_cancel_button);
|
||||
final Button cancelButton = (Button)buttonsView.findViewById(R.id.cancel_button);
|
||||
cancelButton.setText(buttonResource.getResource("cancel").getValue());
|
||||
cancelButton.setOnClickListener(new Button.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
setTextFromResource(R.id.add_custom_catalog_summary_example, "catalogSummaryExample");
|
||||
|
||||
setupButton(
|
||||
R.id.add_custom_catalog_ok_button, "ok", new View.OnClickListener() {
|
||||
R.id.ok_button, "ok", new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
final InputMethodManager imm =
|
||||
(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
|
||||
|
@ -78,7 +78,7 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
}
|
||||
);
|
||||
setupButton(
|
||||
R.id.add_custom_catalog_cancel_button, "cancel", new View.OnClickListener() {
|
||||
R.id.cancel_button, "cancel", new View.OnClickListener() {
|
||||
public void onClick(View view) {
|
||||
finish();
|
||||
}
|
||||
|
@ -187,7 +187,8 @@ public class AddCustomCatalogActivity extends Activity {
|
|||
}
|
||||
|
||||
private void setupButton(int id, String resourceKey, View.OnClickListener listener) {
|
||||
final Button button = (Button)findViewById(id);
|
||||
final Button button =
|
||||
(Button)findViewById(R.id.add_custom_catalog_buttons).findViewById(id);
|
||||
button.setText(
|
||||
ZLResource.resource("dialog").getResource("button").getResource(resourceKey).getValue()
|
||||
);
|
||||
|
|
|
@ -188,7 +188,8 @@ public class AuthenticationActivity extends Activity {
|
|||
|
||||
final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button");
|
||||
|
||||
myOkButton = findButton(R.id.authentication_ok_button);
|
||||
final View buttonsView = findViewById(R.id.authentication_buttons);
|
||||
myOkButton = (Button)buttonsView.findViewById(R.id.ok_button);
|
||||
myOkButton.setText(buttonResource.getResource("ok").getValue());
|
||||
myOkButton.setOnClickListener(new Button.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
@ -202,7 +203,7 @@ public class AuthenticationActivity extends Activity {
|
|||
}
|
||||
});
|
||||
|
||||
final Button cancelButton = findButton(R.id.authentication_cancel_button);
|
||||
final Button cancelButton = (Button)buttonsView.findViewById(R.id.cancel_button);
|
||||
cancelButton.setText(buttonResource.getResource("cancel").getValue());
|
||||
cancelButton.setOnClickListener(new Button.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
|
@ -277,10 +278,6 @@ public class AuthenticationActivity extends Activity {
|
|||
return (TextView)findViewById(resourceId);
|
||||
}
|
||||
|
||||
private Button findButton(int resourceId) {
|
||||
return (Button)findViewById(resourceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
|
|
@ -257,10 +257,6 @@ public abstract class NetworkBookActions {
|
|||
if (mgr == null) {
|
||||
return;
|
||||
}
|
||||
/*if (!NetworkOperationRunnable::tryConnect()) {
|
||||
return;
|
||||
}*/
|
||||
|
||||
|
||||
final ZLResource dialogResource = ZLResource.resource("dialog");
|
||||
final ZLResource buttonResource = dialogResource.getResource("button");
|
||||
|
@ -374,5 +370,4 @@ public abstract class NetworkBookActions {
|
|||
Util.openInBrowser(activity, reference.Url);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.geometerplus.zlibrary.ui.android.library;
|
|||
|
||||
import java.io.*;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.*;
|
||||
import android.os.Process;
|
||||
import android.net.Uri;
|
||||
|
@ -49,6 +50,10 @@ public class UncaughtExceptionHandler implements java.lang.Thread.UncaughtExcept
|
|||
myContext.startActivity(intent);
|
||||
}
|
||||
|
||||
if (myContext instanceof Activity) {
|
||||
((Activity)myContext).finish();
|
||||
}
|
||||
|
||||
Process.killProcess(Process.myPid());
|
||||
System.exit(10);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue