AppCompat Migration contribution

This commit is contained in:
daivat15 2018-02-17 13:51:50 +05:30 committed by Daniel Gultsch
parent 5775223653
commit 54dadfd7cd
2 changed files with 9 additions and 9 deletions

View file

@ -26,7 +26,7 @@
*/ */
package eu.siacs.conversations.services; package eu.siacs.conversations.services;
import android.app.Activity; import android.support.v7.app.AppCompatActivity ;
import android.app.Application; import android.app.Application;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.Service; import android.app.Service;
@ -113,7 +113,7 @@ public class MemorizingTrustManager {
static String KEYSTORE_FILE = "KeyStore.bks"; static String KEYSTORE_FILE = "KeyStore.bks";
Context master; Context master;
Activity foregroundAct; AppCompatActivity foregroundAct;
NotificationManager notificationManager; NotificationManager notificationManager;
private static int decisionId = 0; private static int decisionId = 0;
private static SparseArray<MTMDecision> openDecisions = new SparseArray<MTMDecision>(); private static SparseArray<MTMDecision> openDecisions = new SparseArray<MTMDecision>();
@ -172,8 +172,8 @@ public class MemorizingTrustManager {
app = (Application)m; app = (Application)m;
} else if (m instanceof Service) { } else if (m instanceof Service) {
app = ((Service)m).getApplication(); app = ((Service)m).getApplication();
} else if (m instanceof Activity) { } else if (m instanceof AppCompatActivity) {
app = ((Activity)m).getApplication(); app = ((AppCompatActivity)m).getApplication();
} else throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!"); } else throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!");
File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE); File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE);
@ -197,7 +197,7 @@ public class MemorizingTrustManager {
* *
* @param act Activity to be bound * @param act Activity to be bound
*/ */
public void bindDisplayActivity(Activity act) { public void bindDisplayActivity(AppCompatActivity act) {
foregroundAct = act; foregroundAct = act;
} }
@ -205,11 +205,11 @@ public class MemorizingTrustManager {
* Removes an Activity from the MTM display stack. * Removes an Activity from the MTM display stack.
* *
* Always call this function when the Activity added with * Always call this function when the Activity added with
* {@link #bindDisplayActivity(Activity)} is hidden. * {@link #bindDisplayActivity(AppCompatActivity)} is hidden.
* *
* @param act Activity to be unbound * @param act Activity to be unbound
*/ */
public void unbindDisplayActivity(Activity act) { public void unbindDisplayActivity(AppCompatActivity act) {
// do not remove if it was overridden by a different activity // do not remove if it was overridden by a different activity
if (foregroundAct == act) if (foregroundAct == act)
foregroundAct = null; foregroundAct = null;

View file

@ -1,6 +1,6 @@
package eu.siacs.conversations.ui; package eu.siacs.conversations.ui;
import android.app.Activity; import android.support.v7.app.AppCompatActivity ;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.util.Log; import android.util.Log;
@ -15,7 +15,7 @@ import eu.siacs.conversations.utils.zxing.IntentIntegrator;
import eu.siacs.conversations.utils.zxing.IntentResult; import eu.siacs.conversations.utils.zxing.IntentResult;
import eu.siacs.conversations.xmpp.jid.Jid; import eu.siacs.conversations.xmpp.jid.Jid;
public class UriHandlerActivity extends Activity { public class UriHandlerActivity extends AppCompatActivity {
public static final String ACTION_SCAN_QR_CODE = "scan_qr_code"; public static final String ACTION_SCAN_QR_CODE = "scan_qr_code";
@Override @Override