Skip to content

Commit 46376ae

Browse files
committed
empty drawer header, move settings to root categories list as a footer
1 parent 0fd1479 commit 46376ae

File tree

3 files changed

+5
-69
lines changed

3 files changed

+5
-69
lines changed

org.fox.ttrss/src/main/java/org/fox/ttrss/FeedsFragment.java

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -184,33 +184,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
184184
m_adapter = new FeedsAdapter();
185185
m_list.setAdapter(m_adapter);
186186

187-
TextView login = view.findViewById(R.id.drawer_header_login);
188-
189-
if (login != null) {
190-
login.setText(m_prefs.getString("login", ""));
191-
}
192-
193-
TextView server = view.findViewById(R.id.drawer_header_server);
194-
195-
if (server != null) {
196-
try {
197-
server.setText(new URL(m_prefs.getString("ttrss_url", "")).getHost());
198-
} catch (MalformedURLException e) {
199-
server.setText("");
200-
}
201-
}
202-
203-
View settingsBtn = view.findViewById(R.id.drawer_settings_btn);
204-
205-
if (settingsBtn != null) {
206-
settingsBtn.setOnClickListener(v -> {
207-
Intent intent = new Intent(getActivity(),
208-
PreferencesActivity.class);
209-
210-
startActivityForResult(intent, 0);
211-
});
212-
}
213-
214187
FeedsModel model = getModel();
215188

216189
model.getUpdatesData().observe(m_activity, lastUpdate -> {
@@ -291,6 +264,7 @@ protected void onFeedsLoaded(List<Feed> loadedFeeds) {
291264

292265
feedsWork.add(new Feed(Feed.TYPE_DIVIDER));
293266
feedsWork.add(new Feed(Feed.TYPE_TOGGLE_UNREAD, getString(R.string.unread_only), true));
267+
feedsWork.add(new Feed(Feed.TYPE_SETTINGS, getString(R.string.preferences), true));
294268

295269
m_adapter.submitList(feedsWork);
296270
}
@@ -508,6 +482,8 @@ private boolean neverOpenHeadlines(Feed feed) {
508482
protected int getIconForFeed(Feed feed) {
509483
if (feed.id == Feed.TYPE_GOBACK) {
510484
return R.drawable.baseline_arrow_back_24;
485+
} else if (feed.id == Feed.TYPE_SETTINGS) {
486+
return R.drawable.baseline_settings_24;
511487
} else if (feed.id == Feed.CAT_LABELS && feed.is_cat) {
512488
return R.drawable.baseline_label_24;
513489
} else if (feed.id == Feed.CAT_SPECIAL && feed.is_cat) {

org.fox.ttrss/src/main/java/org/fox/ttrss/types/Feed.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class Feed implements Comparable<Feed>, Parcelable {
1111
public static final int TYPE_GOBACK = -10001;
1212
public static final int TYPE_DIVIDER = -10002;
1313
public static final int TYPE_TOGGLE_UNREAD = -10003;
14+
public static final int TYPE_SETTINGS = -10004;
1415

1516
public String feed_url;
1617
public String title;

org.fox.ttrss/src/main/res/layout/fragment_feeds.xml

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,13 @@
1010
<com.google.android.material.appbar.AppBarLayout
1111
android:background="@null"
1212
android:layout_width="match_parent"
13-
android:layout_height="wrap_content">
13+
android:layout_height="8dp">
1414

1515
<FrameLayout
1616
app:layout_scrollFlags="scroll|enterAlways"
1717
android:layout_width="match_parent"
1818
android:layout_height="wrap_content">
1919

20-
<com.google.android.material.button.MaterialButton
21-
style="?attr/materialIconButtonStyle"
22-
android:layout_width="wrap_content"
23-
android:layout_height="wrap_content"
24-
android:scaleX="1.5"
25-
android:scaleY="1.5"
26-
app:icon="@drawable/baseline_settings_24"
27-
android:id="@+id/drawer_settings_btn"
28-
android:layout_gravity="center_vertical|end" />
29-
30-
<LinearLayout
31-
android:layout_width="match_parent"
32-
android:layout_height="wrap_content"
33-
android:orientation="vertical"
34-
android:layout_alignParentBottom="true"
35-
android:layout_alignParentLeft="true"
36-
android:layout_alignParentStart="true"
37-
android:id="@+id/linearLayout"
38-
android:layout_gravity="center_horizontal|bottom">
39-
40-
<TextView
41-
android:id="@+id/drawer_header_login"
42-
android:layout_width="wrap_content"
43-
android:layout_height="wrap_content"
44-
android:layout_marginStart="16dp"
45-
tools:text="user"
46-
android:textAppearance="?attr/textAppearanceHeadlineSmall"
47-
android:textColor="?attr/colorOnSurface"/>
48-
49-
<TextView
50-
android:id="@+id/drawer_header_server"
51-
android:layout_width="wrap_content"
52-
android:layout_height="wrap_content"
53-
android:layout_marginStart="16dp"
54-
android:layout_marginTop="8dp"
55-
android:layout_marginBottom="8dp"
56-
tools:text="example.org"
57-
android:textAppearance="?attr/textAppearanceTitleSmall"
58-
android:textColor="?attr/colorOnSurfaceVariant"/>
59-
</LinearLayout>
60-
6120
<com.google.android.material.progressindicator.LinearProgressIndicator
6221
android:id="@+id/loading_progress"
6322
android:max="100"

0 commit comments

Comments
 (0)