FreeShare Geek v3.1.8290版本的 MD5 值为:492ca3ae4cdfab7e2d18d5e1b4428e75

以下内容为反编译后的 f.java 源代码,内容仅作参考


package com.stkj.presenter.impl.transport;

import android.content.Context;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.stkj.presenter.handlers.p;
import com.stkj.presenter.handlers.q;
import com.stkj.presenter.ui.transport.TransportActivity;
import com.stkj.processor.core.ConnectionBuilder;
import com.stkj.processor.core.k;
import com.stkj.processor.core.l;
import com.stkj.processor.core.r;
import com.stkj.processor.entity.Client;
import com.stkj.processor.entity.FileBean;
import com.stkj.processor.server.t;
import com.stkj.ui.def.p.h;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicBoolean;
import rx.i;

public class f implements com.stkj.presenter.a.o.e, q {
    private final h b;
    private p d;
    private Bitmap e;
    private TimerTask f;
    private Timer g;
    private Timer h;
    private TimerTask i;
    private boolean k;
    private Context m;
    private int n;

    private final com.stkj.processor.def.i.a f1973a = new com.stkj.processor.impl.j.a();

    private AtomicBoolean f1974c = new AtomicBoolean(false);
    private Handler j = new Handler();
    private int l = 0;
    private Handler o = new Handler();
    private Runnable p = new Runnable() {
        @Override
        public void run() {
            try {
                BufferedReader bufferedReader = new BufferedReader(new FileReader("/proc/net/arp"));
                try {
                    for (String readLine = bufferedReader.readLine(); readLine != null; readLine = bufferedReader.readLine()) {
                        String[] split = readLine.split(" +");
                        if (split != null) {
                            String str = split[0];
                            if (str.startsWith("192.168.43") || str.startsWith("192.168.1")) {
                                f.this.o.post(new Runnable() {
                                    @Override
                                    public void run() {
                                        f.this.b.w_();
                                        f.this.d();
                                    }
                                });
                                return;
                            }
                        }
                    }
                } finally {
                    bufferedReader.close();
                }
            } catch (IOException e) {
                Log.d("TEXT_WIFI_AP_CLIENT", "e: " + e);
            }
            f.this.o.postDelayed(this, 500L);
        }
    };

    static int g(f fVar) {
        int i = fVar.l;
        fVar.l = i + 1;
        return i;
    }

    static int j(f fVar) {
        int i = fVar.n;
        fVar.n = i + 1;
        return i;
    }

    public f(h hVar) {
        this.m = hVar.h();
        this.b = hVar;
        this.b.a(this);
    }

    @Override
    public void a() {
        com.stkj.presenter.ui.d.a.c(this.b.h());
    }

    @Override
    public void a(final Context context) {
        this.b.e();
        ConnectionBuilder.WifiConnection a2 = this.f1973a.a(com.stkj.processor.impl.l.a.a().b());
        r.a().a(a2);
        a(a2);
        this.b.b("http://192.168.43.1:" + t.f2198c);
        this.e = this.f1973a.a(context, (int) com.stkj.ui.b.a.a(300.0f), JsonProperty.USE_DEFAULT_NAME, "http://192.168.43.1:" + t.f2198c, com.stkj.presenter.c.no_media);
        this.b.a(this.e);
        this.b.a(k.a().c());
        t.f().a(new i<Long>() {
            @Override
            public void a() {
                unsubscribe();
            }

            @Override
            public void a(Throwable th) {
                unsubscribe();
            }

            @Override
            public void a(Long l) {
                unsubscribe();
                if (!TextUtils.isEmpty(t.a(true))) {
                    String g = t.f().g();
                    f.this.b.b(g);
                    f.this.e = f.this.f1973a.a(context, (int) com.stkj.ui.b.a.a(300.0f), JsonProperty.USE_DEFAULT_NAME, g, com.stkj.presenter.c.no_media);
                    f.this.b.a(f.this.e);
                }
            }
        });
    }

    @Override
    public Handler e() {
        return this.o;
    }

    private void a(final ConnectionBuilder.WifiConnection wifiConnection) {
        final Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                if (f.this.b()) {
                    TransportService.a(f.this.b.h());
                    f.this.d = (p) t.f().c("WEB_SHARE");
                    f.this.d.a(f.this);
                    f.this.d.a(com.stkj.processor.def.g.a.a().f());
                    f.this.k = true;
                    f.this.o.post(new Runnable() {
                        @Override
                        public void run() {
                            f.this.b.g_(wifiConnection.getSSID());
                            f.this.i();
                        }
                    });
                    timer.cancel();
                    cancel();
                }
                f.g(f.this);
                if (f.this.l == 5) {
                    r.a().a(wifiConnection);
                }
                if (f.this.l >= 10) {
                    timer.cancel();
                    cancel();
                    f.this.j.post(new Runnable() {
                        @Override
                        public void run() {
                            f.this.b.d();
                        }
                    });
                    f.this.onBackPressed();
                }
            }
        }, 0L, 1000L);
    }

    @Override
    public boolean g() {
        return this.k;
    }

    @Override
    public void b(Context context) {
        this.d.b(this);
        if (this.e != null) {
            this.e.recycle();
        }
        if (this.g != null) {
            this.g.cancel();
        }
        if (this.f != null) {
            this.f.cancel();
        }
        if (this.h != null) {
            this.h.cancel();
        }
        if (this.i != null) {
            this.i.cancel();
        }
        if (this.j != null) {
            this.j.removeCallbacksAndMessages(null);
        }
    }

    @Override
    public void onBackPressed() {
        TransportService.b(this.b.h());
        r.a().b();
        new Thread(new Runnable() {
            @Override
            public void run() {
                l.c(f.this.b.h());
            }
        }).start();
        if (l.b()) {
            this.g = new Timer();
            this.f = new TimerTask() {
                @Override
                public void run() {
                    f.j(f.this);
                    if (f.this.n < 10) {
                        switch (l.a()) {
                            case -1:
                                f.this.b.h().finish();
                                return;
                            case 0:
                            default:
                                return;
                            case 1:
                                if (f.this.b()) {
                                    f.this.b.h().finish();
                                    return;
                                }
                                return;
                            case 2:
                                if (f.this.h()) {
                                    f.this.b.h().finish();
                                    return;
                                }
                                return;
                        }
                    }
                    r.a().b();
                    f.this.j.post(new Runnable() {
                        @Override
                        public void run() {
                            f.this.b.c();
                        }
                    });
                    f.this.b.h().finish();
                }
            };
            this.g.schedule(this.f, 0L, 2000L);
            return;
        }
        this.b.h().finish();
    }

    @Override
    public boolean b() {
        return l.h(this.b.h());
    }

    @Override
    public String c() {
        return "WebShareSend";
    }

    public boolean h() {
        return l.f(this.b.h());
    }

    @Override
    public void a(Client client, FileBean fileBean) {
    }

    @Override
    public void a(Client client, FileBean fileBean, int i, long j) {
    }

    @Override
    public void a(Client client, Exception exc) {
    }

    @Override
    public void a(Client client) {
        if (!this.f1974c.get()) {
            this.f1974c.set(true);
            this.b.h().finish();
            c cVar = new c();
            cVar.a(3);
            cVar.a(1);
            cVar.a(4);
            TransportActivity.a(this.b.h(), cVar);
        }
    }

    public void d() {
        final Runnable runnable = new Runnable() {
            @Override
            public void run() {
                f.this.b.d_(f.this.f());
            }
        };
        this.h = new Timer();
        this.i = new TimerTask() {
            @Override
            public void run() {
                f.this.j.post(runnable);
            }
        };
        this.h.schedule(this.i, 0L, 1000L);
    }

    public boolean f() {
        return ((ConnectivityManager) com.stkj.presenter.core.a.a().b().getSystemService("connectivity")).getNetworkInfo(0).isConnectedOrConnecting();
    }

    public void i() {
        new Thread(this.p).start();
    }
}