mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
some fixes
This commit is contained in:
parent
0e933cfd50
commit
1a98f7803a
5 changed files with 15 additions and 10 deletions
|
@ -118,5 +118,5 @@ dependencies {
|
||||||
testImplementation 'junit:junit:'
|
testImplementation 'junit:junit:'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
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.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.ActionBar;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
@ -55,10 +56,8 @@ public class WebviewActivity extends BaseActivity {
|
||||||
|
|
||||||
public static List<String> trackingDomains;
|
public static List<String> trackingDomains;
|
||||||
private String url;
|
private String url;
|
||||||
private String peertubeLinkToFetch;
|
|
||||||
private boolean peertubeLink;
|
private boolean peertubeLink;
|
||||||
private CustomWebview webView;
|
private CustomWebview webView;
|
||||||
private Menu defaultMenu;
|
|
||||||
private FedilabWebViewClient FedilabWebViewClient;
|
private FedilabWebViewClient FedilabWebViewClient;
|
||||||
private ActivityWebviewBinding binding;
|
private ActivityWebviewBinding binding;
|
||||||
|
|
||||||
|
@ -70,11 +69,19 @@ public class WebviewActivity extends BaseActivity {
|
||||||
binding = ActivityWebviewBinding.inflate(getLayoutInflater());
|
binding = ActivityWebviewBinding.inflate(getLayoutInflater());
|
||||||
View view = binding.getRoot();
|
View view = binding.getRoot();
|
||||||
setContentView(view);
|
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();
|
Bundle b = getIntent().getExtras();
|
||||||
if (b != null) {
|
if (b != null) {
|
||||||
url = b.getString("url", null);
|
url = b.getString("url", null);
|
||||||
peertubeLinkToFetch = b.getString("peertubeLinkToFetch", null);
|
|
||||||
peertubeLink = b.getBoolean("peertubeLink", false);
|
peertubeLink = b.getBoolean("peertubeLink", false);
|
||||||
}
|
}
|
||||||
if (url == null)
|
if (url == null)
|
||||||
|
@ -164,16 +171,13 @@ public class WebviewActivity extends BaseActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
/* if (!peertubeLink)
|
|
||||||
setCount(WebviewActivity.this, "0");*/
|
|
||||||
defaultMenu = menu;
|
|
||||||
return super.onPrepareOptionsMenu(menu);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
public boolean onCreateOptionsMenu(@NotNull Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.main_webview, menu);
|
getMenuInflater().inflate(R.menu.main_webview, menu);
|
||||||
defaultMenu = menu;
|
|
||||||
if (peertubeLink) {
|
if (peertubeLink) {
|
||||||
menu.findItem(R.id.action_go).setVisible(false);
|
menu.findItem(R.id.action_go).setVisible(false);
|
||||||
menu.findItem(R.id.action_block).setVisible(false);
|
menu.findItem(R.id.action_block).setVisible(false);
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class WebviewConnectActivity extends BaseActivity {
|
||||||
editor.commit();
|
editor.commit();
|
||||||
//The user is now authenticated, it will be redirected to MainActivity
|
//The user is now authenticated, it will be redirected to MainActivity
|
||||||
Runnable myRunnable = () -> {
|
Runnable myRunnable = () -> {
|
||||||
Intent mainActivity = new Intent(WebviewConnectActivity.this, BaseMainActivity.class);
|
Intent mainActivity = new Intent(WebviewConnectActivity.this, MainActivity.class);
|
||||||
startActivity(mainActivity);
|
startActivity(mainActivity);
|
||||||
finish();
|
finish();
|
||||||
};
|
};
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class PinnedTimelineHelper {
|
||||||
Collections.sort(pinnedTimelineList, (obj1, obj2) -> Integer.compare(obj1.position, obj2.position));
|
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
|
//Values must be initialized if there is no records in db
|
||||||
if (pinned == null) {
|
if (pinned == null) {
|
||||||
pinned = new Pinned();
|
pinned = new Pinned();
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/toolbar_title"
|
android:id="@+id/toolbar_title"
|
||||||
|
android:textSize="14sp"
|
||||||
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"/>
|
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"/>
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
Loading…
Reference in a new issue