some fixes

This commit is contained in:
stom79 2018-10-30 17:15:29 +01:00
parent b2b08cc02d
commit 60022ff22e
4 changed files with 15 additions and 21 deletions

View File

@ -30,7 +30,6 @@ import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageButton;
@ -410,12 +409,18 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
pbar_inf.setIndeterminate(false);
pbar_inf.setScaleY(3f);
File file = new File(getCacheDir() + "/" + Helper.md5(url)+".mp4");
try {
HttpsURLConnection.setDefaultSSLSocketFactory(new TLSSocketFactory());
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
if(file.exists()) {
Uri uri = Uri.parse(file.getAbsolutePath());
videoView.setVisibility(View.VISIBLE);
Log.v(Helper.TAG,"uri 2: " + uri);
videoView.setVideoURI(uri);
videoView.seekTo(0);
videoView.start();
MediaController mc = new MediaController(MediaActivity.this);
videoView.setMediaController(mc);
@ -432,14 +437,6 @@ public class MediaActivity extends BaseActivity implements OnDownloadInterface {
}else{
videoView.setVisibility(View.VISIBLE);
Uri uri = Uri.parse(url);
try {
HttpsURLConnection.setDefaultSSLSocketFactory(new TLSSocketFactory());
} catch (KeyManagementException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
Log.v(Helper.TAG,"uri 1: " + uri);
videoView.setVideoURI(uri);
videoView.start();
MediaController mc = new MediaController(MediaActivity.this);

View File

@ -7,6 +7,7 @@ import java.net.Socket;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
@ -30,6 +31,11 @@ public class TLSSocketFactory extends SSLSocketFactory {
public SSLContext getSSLContext(){
return this.context;
}
public SSLEngine getSSLEngine(){
return this.context.createSSLEngine();
}
@Override
public String[] getDefaultCipherSuites() {
return sSLSocketFactory.getDefaultCipherSuites();

View File

@ -20,7 +20,6 @@ import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v7.widget.RecyclerView;
import android.view.View;

View File

@ -95,7 +95,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
private List<String> mutedAccount;
private String instanceType;
private String search_peertube, remote_channel_name;
private boolean isFetchingMore;
public DisplayStatusFragment(){
}
@ -113,7 +112,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
firstTootsLoaded = true;
showPinned = false;
showReply = false;
isFetchingMore = false;
if (bundle != null) {
type = (RetrieveFeedsAsyncTask.Type) bundle.get("type");
targetedId = bundle.getString("targetedId", null);
@ -463,11 +461,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
if( tmpStatuses.size() < 3) //If new toots are only two
lv_status.scrollToPosition(0);
else {
if(isFetchingMore)
lv_status.scrollToPosition(position);
else
lv_status.scrollToPosition(position + tmpStatuses.size());
isFetchingMore = false;
lv_status.scrollToPosition(position + tmpStatuses.size());
}
}
@ -491,7 +485,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
}
swipeRefreshLayout.setRefreshing(false);
firstLoad = false;
isFetchingMore = false;
}
}
@ -734,7 +727,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
}
public void fetchMore(String max_id){
isFetchingMore = true;
asyncTask = new RetrieveFeedsAsyncTask(context, type, max_id, DisplayStatusFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}