added custom menu group icon

This commit is contained in:
nuclearfog 2021-02-07 10:51:15 +01:00
parent f20b92d74b
commit 4462fec2a9
No known key found for this signature in database
GPG Key ID: D5490E4A81F97B14
5 changed files with 40 additions and 7 deletions

View File

@ -150,6 +150,7 @@ public class ListDetail extends AppCompatActivity implements OnTabSelectedListen
public boolean onCreateOptionsMenu(Menu m) {
getMenuInflater().inflate(R.menu.userlist, m);
AppStyles.setMenuIconColor(m, settings.getIconColor());
AppStyles.setOverflowIcon(toolbar, settings.getIconColor());
return super.onCreateOptionsMenu(m);
}

View File

@ -101,6 +101,7 @@ public class TweetActivity extends AppCompatActivity implements OnClickListener,
private TextView tweet_api, tweetDate, tweetText, scrName, usrName, tweetLocName, sensitive_media;
private Button ansButton, rtwButton, favButton, replyName, tweetLocGPS, retweeter;
private ImageView profile_img, mediaButton;
private Toolbar toolbar;
private Dialog deleteDialog;
private GlobalSettings settings;
@ -114,9 +115,9 @@ public class TweetActivity extends AppCompatActivity implements OnClickListener,
protected void onCreate(@Nullable Bundle b) {
super.onCreate(b);
setContentView(R.layout.page_tweet);
Toolbar tool = findViewById(R.id.tweet_toolbar);
View root = findViewById(R.id.tweet_layout);
ViewPager pager = findViewById(R.id.tweet_pager);
toolbar = findViewById(R.id.tweet_toolbar);
ansButton = findViewById(R.id.tweet_answer);
rtwButton = findViewById(R.id.tweet_retweet);
favButton = findViewById(R.id.tweet_favorit);
@ -166,8 +167,8 @@ public class TweetActivity extends AppCompatActivity implements OnClickListener,
tweetText.setMovementMethod(LinkAndScrollMovement.getInstance());
tweetText.setLinkTextColor(settings.getHighlightColor());
deleteDialog = DialogBuilder.create(this, DELETE_TWEET, this);
tool.setTitle("");
setSupportActionBar(tool);
toolbar.setTitle("");
setSupportActionBar(toolbar);
AppStyles.setTheme(settings, root);
retweeter.setOnClickListener(this);
@ -222,6 +223,7 @@ public class TweetActivity extends AppCompatActivity implements OnClickListener,
@Override
public boolean onCreateOptionsMenu(Menu m) {
getMenuInflater().inflate(R.menu.tweet, m);
AppStyles.setOverflowIcon(toolbar, settings.getIconColor());
return super.onCreateOptionsMenu(m);
}

View File

@ -142,6 +142,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
private Button following, follower;
private ViewPager tabPages;
private TabLayout tabLayout;
private Toolbar toolbar;
private Dialog unfollowConfirm, blockConfirm, muteConfirm;
@Nullable
@ -154,7 +155,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
protected void onCreate(@Nullable Bundle b) {
super.onCreate(b);
setContentView(R.layout.page_profile);
Toolbar tool = findViewById(R.id.profile_toolbar);
toolbar = findViewById(R.id.profile_toolbar);
View root = findViewById(R.id.user_view);
tabLayout = findViewById(R.id.profile_tab);
user_bio = findViewById(R.id.bio);
@ -178,7 +179,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
user_location.setCompoundDrawablesWithIntrinsicBounds(R.drawable.userlocation, 0, 0, 0);
user_website.setCompoundDrawablesWithIntrinsicBounds(R.drawable.link, 0, 0, 0);
follow_back.setCompoundDrawablesWithIntrinsicBounds(R.drawable.followback, 0, 0, 0);
tool.setBackgroundColor(settings.getBackgroundColor() & TOOLBAR_TRANSPARENCY);
toolbar.setBackgroundColor(settings.getBackgroundColor() & TOOLBAR_TRANSPARENCY);
username.setBackgroundColor(settings.getBackgroundColor() & TEXT_TRANSPARENCY);
follow_back.setBackgroundColor(settings.getBackgroundColor() & TEXT_TRANSPARENCY);
user_bio.setMovementMethod(LinkAndScrollMovement.getInstance());
@ -186,8 +187,8 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
AppStyles.setTheme(settings, root);
user_website.setTextColor(settings.getHighlightColor());
tool.setTitle("");
setSupportActionBar(tool);
toolbar.setTitle("");
setSupportActionBar(toolbar);
adapter = new FragmentAdapter(getSupportFragmentManager());
tabPages.setAdapter(adapter);
tabPages.setOffscreenPageLimit(2);
@ -262,6 +263,7 @@ public class UserProfile extends AppCompatActivity implements OnClickListener, O
public boolean onCreateOptionsMenu(Menu m) {
getMenuInflater().inflate(R.menu.profile, m);
AppStyles.setMenuIconColor(m, settings.getIconColor());
AppStyles.setOverflowIcon(toolbar, settings.getIconColor());
return super.onCreateOptionsMenu(m);
}

View File

@ -24,7 +24,9 @@ import android.widget.TextView;
import androidx.annotation.ArrayRes;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.appcompat.widget.Toolbar;
import androidx.cardview.widget.CardView;
import androidx.core.content.res.ResourcesCompat;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
@ -214,7 +216,24 @@ public final class AppStyles {
}
}
/**
* set Toolbar overflow icon color
*
* @param toolbar Toolbar with overflow icon
* @param color icon color
*/
public static void setOverflowIcon(Toolbar toolbar, int color) {
Drawable groupIcon = ResourcesCompat.getDrawable(toolbar.getResources(), R.drawable.group, null);
setDrawableColor(groupIcon, color);
toolbar.setOverflowIcon(groupIcon);
}
/**
* sets progress circle color
*
* @param circle progress circle
* @param color highlight color
*/
public static void setProgressColor(ProgressBar circle, int color) {
Drawable icon = circle.getIndeterminateDrawable();
if (icon != null) {

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M10.001,7.8C8.786,7.8 7.8,8.785 7.8,10s0.986,2.2 2.201,2.2S12.2,11.215 12.2,10S11.216,7.8 10.001,7.8zM10.001,5.2C11.216,5.2 12.2,4.214 12.2,3s-0.984,-2.2 -2.199,-2.2S7.8,1.785 7.8,3S8.786,5.2 10.001,5.2zM10.001,14.8C8.786,14.8 7.8,15.785 7.8,17s0.986,2.2 2.201,2.2S12.2,18.215 12.2,17S11.216,14.8 10.001,14.8z"
android:fillColor="#FFFFFF" />
</vector>