Merge pull request #1958 from akallabeth/android-bookmark-fix

Android bookmark fix
This commit is contained in:
Bernhard Miklautz 2014-07-14 10:47:40 +02:00
commit bf835c54d8
2 changed files with 28 additions and 55 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
/*
Main screen layout
@ -8,35 +8,30 @@
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-->
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Dummy item to prevent SuperBarView from receiving focus (and showing the keyboard) -->
<LinearLayout
android:focusable="true" android:focusableInTouchMode="true"
android:layout_width="0px" android:layout_height="0px"/>
<!-- Dummy item to prevent SuperBarView from receiving focus (and showing the keyboard) -->
<include android:id="@+id/superBar" layout="@layout/super_bar" android:layout_alignParentTop="true" />
<LinearLayout
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true" />
<include
android:id="@+id/superBar"
android:layout_alignParentTop="true"
layout="@layout/super_bar" />
<ListView
android:id="@+id/listViewBookmarks"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/superBar"
android:layout_below="@id/superBar"
android:divider="@android:drawable/divider_horizontal_dark"
android:dividerHeight="1dp"
android:visibility="gone"
/>
android:dividerHeight="1dp" />
<WebView
android:id="@+id/webViewWelcome"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_below="@id/superBar"
android:fillViewport="true"
/>
</RelativeLayout>
</RelativeLayout>

View File

@ -9,26 +9,12 @@
package com.freerdp.freerdpcore.presentation;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Locale;
import com.freerdp.freerdpcore.R;
import com.freerdp.freerdpcore.application.GlobalApp;
import com.freerdp.freerdpcore.application.GlobalSettings;
import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.domain.ConnectionReference;
import com.freerdp.freerdpcore.domain.PlaceholderBookmark;
import com.freerdp.freerdpcore.domain.QuickConnectBookmark;
import com.freerdp.freerdpcore.utils.BookmarkArrayAdapter;
import com.freerdp.freerdpcore.utils.SeparatedListAdapter;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.text.Editable;
@ -42,8 +28,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnCreateContextMenuListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.Button;
@ -51,6 +35,16 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ListView;
import com.freerdp.freerdpcore.R;
import com.freerdp.freerdpcore.application.GlobalApp;
import com.freerdp.freerdpcore.application.GlobalSettings;
import com.freerdp.freerdpcore.domain.BookmarkBase;
import com.freerdp.freerdpcore.domain.ConnectionReference;
import com.freerdp.freerdpcore.domain.PlaceholderBookmark;
import com.freerdp.freerdpcore.domain.QuickConnectBookmark;
import com.freerdp.freerdpcore.utils.BookmarkArrayAdapter;
import com.freerdp.freerdpcore.utils.SeparatedListAdapter;
public class HomeActivity extends Activity {
private final static String ADD_BOOKMARK_PLACEHOLDER = "add_bookmark";
@ -108,22 +102,6 @@ public class HomeActivity extends Activity {
listViewBookmarks = (ListView) findViewById(R.id.listViewBookmarks);
String filename = ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE) ? "welcome.html" : "welcome_phone.html";
Locale def = Locale.getDefault();
String prefix = def.getLanguage().toLowerCase(def);
String base = "file:///android_asset/";
String dir = prefix + "_help_page/"
+ filename;
try {
InputStream is = getAssets().open(dir);
is.close();
dir = base + dir;
} catch (IOException e) {
Log.e(TAG, "Missing localized asset " + dir, e);
dir = "file:///android_asset/help_page/" + filename;
}
// set listeners for the list view
listViewBookmarks.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {