1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-23 04:41:16 +00:00

Added share device ID button to drawer, always show scrollbar.

This commit is contained in:
Felix Ableitner 2016-02-08 22:59:40 +01:00
parent 776a746740
commit 691ca26daa
7 changed files with 20 additions and 12 deletions

View file

@ -30,15 +30,10 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
RestApi.OnReceiveConnectionsListener, View.OnClickListener { RestApi.OnReceiveConnectionsListener, View.OnClickListener {
private TextView mDeviceId; private TextView mDeviceId;
private TextView mCpuUsage; private TextView mCpuUsage;
private TextView mRamUsage; private TextView mRamUsage;
private TextView mDownload; private TextView mDownload;
private TextView mUpload; private TextView mUpload;
private TextView mAnnounceServer; private TextView mAnnounceServer;
private TextView mExitButton; private TextView mExitButton;
@ -95,10 +90,10 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
mAnnounceServer = (TextView) view.findViewById(R.id.announce_server); mAnnounceServer = (TextView) view.findViewById(R.id.announce_server);
mExitButton = (TextView) view.findViewById(R.id.drawerActionExit); mExitButton = (TextView) view.findViewById(R.id.drawerActionExit);
view.findViewById(R.id.deviceIdContainer)
.setOnClickListener(this);
view.findViewById(R.id.drawerActionWebGui) view.findViewById(R.id.drawerActionWebGui)
.setOnClickListener(this); .setOnClickListener(this);
view.findViewById(R.id.drawerActionShareId)
.setOnClickListener(this);
view.findViewById(R.id.drawerActionDonate) view.findViewById(R.id.drawerActionDonate)
.setOnClickListener(this); .setOnClickListener(this);
view.findViewById(R.id.drawerActionRestart) view.findViewById(R.id.drawerActionRestart)
@ -190,13 +185,17 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
@Override @Override
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()) { switch (v.getId()) {
case R.id.deviceIdContainer:
RestApi.shareDeviceId(getActivity(), mDeviceId.getText().toString());
break;
case R.id.drawerActionWebGui: case R.id.drawerActionWebGui:
startActivity(new Intent(mActivity, WebGuiActivity.class)); startActivity(new Intent(mActivity, WebGuiActivity.class));
mActivity.closeDrawer(); mActivity.closeDrawer();
break; break;
case R.id.drawerActionShareId:
Intent i = new Intent(android.content.Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(android.content.Intent.EXTRA_TEXT, mDeviceId.getText());
startActivity(Intent.createChooser(i, "Share device ID with"));
mActivity.closeDrawer();
break;
case R.id.drawerActionDonate: case R.id.drawerActionDonate:
startActivity(new Intent(ACTION_VIEW, Uri.parse( startActivity(new Intent(ACTION_VIEW, Uri.parse(
getString(R.string.donate_url)))); getString(R.string.donate_url))));

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -30,7 +30,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_above="@+id/bottomActions" android:layout_above="@+id/bottomActions"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:fillViewport="true"> android:fillViewport="true"
android:fadeScrollbars="false">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -38,7 +39,6 @@
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:id="@+id/deviceIdContainer"
style="@style/Widget.Syncthing.TextView.Label" style="@style/Widget.Syncthing.TextView.Label"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -207,6 +207,15 @@
android:drawableStart="@drawable/ic_web_black_24dp" android:drawableStart="@drawable/ic_web_black_24dp"
android:text="@string/web_gui_title" /> android:text="@string/web_gui_title" />
<TextView
android:id="@+id/drawerActionShareId"
style="@style/Widget.Syncthing.TextView.Label"
android:layout_width="match_parent"
android:layout_height="48dp"
android:drawableLeft="@drawable/ic_share_black_24dp"
android:drawableStart="@drawable/ic_share_black_24dp"
android:text="@string/share_device_id" />
<TextView <TextView
android:id="@+id/drawerActionDonate" android:id="@+id/drawerActionDonate"
style="@style/Widget.Syncthing.TextView.Label" style="@style/Widget.Syncthing.TextView.Label"