Skip to content

Commit

Permalink
- Added Settings activity
Browse files Browse the repository at this point in the history
  • Loading branch information
PavlosIsaris committed Sep 27, 2022
1 parent bf2de6e commit 62a1ce1
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 9 deletions.
8 changes: 6 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
android:label="@string/app_name"
android:logo="@drawable/icsee_logo"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
<activity
android:name=".ICSeeSettingsActivity"
android:exported="false"
android:label="@string/title_activity_icsee_settings" />
<activity
android:name=".SettingsActivity"
android:exported="false"
Expand Down Expand Up @@ -61,7 +65,7 @@
<activity
android:name=".camera.ImageView"
android:label="@string/title_activity_image_edit"
android:screenOrientation="landscape"/>
android:screenOrientation="landscape" />
</application>

</manifest>
</manifest>
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.3.0'
}
}

Expand All @@ -14,6 +14,9 @@ apply plugin: 'com.android.application'
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
implementation 'com.quickbirdstudios:opencv:3.4.15'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.android.material:material:1.6.1'
}

android {
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.useAndroidX=true
android.enableJetifier=true
9 changes: 9 additions & 0 deletions res/layout/settings_activity.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<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>
12 changes: 12 additions & 0 deletions res/values/arrays.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<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>
15 changes: 15 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,19 @@
<string name="application_logo">Application logo</string>
<string name="filter_view_http_icsee">icsee_filter</string>
<string name="settings_about_btn">Settings / About</string>
<string name="title_activity_icsee_settings">ICSeeSettingsActivity</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>
35 changes: 35 additions & 0 deletions res/xml/root_preferences.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<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>
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

32 changes: 32 additions & 0 deletions src/gr/scify/icsee/ICSeeSettingsActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package gr.scify.icsee;

import android.os.Bundle;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceFragmentCompat;

public class ICSeeSettingsActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_activity);
if (savedInstanceState == null) {
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);
}
}
}
8 changes: 3 additions & 5 deletions src/gr/scify/icsee/ICSeeStartActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Vibrator;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import gr.scify.icsee.camera.ModifiedLoaderCallback;
import gr.scify.icsee.sounds.SoundPlayer;

import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.OpenCVLoader;

import java.util.Locale;
import gr.scify.icsee.camera.ModifiedLoaderCallback;
import gr.scify.icsee.sounds.SoundPlayer;

public class ICSeeStartActivity extends Activity {
protected Context mContext;
Expand Down

0 comments on commit 62a1ce1

Please sign in to comment.