mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
removed design lib from deps - android
This commit is contained in:
parent
30fb0f5a94
commit
fbcc4f28e7
@ -1,26 +1,55 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.purplei2p.i2pd"
|
package="org.purplei2p.i2pd"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="2.18.0">
|
android:versionName="2.18.0">
|
||||||
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="25"/>
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-sdk
|
||||||
<uses-permission android:name="android.permission.INTERNET"/><!-- normal perm, per https://developer.android.com/guide/topics/permissions/normal-permissions.html -->
|
android:minSdkVersion="14"
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!-- normal perm -->
|
android:targetSdkVersion="25" />
|
||||||
<application android:label="@string/app_name" android:allowBackup="true" android:icon="@drawable/icon" android:theme="@style/Theme.AppCompat">
|
|
||||||
<receiver android:name=".NetworkStateChangeReceiver">
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
<intent-filter>
|
<uses-permission android:name="android.permission.INTERNET" /> <!-- normal perm, per https://developer.android.com/guide/topics/permissions/normal-permissions.html -->
|
||||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
</intent-filter>
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
</receiver>
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- normal perm -->
|
||||||
<activity android:name=".I2PDPermsAskerActivity" android:label="@string/app_name">
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@drawable/icon"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
>
|
||||||
|
<receiver android:name=".NetworkStateChangeReceiver">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".I2PDPermsAskerActivity"
|
||||||
|
android:label="@string/app_name">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".I2PDActivity" android:label="@string/app_name"/>
|
<activity
|
||||||
<service android:enabled="true" android:name=".ForegroundService"/>
|
android:name=".I2PDActivity"
|
||||||
|
android:label="@string/app_name" />
|
||||||
|
|
||||||
|
<service
|
||||||
|
android:name=".ForegroundService"
|
||||||
|
android:enabled="true" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".I2PDPermsExplanationActivity"
|
||||||
|
android:label="@string/title_activity_i2_pdperms_asker_prompt"
|
||||||
|
android:parentActivityName=".I2PDPermsAskerActivity">
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value="org.purplei2p.i2pd.I2PDPermsAskerActivity" />
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
|
||||||
|
</manifest>
|
@ -19,7 +19,6 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.android.support:support-v4:25.3.1'
|
compile 'com.android.support:support-v4:25.3.1'
|
||||||
compile 'com.android.support:design:25.3.1'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@ -33,6 +32,7 @@ android {
|
|||||||
versionName "2.18.0"
|
versionName "2.18.0"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters 'armeabi-v7a'
|
abiFilters 'armeabi-v7a'
|
||||||
|
//abiFilters 'x86'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@ -65,3 +65,4 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
27
android/res/layout/activity_perms_explanation.xml
Normal file
27
android/res/layout/activity_perms_explanation.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<LinearLayout android:id="@+id/layout_prompt"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingBottom="@dimen/vertical_page_margin"
|
||||||
|
android:paddingLeft="@dimen/horizontal_page_margin"
|
||||||
|
android:paddingRight="@dimen/horizontal_page_margin"
|
||||||
|
android:paddingTop="@dimen/vertical_page_margin"
|
||||||
|
tools:context=".I2PDPermsAskerActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textview_explanation"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/horizontal_page_margin"
|
||||||
|
android:text="SD card write access is required to write the keys and other files to the I2PD folder on SD card."
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/button_ok"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="OK"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
@ -14,4 +14,5 @@
|
|||||||
<string name="gracefulShutdownInProgress">i2pd: graceful shutdown in progress</string>
|
<string name="gracefulShutdownInProgress">i2pd: graceful shutdown in progress</string>
|
||||||
<string name="stopped">i2pd has stopped</string>
|
<string name="stopped">i2pd has stopped</string>
|
||||||
<string name="remaining">remaining</string>
|
<string name="remaining">remaining</string>
|
||||||
|
<string name="title_activity_i2_pdperms_asker_prompt">Prompt</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -12,14 +12,13 @@ import android.content.Intent;
|
|||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class I2PDActivity extends AppCompatActivity {
|
public class I2PDActivity extends Activity {
|
||||||
private static final String TAG = "i2pdActvt";
|
private static final String TAG = "i2pdActvt";
|
||||||
public static final int GRACEFUL_DELAY_MILLIS = 10 * 60 * 1000;
|
public static final int GRACEFUL_DELAY_MILLIS = 10 * 60 * 1000;
|
||||||
|
|
||||||
|
@ -6,15 +6,13 @@ import android.content.Intent;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.design.widget.Snackbar;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
//dangerous perms, per https://developer.android.com/guide/topics/permissions/normal-permissions.html :
|
//dangerous perms, per https://developer.android.com/guide/topics/permissions/normal-permissions.html :
|
||||||
//android.permission.WRITE_EXTERNAL_STORAGE
|
//android.permission.WRITE_EXTERNAL_STORAGE
|
||||||
public class I2PDPermsAskerActivity extends AppCompatActivity {
|
public class I2PDPermsAskerActivity extends Activity {
|
||||||
|
|
||||||
private static final int PERMISSION_WRITE_EXTERNAL_STORAGE = 0;
|
private static final int PERMISSION_WRITE_EXTERNAL_STORAGE = 0;
|
||||||
|
|
||||||
@ -58,16 +56,7 @@ public class I2PDPermsAskerActivity extends AppCompatActivity {
|
|||||||
// this thread waiting for the user's response! After the user
|
// this thread waiting for the user's response! After the user
|
||||||
// sees the explanation, try again to request the permission.
|
// sees the explanation, try again to request the permission.
|
||||||
|
|
||||||
Snackbar.make(mLayout, "SD card write access is required to write the keys and other files to the I2PD folder on SD card.",
|
showExplanation();
|
||||||
Snackbar.LENGTH_INDEFINITE).setAction("OK", new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
// Request the permission
|
|
||||||
ActivityCompat.requestPermissions(I2PDPermsAskerActivity.this,
|
|
||||||
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
|
||||||
PERMISSION_WRITE_EXTERNAL_STORAGE);
|
|
||||||
}
|
|
||||||
}).show();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -118,4 +107,24 @@ public class I2PDPermsAskerActivity extends AppCompatActivity {
|
|||||||
startActivity(new Intent(this, I2PDActivity.class));
|
startActivity(new Intent(this, I2PDActivity.class));
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final int SHOW_EXPLANATION_REQUEST = 1; // The request code
|
||||||
|
private void showExplanation() {
|
||||||
|
Intent intent = new Intent(this, I2PDPermsExplanationActivity.class);
|
||||||
|
startActivityForResult(intent, SHOW_EXPLANATION_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
// Check which request we're responding to
|
||||||
|
if (requestCode == SHOW_EXPLANATION_REQUEST) {
|
||||||
|
// Make sure the request was successful
|
||||||
|
if (resultCode == RESULT_OK) {
|
||||||
|
// Request the permission
|
||||||
|
ActivityCompat.requestPermissions(I2PDPermsAskerActivity.this,
|
||||||
|
new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||||
|
PERMISSION_WRITE_EXTERNAL_STORAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
package org.purplei2p.i2pd;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
public class I2PDPermsExplanationActivity extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_perms_explanation);
|
||||||
|
//getActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
Button button_ok = (Button) findViewById(R.id.button_ok);
|
||||||
|
button_ok.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
returnFromActivity();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void returnFromActivity() {
|
||||||
|
Intent data = new Intent();
|
||||||
|
Activity parent = getParent();
|
||||||
|
if (parent == null) {
|
||||||
|
setResult(Activity.RESULT_OK, data);
|
||||||
|
} else {
|
||||||
|
parent.setResult(Activity.RESULT_OK, data);
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user