Compare commits

..

7 Commits

15 changed files with 75 additions and 63 deletions

View File

@ -1,14 +1,15 @@
apply plugin: 'com.android.application'
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION as String)
defaultConfig {
versionCode 4745284
versionCode Integer.parseInt(project.I2P_ANDROID_VERSION_CODE as String)
versionName "$I2P_ANDROID_VERSION"
minSdkVersion 21
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION as String)
@ -76,16 +77,16 @@ dependencies {
implementation "com.android.support:preference-v14:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
// Remote dependencies
implementation 'com.androidplot:androidplot-core:1.4.1'
implementation 'com.androidplot:androidplot-core:1.5.11'
implementation 'com.eowise:recyclerview-stickyheaders:0.5.2@aar'
implementation 'com.inkapplications.viewpageindicator:library:2.4.4'
implementation 'com.inkapplications.viewpageindicator:library:2.4.3'
implementation 'com.pnikosis:materialish-progress:1.7'
implementation "net.i2p:router:$I2P_VERSION"
implementation "net.i2p:i2p:$I2P_VERSION"
implementation "net.i2p.client:mstreaming:$I2P_VERSION"
implementation "net.i2p.client:streaming:$I2P_VERSION"
implementation 'net.i2p.android.ext:floatingactionbutton:1.10.1'
implementation 'org.sufficientlysecure:html-textview:3.1'
implementation 'com.github.SufficientlySecure:html-textview:v3.6'
// Testing-only dependencies
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2') {
exclude group: 'com.android.support', module: 'support-annotations'
@ -93,6 +94,8 @@ dependencies {
}
dependencies {
implementation 'androidx.test.espresso:espresso-core:3.6.1'
implementation 'androidx.test.ext:junit:1.2.1'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}

View File

@ -1,39 +1,43 @@
package net.i2p.android;
import android.test.ActivityInstrumentationTestCase2;
import androidx.test.core.app.ActivityScenario;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import net.i2p.android.router.R;
import static android.support.test.espresso.Espresso.closeSoftKeyboard;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static android.support.test.espresso.Espresso.pressBack;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.swipeLeft;
import static android.support.test.espresso.assertion.ViewAssertions.doesNotExist;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.hasSibling;
import static android.support.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static androidx.test.espresso.Espresso.closeSoftKeyboard;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.Espresso.pressBack;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.action.ViewActions.swipeLeft;
import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.hasSibling;
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.not;
public class I2PActivityTest extends ActivityInstrumentationTestCase2<I2PActivity> {
public I2PActivityTest() {
super(I2PActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
// For each test method invocation, the Activity will not actually be created
// until the first time this method is called.
getActivity();
@RunWith(AndroidJUnit4.class)
public class I2PActivityTest {
private ActivityScenario<I2PActivity> scenario;
@Before
public void setUp() {
scenario = ActivityScenario.launch(I2PActivity.class);
}
@Test
public void testMainTabs() {
onView(withId(R.id.router_onoff_button)).check(matches(isDisplayed()));
@ -55,6 +59,7 @@ public class I2PActivityTest extends ActivityInstrumentationTestCase2<I2PActivit
onView(withId(R.id.router_onoff_button)).check(matches(isDisplayed()));
}
@Test
public void testMainSwipe() {
onView(withId(R.id.router_onoff_button)).check(matches(isDisplayed()));
@ -70,9 +75,10 @@ public class I2PActivityTest extends ActivityInstrumentationTestCase2<I2PActivit
// TODO: test addressbook ViewPager
}
@Test
public void testSettingsNavigation() {
// Open settings menu
openActionBarOverflowOrOptionsMenu(getActivity());
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
onView(withText(R.string.menu_settings)).perform(click());
// Open bandwidth page
@ -106,4 +112,4 @@ public class I2PActivityTest extends ActivityInstrumentationTestCase2<I2PActivit
pressBack();
onView(withText(R.string.settings_label_advanced)).check(doesNotExist());
}
}
}

View File

@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<!-- following two are for UPnP -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
@ -29,7 +30,10 @@
android:icon="@drawable/ic_launcher_itoopie"
android:enabled="true"
android:exported="true"
android:label="@string/app_name">
android:label="@string/app_name"
android:foregroundServiceType="specialUse">
<property android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE"
android:value="i2p_router_background_process_required_network_operation"/>
<intent-filter>
<action android:name="net.i2p.android.router.service.IRouterState" />
</intent-filter>

View File

@ -19,7 +19,7 @@ import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.Toast;
import com.viewpagerindicator.TitlePageIndicator;
//import com.viewpagerindicator.TitlePageIndicator;
import net.i2p.android.i2ptunnel.preferences.EditTunnelContainerFragment;
import net.i2p.android.i2ptunnel.util.TunnelUtil;
@ -52,7 +52,7 @@ public class TunnelsContainer extends Fragment implements
private boolean mTwoPane;
ViewPager mViewPager;
TitlePageIndicator mPageIndicator;
//TitlePageIndicator mPageIndicator;
FragmentPagerAdapter mFragPagerAdapter;
private static final String FRAGMENT_CLIENT = "client_fragment";
@ -82,7 +82,7 @@ public class TunnelsContainer extends Fragment implements
View v = inflater.inflate(R.layout.container_tunnels, container, false);
mViewPager = (ViewPager) v.findViewById(R.id.pager);
mPageIndicator = (TitlePageIndicator) v.findViewById(R.id.page_indicator);
//mPageIndicator = (TitlePageIndicator) v.findViewById(R.id.page_indicator);
mNewTunnel = (ImageButton) v.findViewById(R.id.promoted_action);
mNewTunnel.setVisibility(showActions() ? View.VISIBLE : View.GONE);
@ -111,7 +111,7 @@ public class TunnelsContainer extends Fragment implements
mViewPager.setAdapter(mFragPagerAdapter);
// Bind the page indicator to the pager.
mPageIndicator.setViewPager(mViewPager);
//mPageIndicator.setViewPager(mViewPager);
mNewTunnel.setOnClickListener(new View.OnClickListener() {
@Override

View File

@ -20,7 +20,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import com.viewpagerindicator.TitlePageIndicator;
//import com.viewpagerindicator.TitlePageIndicator;
import net.i2p.android.router.R;
import net.i2p.android.router.util.NamingServiceUtil;
@ -92,10 +92,10 @@ public class AddressbookContainer extends Fragment
if (!mTwoPane) {
mViewPager = (ViewPager) v.findViewById(R.id.pager);
TitlePageIndicator pageIndicator = (TitlePageIndicator) v.findViewById(R.id.page_indicator);
//TitlePageIndicator pageIndicator = (TitlePageIndicator) v.findViewById(R.id.page_indicator);
mFragPagerAdapter = new AddressbookPagerAdapter(getActivity(), getChildFragmentManager());
mViewPager.setAdapter(mFragPagerAdapter);
pageIndicator.setViewPager(mViewPager);
//pageIndicator.setViewPager(mViewPager);
}
return v;

View File

@ -1,5 +1,7 @@
package net.i2p.android.router.service;
import static android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
@ -173,11 +175,18 @@ public class RouterService extends Service {
// We need to *not* check if we're restarting on Android greater than Oreo due to
// changes in how notifications work and the use of NotificationChannels.
if(!restart) {
startForeground(1337, _statusBar.getNote());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(1337, _statusBar.getNote(), FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
} else {
startForeground(1337, _statusBar.getNote());
}
} else {
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
startForeground(1337, _statusBar.getNote());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(1337, _statusBar.getNote(), FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
}
}

View File

@ -140,6 +140,7 @@ class StatusBar {
mNotificationManager.createNotificationChannel(mNotificationChannel);
mNotificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
mNotifyBuilder.setChannelId(NOTIFICATION_CHANNEL_ID);
//
}
mNotif = mNotifyBuilder.build();
mNotificationManager.notify(ID, mNotif);

View File

@ -5,10 +5,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/page_indicator"
style="@style/PagerIndicator" />
<!-- The main content view -->
<android.support.v4.view.ViewPager
android:id="@+id/pager"

View File

@ -29,10 +29,6 @@
android:layout_weight="2"
android:orientation="vertical">
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/page_indicator"
style="@style/PagerIndicator" />
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"

View File

@ -4,17 +4,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.viewpagerindicator.TitlePageIndicator
android:id="@+id/page_indicator"
style="@style/PagerIndicator" />
<!-- The main content view -->
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_alignParentBottom="true"
android:layout_below="@id/page_indicator" />
android:layout_alignParentBottom="true" />
<net.i2p.android.ext.floatingactionbutton.AddFloatingActionButton
android:id="@+id/promoted_action"

View File

@ -15,7 +15,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'com.android.tools.lint:lint-gradle:26.1.1'
}
}

View File

@ -14,10 +14,12 @@ POM_DEVELOPER_ID=idk
POM_DEVELOPER_NAME=idk
POM_DEVELOPER_EMAIL=hankhill19580@gmail.com
ANDROID_BUILD_TARGET_SDK_VERSION=33
ANDROID_BUILD_SDK_VERSION=33
ANDROID_BUILD_TARGET_SDK_VERSION=34
ANDROID_BUILD_SDK_VERSION=34
I2P_VERSION=2.6.0
I2P_ANDROID_VERSION=2.6.0
I2P_VERSION=2.7.0
I2P_ANDROID_VERSION=2.7.0
I2P_ANDROID_VERSION_CODE=4745288
android.disableAutomaticComponentCreation=true
android.useAndroidX=true
android.useAndroidX=true
#android.enableJetifier=true

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip