Hacks to make dialogs on Android 2.3 black on white, and not black on black

This commit is contained in:
Dominik Schürmann 2014-02-02 16:24:58 +01:00
parent 172b57bb97
commit 75faa60be1
8 changed files with 57 additions and 23 deletions

View File

@ -56,7 +56,7 @@
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@drawable/icon"
android:theme="@style/Theme.AppCompat.Light"
android:theme="@style/KeychainTheme"
android:label="@string/app_name">
<activity
android:name=".ui.KeyListPublicActivity"

View File

@ -33,10 +33,12 @@ import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.support.v4.app.DialogFragment;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import com.beardedhen.androidbootstrap.BootstrapButton;
@ -57,6 +59,7 @@ public class FileDialogFragment extends DialogFragment {
private EditText mFilename;
private BootstrapButton mBrowse;
private CheckBox mCheckBox;
private TextView mMessageTextView;
private static final int REQUEST_CODE = 0x00007004;
@ -96,12 +99,13 @@ public class FileDialogFragment extends DialogFragment {
LayoutInflater inflater = (LayoutInflater) activity
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
AlertDialog.Builder alert = new AlertDialog.Builder(activity);
alert.setTitle(title);
alert.setMessage(message);
View view = inflater.inflate(R.layout.file_dialog, null);
mMessageTextView = (TextView) view.findViewById(R.id.message);
mMessageTextView.setText(message);
mFilename = (EditText) view.findViewById(R.id.input);
mFilename.setText(defaultFile);
mBrowse = (BootstrapButton) view.findViewById(R.id.btn_browse);

View File

@ -32,6 +32,7 @@ import android.app.Dialog;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
@ -76,7 +77,7 @@ public class ShareQrCodeDialogFragment extends DialogFragment {
Uri dataUri = getArguments().getParcelable(ARG_KEY_URI);
mFingerprintOnly = getArguments().getBoolean(ARG_FINGERPRINT_ONLY);
AlertDialog.Builder alert = new AlertDialog.Builder(activity);
AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
alert.setTitle(R.string.share_qr_code_dialog_title);

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -1,32 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010 Thialfihar <thi@thialfihar.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dip"
android:paddingRight="5dip" >
android:paddingRight="5dip">
<TextView
android:id="@+id/message"
android:layout_marginBottom="8dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
android:orientation="horizontal">
<EditText
android:id="@+id/input"

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Used in Android >= 4 -->
<style name="KeychainTheme" parent="@style/Theme.AppCompat.Light">
</style>
<style name="SectionHeader">
<item name="android:drawableBottom">@drawable/section_header</item>
<item name="android:drawablePadding">4dp</item>
<item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">4dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textColor">@color/emphasis</item>
<item name="android:textSize">14sp</item>
</style>
</resources>

View File

@ -1,14 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Used in Android < 4 -->
<style name="KeychainTheme" parent="@style/Theme.AppCompat.Light">
<item name="android:alertDialogStyle">@style/CustomDialogTheme</item>
</style>
<!-- Ugly fix to make content background of Dialogs on Android < 4 white not black! -->
<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
<item name="android:fullDark">@drawable/popup_full_bright</item>
<!--<item name="android:topDark">@android:drawable/popup_full_dark</item>-->
<item name="android:centerDark">@drawable/popup_center_bright</item>
<!--<item name="android:bottomDark">@android:drawable/popup_bottom_dark</item>-->
<!--<item name="fullBright">@android:drawable/popup_full_bright</item>-->
<!--<item name="topBright">@android:drawable/popup_top_bright</item>-->
<!--<item name="centerBright">@android:drawable/popup_center_bright</item>-->
<!--<item name="bottomBright">@android:drawable/popup_bottom_bright</item>-->
<!--<item name="bottomMedium">@android:drawable/popup_bottom_medium</item>-->
<!--<item name="centerMedium">@android:drawable/popup_center_medium</item>-->
</style>
<style name="SectionHeader">
<item name="android:drawableBottom">@drawable/section_header</item>
<item name="android:drawablePadding">4dp</item>
<item name="android:layout_marginTop">8dp</item>
<item name="android:paddingLeft">4dp</item>
<!-- <item name="android:textAllCaps">true</item> -->
<item name="android:textColor">@color/emphasis</item>
<item name="android:textSize">14sp</item>
</style>
</resources>