Create a new activity to manage certificates
This commit is contained in:
parent
c4cadc4083
commit
d11cb63c16
1
.idea/misc.xml
generated
1
.idea/misc.xml
generated
@ -7,6 +7,7 @@
|
||||
<entry key="app/src/main/res/drawable/ic_launcher_background.xml" value="0.3859375" />
|
||||
<entry key="app/src/main/res/drawable/ic_launcher_foreground.xml" value="0.2234375" />
|
||||
<entry key="app/src/main/res/drawable/splashscreen.xml" value="0.3859375" />
|
||||
<entry key="app/src/main/res/layout/activity_certs_manager.xml" value="0.29483695652173914" />
|
||||
<entry key="app/src/main/res/layout/content_certs.xml" value="0.29483695652173914" />
|
||||
<entry key="app/src/main/res/layout/fragment_first.xml" value="0.29483695652173914" />
|
||||
<entry key="app/src/main/res/layout/fragment_second.xml" value="0.29483695652173914" />
|
||||
|
@ -37,6 +37,7 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.4.0'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
|
||||
implementation 'androidx.preference:preference:1.2.0'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
|
@ -3,14 +3,17 @@
|
||||
package="org.communiquons.dccaggregator">
|
||||
|
||||
<application
|
||||
android:name=".DCCAggregator"
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.DCCAggregator">
|
||||
|
||||
<!-- Main activity -->
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".activities.MainActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/SplashTheme">
|
||||
<intent-filter>
|
||||
@ -19,6 +22,13 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
||||
<!-- Manage certificates -->
|
||||
<activity
|
||||
android:name=".activities.CertsManager"
|
||||
android:label="@string/activity_certsmanagers"
|
||||
android:exported="false" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,10 @@
|
||||
package org.communiquons.dccaggregator
|
||||
|
||||
import android.app.Application
|
||||
import org.communiquons.dccaggregator.helper.CertificatesList
|
||||
|
||||
class DCCAggregator : Application() {
|
||||
val certManager by lazy {
|
||||
CertificatesList(this)
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package org.communiquons.dccaggregator
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setTheme(R.style.Theme_DCCAggregator)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package org.communiquons.dccaggregator.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import org.communiquons.dccaggregator.R
|
||||
|
||||
class CertsManager : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_certs_manager)
|
||||
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == android.R.id.home) {
|
||||
finish()
|
||||
return true
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package org.communiquons.dccaggregator.activities
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import org.communiquons.dccaggregator.DCCAggregator
|
||||
import org.communiquons.dccaggregator.R
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setTheme(R.style.Theme_DCCAggregator)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
// On first launch, start certificates manager first
|
||||
if (!(application as DCCAggregator).certManager.hasGeneratedCertificate)
|
||||
openCertsManager()
|
||||
}
|
||||
|
||||
fun openCertsManager() {
|
||||
startActivity(Intent(this, CertsManager::class.java))
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package org.communiquons.dccaggregator.helper
|
||||
|
||||
import android.content.Context
|
||||
import androidx.preference.PreferenceManager
|
||||
|
||||
class CertificatesList(context: Context) {
|
||||
private val prefsManager = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
val hasGeneratedCertificate get() = false
|
||||
}
|
9
app/src/main/res/layout/activity_certs_manager.xml
Normal file
9
app/src/main/res/layout/activity_certs_manager.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activities.CertsManager">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -4,7 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
tools:context=".activities.MainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -1,3 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">DCCAggregator</string>
|
||||
<string name="activity_certsmanagers">Input certificates</string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user