Commit 2553b483 authored by Thomas's avatar Thomas
Browse files

Some fixes

parent 18bc812c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ android {
        }
    }
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
@@ -128,4 +129,5 @@ dependencies {
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
   // debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'

    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -479,7 +479,9 @@ public class ProfileActivity extends BaseActivity {
     * This methode is called to update the view once an action has been performed
     */
    private void updateAccount() {

        if (currentAccount == null || account == null) {
            return;
        }
        //The value for account is from same server so id can be used
        if (account.id.equals(currentAccount.user_id)) {
            binding.accountFollow.setVisibility(View.GONE);
+28 −25
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public class WebviewConnectActivity extends BaseActivity {
                    String scope = requestedAdmin ? Helper.OAUTH_SCOPES_ADMIN : Helper.OAUTH_SCOPES;
                    oauthVM.createToken(currentInstanceLogin, "authorization_code", client_idLogin, client_secretLogin, Helper.REDIRECT_CONTENT_WEB, scope, code)
                            .observe(WebviewConnectActivity.this, tokenObj -> {
                                if (tokenObj != null) {
                                    Account account = new Account();
                                    account.client_id = client_idLogin;
                                    account.client_secret = client_secretLogin;
@@ -233,8 +234,10 @@ public class WebviewConnectActivity extends BaseActivity {
                                        } else {
                                            Toasty.error(WebviewConnectActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
                                        }

                                    });
                                } else {
                                    Toasty.error(WebviewConnectActivity.this, getString(R.string.toast_token), Toasty.LENGTH_SHORT).show();
                                }
                            });
                    return true;
                } else {
+8 −2
Original line number Diff line number Diff line
@@ -1298,13 +1298,19 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
                @Override
                public void afterTextChanged(Editable s) {
                    int currentLength = MastodonHelper.countLength(holder);
                    if (currentLength > max_car + 1) {
                    int max_car = MastodonHelper.getInstanceMaxChars(context);
                    if (currentLength > max_car) {
                        holder.binding.characterCount.setTextColor(Color.RED);
                    } else {
                        holder.binding.characterCount.setTextColor(holder.binding.content.getTextColors());
                    }
                    /*if (currentLength > max_car + 1) {
                        holder.binding.contentSpoiler.setText(s.delete(max_car - holder.binding.content.getText().length(), (currentLength - holder.binding.content.getText().length())));
                        buttonVisibility(holder);
                    } else if (currentLength > max_car) {
                        buttonVisibility(holder);
                        holder.binding.contentSpoiler.setText(s.delete(cPosition, cPosition + 1));
                    }
                    }*/
                    statusList.get(holder.getBindingAdapterPosition()).spoiler_text = s.toString();
                    if (s.toString().trim().length() < 2) {
                        buttonVisibility(holder);
+11 −11
Original line number Diff line number Diff line
@@ -37,12 +37,12 @@ import androidx.preference.PreferenceManager;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util;
import com.google.android.exoplayer2.upstream.DefaultDataSource;

import java.util.Timer;

@@ -61,7 +61,7 @@ import app.fedilab.android.webview.FedilabWebViewClient;
public class FragmentMedia extends Fragment {


    private SimpleExoPlayer player;
    private ExoPlayer player;
    private Timer timer;
    private String url;
    private boolean canSwipe;
@@ -261,26 +261,26 @@ public class FragmentMedia extends Fragment {
        binding.mediaVideo.setVisibility(View.VISIBLE);
        Uri uri = Uri.parse(url);
        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
        String userAgent = sharedpreferences.getString(getString(R.string.SET_CUSTOM_USER_AGENT), Helper.USER_AGENT);
        int video_cache = sharedpreferences.getInt(getString(R.string.SET_VIDEO_CACHE), Helper.DEFAULT_VIDEO_CACHE_MB);
        ProgressiveMediaSource videoSource;
        MediaItem mediaItem = new MediaItem.Builder().setUri(uri).build();
        if (video_cache == 0) {
            DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(requireActivity(),
                    Util.getUserAgent(requireActivity(), userAgent), null);
            DataSource.Factory dataSourceFactory = new DefaultDataSource.Factory(requireActivity());
            videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
                    .createMediaSource(uri);
                    .createMediaSource(mediaItem);
        } else {
            CacheDataSourceFactory cacheDataSourceFactory = new CacheDataSourceFactory(requireActivity());
            videoSource = new ProgressiveMediaSource.Factory(cacheDataSourceFactory)
                    .createMediaSource(uri);
                    .createMediaSource(mediaItem);
        }
        player = new SimpleExoPlayer.Builder(requireActivity()).build();
        player = new ExoPlayer.Builder(requireActivity()).build();
        if (type.equalsIgnoreCase("gifv"))
            player.setRepeatMode(Player.REPEAT_MODE_ONE);
        binding.mediaVideo.setPlayer(player);
        binding.loader.setVisibility(View.GONE);
        binding.mediaPicture.setVisibility(View.GONE);
        player.prepare(videoSource);
        player.setMediaSource(videoSource);
        player.prepare();
        player.setPlayWhenReady(true);
    }

Loading