Commit abef905b authored by Administrator's avatar Administrator

settings demo

parent 8ec9bb6f
......@@ -43,9 +43,9 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:design:28.0.0'
//compile 'com.android.support:support-v4:24.2.0'
api project(':echo-lib')
......@@ -53,5 +53,6 @@ dependencies {
//引入netty之后,class直接就爆炸了。考虑实现API精简
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.preference:preference:1.1.0'
annotationProcessor 'org.projectlombok:lombok:1.18.2'
}
......@@ -2,6 +2,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.virjar.echo.adr">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
......@@ -10,13 +16,16 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".ui.SettingsActivity"
android:label="@string/title_activity_settings" />
<activity android:name=".MainActivity" />
<activity android:name=".ui.LoginActivity"
<activity
android:name=".ui.LoginActivity"
android:configChanges="orientation|screenSize"
android:theme="@style/Theme.AppCompat.NoActionBar"
android:windowSoftInputMode="stateHidden|adjustPan"
android:configChanges="orientation|screenSize">
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -25,7 +34,7 @@
</activity>
<receiver
android:name="com.virjar.echo.adr.StartOnBootBroadcastReceiver"
android:name=".StartOnBootBroadcastReceiver"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="1000">
......@@ -45,27 +54,20 @@
<data android:scheme="package" />
</intent-filter>
</receiver>
<!--开机自启服务-->
</receiver> <!-- 开机自启服务 -->
<service
android:name="com.virjar.echo.adr.HttpProxyService"
android:name=".HttpProxyService"
android:enabled="true"
android:exported="true"
tools:ignore="ExportedService">
<intent-filter android:priority="1000">
<action android:name="com.virjar.g4proxy.service" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
</application>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
</manifest>
\ No newline at end of file
......@@ -10,9 +10,10 @@ import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.os.Build;
import android.os.IBinder;
import android.support.annotation.Nullable;
import androidx.annotation.Nullable;
import com.virjar.echo.nat.client.EchoClient;
import com.virjar.echo.nat.log.EchoLogger;
......
......@@ -2,7 +2,8 @@ package com.virjar.echo.adr;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
......
package com.virjar.echo.adr.ui;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.virjar.echo.adr.R;
public class LoginActivity extends AppCompatActivity {
......@@ -18,11 +22,26 @@ public class LoginActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_login);
imageView = findViewById(R.id.imageView);
textView = findViewById(R.id.textView);
setupAnimation();
Button btnSetting = findViewById(R.id.btn_setting);
btnSetting.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
startActivity(new Intent(LoginActivity.this, SettingsActivity.class));
}
});
}
private void setupAnimation() {
imageView.setOnTouchListener(new OnSwipeTouchListener(getApplicationContext()) {
public void onSwipeTop() {
}
......@@ -56,4 +75,5 @@ public class LoginActivity extends AppCompatActivity {
});
}
}
package com.virjar.echo.adr.ui;
import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceFragmentCompat;
import com.virjar.echo.adr.R;
public class SettingsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_activity);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.settings, new SettingsFragment())
.commit();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}
public static class SettingsFragment extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.root_preferences, rootKey);
}
}
}
\ No newline at end of file
......@@ -94,11 +94,7 @@
android:paddingRight="32dp">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="#96ffffff"
android:theme="@style/EditScreenTextInputLayoutStyle">
<EditText
android:layout_width="match_parent"
......@@ -111,13 +107,7 @@
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="16sp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="#96ffffff"
android:theme="@style/EditScreenTextInputLayoutStyle">
<EditText
android:layout_width="match_parent"
......@@ -130,7 +120,7 @@
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="16sp" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
......@@ -153,6 +143,7 @@
android:textSize="16dp" />
<Button
android:id="@+id/btn_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
......
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/settings"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
\ No newline at end of file
<resources>
<!-- Reply Preference -->
<string-array name="reply_entries">
<item>Reply</item>
<item>Reply to all</item>
</string-array>
<string-array name="reply_values">
<item>reply</item>
<item>reply_all</item>
</string-array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#FFFFFF</color>
<color name="colorPrimaryDark">#FFFFFF</color>
<color name="colorAccent">#FFFFFF</color>
<color name="colorPrimary">#2196f3</color>
<color name="colorPrimaryDark">#1976d2</color>
<color name="colorAccent">#FF9800</color>
<color name="textInputLayout">#96ffffff</color>
</resources>
<resources>
<string name="app_name">EchoProxy</string>
<string name="title_activity_settings">SettingsActivity</string>
<!-- Preference Titles -->
<string name="messages_header">Messages</string>
<string name="sync_header">Sync</string>
<!-- Messages Preferences -->
<string name="signature_title">Your signature</string>
<string name="reply_title">Default reply action</string>
<!-- Sync Preferences -->
<string name="sync_title">Sync email periodically</string>
<string name="attachment_title">Download incoming attachments</string>
<string name="attachment_summary_on">Automatically download attachments for incoming emails
</string>
<string name="attachment_summary_off">Only download attachments when manually requested</string>
</resources>
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/messages_header">
<EditTextPreference
app:key="signature"
app:title="@string/signature_title"
app:useSimpleSummaryProvider="true" />
<ListPreference
app:defaultValue="reply"
app:entries="@array/reply_entries"
app:entryValues="@array/reply_values"
app:key="reply"
app:title="@string/reply_title"
app:useSimpleSummaryProvider="true" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/sync_header">
<SwitchPreferenceCompat
app:key="sync"
app:title="@string/sync_title" />
<SwitchPreferenceCompat
app:dependency="sync"
app:key="attachment"
app:summaryOff="@string/attachment_summary_off"
app:summaryOn="@string/attachment_summary_on"
app:title="@string/attachment_title" />
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
......@@ -14,7 +14,7 @@ org.gradle.jvmargs=-Xmx1536m
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=false
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=false
android.enableJetifier=true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment