1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-10 20:15:54 +00:00

Merge pull request #439 from veniosg/master

Various visual fixes and resource refactoring
This commit is contained in:
Felix Ableitner 2015-08-06 18:26:07 +07:00
commit 8812611b64
27 changed files with 206 additions and 121 deletions

View file

@ -15,7 +15,7 @@
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:banner="@drawable/banner" android:banner="@drawable/banner"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/AppTheme" android:theme="@style/Theme.Syncthing"
android:description="@string/app_description" android:description="@string/app_description"
android:supportsRtl="true" android:supportsRtl="true"
android:installLocation="internalOnly"> android:installLocation="internalOnly">
@ -67,7 +67,7 @@
android:value="splitActionBarWhenNarrow" /> android:value="splitActionBarWhenNarrow" />
</activity> </activity>
<activity android:name=".activities.RestartActivity" <activity android:name=".activities.RestartActivity"
android:theme="@style/Translucent"/> android:theme="@style/Theme.Syncthing.Translucent"/>
<service android:name=".syncthing.SyncthingService" /> <service android:name=".syncthing.SyncthingService" />

View file

@ -63,7 +63,7 @@ public class FolderPickerActivity extends SyncthingActivity
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setContentView(R.layout.folder_picker_activity); setContentView(R.layout.activity_folder_picker);
mListView = (ListView) findViewById(android.R.id.list); mListView = (ListView) findViewById(android.R.id.list);
mListView.setOnItemClickListener(this); mListView.setOnItemClickListener(this);
mListView.setEmptyView(findViewById(android.R.id.empty)); mListView.setEmptyView(findViewById(android.R.id.empty));

View file

@ -9,7 +9,6 @@ import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.widget.EditText;
import android.support.v4.view.MenuItemCompat; import android.support.v4.view.MenuItemCompat;
import android.widget.ScrollView; import android.widget.ScrollView;
@ -18,7 +17,6 @@ import android.widget.TextView;
import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.R;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@ -42,7 +40,7 @@ public class LogActivity extends SyncthingActivity {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.log_activity); setContentView(R.layout.activity_log);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (savedInstanceState != null) { if (savedInstanceState != null) {

View file

@ -82,7 +82,7 @@ public class MainActivity extends SyncthingActivity
mDisabledDialog = SyncthingService.showDisabledDialog(MainActivity.this); mDisabledDialog = SyncthingService.showDisabledDialog(MainActivity.this);
} else if (mLoadingDialog == null) { } else if (mLoadingDialog == null) {
LayoutInflater inflater = getLayoutInflater(); LayoutInflater inflater = getLayoutInflater();
View dialogLayout = inflater.inflate(R.layout.loading_dialog, null); View dialogLayout = inflater.inflate(R.layout.dialog_loading, null);
TextView loadingText = (TextView) dialogLayout.findViewById(R.id.loading_text); TextView loadingText = (TextView) dialogLayout.findViewById(R.id.loading_text);
loadingText.setText((getService().isFirstStart()) loadingText.setText((getService().isFirstStart())
? R.string.web_gui_creating_key ? R.string.web_gui_creating_key
@ -194,7 +194,7 @@ public class MainActivity extends SyncthingActivity
final ActionBar actionBar = getSupportActionBar(); final ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
setContentView(R.layout.main_activity); setContentView(R.layout.activity_main);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager = (ViewPager) findViewById(R.id.pager);
@ -375,7 +375,7 @@ public class MainActivity extends SyncthingActivity
@Override @Override
public void onReceiveUsageReport(String report) { public void onReceiveUsageReport(String report) {
View v = LayoutInflater.from(MainActivity.this) View v = LayoutInflater.from(MainActivity.this)
.inflate(R.layout.usage_reporting_dialog, null); .inflate(R.layout.dialog_usage_reporting, null);
TextView tv = (TextView) v.findViewById(R.id.example); TextView tv = (TextView) v.findViewById(R.id.example);
tv.setText(report); tv.setText(report);
new AlertDialog.Builder(MainActivity.this) new AlertDialog.Builder(MainActivity.this)

View file

@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.activities;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.ComponentName; import android.content.ComponentName;
import android.graphics.Bitmap;
import android.net.http.SslCertificate; import android.net.http.SslCertificate;
import android.net.http.SslError; import android.net.http.SslError;
import android.os.Build; import android.os.Build;
@ -17,7 +16,6 @@ import android.webkit.WebViewClient;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.syncthing.RestApi;
import com.nutomic.syncthingandroid.syncthing.SyncthingService; import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -32,8 +30,6 @@ import java.security.SignatureException;
import java.security.cert.CertificateException; import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory; import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
/** /**
* Holds a WebView that shows the web ui of the local syncthing instance. * Holds a WebView that shows the web ui of the local syncthing instance.
@ -108,7 +104,7 @@ public class WebGuiActivity extends SyncthingActivity
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.web_gui_activity); setContentView(R.layout.activity_web_gui);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mLoadingView = findViewById(R.id.loading); mLoadingView = findViewById(R.id.loading);

View file

@ -68,7 +68,7 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) getContext() LayoutInflater inflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.menu_item, parent, false); convertView = inflater.inflate(R.layout.item_menu, parent, false);
} }
ImageView icon = (ImageView) convertView.findViewById(R.id.icon); ImageView icon = (ImageView) convertView.findViewById(R.id.icon);
@ -114,7 +114,7 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
*/ */
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.drawer_fragment, container, false); View view = inflater.inflate(R.layout.fragment_drawer, container, false);
mDeviceId = (TextView) view.findViewById(R.id.device_id); mDeviceId = (TextView) view.findViewById(R.id.device_id);
mCpuUsage = (TextView) view.findViewById(R.id.cpu_usage); mCpuUsage = (TextView) view.findViewById(R.id.cpu_usage);
mRamUsage = (TextView) view.findViewById(R.id.ram_usage); mRamUsage = (TextView) view.findViewById(R.id.ram_usage);

View file

@ -13,6 +13,7 @@ import android.widget.AdapterView;
import com.nutomic.syncthingandroid.R; import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.activities.MainActivity; import com.nutomic.syncthingandroid.activities.MainActivity;
import com.nutomic.syncthingandroid.activities.SettingsActivity; import com.nutomic.syncthingandroid.activities.SettingsActivity;
import com.nutomic.syncthingandroid.activities.SyncthingActivity;
import com.nutomic.syncthingandroid.syncthing.SyncthingService; import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import com.nutomic.syncthingandroid.util.FoldersAdapter; import com.nutomic.syncthingandroid.util.FoldersAdapter;
@ -43,6 +44,15 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
initAdapter(); initAdapter();
} }
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setEmptyText(getString(R.string.folder_list_empty));
getListView().setOnItemClickListener(this);
getListView().setOnItemLongClickListener(this);
}
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState); super.onActivityCreated(savedInstanceState);
@ -52,16 +62,13 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
} }
private void initAdapter() { private void initAdapter() {
MainActivity activity = (MainActivity) getActivity(); SyncthingActivity activity = (SyncthingActivity) getActivity();
if (activity == null || activity.getApi() == null) if (activity == null || activity.getApi() == null)
return; return;
mAdapter = new FoldersAdapter(activity); mAdapter = new FoldersAdapter(activity);
mAdapter.add(activity.getApi().getFolders()); mAdapter.add(activity.getApi().getFolders());
setListAdapter(mAdapter); setListAdapter(mAdapter);
setEmptyText(getString(R.string.folder_list_empty));
getListView().setOnItemClickListener(this);
getListView().setOnItemLongClickListener(this);
} }
private void updateList() { private void updateList() {

View file

@ -34,7 +34,7 @@ public class DevicesAdapter extends ArrayAdapter<RestApi.Device>
}; };
public DevicesAdapter(Context context) { public DevicesAdapter(Context context) {
super(context, R.layout.device_list_item); super(context, R.layout.item_device_list);
} }
@Override @Override
@ -42,7 +42,7 @@ public class DevicesAdapter extends ArrayAdapter<RestApi.Device>
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) getContext() LayoutInflater inflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE); .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.device_list_item, parent, false); convertView = inflater.inflate(R.layout.item_device_list, parent, false);
} }
TextView name = (TextView) convertView.findViewById(R.id.name); TextView name = (TextView) convertView.findViewById(R.id.name);

View file

@ -1,6 +1,7 @@
package com.nutomic.syncthingandroid.util; package com.nutomic.syncthingandroid.util;
import android.content.Context; import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -15,6 +16,10 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static com.nutomic.syncthingandroid.syncthing.RestApi.readableFileSize;
/** /**
* Generates item views for folder items. * Generates item views for folder items.
*/ */
@ -22,6 +27,7 @@ public class FoldersAdapter extends ArrayAdapter<RestApi.Folder>
implements RestApi.OnReceiveModelListener { implements RestApi.OnReceiveModelListener {
private HashMap<String, RestApi.Model> mModels = new HashMap<>(); private HashMap<String, RestApi.Model> mModels = new HashMap<>();
private LayoutInflater mInflater;
private final static Comparator<RestApi.Folder> COMPARATOR = new Comparator<RestApi.Folder>() { private final static Comparator<RestApi.Folder> COMPARATOR = new Comparator<RestApi.Folder>() {
@Override @Override
@ -31,47 +37,54 @@ public class FoldersAdapter extends ArrayAdapter<RestApi.Folder>
}; };
public FoldersAdapter(Context context) { public FoldersAdapter(Context context) {
super(context, R.layout.folder_list_item); super(context, R.layout.item_folder_list);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
} }
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) getContext() convertView = mInflater.inflate(R.layout.item_folder_list, parent, false);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.folder_list_item, parent, false);
}
TextView id = (TextView) convertView.findViewById(R.id.id); viewHolder = new ViewHolder();
TextView state = (TextView) convertView.findViewById(R.id.state); viewHolder.id = (TextView) convertView.findViewById(R.id.id);
TextView directory = (TextView) convertView.findViewById(R.id.directory); viewHolder.state = (TextView) convertView.findViewById(R.id.state);
TextView items = (TextView) convertView.findViewById(R.id.items); viewHolder.directory = (TextView) convertView.findViewById(R.id.directory);
TextView size = (TextView) convertView.findViewById(R.id.size); viewHolder.items = (TextView) convertView.findViewById(R.id.items);
TextView invalid = (TextView) convertView.findViewById(R.id.invalid); viewHolder.size = (TextView) convertView.findViewById(R.id.size);
viewHolder.invalid = (TextView) convertView.findViewById(R.id.invalid);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
RestApi.Folder folder = getItem(position); RestApi.Folder folder = getItem(position);
RestApi.Model model = mModels.get(folder.id); RestApi.Model model = mModels.get(folder.id);
id.setText(folder.id); viewHolder.id.setText(folder.id);
state.setTextColor(getContext().getResources().getColor(R.color.text_green)); viewHolder.state.setTextColor(getContext().getResources().getColor(R.color.text_green));
directory.setText((folder.path)); viewHolder.directory.setText((folder.path));
if (model != null) { if (model != null) {
int percentage = (model.globalBytes != 0) int percentage = (model.globalBytes != 0)
? (int) Math.floor(100 * model.inSyncBytes / model.globalBytes) ? (int) Math.floor(100 * model.inSyncBytes / model.globalBytes)
: 100; : 100;
state.setText(getContext().getString(R.string.folder_progress_format, viewHolder.state.setText(getContext().getString(R.string.folder_progress_format,
RestApi.getLocalizedState(getContext(), model.state), RestApi.getLocalizedState(getContext(), model.state),
percentage)); percentage));
items.setText(getContext() viewHolder.items.setVisibility(VISIBLE);
viewHolder.items.setText(getContext()
.getString(R.string.files, model.inSyncFiles, model.globalFiles)); .getString(R.string.files, model.inSyncFiles, model.globalFiles));
size.setText(RestApi.readableFileSize(getContext(), model.inSyncBytes) + " / " + viewHolder.size.setVisibility(VISIBLE);
RestApi.readableFileSize(getContext(), model.globalBytes)); viewHolder.size.setText(readableFileSize(getContext(), model.inSyncBytes) + " / " +
if (folder.invalid.equals("")) { readableFileSize(getContext(), model.globalBytes));
invalid.setText(model.invalid); if (TextUtils.isEmpty(folder.invalid)) {
invalid.setVisibility((model.invalid.equals("")) ? View.GONE : View.VISIBLE); setTextOrHide(viewHolder.invalid, model.invalid);
} }
} else { } else {
invalid.setText(folder.invalid); viewHolder.items.setVisibility(GONE);
invalid.setVisibility((folder.invalid.equals("")) ? View.GONE : View.VISIBLE); viewHolder.size.setVisibility(GONE);
setTextOrHide(viewHolder.invalid, folder.invalid);
} }
return convertView; return convertView;
@ -113,4 +126,22 @@ public class FoldersAdapter extends ArrayAdapter<RestApi.Folder>
notifyDataSetChanged(); notifyDataSetChanged();
} }
private void setTextOrHide(TextView view, String text) {
boolean isEmpty = TextUtils.isEmpty(text);
if (isEmpty) {
view.setVisibility(GONE);
} else {
view.setText(text);
view.setVisibility(VISIBLE);
}
}
private static class ViewHolder {
TextView id;
TextView state;
TextView directory;
TextView items;
TextView size;
TextView invalid;
}
} }

View file

@ -1,63 +1,66 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dip"> android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp">
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/status" android:layout_toLeftOf="@+id/status"
android:layout_toStartOf="@+id/status" android:layout_toStartOf="@+id/status"
android:ellipsize="end"
android:lines="1" android:lines="1"
android:ellipsize="end" /> android:textAppearance="?textAppearanceListItemPrimary" />
<TextView <TextView
android:id="@+id/status" android:id="@+id/status"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignBottom="@+id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" /> android:layout_alignBottom="@+id/name"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:textAppearance="?textAppearanceListItemSmall" />
<TextView <TextView
android:id="@+id/download_title" android:id="@+id/download_title"
android:text="@string/download_title_colon"
android:layout_below="@id/name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:layout_below="@id/name"
android:text="@string/download_title_colon"
android:textAppearance="?textAppearanceListItemSecondary" />
<TextView <TextView
android:id="@+id/download" android:id="@+id/download"
android:layout_alignBaseline="@id/download_title"
android:layout_toRightOf="@id/download_title"
android:layout_toEndOf="@id/download_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:layout_alignBaseline="@id/download_title"
android:layout_toEndOf="@id/download_title"
android:layout_toRightOf="@id/download_title"
android:textAppearance="?textAppearanceListItemSecondary" />
<TextView <TextView
android:id="@+id/upload_title" android:id="@+id/upload_title"
android:text="@string/upload_title_colon"
android:layout_below="@id/download_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:layout_below="@id/download_title"
android:text="@string/upload_title_colon"
android:textAppearance="?textAppearanceListItemSecondary" />
<TextView <TextView
android:id="@+id/upload" android:id="@+id/upload"
android:layout_alignBaseline="@id/upload_title"
android:layout_toRightOf="@id/upload_title"
android:layout_toEndOf="@id/upload_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:layout_alignBaseline="@id/upload_title"
android:layout_toEndOf="@id/upload_title"
android:layout_toRightOf="@id/upload_title"
android:textAppearance="?textAppearanceListItemSecondary" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,58 +1,62 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dip"> android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp">
<TextView <TextView
android:id="@+id/id" android:id="@+id/id"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/state" android:layout_toLeftOf="@+id/state"
android:layout_toStartOf="@+id/state" android:layout_toStartOf="@+id/state"
android:lines="1" android:ellipsize="end"
android:ellipsize="end" /> android:maxLines="1"
android:textAppearance="?textAppearanceListItemPrimary" />
<TextView <TextView
android:id="@+id/state" android:id="@+id/state"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignBottom="@+id/id"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_alignBottom="@id/id"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:textAppearance="?textAppearanceListItemSmall" />
<TextView <TextView
android:id="@+id/directory" android:id="@+id/directory"
android:layout_below="@id/state"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:ellipsize="end" /> android:layout_below="@id/state"
android:ellipsize="end"
android:textAppearance="?textAppearanceListItemSecondary" />
<TextView <TextView
android:id="@+id/items" android:id="@+id/items"
android:layout_below="@id/directory"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_below="@id/directory"
android:textAppearance="?textAppearanceListItemSecondary" />
<TextView <TextView
android:id="@+id/size" android:id="@+id/size"
android:layout_below="@id/items"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_below="@id/items"
android:textAppearance="?textAppearanceListItemSecondary" />
<TextView <TextView
android:id="@+id/invalid" android:id="@+id/invalid"
android:textColor="@color/text_red"
android:layout_below="@id/size"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:layout_below="@id/size"
android:textAppearance="?textAppearanceListItemSecondary"
android:textColor="@color/text_red" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- DialogTheme produces weird background on 4.4, so we only use it on Lollipop for now. -->
<style name="AppTheme" parent="BaseTheme">
<item name="android:alertDialogTheme">@style/DialogTheme</item>
</style>
<style name="DialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
</style>
</resources>

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- DialogTheme produces weird background on 4.4, so we only use it on Lollipop for now. -->
<style name="Theme.Syncthing" parent="Theme.Syncthing.Base">
<item name="android:alertDialogTheme">@style/Theme.Syncthing.Dialog</item>
</style>
</resources>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="textAppearanceListItemPrimary" format="reference"/>
<attr name="textAppearanceListItemSecondary" format="reference"/>
</resources>

View file

@ -3,9 +3,7 @@
<color name="primary">#03A9F4</color> <color name="primary">#03A9F4</color>
<color name="primary_dark">#0288D1</color> <color name="primary_dark">#0288D1</color>
<color name="primary_light">#B3E5FC</color> <color name="primary_light">#B3E5FC</color>
<color name="accent">#4CAF50</color> <color name="accent">#FF9100</color>
<color name="primary_text">#212121</color>
<color name="secondary_text">#727272</color>
<color name="icons">#FFFFFF</color> <color name="icons">#FFFFFF</color>
<color name="divider">#B6B6B6</color> <color name="divider">#B6B6B6</color>

View file

@ -1,22 +1,27 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="BaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <!-- Widget styles -->
<item name="colorPrimary">@color/primary</item> <eat-comment />
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item> <style name="Widget.Syncthing.ListView" parent="Widget.AppCompat.ListView">
<item name="android:textColorPrimary">@color/primary_text</item> <item name="android:paddingTop">8dp</item>
<item name="android:textColorSecondary">@color/secondary_text</item> <item name="android:paddingBottom">8dp</item>
<item name="android:clipToPadding">false</item>
<item name="android:scrollbarStyle">outsideOverlay</item>
<item name="android:divider">@android:color/transparent</item>
</style> </style>
<style name="AppTheme" parent="BaseTheme"/> <!-- Text appearances -->
<eat-comment />
<style name="Translucent" parent="AppTheme"> <style name="TextAppearance.Syncthing.ListItemPrimary" parent="TextAppearance.AppCompat.Subhead">
<item name="android:windowNoTitle">true</item> <item name="android:textColor">?android:textColorPrimary</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
</style> </style>
<style name="TextAppearance.Syncthing.ListItemSecondary" parent="TextAppearance.AppCompat.Body1">
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="TextAppearance.Syncthing.ListItemSmall" parent="TextAppearance.AppCompat.Caption" />
</resources> </resources>

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Activity themes -->
<eat-comment/>
<style name="Theme.Syncthing.Base" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="actionBarTheme">@style/ThemeOverlay.Syncthing.ActionBar</item>
<item name="textAppearanceListItemPrimary">@style/TextAppearance.Syncthing.ListItemPrimary</item>
<item name="textAppearanceListItemSecondary">@style/TextAppearance.Syncthing.ListItemSecondary</item>
<item name="textAppearanceListItemSmall">@style/TextAppearance.Syncthing.ListItemSmall</item>
<item name="android:listViewStyle">@style/Widget.Syncthing.ListView</item>
</style>
<style name="Theme.Syncthing" parent="Theme.Syncthing.Base"/>
<style name="Theme.Syncthing.Translucent">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowAnimationStyle">@android:style/Animation</item>
</style>
<!-- Dialog themes -->
<eat-comment/>
<style name="Theme.Syncthing.Dialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
</style>
<!-- ActionBar themes -->
<eat-comment/>
<style name="ThemeOverlay.Syncthing.ActionBar" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="colorAccent">@android:color/white</item>
</style>
</resources>

View file

@ -5,7 +5,7 @@
android:persistent="false" android:persistent="false"
android:key="device_id" android:key="device_id"
android:title="@string/device_id" android:title="@string/device_id"
android:widgetLayout="@layout/scan_qr_code_widget" /> android:widgetLayout="@layout/pref_widget_scan_qr_code" />
<EditTextPreference <EditTextPreference
android:persistent="false" android:persistent="false"