diff --git a/src/org/geometerplus/android/fbreader/crash/FixBooksDirectoryActivity.java b/src/org/geometerplus/android/fbreader/crash/FixBooksDirectoryActivity.java new file mode 100644 index 000000000..21d0e1a4e --- /dev/null +++ b/src/org/geometerplus/android/fbreader/crash/FixBooksDirectoryActivity.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2007-2011 Geometer Plus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +package org.geometerplus.android.fbreader.crash; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.*; + +import org.geometerplus.zlibrary.core.resources.ZLResource; + +import org.geometerplus.fbreader.Paths; + +import org.geometerplus.zlibrary.ui.android.R; + +import org.geometerplus.android.fbreader.FBReader; + +public class FixBooksDirectoryActivity extends Activity { + @Override + protected void onCreate(Bundle bundle) { + super.onCreate(bundle); + setContentView(R.layout.books_directory_fix); + + final ZLResource resource = ZLResource.resource("crash").getResource("fixBooksDirectory"); + final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button"); + + setTitle(resource.getResource("title").getValue()); + + final TextView textView = (TextView)findViewById(R.id.books_directory_fix_text); + textView.setText(resource.getResource("text").getValue()); + + 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); + okButton.setText(buttonResource.getResource("ok").getValue()); + okButton.setOnClickListener(new Button.OnClickListener() { + public void onClick(View v) { + Paths.BooksDirectoryOption().setValue(directoryView.getText().toString()); + startActivity(new Intent(FixBooksDirectoryActivity.this, FBReader.class)); + finish(); + } + }); + + final Button cancelButton = (Button)findViewById(R.id.books_directory_fix_cancel_button); + cancelButton.setText(buttonResource.getResource("cancel").getValue()); + cancelButton.setOnClickListener(new Button.OnClickListener() { + public void onClick(View v) { + finish(); + } + }); + } +}