diff options
author | Andrew Dolgov <[email protected]> | 2015-11-30 06:20:01 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2015-11-30 06:20:01 +0300 |
commit | ddb72b88ca42b734fa89cb0e32d1cd4f02e19044 (patch) | |
tree | a547f52cb80b0d7aab0c83a2d268ef95f2bae417 /org.fox.ttrss/src/main | |
parent | 6e2b220669c123e43ae59b2fb9d0ba278c42f8bc (diff) |
move settings to drawer header
Diffstat (limited to 'org.fox.ttrss/src/main')
-rwxr-xr-x | org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java | 33 | ||||
-rwxr-xr-x | org.fox.ttrss/src/main/res/layout/drawer_header.xml | 113 |
2 files changed, 60 insertions, 86 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java index 3aa16125..d70ee8c8 100755 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/BaseFeedlistFragment.java @@ -43,15 +43,15 @@ public abstract class BaseFeedlistFragment extends Fragment { server.setText(""); } - View account = view.findViewById(R.id.drawer_header_account); + View settings = view.findViewById(R.id.drawer_settings_btn); - account.setOnClickListener(new View.OnClickListener() { + settings.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { - Intent intent = new Intent(Intent.ACTION_VIEW, - Uri.parse(prefs.getString("ttrss_url", ""))); - startActivity(intent); + Intent intent = new Intent(getActivity(), + PreferencesActivity.class); + startActivityForResult(intent, 0); } catch (Exception e) { } @@ -128,29 +128,6 @@ public abstract class BaseFeedlistFragment extends Fragment { counter.setText(R.string.blank); } - // settings - footer = inflater.inflate(R.layout.feeds_row, list, false); - footer.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(activity, - PreferencesActivity.class); - startActivityForResult(intent, 0); - } - }); - - list.addFooterView(footer); - text = (TextView) footer.findViewById(R.id.title); - text.setText(R.string.preferences); - - icon = (ImageView) footer.findViewById(R.id.icon); - tv = new TypedValue(); - getActivity().getTheme().resolveAttribute(R.attr.ic_settings, tv, true); - icon.setImageResource(tv.resourceId); - - TextView counter = (TextView) footer.findViewById(R.id.unread_counter); - counter.setText(R.string.blank); - } catch (InflateException e) { // welp couldn't inflate header i guess e.printStackTrace(); diff --git a/org.fox.ttrss/src/main/res/layout/drawer_header.xml b/org.fox.ttrss/src/main/res/layout/drawer_header.xml index 472ca1ca..2160728d 100755 --- a/org.fox.ttrss/src/main/res/layout/drawer_header.xml +++ b/org.fox.ttrss/src/main/res/layout/drawer_header.xml @@ -1,75 +1,71 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="120dp" android:orientation="vertical" android:weightSum="1" android:clickable="false"> - - <ImageView - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:id="@+id/imageView" - android:scaleType="fitXY" - android:background="?colorPrimaryDark" - android:src="?drawer_header" /> - <FrameLayout - android:layout_width="48dp" - android:layout_height="48dp" - android:background="@drawable/circle_bg" - android:clickable="true" - android:layout_centerVertical="true" - android:layout_alignParentRight="true" - android:layout_alignParentEnd="true" - android:layout_marginRight="16dp" - android:elevation="8dp"> + android:layout_width="match_parent" + android:layout_height="match_parent"> <ImageView - android:id="@+id/drawer_header_account" - android:background="@drawable/ripple" - android:layout_width="36dp" - android:layout_height="36dp" - android:tint="?colorAccent" - android:src="@drawable/ic_account" - android:layout_gravity="center" /> - </FrameLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="56dp" - android:orientation="vertical" - android:layout_alignParentBottom="true" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:id="@+id/linearLayout"> + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:id="@+id/imageView" + android:scaleType="fitXY" + android:background="?colorPrimaryDark" + android:src="?drawer_header" /> - <TextView - android:id="@+id/drawer_header_login" + <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="16dp" - android:textColor="@android:color/primary_text_dark" - android:text="test" - android:textSize="14sp" - android:textStyle="bold" + android:src="@drawable/ic_settings" + android:id="@+id/drawer_settings_btn" + android:layout_gravity="bottom|right" + android:clickable="true" + android:focusable="true" + android:layout_marginBottom="16dp" + android:layout_marginRight="12dp" + android:background="?attr/selectableItemBackground" /> - /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="56dp" + android:orientation="vertical" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:id="@+id/linearLayout" + android:layout_gravity="center_horizontal|bottom"> - <TextView - android:id="@+id/drawer_header_server" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textColor="@android:color/primary_text_dark" - android:layout_marginLeft="16dp" - android:layout_marginTop="5dp" - android:text="example.org" - android:textSize="14sp" - android:textStyle="normal" + <TextView + android:id="@+id/drawer_header_login" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="16dp" + android:textColor="@android:color/primary_text_dark" + android:text="test" + android:textSize="14sp" + android:textStyle="bold" + + /> - /> - </LinearLayout> + <TextView + android:id="@+id/drawer_header_server" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="@android:color/primary_text_dark" + android:layout_marginLeft="16dp" + android:layout_marginTop="5dp" + android:text="example.org" + android:textSize="14sp" + android:textStyle="normal" + + /> + </LinearLayout> + </FrameLayout> <ProgressBar style="?android:attr/progressBarStyleHorizontal" @@ -79,5 +75,6 @@ android:layout_height="wrap_content" android:id="@+id/feeds_loading_bar" android:layout_alignParentLeft="true" - android:layout_alignParentBottom="true" /> -</RelativeLayout>
\ No newline at end of file + android:layout_alignParentBottom="true" + android:layout_gravity="bottom" /> +</FrameLayout>
\ No newline at end of file |