Use compatibility method for setTextAppearance
This commit is contained in:
parent
159cb83af8
commit
5cdc58eda5
4 changed files with 68 additions and 4 deletions
|
@ -1187,8 +1187,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||||
layoutParams.setMargins(100, 10, 10, 10);
|
layoutParams.setMargins(100, 10, 10, 10);
|
||||||
holder.background.setBackgroundResource(R.drawable.resizable_chat_bubble_outgoing);
|
holder.background.setBackgroundResource(R.drawable.resizable_chat_bubble_outgoing);
|
||||||
holder.contactName.setTextAppearance(R.style.font3);
|
Compatibility.setTextAppearance(holder.contactName, getActivity(), R.style.font3);
|
||||||
holder.fileTransferAction.setTextAppearance(R.style.font15);
|
Compatibility.setTextAppearance(holder.fileTransferAction, getActivity(), R.style.font15);
|
||||||
holder.fileTransferAction.setBackgroundResource(R.drawable.resizable_confirm_delete_button);
|
holder.fileTransferAction.setBackgroundResource(R.drawable.resizable_confirm_delete_button);
|
||||||
} else {
|
} else {
|
||||||
if (isEditMode) {
|
if (isEditMode) {
|
||||||
|
@ -1199,8 +1199,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
layoutParams.setMargins(10, 10, 100, 10);
|
layoutParams.setMargins(10, 10, 100, 10);
|
||||||
}
|
}
|
||||||
holder.background.setBackgroundResource(R.drawable.resizable_chat_bubble_incoming);
|
holder.background.setBackgroundResource(R.drawable.resizable_chat_bubble_incoming);
|
||||||
holder.contactName.setTextAppearance(R.style.font9);
|
Compatibility.setTextAppearance(holder.contactName, getActivity(), R.style.font9);
|
||||||
holder.fileTransferAction.setTextAppearance(R.style.font8);
|
Compatibility.setTextAppearance(holder.fileTransferAction, getActivity(), R.style.font8);
|
||||||
holder.fileTransferAction.setBackgroundResource(R.drawable.resizable_assistant_button);
|
holder.fileTransferAction.setBackgroundResource(R.drawable.resizable_assistant_button);
|
||||||
}
|
}
|
||||||
holder.bubbleLayout.setLayoutParams(layoutParams);
|
holder.bubbleLayout.setLayoutParams(layoutParams);
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.provider.ContactsContract;
|
||||||
import android.provider.ContactsContract.CommonDataKinds.SipAddress;
|
import android.provider.ContactsContract.CommonDataKinds.SipAddress;
|
||||||
import android.provider.ContactsContract.Contacts;
|
import android.provider.ContactsContract.Contacts;
|
||||||
import android.provider.ContactsContract.Intents.Insert;
|
import android.provider.ContactsContract.Intents.Insert;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ApiElevenPlus.java
|
ApiElevenPlus.java
|
||||||
|
@ -162,4 +163,9 @@ public class ApiElevenPlus {
|
||||||
|
|
||||||
return notif;
|
return notif;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public static void setTextAppearance(TextView textview, Context context, int style) {
|
||||||
|
textview.setTextAppearance(context, style);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
48
src/org/linphone/compatibility/ApiTwentyThreePlus.java
Normal file
48
src/org/linphone/compatibility/ApiTwentyThreePlus.java
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
package org.linphone.compatibility;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.linphone.R;
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.app.Notification;
|
||||||
|
import android.app.PendingIntent;
|
||||||
|
import android.content.ContentUris;
|
||||||
|
import android.content.ContentValues;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.provider.ContactsContract;
|
||||||
|
import android.provider.ContactsContract.CommonDataKinds.SipAddress;
|
||||||
|
import android.provider.ContactsContract.Contacts;
|
||||||
|
import android.provider.ContactsContract.Intents.Insert;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
/*
|
||||||
|
ApiTwentyThreePlus.java
|
||||||
|
Copyright (C) 2012 Belledonne Communications, Grenoble, France
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* @author Sylvain Berfini
|
||||||
|
*/
|
||||||
|
@TargetApi(23)
|
||||||
|
public class ApiTwentyThreePlus {
|
||||||
|
public static void setTextAppearance(TextView textview, int style) {
|
||||||
|
textview.setTextAppearance(style);
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -29,6 +30,7 @@ import android.text.Html;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||||
|
import android.widget.TextView;
|
||||||
/**
|
/**
|
||||||
* @author Sylvain Berfini
|
* @author Sylvain Berfini
|
||||||
*/
|
*/
|
||||||
|
@ -120,4 +122,12 @@ public class Compatibility {
|
||||||
}*/
|
}*/
|
||||||
return Html.fromHtml(text);
|
return Html.fromHtml(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setTextAppearance(TextView textview, Context context, int style) {
|
||||||
|
if (Version.sdkAboveOrEqual(Version.API23_MARSHMALLOW_60)) {
|
||||||
|
ApiTwentyThreePlus.setTextAppearance(textview, style);
|
||||||
|
} else {
|
||||||
|
ApiElevenPlus.setTextAppearance(textview, context, style);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue