mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-19 13:01:17 +01:00
bug fix, settings layout fix, dependency update
This commit is contained in:
parent
5421071c27
commit
0aa15a1f71
@ -42,7 +42,7 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.3.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
|
@ -30,6 +30,11 @@ public class PushNotification {
|
||||
public static final String NOTIFICATION_NAME = BuildConfig.APPLICATION_ID + " UnifiedPush";
|
||||
public static final String NOTIFICATION_ID_STR = BuildConfig.APPLICATION_ID + ".notification";
|
||||
|
||||
/**
|
||||
* maximum notifications to show
|
||||
*/
|
||||
private static final int NOTIFICATION_LIMIT = 3;
|
||||
|
||||
private static final int NOTIFICATION_ID = 0x25281;
|
||||
|
||||
private NotificationManagerCompat notificationManager;
|
||||
@ -73,10 +78,7 @@ public class PushNotification {
|
||||
String title = settings.getLogin().getConfiguration().getName();
|
||||
String content;
|
||||
int icon;
|
||||
if (notifications.size() > 1) {
|
||||
content = context.getString(R.string.notification_new);
|
||||
icon = R.drawable.bell;
|
||||
} else {
|
||||
if (notifications.size() == 1) {
|
||||
Notification notification = notifications.getFirst();
|
||||
switch (notification.getType()) {
|
||||
case Notification.TYPE_FAVORITE:
|
||||
@ -124,6 +126,12 @@ public class PushNotification {
|
||||
content = context.getString(R.string.notification_new);
|
||||
break;
|
||||
}
|
||||
} else if (notifications.size() <= NOTIFICATION_LIMIT) {
|
||||
content = context.getString(R.string.notification_new);
|
||||
icon = R.drawable.bell;
|
||||
} else {
|
||||
// ignore new push notifications
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU || context.checkSelfPermission(POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
|
||||
notificationBuilder.setContentTitle(title).setContentText(content).setSmallIcon(icon);
|
||||
|
@ -93,6 +93,7 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
|
||||
private Dialog loadingCircle;
|
||||
|
||||
private DrawerLayout drawerLayout;
|
||||
private NavigationView navigationView;
|
||||
private TabSelector tabSelector;
|
||||
private ViewPager2 viewPager;
|
||||
private ImageView profileImage;
|
||||
@ -116,7 +117,7 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.page_main);
|
||||
Toolbar toolbar = findViewById(R.id.home_toolbar);
|
||||
NavigationView navigationView = findViewById(R.id.home_navigator);
|
||||
navigationView = findViewById(R.id.home_navigator);
|
||||
header = (ViewGroup) navigationView.getHeaderView(0);
|
||||
floatingButton = findViewById(R.id.home_post);
|
||||
drawerLayout = findViewById(R.id.main_layout);
|
||||
@ -138,34 +139,29 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
|
||||
if (navigationView.getLayoutParams() != null) {
|
||||
navigationView.getLayoutParams().width = Math.round(getResources().getDisplayMetrics().widthPixels / 2.0f);
|
||||
}
|
||||
if (!settings.floatingButtonEnabled()) {
|
||||
floatingButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (!settings.getLogin().getConfiguration().isFilterSupported()) {
|
||||
navigationView.getMenu().findItem(R.id.menu_navigator_filter).setVisible(false);
|
||||
}
|
||||
toolbar.setTitle("");
|
||||
toolbar.setNavigationIcon(R.drawable.menu);
|
||||
setSupportActionBar(toolbar);
|
||||
AppStyles.setTheme(header);
|
||||
setStyle();
|
||||
updateUI();
|
||||
|
||||
navigationView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AppStyles.setTheme(navigationView);
|
||||
}
|
||||
});
|
||||
if (savedInstanceState != null) {
|
||||
Serializable data = savedInstanceState.getSerializable(KEY_USER_SAVE);
|
||||
if (data instanceof User) {
|
||||
setCurrentUser((User) data);
|
||||
}
|
||||
}
|
||||
// load user information
|
||||
if (settings.isLoggedIn() && currentUser == null) {
|
||||
UserParam param = new UserParam(UserParam.DATABASE, settings.getLogin().getId());
|
||||
userLoader.execute(param, this);
|
||||
}
|
||||
// set navigation view style
|
||||
navigationView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AppStyles.setTheme(navigationView);
|
||||
}
|
||||
});
|
||||
|
||||
toolbar.setNavigationOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
@ -298,15 +294,10 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
|
||||
// update layout & theme
|
||||
case SettingsActivity.RETURN_SETTINGS_CHANGED:
|
||||
case AccountActivity.RETURN_SETTINGS_CHANGED:
|
||||
if (settings.floatingButtonEnabled()) {
|
||||
floatingButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
floatingButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (adapter != null) {
|
||||
adapter.notifySettingsChanged();
|
||||
}
|
||||
setStyle();
|
||||
updateUI();
|
||||
setCurrentUser(currentUser);
|
||||
break;
|
||||
}
|
||||
@ -455,11 +446,17 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void setStyle() {
|
||||
private void updateUI() {
|
||||
AppStyles.setTheme(drawerLayout);
|
||||
AppStyles.setTheme(header);
|
||||
tabSelector.addTabIcons(settings.getLogin().getConfiguration().getHomeTabIcons());
|
||||
tabSelector.updateTheme();
|
||||
if (!settings.floatingButtonEnabled()) {
|
||||
floatingButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (!settings.getLogin().getConfiguration().isFilterSupported()) {
|
||||
navigationView.getMenu().findItem(R.id.menu_navigator_filter).setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -470,6 +467,7 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
|
||||
private void setCurrentUser(@Nullable User user) {
|
||||
currentUser = user;
|
||||
if (user != null) {
|
||||
header.setVisibility(View.VISIBLE);
|
||||
followingCount.setText(StringUtils.NUMBER_FORMAT.format(user.getFollowing()));
|
||||
followerCount.setText(StringUtils.NUMBER_FORMAT.format(user.getFollower()));
|
||||
screenname.setText(user.getScreenname());
|
||||
@ -488,11 +486,7 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
|
||||
profileImage.setImageDrawable(placeholder);
|
||||
}
|
||||
} else {
|
||||
profileImage.setImageResource(0);
|
||||
followingCount.setText("");
|
||||
followerCount.setText("");
|
||||
screenname.setText("");
|
||||
username.setText("");
|
||||
header.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/mainpage_toolbar_height"
|
||||
android:padding="@dimen/navigation_header_layout_padding"
|
||||
android:visibility="invisible"
|
||||
tools:ignore="UseCompatTextViewDrawableXml">
|
||||
|
||||
<ImageView
|
||||
|
@ -333,6 +333,7 @@
|
||||
android:id="@+id/spinner_font"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/settings_column_margin"
|
||||
app:layout_constraintStart_toStartOf="@+id/enable_status_hide_sensitive_descr"
|
||||
app:layout_constraintTop_toBottomOf="@id/enable_status_hide_sensitive"
|
||||
app:layout_constraintEnd_toStartOf="@id/spinner_scale"
|
||||
|
Loading…
Reference in New Issue
Block a user