Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
version upgrade, bug fix, code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearfog committed Jan 4, 2024
1 parent 79a8ee4 commit b1f1ed2
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 36 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId 'org.nuclearfog.twidda'
minSdkVersion 21
targetSdkVersion 34
versionCode 105
versionName '3.5.2'
versionCode 106
versionName '3.5.3'
resConfigs 'en', 'es', 'de', 'zh-rCN'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public class UsersActivity extends AppCompatActivity implements OnTabSelectedLis
private UserFilterAction filterLoader;
private UserAdapter adapter;

private TabSelector tabSelector;
private ViewPager2 viewPager;

private int mode;
Expand All @@ -114,7 +113,7 @@ protected void onCreate(Bundle savedInst) {
ViewGroup root = findViewById(R.id.page_tab_view_root);
Toolbar toolbar = findViewById(R.id.page_tab_view_toolbar);
View fragmentContainer = findViewById(R.id.page_tab_view_fragment_container);
tabSelector = findViewById(R.id.page_tab_view_tabs);
TabSelector tabSelector = findViewById(R.id.page_tab_view_tabs);
viewPager = findViewById(R.id.page_tab_view_pager);

FragmentTransaction fragmentTransaction;
Expand Down Expand Up @@ -212,7 +211,7 @@ protected void onCreate(Bundle savedInst) {

@Override
public void onBackPressed() {
if (tabSelector.getVisibility() == View.VISIBLE && viewPager.getCurrentItem() > 0) {
if (viewPager.getVisibility() == View.VISIBLE && viewPager.getCurrentItem() > 0) {
viewPager.setCurrentItem(0);
} else {
super.onBackPressed();
Expand Down Expand Up @@ -262,29 +261,29 @@ public void onTabSelected() {

@Override
public boolean onQueryTextSubmit(String query) {
if (!filterLoader.isIdle())
return false;
if (viewPager.getCurrentItem() == 0) {
if (USERNAME_PATTERN.matcher(query).matches()) {
UserFilterAction.Param param = new UserFilterAction.Param(UserFilterAction.Param.MUTE_USER, query);
filterLoader.execute(param, this);
return true;
}
Toast.makeText(getApplicationContext(), R.string.error_username_format, Toast.LENGTH_SHORT).show();
} else if (viewPager.getCurrentItem() == 1) {
if (USERNAME_PATTERN.matcher(query).matches()) {
UserFilterAction.Param param = new UserFilterAction.Param(UserFilterAction.Param.BLOCK_USER, query);
filterLoader.execute(param, this);
return true;
}
Toast.makeText(getApplicationContext(), R.string.error_username_format, Toast.LENGTH_SHORT).show();
} else if (viewPager.getCurrentItem() == 2) {
if (Patterns.WEB_URL.matcher(query).matches()) {
UserFilterAction.Param param = new UserFilterAction.Param(UserFilterAction.Param.BLOCK_DOMAIN, Uri.parse(query).getHost());
filterLoader.execute(param, this);
return true;
if (filterLoader.isIdle()) {
if (viewPager.getCurrentItem() == 0) {
if (USERNAME_PATTERN.matcher(query).matches()) {
UserFilterAction.Param param = new UserFilterAction.Param(UserFilterAction.Param.MUTE_USER, query);
filterLoader.execute(param, this);
return true;
}
Toast.makeText(getApplicationContext(), R.string.error_username_format, Toast.LENGTH_SHORT).show();
} else if (viewPager.getCurrentItem() == 1) {
if (USERNAME_PATTERN.matcher(query).matches()) {
UserFilterAction.Param param = new UserFilterAction.Param(UserFilterAction.Param.BLOCK_USER, query);
filterLoader.execute(param, this);
return true;
}
Toast.makeText(getApplicationContext(), R.string.error_username_format, Toast.LENGTH_SHORT).show();
} else if (viewPager.getCurrentItem() == 2) {
if (Patterns.WEB_URL.matcher(query).matches()) {
UserFilterAction.Param param = new UserFilterAction.Param(UserFilterAction.Param.BLOCK_DOMAIN, Uri.parse(query).getHost());
filterLoader.execute(param, this);
return true;
}
Toast.makeText(getApplicationContext(), R.string.error_domain_format, Toast.LENGTH_SHORT).show();
}
Toast.makeText(getApplicationContext(), R.string.error_domain_format, Toast.LENGTH_SHORT).show();
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
confirm = new ConfirmDialog(requireActivity(), this);
timepicker = new TimePickerDialog(requireActivity(), this);
audioDialog = new AudioPlayerDialog(requireActivity());

setAdapter(adapter, false);

if (savedInstanceState != null) {
Object data = savedInstanceState.getSerializable(KEY_SAVE);
if (data instanceof ScheduledStatuses) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
search = args.getString(KEY_SEARCH, "");
mode = args.getInt(KEY_MODE, 0);
}
if (mode == MODE_FOLLOW || mode == MODE_FEATURE) {
adapter.enableDelete();
}
if (savedInstanceState != null) {
Object data = savedInstanceState.getSerializable(KEY_DATA);
if (data instanceof Tags) {
adapter.setItems((Tags) data);
}
}
if (mode == MODE_FOLLOW || mode == MODE_FEATURE) {
adapter.enableDelete();
}
}


Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout-land/page_editprofile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintDimensionRatio="3.0"
app:layout_constraintWidth_percent="0.5"/>
app:layout_constraintWidth_percent="0.5" />

<Button
android:id="@+id/profile_edit_add_banner"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_list.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/item_announcement.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down

0 comments on commit b1f1ed2

Please sign in to comment.