Skip to content

Commit

Permalink
fix wrong language shown in licence popup
Browse files Browse the repository at this point in the history
  • Loading branch information
B0pol committed Jan 31, 2020
1 parent edc9d47 commit 9d60b74
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.os.AsyncTask;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
Expand All @@ -14,6 +15,8 @@
import java.io.InputStreamReader;
import java.lang.ref.WeakReference;

import static org.schabi.newpipe.util.Localization.assureCorrectAppLanguage;

public class LicenseFragmentHelper extends AsyncTask<Object, Void, Integer> {

final WeakReference<Activity> weakReference;
Expand Down Expand Up @@ -55,15 +58,15 @@ protected void onPostExecute(Integer result) {
wv.loadData(webViewData, "text/html; charset=UTF-8", null);

alert.setView(wv);
alert.setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
assureCorrectAppLanguage(activity.getApplicationContext());
alert.setNegativeButton(getFinishString(activity), (dialog, which) -> dialog.dismiss());
alert.show();
}

private static String getFinishString(Activity activity) {
return activity.getApplicationContext().getResources().getString(R.string.finish);
}

/**
* @param context the context to use
* @param license the license
Expand Down

0 comments on commit 9d60b74

Please sign in to comment.