fix_reports
Thomas 2 years ago
parent a866f5524a
commit 575329586f

@ -1,9 +1,9 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" <shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<shortcut <shortcut
android:shortcutId="compose"
android:enabled="true" android:enabled="true"
android:icon="@drawable/ic_baseline_add_comment_24" android:icon="@drawable/ic_baseline_add_comment_24"
android:shortcutId="compose"
android:shortcutShortLabel="@string/compose_shortcut_short_label1" android:shortcutShortLabel="@string/compose_shortcut_short_label1"
tools:targetApi="n_mr1"> tools:targetApi="n_mr1">
<intent <intent

@ -1,9 +1,9 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" <shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<shortcut <shortcut
android:shortcutId="compose"
android:enabled="true" android:enabled="true"
android:icon="@drawable/ic_baseline_add_comment_24" android:icon="@drawable/ic_baseline_add_comment_24"
android:shortcutId="compose"
android:shortcutShortLabel="@string/compose_shortcut_short_label1" android:shortcutShortLabel="@string/compose_shortcut_short_label1"
tools:targetApi="n_mr1"> tools:targetApi="n_mr1">
<intent <intent

@ -82,7 +82,6 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<meta-data <meta-data

File diff suppressed because it is too large Load Diff

@ -248,12 +248,16 @@ public class MastodonHelper {
String targetedUrl = disableGif ? (type == MediaAccountType.AVATAR ? account.avatar_static : account.header_static) : (type == MediaAccountType.AVATAR ? account.avatar : account.header); String targetedUrl = disableGif ? (type == MediaAccountType.AVATAR ? account.avatar_static : account.header_static) : (type == MediaAccountType.AVATAR ? account.avatar : account.header);
if (targetedUrl != null) { if (targetedUrl != null) {
if (disableGif || (!targetedUrl.endsWith(".gif"))) { if (disableGif || (!targetedUrl.endsWith(".gif"))) {
Glide.with(activity != null ? activity : context) try {
.asDrawable() Glide.with(activity != null ? activity : context)
.load(targetedUrl) .asDrawable()
.thumbnail(0.1f) .load(targetedUrl)
.placeholder(placeholder) .thumbnail(0.1f)
.into(view); .placeholder(placeholder)
.into(view);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
} else { } else {
Glide.with(activity != null ? activity : context) Glide.with(activity != null ? activity : context)
.asGif() .asGif()

@ -17,9 +17,11 @@ package app.fedilab.android.peertube.activities;
import static app.fedilab.android.BaseMainActivity.currentAccount; import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentInstance; import static app.fedilab.android.BaseMainActivity.currentInstance;
import static app.fedilab.android.BaseMainActivity.currentToken; import static app.fedilab.android.BaseMainActivity.currentToken;
import static app.fedilab.android.BaseMainActivity.currentUserID;
import static app.fedilab.android.BaseMainActivity.fetchRecentAccounts; import static app.fedilab.android.BaseMainActivity.fetchRecentAccounts;
import static app.fedilab.android.BaseMainActivity.headerMenuOpen; import static app.fedilab.android.BaseMainActivity.headerMenuOpen;
import static app.fedilab.android.BaseMainActivity.headerOptionInfoClick; import static app.fedilab.android.BaseMainActivity.headerOptionInfoClick;
import static app.fedilab.android.BaseMainActivity.mamageNewIntent;
import static app.fedilab.android.BaseMainActivity.manageDrawerMenu; import static app.fedilab.android.BaseMainActivity.manageDrawerMenu;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
@ -201,6 +203,15 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
currentToken = sharedpreferences.getString(app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN, null); currentToken = sharedpreferences.getString(app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN, null);
} }
currentAccount = new Account(PeertubeMainActivity.this).getConnectedAccount(); currentAccount = new Account(PeertubeMainActivity.this).getConnectedAccount();
if (currentAccount == null) {
if (currentUserID == null) {
currentUserID = sharedpreferences.getString(PREF_USER_ID, null);
}
if (currentInstance == null) {
currentInstance = sharedpreferences.getString(PREF_USER_INSTANCE, null);
}
currentAccount = new Account(PeertubeMainActivity.this).getUniqAccount(currentUserID, currentInstance);
}
} catch (DBException e) { } catch (DBException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -211,7 +222,6 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
finish(); finish();
return; return;
} }
//If the attached account is null, the app will fetch remote instance to get up-to-date values //If the attached account is null, the app will fetch remote instance to get up-to-date values
if (currentAccount != null && currentAccount.peertube_account == null) { if (currentAccount != null && currentAccount.peertube_account == null) {
try { try {
@ -221,7 +231,6 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
e.printStackTrace(); e.printStackTrace();
} }
} }
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> { Runnable myRunnable = () -> {
headerMainBinding.accountAcc.setText(String.format("%s@%s", currentAccount.peertube_account.getUsername(), currentAccount.instance)); headerMainBinding.accountAcc.setText(String.format("%s@%s", currentAccount.peertube_account.getUsername(), currentAccount.instance));
@ -240,6 +249,13 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
headerMenuOpen = !headerMenuOpen; headerMenuOpen = !headerMenuOpen;
manageDrawerMenu(PeertubeMainActivity.this, binding.drawerNavView, headerMainBinding); manageDrawerMenu(PeertubeMainActivity.this, binding.drawerNavView, headerMainBinding);
}); });
if (Helper.isLoggedIn()) {
binding.navView.inflateMenu(R.menu.bottom_nav_menu_connected_peertube);
refreshToken();
} else {
binding.navView.inflateMenu(R.menu.bottom_nav_menu);
}
}; };
mainHandler.post(myRunnable); mainHandler.post(myRunnable);
}).start(); }).start();
@ -353,13 +369,7 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
setTitleCustom(R.string.title_home); setTitleCustom(R.string.title_home);
if (Helper.isLoggedIn()) {
binding.navView.inflateMenu(R.menu.bottom_nav_menu_connected_peertube);
refreshToken();
} else {
binding.navView.inflateMenu(R.menu.bottom_nav_menu);
}
peertubeInformation = new PeertubeInformation(); peertubeInformation = new PeertubeInformation();
peertubeInformation.setCategories(new LinkedHashMap<>()); peertubeInformation.setCategories(new LinkedHashMap<>());
peertubeInformation.setLanguages(new LinkedHashMap<>()); peertubeInformation.setLanguages(new LinkedHashMap<>());
@ -396,8 +406,9 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
getSupportFragmentManager(), android.R.id.content, new FragmentLoginPickInstancePeertube(), getSupportFragmentManager(), android.R.id.content, new FragmentLoginPickInstancePeertube(),
null, null, FragmentLoginPickInstancePeertube.class.getName()); null, null, FragmentLoginPickInstancePeertube.class.getName());
} }
mamageNewIntent(PeertubeMainActivity.this, getIntent());
fetchRecentAccounts(PeertubeMainActivity.this, headerMainBinding); fetchRecentAccounts(PeertubeMainActivity.this, headerMainBinding);
} }
public DisplayVideosFragment getSubscriptionFragment() { public DisplayVideosFragment getSubscriptionFragment() {
@ -656,8 +667,18 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
recreate(); recreate();
} }
} }
mamageNewIntent(PeertubeMainActivity.this, intent);
} }
/*public static void mamageNewIntent(Activity activity,
Intent intent) {
if (intent == null)
return;
String action = intent.getAction();
if (action != null && action.equalsIgnoreCase("app.fedilab.android.shorcut.compose")) {
CrossActionHelper.doCrossAction(activity, CrossActionHelper.TypeOfCrossAction.COMPOSE, null, null);
}
}*/
@SuppressLint("ApplySharedPref") @SuppressLint("ApplySharedPref")
private void showRadioButtonDialog() { private void showRadioButtonDialog() {

@ -1,10 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24" android:viewportWidth="24"
android:viewportHeight="24"> android:viewportHeight="24">
<path <path
android:fillColor="?attr/colorControlNormal" android:fillColor="@android:color/black"
android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM17,11h-4v4h-2v-4H7V9h4V5h2v4h4v2z" /> android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM17,11h-4v4h-2v-4H7V9h4V5h2v4h4v2z" />
</vector> </vector>

@ -1,9 +1,9 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" <shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<shortcut <shortcut
android:shortcutId="compose"
android:enabled="true" android:enabled="true"
android:icon="@drawable/ic_baseline_add_comment_24" android:icon="@drawable/ic_baseline_add_comment_24"
android:shortcutId="compose"
android:shortcutShortLabel="@string/compose_shortcut_short_label1" android:shortcutShortLabel="@string/compose_shortcut_short_label1"
tools:targetApi="n_mr1"> tools:targetApi="n_mr1">
<intent <intent

Loading…
Cancel
Save