mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-05 00:23:09 +02:00
Dr Who
This commit is contained in:
@@ -218,11 +218,7 @@ public class FragmentBase extends Fragment {
|
||||
}
|
||||
|
||||
public String getRequestKey() {
|
||||
String we = toString();
|
||||
int pa = we.indexOf('(');
|
||||
int sp = we.indexOf(' ', pa);
|
||||
String who = we.substring(pa + 1, sp);
|
||||
return getClass().getName() + ":result:" + who;
|
||||
return Helper.getRequestKey(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,11 +44,7 @@ public class FragmentDialogBase extends DialogFragment {
|
||||
private int targetRequestCode;
|
||||
|
||||
public String getRequestKey() {
|
||||
String we = toString();
|
||||
int pa = we.indexOf('(');
|
||||
int sp = we.indexOf(' ', pa);
|
||||
String who = we.substring(pa + 1, sp);
|
||||
return getClass().getName() + ":result:" + who;
|
||||
return Helper.getRequestKey(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -98,6 +98,7 @@ import androidx.browser.customtabs.CustomTabsServiceConnection;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
@@ -119,6 +120,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
@@ -1185,6 +1187,26 @@ public class Helper {
|
||||
return layout.getOffsetForHorizontal(line, x);
|
||||
}
|
||||
|
||||
static String getRequestKey(Fragment fragment) {
|
||||
String who;
|
||||
try {
|
||||
Class<?> cls = fragment.getClass();
|
||||
while (!cls.isAssignableFrom(Fragment.class))
|
||||
cls = cls.getSuperclass();
|
||||
Field f = cls.getDeclaredField("mWho");
|
||||
f.setAccessible(true);
|
||||
who = (String) f.get(fragment);
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
String we = fragment.toString();
|
||||
int pa = we.indexOf('(');
|
||||
int sp = we.indexOf(' ', pa);
|
||||
who = we.substring(pa + 1, sp);
|
||||
}
|
||||
|
||||
return fragment.getClass().getName() + ":result:" + who;
|
||||
}
|
||||
|
||||
// Graphics
|
||||
|
||||
static int dp2pixels(Context context, int dp) {
|
||||
|
||||
Reference in New Issue
Block a user