Minor fixes

This commit is contained in:
Grishka 2022-03-12 22:02:51 +03:00
parent 160b32f0e8
commit 938a6b6c78
10 changed files with 67 additions and 13 deletions

View File

@ -5,12 +5,12 @@ plugins {
android {
compileSdk 31
buildToolsVersion "32.0.0"
buildToolsVersion "33.0.0-rc1"
defaultConfig {
applicationId "org.joinmastodon.android"
minSdk 23
targetSdk 31
versionCode 11
versionCode 12
versionName "0.1"
}
@ -51,7 +51,7 @@ dependencies {
api 'androidx.annotation:annotation:1.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.9'
implementation 'me.grishka.litex:recyclerview:1.2.1.1'
implementation 'me.grishka.litex:swiperefreshlayout:1.1.0'
implementation 'me.grishka.litex:swiperefreshlayout:1.1.0.1'
implementation 'me.grishka.litex:browser:1.4.0'
implementation 'me.grishka.litex:dynamicanimation:1.1.0-alpha03'
implementation 'me.grishka.litex:viewpager:1.0.0'

View File

@ -8,12 +8,15 @@ import com.squareup.otto.Subscribe;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.requests.accounts.GetAccountStatuses;
import org.joinmastodon.android.api.session.AccountSessionManager;
import org.joinmastodon.android.events.StatusCountersUpdatedEvent;
import org.joinmastodon.android.events.StatusCreatedEvent;
import org.joinmastodon.android.events.StatusDeletedEvent;
import org.joinmastodon.android.model.Account;
import org.joinmastodon.android.model.Status;
import org.parceler.Parcels;
import java.util.Collections;
import java.util.List;
import me.grishka.appkit.api.SimpleCallback;
@ -81,4 +84,19 @@ public class AccountTimelineFragment extends StatusListFragment{
public void onStatusDeleted(StatusDeletedEvent ev){
super.onStatusDeleted(ev);
}
@Subscribe
public void onStatusCreated(StatusCreatedEvent ev){
if(!AccountSessionManager.getInstance().isSelf(accountID, ev.status.account))
return;
if(filter==GetAccountStatuses.Filter.DEFAULT){
// Keep replies to self, discard all other replies
if(ev.status.inReplyToAccountId!=null && !ev.status.inReplyToAccountId.equals(AccountSessionManager.getInstance().getAccount(accountID).self.id))
return;
}else if(filter==GetAccountStatuses.Filter.MEDIA){
if(ev.status.mediaAttachments.isEmpty())
return;
}
prependItems(Collections.singletonList(ev.status), true);
}
}

View File

@ -284,8 +284,12 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis
if(replyTo!=null){
replyText.setText(getString(R.string.in_reply_to, replyTo.account.displayName));
ArrayList<String> mentions=new ArrayList<>();
mentions.add('@'+replyTo.account.acct);
for(Mention mention : replyTo.mentions){
String ownID=AccountSessionManager.getInstance().getAccount(accountID).self.id;
if(!replyTo.account.id.equals(ownID))
mentions.add('@'+replyTo.account.acct);
for(Mention mention:replyTo.mentions){
if(mention.id.equals(ownID))
continue;
String m='@'+mention.acct;
if(!mentions.contains(m))
mentions.add(m);

View File

@ -1,16 +1,26 @@
package org.joinmastodon.android.fragments;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.requests.timelines.GetHashtagTimeline;
import org.joinmastodon.android.model.Status;
import java.util.List;
import me.grishka.appkit.Nav;
import me.grishka.appkit.api.SimpleCallback;
public class HashtagTimelineFragment extends StatusListFragment{
private String hashtag;
private ImageButton fab;
public HashtagTimelineFragment(){
setListLayoutId(R.layout.recycler_fragment_with_fab);
}
@Override
public void onAttach(Activity activity){
@ -37,4 +47,18 @@ public class HashtagTimelineFragment extends StatusListFragment{
if(!getArguments().getBoolean("noAutoLoad") && !loaded && !dataLoading)
loadData();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState);
fab=view.findViewById(R.id.fab);
fab.setOnClickListener(this::onFabClick);
}
private void onFabClick(View v){
Bundle args=new Bundle();
args.putString("account", accountID);
args.putString("prefilledText", '#'+hashtag+' ');
Nav.go(getActivity(), ComposeFragment.class, args);
}
}

View File

@ -10,6 +10,7 @@ import com.squareup.otto.Subscribe;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.requests.statuses.GetStatusContext;
import org.joinmastodon.android.events.StatusCountersUpdatedEvent;
import org.joinmastodon.android.events.StatusCreatedEvent;
import org.joinmastodon.android.events.StatusDeletedEvent;
import org.joinmastodon.android.model.Account;
import org.joinmastodon.android.model.StatusContext;
@ -97,4 +98,11 @@ public class ThreadFragment extends StatusListFragment{
public void onStatusDeleted(StatusDeletedEvent ev){
super.onStatusDeleted(ev);
}
@Subscribe
public void onStatusCreated(StatusCreatedEvent ev){
if(ev.status.inReplyToId!=null && getStatusByID(ev.status.inReplyToId)!=null){
onAppendItems(Collections.singletonList(ev.status));
}
}
}

View File

@ -79,6 +79,7 @@
android:textAppearance="@style/m3_body_large"
android:gravity="top"
android:background="@null"
android:hint="@string/compose_hint"
android:inputType="textMultiLine|textCapSentences"/>
<LinearLayout

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="navigation_bar_bg">@color/actionbar_bg</color>
<color name="navigation_bar_bg">@color/gray_50</color>
</resources>

View File

@ -87,8 +87,6 @@
<color name="purple_900">#3E1C96</color>
<color name="fab_icon">#282C37</color>
<color name="actionbar_bg">#FAFBFC</color>
<color name="actionbar_bg_dark">#4C4F58</color>
<color name="navigation_bar_bg">#282C37</color>
<color name="highlight_over_dark">#30FFFFFF</color>
<color name="highlight_over_light">#18000000</color>

View File

@ -203,4 +203,5 @@
<string name="resend">Resend</string>
<string name="open_email_app">Open email app</string>
<string name="resent_email">Confirmation email sent</string>
<string name="compose_hint">Type or paste what\'s on your mind</string>
</resources>

View File

@ -24,7 +24,7 @@
<item name="colorBackgroundLightest">@color/gray_25</item>
<item name="colorDarkIcon">@color/gray_900</item>
<item name="colorWindowBackground">@color/white</item>
<item name="android:statusBarColor">@color/actionbar_bg</item>
<item name="android:statusBarColor">@color/gray_50</item>
<item name="android:navigationBarColor">@color/navigation_bar_bg</item>
<item name="android:actionBarTheme">@style/Theme.Mastodon.Toolbar</item>
<item name="android:alertDialogTheme">@style/Theme.Mastodon.Dialog.Alert</item>
@ -67,8 +67,8 @@
<item name="colorBackgroundLightest">@color/gray_700</item>
<item name="colorDarkIcon">@color/gray_25</item>
<item name="colorWindowBackground">@color/gray_800</item>
<item name="android:statusBarColor">@color/actionbar_bg_dark</item>
<item name="android:navigationBarColor">@color/actionbar_bg_dark</item>
<item name="android:statusBarColor">@color/gray_800</item>
<item name="android:navigationBarColor">@color/gray_800</item>
<item name="android:actionBarTheme">@style/Theme.Mastodon.Toolbar.Dark</item>
<item name="android:alertDialogTheme">@style/Theme.Mastodon.Dialog.Alert.Dark</item>
<item name="colorPollMostVoted">@color/primary_700</item>
@ -91,13 +91,13 @@
<style name="Theme.Mastodon.AutoLightDark" parent="Theme.Mastodon.Light"/>
<style name="Theme.Mastodon.Toolbar" parent="android:ThemeOverlay.Material.ActionBar">
<item name="android:colorPrimary">@color/actionbar_bg</item>
<item name="android:colorPrimary">@color/gray_50</item>
<item name="android:textColorPrimary">@color/gray_800</item>
<item name="android:textColorSecondary">@color/gray_800</item>
</style>
<style name="Theme.Mastodon.Toolbar.Dark" parent="android:ThemeOverlay.Material.Dark.ActionBar">
<item name="android:colorPrimary">@color/actionbar_bg_dark</item>
<item name="android:colorPrimary">@color/gray_800</item>
<item name="android:textColorPrimary">@color/gray_50</item>
<item name="android:textColorSecondary">@color/gray_50</item>
</style>