This commit is contained in:
nuclearfog 2023-10-07 14:46:57 +02:00
parent 7fab4fe6d3
commit 82621a7c46
No known key found for this signature in database
GPG Key ID: 03488A185C476379
7 changed files with 50 additions and 17 deletions

View File

@ -433,6 +433,7 @@ public class MainActivity extends AppCompatActivity implements ActivityResultCal
@Override
public void onTabSelected() {
invalidateOptionsMenu();
if (adapter != null) {
adapter.scrollToTop();
}

View File

@ -1,6 +1,9 @@
package org.nuclearfog.twidda.ui.activities;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
@ -10,6 +13,7 @@ import androidx.fragment.app.FragmentTransaction;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.utils.AppStyles;
import org.nuclearfog.twidda.config.GlobalSettings;
import org.nuclearfog.twidda.ui.fragments.ScheduleFragment;
/**
@ -17,7 +21,7 @@ import org.nuclearfog.twidda.ui.fragments.ScheduleFragment;
*
* @author nuclearfog
*/
public class ScheduleActivity extends AppCompatActivity {
public class ScheduleActivity extends AppCompatActivity implements OnClickListener {
@Override
@ -25,14 +29,30 @@ public class ScheduleActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.page_fragment);
ViewGroup root = findViewById(R.id.page_fragment_root);
View floatingButton = findViewById(R.id.page_fragment_floating_button);
Toolbar toolbar = findViewById(R.id.page_fragment_toolbar);
GlobalSettings settings = GlobalSettings.get(this);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.page_fragment_container, ScheduleFragment.class, null);
fragmentTransaction.commit();
if (settings.floatingButtonEnabled()) {
floatingButton.setVisibility(View.VISIBLE);
}
toolbar.setTitle(R.string.toolbar_schedule_title);
setSupportActionBar(toolbar);
AppStyles.setTheme(root);
floatingButton.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v.getId() == R.id.page_tab_view_post_button) {
Intent intent = new Intent(this, StatusEditor.class);
startActivity(intent);
}
}
}

View File

@ -101,11 +101,10 @@ public class SearchActivity extends AppCompatActivity implements OnClickListener
hashtagAction.execute(param, this);
}
}
adapter.setSearch(search);
if (!settings.floatingButtonEnabled()) {
floatingButton.setVisibility(View.INVISIBLE);
if (settings.floatingButtonEnabled()) {
floatingButton.setVisibility(View.VISIBLE);
}
adapter.setSearch(search);
toolbar.setTitle("");
setSupportActionBar(toolbar);
viewPager.setOffscreenPageLimit(3);

View File

@ -9,12 +9,28 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/page_fragment_toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/dmpage_toolbar_height" />
android:layout_height="@dimen/page_fragment_toolbar_height" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/page_fragment_container"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
android:layout_weight="1">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/page_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/page_fragment_floating_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/floating_button_margin"
android:src="@drawable/post"
android:visibility="gone"
android:layout_gravity="bottom|end"
android:contentDescription="@string/menu_status" />
</FrameLayout>
</LinearLayout>

View File

@ -261,7 +261,7 @@
android:layout_gravity="end|bottom"
android:src="@drawable/post"
android:contentDescription="@string/menu_status"
android:layout_margin="@dimen/profile_floating_button_margin"
android:layout_margin="@dimen/floating_button_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />

View File

@ -36,7 +36,7 @@
android:id="@+id/page_tab_view_post_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/page_tab_view_floating_button_margin"
android:layout_margin="@dimen/floating_button_margin"
android:visibility="gone"
android:src="@drawable/post"
android:contentDescription="@string/menu_status"

View File

@ -7,6 +7,7 @@
<dimen name="edittext_background_padding">5dp</dimen>
<dimen name="edittext_textsize">16sp</dimen>
<dimen name="edittext_margin">2dp</dimen>
<dimen name="floating_button_margin">20dp</dimen>
<!--dimens of page_settings.xml-->
<dimen name="settings_toolbar_height">@dimen/toolbar_height</dimen>
@ -58,7 +59,6 @@
<dimen name="profile_textsize_small">12sp</dimen>
<dimen name="profile_icon_size">14sp</dimen>
<dimen name="profile_tabselector_height">52sp</dimen>
<dimen name="profile_floating_button_margin">20dp</dimen>
<integer name="profile_text_bio_lines">6</integer>
<!--dimens of page_editprofile.xml-->
@ -175,15 +175,12 @@
<dimen name="item_placeholder_margin">10dp</dimen>
<dimen name="item_placeholder_button_textsize">16sp</dimen>
<!--dimens of page_tab_view-->
<dimen name="page_tab_view_floating_button_margin">20dp</dimen>
<!--dimens of page_main.xml-->
<dimen name="mainpage_toolbar_height">@dimen/toolbar_height</dimen>
<dimen name="mainpage_navigation_padding_item">20dp</dimen>
<!--dimens of page_list.xml-->
<dimen name="dmpage_toolbar_height">@dimen/toolbar_height</dimen>
<!--dimens of page_fragment.xml-->
<dimen name="page_fragment_toolbar_height">@dimen/toolbar_height</dimen>
<!--dimens of dialog_app_info.xml-->
<dimen name="infopopup_text_padding">5dp</dimen>