mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-10 12:05:53 +00:00
Merge pull request #439 from veniosg/master
Various visual fixes and resource refactoring
This commit is contained in:
commit
8812611b64
27 changed files with 206 additions and 121 deletions
|
@ -15,7 +15,7 @@
|
|||
android:icon="@drawable/ic_launcher"
|
||||
android:banner="@drawable/banner"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme"
|
||||
android:theme="@style/Theme.Syncthing"
|
||||
android:description="@string/app_description"
|
||||
android:supportsRtl="true"
|
||||
android:installLocation="internalOnly">
|
||||
|
@ -67,7 +67,7 @@
|
|||
android:value="splitActionBarWhenNarrow" />
|
||||
</activity>
|
||||
<activity android:name=".activities.RestartActivity"
|
||||
android:theme="@style/Translucent"/>
|
||||
android:theme="@style/Theme.Syncthing.Translucent"/>
|
||||
|
||||
<service android:name=".syncthing.SyncthingService" />
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class FolderPickerActivity extends SyncthingActivity
|
|||
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
setContentView(R.layout.folder_picker_activity);
|
||||
setContentView(R.layout.activity_folder_picker);
|
||||
mListView = (ListView) findViewById(android.R.id.list);
|
||||
mListView.setOnItemClickListener(this);
|
||||
mListView.setEmptyView(findViewById(android.R.id.empty));
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.util.Log;
|
|||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.EditText;
|
||||
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.widget.ScrollView;
|
||||
|
@ -18,7 +17,6 @@ import android.widget.TextView;
|
|||
import com.nutomic.syncthingandroid.R;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
|
@ -42,7 +40,7 @@ public class LogActivity extends SyncthingActivity {
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.log_activity);
|
||||
setContentView(R.layout.activity_log);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
|
|
|
@ -82,7 +82,7 @@ public class MainActivity extends SyncthingActivity
|
|||
mDisabledDialog = SyncthingService.showDisabledDialog(MainActivity.this);
|
||||
} else if (mLoadingDialog == null) {
|
||||
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);
|
||||
loadingText.setText((getService().isFirstStart())
|
||||
? R.string.web_gui_creating_key
|
||||
|
@ -194,7 +194,7 @@ public class MainActivity extends SyncthingActivity
|
|||
final ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
setContentView(R.layout.main_activity);
|
||||
setContentView(R.layout.activity_main);
|
||||
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
|
@ -375,7 +375,7 @@ public class MainActivity extends SyncthingActivity
|
|||
@Override
|
||||
public void onReceiveUsageReport(String report) {
|
||||
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);
|
||||
tv.setText(report);
|
||||
new AlertDialog.Builder(MainActivity.this)
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.nutomic.syncthingandroid.activities;
|
|||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ComponentName;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.http.SslCertificate;
|
||||
import android.net.http.SslError;
|
||||
import android.os.Build;
|
||||
|
@ -17,7 +16,6 @@ import android.webkit.WebViewClient;
|
|||
import android.widget.ProgressBar;
|
||||
|
||||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.syncthing.RestApi;
|
||||
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
@ -32,8 +30,6 @@ import java.security.SignatureException;
|
|||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
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.
|
||||
|
@ -108,7 +104,7 @@ public class WebGuiActivity extends SyncthingActivity
|
|||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setContentView(R.layout.web_gui_activity);
|
||||
setContentView(R.layout.activity_web_gui);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mLoadingView = findViewById(R.id.loading);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
|
|||
if (convertView == null) {
|
||||
LayoutInflater inflater = (LayoutInflater) getContext()
|
||||
.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);
|
||||
|
@ -114,7 +114,7 @@ public class DrawerFragment extends Fragment implements RestApi.OnReceiveSystemI
|
|||
*/
|
||||
@Override
|
||||
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);
|
||||
mCpuUsage = (TextView) view.findViewById(R.id.cpu_usage);
|
||||
mRamUsage = (TextView) view.findViewById(R.id.ram_usage);
|
||||
|
|
|
@ -13,6 +13,7 @@ import android.widget.AdapterView;
|
|||
import com.nutomic.syncthingandroid.R;
|
||||
import com.nutomic.syncthingandroid.activities.MainActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SettingsActivity;
|
||||
import com.nutomic.syncthingandroid.activities.SyncthingActivity;
|
||||
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
|
||||
import com.nutomic.syncthingandroid.util.FoldersAdapter;
|
||||
|
||||
|
@ -43,6 +44,15 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
|
|||
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
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
@ -52,16 +62,13 @@ public class FoldersFragment extends ListFragment implements SyncthingService.On
|
|||
}
|
||||
|
||||
private void initAdapter() {
|
||||
MainActivity activity = (MainActivity) getActivity();
|
||||
SyncthingActivity activity = (SyncthingActivity) getActivity();
|
||||
if (activity == null || activity.getApi() == null)
|
||||
return;
|
||||
|
||||
mAdapter = new FoldersAdapter(activity);
|
||||
mAdapter.add(activity.getApi().getFolders());
|
||||
setListAdapter(mAdapter);
|
||||
setEmptyText(getString(R.string.folder_list_empty));
|
||||
getListView().setOnItemClickListener(this);
|
||||
getListView().setOnItemLongClickListener(this);
|
||||
}
|
||||
|
||||
private void updateList() {
|
||||
|
|
|
@ -34,7 +34,7 @@ public class DevicesAdapter extends ArrayAdapter<RestApi.Device>
|
|||
};
|
||||
|
||||
public DevicesAdapter(Context context) {
|
||||
super(context, R.layout.device_list_item);
|
||||
super(context, R.layout.item_device_list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,7 +42,7 @@ public class DevicesAdapter extends ArrayAdapter<RestApi.Device>
|
|||
if (convertView == null) {
|
||||
LayoutInflater inflater = (LayoutInflater) getContext()
|
||||
.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);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.nutomic.syncthingandroid.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -15,6 +16,10 @@ import java.util.Comparator;
|
|||
import java.util.HashMap;
|
||||
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.
|
||||
*/
|
||||
|
@ -22,6 +27,7 @@ public class FoldersAdapter extends ArrayAdapter<RestApi.Folder>
|
|||
implements RestApi.OnReceiveModelListener {
|
||||
|
||||
private HashMap<String, RestApi.Model> mModels = new HashMap<>();
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
private final static Comparator<RestApi.Folder> COMPARATOR = new Comparator<RestApi.Folder>() {
|
||||
@Override
|
||||
|
@ -31,47 +37,54 @@ public class FoldersAdapter extends ArrayAdapter<RestApi.Folder>
|
|||
};
|
||||
|
||||
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
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder viewHolder;
|
||||
if (convertView == null) {
|
||||
LayoutInflater inflater = (LayoutInflater) getContext()
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
convertView = inflater.inflate(R.layout.folder_list_item, parent, false);
|
||||
}
|
||||
convertView = mInflater.inflate(R.layout.item_folder_list, parent, false);
|
||||
|
||||
TextView id = (TextView) convertView.findViewById(R.id.id);
|
||||
TextView state = (TextView) convertView.findViewById(R.id.state);
|
||||
TextView directory = (TextView) convertView.findViewById(R.id.directory);
|
||||
TextView items = (TextView) convertView.findViewById(R.id.items);
|
||||
TextView size = (TextView) convertView.findViewById(R.id.size);
|
||||
TextView invalid = (TextView) convertView.findViewById(R.id.invalid);
|
||||
viewHolder = new ViewHolder();
|
||||
viewHolder.id = (TextView) convertView.findViewById(R.id.id);
|
||||
viewHolder.state = (TextView) convertView.findViewById(R.id.state);
|
||||
viewHolder.directory = (TextView) convertView.findViewById(R.id.directory);
|
||||
viewHolder.items = (TextView) convertView.findViewById(R.id.items);
|
||||
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.Model model = mModels.get(folder.id);
|
||||
id.setText(folder.id);
|
||||
state.setTextColor(getContext().getResources().getColor(R.color.text_green));
|
||||
directory.setText((folder.path));
|
||||
viewHolder.id.setText(folder.id);
|
||||
viewHolder.state.setTextColor(getContext().getResources().getColor(R.color.text_green));
|
||||
viewHolder.directory.setText((folder.path));
|
||||
if (model != null) {
|
||||
int percentage = (model.globalBytes != 0)
|
||||
? (int) Math.floor(100 * model.inSyncBytes / model.globalBytes)
|
||||
: 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),
|
||||
percentage));
|
||||
items.setText(getContext()
|
||||
viewHolder.items.setVisibility(VISIBLE);
|
||||
viewHolder.items.setText(getContext()
|
||||
.getString(R.string.files, model.inSyncFiles, model.globalFiles));
|
||||
size.setText(RestApi.readableFileSize(getContext(), model.inSyncBytes) + " / " +
|
||||
RestApi.readableFileSize(getContext(), model.globalBytes));
|
||||
if (folder.invalid.equals("")) {
|
||||
invalid.setText(model.invalid);
|
||||
invalid.setVisibility((model.invalid.equals("")) ? View.GONE : View.VISIBLE);
|
||||
viewHolder.size.setVisibility(VISIBLE);
|
||||
viewHolder.size.setText(readableFileSize(getContext(), model.inSyncBytes) + " / " +
|
||||
readableFileSize(getContext(), model.globalBytes));
|
||||
if (TextUtils.isEmpty(folder.invalid)) {
|
||||
setTextOrHide(viewHolder.invalid, model.invalid);
|
||||
}
|
||||
} else {
|
||||
invalid.setText(folder.invalid);
|
||||
invalid.setVisibility((folder.invalid.equals("")) ? View.GONE : View.VISIBLE);
|
||||
viewHolder.items.setVisibility(GONE);
|
||||
viewHolder.size.setVisibility(GONE);
|
||||
setTextOrHide(viewHolder.invalid, folder.invalid);
|
||||
}
|
||||
|
||||
return convertView;
|
||||
|
@ -113,4 +126,22 @@ public class FoldersAdapter extends ArrayAdapter<RestApi.Folder>
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,63 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<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:padding="4dip">
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toLeftOf="@+id/status"
|
||||
android:layout_toStartOf="@+id/status"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:ellipsize="end" />
|
||||
android:textAppearance="?textAppearanceListItemPrimary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/status"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignBottom="@+id/name"
|
||||
android:layout_width="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
|
||||
android:id="@+id/download_title"
|
||||
android:text="@string/download_title_colon"
|
||||
android:layout_below="@id/name"
|
||||
android:layout_width="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
|
||||
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_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
|
||||
android:id="@+id/upload_title"
|
||||
android:text="@string/upload_title_colon"
|
||||
android:layout_below="@id/download_title"
|
||||
android:layout_width="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
|
||||
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_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>
|
|
@ -1,58 +1,62 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<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:padding="4dip">
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_toLeftOf="@+id/state"
|
||||
android:layout_toStartOf="@+id/state"
|
||||
android:lines="1"
|
||||
android:ellipsize="end" />
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textAppearance="?textAppearanceListItemPrimary" />
|
||||
|
||||
<TextView
|
||||
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_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
|
||||
android:id="@+id/directory"
|
||||
android:layout_below="@id/state"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end" />
|
||||
android:layout_below="@id/state"
|
||||
android:ellipsize="end"
|
||||
android:textAppearance="?textAppearanceListItemSecondary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/items"
|
||||
android:layout_below="@id/directory"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/directory"
|
||||
android:textAppearance="?textAppearanceListItemSecondary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/size"
|
||||
android:layout_below="@id/items"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/items"
|
||||
android:textAppearance="?textAppearanceListItemSecondary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/invalid"
|
||||
android:textColor="@color/text_red"
|
||||
android:layout_below="@id/size"
|
||||
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>
|
|
@ -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>
|
9
src/main/res/values-v21/themes.xml
Normal file
9
src/main/res/values-v21/themes.xml
Normal 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>
|
5
src/main/res/values/attrs.xml
Normal file
5
src/main/res/values/attrs.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<attr name="textAppearanceListItemPrimary" format="reference"/>
|
||||
<attr name="textAppearanceListItemSecondary" format="reference"/>
|
||||
</resources>
|
|
@ -3,9 +3,7 @@
|
|||
<color name="primary">#03A9F4</color>
|
||||
<color name="primary_dark">#0288D1</color>
|
||||
<color name="primary_light">#B3E5FC</color>
|
||||
<color name="accent">#4CAF50</color>
|
||||
<color name="primary_text">#212121</color>
|
||||
<color name="secondary_text">#727272</color>
|
||||
<color name="accent">#FF9100</color>
|
||||
<color name="icons">#FFFFFF</color>
|
||||
<color name="divider">#B6B6B6</color>
|
||||
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="BaseTheme" 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="android:textColorPrimary">@color/primary_text</item>
|
||||
<item name="android:textColorSecondary">@color/secondary_text</item>
|
||||
<!-- Widget styles -->
|
||||
<eat-comment />
|
||||
|
||||
<style name="Widget.Syncthing.ListView" parent="Widget.AppCompat.ListView">
|
||||
<item name="android:paddingTop">8dp</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 name="AppTheme" parent="BaseTheme"/>
|
||||
<!-- Text appearances -->
|
||||
<eat-comment />
|
||||
|
||||
<style name="Translucent" parent="AppTheme">
|
||||
<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 name="TextAppearance.Syncthing.ListItemPrimary" parent="TextAppearance.AppCompat.Subhead">
|
||||
<item name="android:textColor">?android:textColorPrimary</item>
|
||||
</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>
|
||||
|
|
44
src/main/res/values/themes.xml
Normal file
44
src/main/res/values/themes.xml
Normal 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>
|
|
@ -5,7 +5,7 @@
|
|||
android:persistent="false"
|
||||
android:key="device_id"
|
||||
android:title="@string/device_id"
|
||||
android:widgetLayout="@layout/scan_qr_code_widget" />
|
||||
android:widgetLayout="@layout/pref_widget_scan_qr_code" />
|
||||
|
||||
<EditTextPreference
|
||||
android:persistent="false"
|
||||
|
|
Loading…
Reference in a new issue