Moved receiver classes to seperate package

This commit is contained in:
Felix Ableitner 2016-10-15 16:31:17 +09:00
parent 0488324843
commit 78891498e8
8 changed files with 21 additions and 12 deletions

View File

@ -5,7 +5,7 @@ import android.preference.PreferenceManager;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ServiceTestRule;
import com.nutomic.syncthingandroid.syncthing.AppConfigReceiver;
import com.nutomic.syncthingandroid.receiver.AppConfigReceiver;
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import com.nutomic.syncthingandroid.test.MockContext;

View File

@ -5,7 +5,7 @@ import android.preference.PreferenceManager;
import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ServiceTestRule;
import com.nutomic.syncthingandroid.syncthing.BatteryReceiver;
import com.nutomic.syncthingandroid.receiver.BatteryReceiver;
import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder;
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import com.nutomic.syncthingandroid.test.MockContext;

View File

@ -7,7 +7,7 @@ import android.support.test.InstrumentationRegistry;
import android.support.test.rule.ServiceTestRule;
import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder;
import com.nutomic.syncthingandroid.syncthing.NetworkReceiver;
import com.nutomic.syncthingandroid.receiver.NetworkReceiver;
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
import com.nutomic.syncthingandroid.test.MockContext;
@ -19,7 +19,7 @@ import org.junit.Test;
/**
* Tests for correct extras on the Intent sent by
* {@link com.nutomic.syncthingandroid.syncthing.NetworkReceiver}.
* {@link NetworkReceiver}.
*
* Does not test for correct result value, as that would require mocking
* {@link android.net.ConnectivityManager} (or replacing it with an interface).

View File

@ -81,12 +81,12 @@
<service android:name=".syncthing.SyncthingService" />
<receiver android:name=".syncthing.NetworkReceiver">
<receiver android:name=".receiver.NetworkReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<receiver android:name=".syncthing.BatteryReceiver">
<receiver android:name=".receiver.BatteryReceiver">
<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
@ -97,7 +97,7 @@
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name=".syncthing.AppConfigReceiver"
<receiver android:name=".receiver.AppConfigReceiver"
tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="com.nutomic.syncthingandroid.action.START" />

View File

@ -11,6 +11,7 @@ import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@ -40,10 +41,10 @@ import java.util.List;
import static android.support.v4.view.MarginLayoutParamsCompat.setMarginEnd;
import static android.support.v4.view.MarginLayoutParamsCompat.setMarginStart;
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
import static android.view.Gravity.CENTER_VERTICAL;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static com.nutomic.syncthingandroid.syncthing.SyncthingService.State.ACTIVE;
import static com.nutomic.syncthingandroid.util.DpConverter.dp;
import static java.lang.String.valueOf;
/**
@ -379,7 +380,8 @@ public class FolderFragment extends Fragment
}
private void addEmptyDeviceListView() {
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(WRAP_CONTENT, dp(48, getActivity()));
int height = (int) TypedValue.applyDimension(COMPLEX_UNIT_DIP, 48, getResources().getDisplayMetrics());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(WRAP_CONTENT, height);
int dividerInset = getResources().getDimensionPixelOffset(R.dimen.material_divider_inset);
int contentInset = getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material);
setMarginStart(params, dividerInset);

View File

@ -1,4 +1,4 @@
package com.nutomic.syncthingandroid.syncthing;
package com.nutomic.syncthingandroid.receiver;
import android.annotation.TargetApi;
import android.app.Notification;
@ -12,6 +12,7 @@ import android.support.v4.app.NotificationCompat;
import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.activities.MainActivity;
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
/**
* Broadcast-receiver to control and configure SyncThing remotely

View File

@ -1,10 +1,13 @@
package com.nutomic.syncthingandroid.syncthing;
package com.nutomic.syncthingandroid.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder;
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
/**
* Receives battery plug/unplug intents and sends the charging state to {@link SyncthingService}.
*/

View File

@ -1,4 +1,4 @@
package com.nutomic.syncthingandroid.syncthing;
package com.nutomic.syncthingandroid.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -7,6 +7,9 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder;
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
/**
* Receives network connection change intents and sends the wifi state to {@link SyncthingService}.
*/