pull/17/head
Thomas 3 years ago
parent 0e933cfd50
commit 1a98f7803a

@ -118,5 +118,5 @@ dependencies {
testImplementation 'junit:junit:'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
}

@ -31,6 +31,7 @@ import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.Toast;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@ -55,10 +56,8 @@ public class WebviewActivity extends BaseActivity {
public static List<String> trackingDomains;
private String url;
private String peertubeLinkToFetch;
private boolean peertubeLink;
private CustomWebview webView;
private Menu defaultMenu;
private FedilabWebViewClient FedilabWebViewClient;
private ActivityWebviewBinding binding;
@ -70,11 +69,19 @@ public class WebviewActivity extends BaseActivity {
binding = ActivityWebviewBinding.inflate(getLayoutInflater());
View view = binding.getRoot();
setContentView(view);
setSupportActionBar(binding.toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
}
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
Bundle b = getIntent().getExtras();
if (b != null) {
url = b.getString("url", null);
peertubeLinkToFetch = b.getString("peertubeLinkToFetch", null);
peertubeLink = b.getBoolean("peertubeLink", false);
}
if (url == null)
@ -164,16 +171,13 @@ public class WebviewActivity extends BaseActivity {
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
/* if (!peertubeLink)
setCount(WebviewActivity.this, "0");*/
defaultMenu = menu;
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
getMenuInflater().inflate(R.menu.main_webview, menu);
defaultMenu = menu;
if (peertubeLink) {
menu.findItem(R.id.action_go).setVisible(false);
menu.findItem(R.id.action_block).setVisible(false);

@ -222,7 +222,7 @@ public class WebviewConnectActivity extends BaseActivity {
editor.commit();
//The user is now authenticated, it will be redirected to MainActivity
Runnable myRunnable = () -> {
Intent mainActivity = new Intent(WebviewConnectActivity.this, BaseMainActivity.class);
Intent mainActivity = new Intent(WebviewConnectActivity.this, MainActivity.class);
startActivity(mainActivity);
finish();
};

@ -64,7 +64,7 @@ public class PinnedTimelineHelper {
Collections.sort(pinnedTimelineList, (obj1, obj2) -> Integer.compare(obj1.position, obj2.position));
}
public static void redrawTopBarPinned(BaseMainActivity activity, ActivityMainBinding activityMainBinding, Pinned pinned, List<MastodonList> mastodonLists) {
public synchronized static void redrawTopBarPinned(BaseMainActivity activity, ActivityMainBinding activityMainBinding, Pinned pinned, List<MastodonList> mastodonLists) {
//Values must be initialized if there is no records in db
if (pinned == null) {
pinned = new Pinned();

@ -50,6 +50,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/toolbar_title"
android:textSize="14sp"
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"/>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>

Loading…
Cancel
Save