-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…e of #2
- Loading branch information
1 parent
46bd93c
commit 7ba2511
Showing
11 changed files
with
236 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<item | ||
android:drawable="@color/gray"/> | ||
|
||
<item> | ||
<bitmap | ||
android:gravity="center" | ||
android:src="@mipmap/ic_launcher"/> | ||
</item> | ||
|
||
</layer-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:id="@+id/setupErrorTitle" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="setupErrorTitle" | ||
android:textAlignment="center" | ||
android:gravity="center" | ||
android:textColor="@android:color/holo_red_dark" | ||
android:textSize="18sp" | ||
android:textStyle="bold" /> | ||
|
||
<TextView | ||
android:id="@+id/setupErrorExpl" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="setupErrorExpl" /> | ||
|
||
<Button | ||
android:id="@+id/setupAction" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="setupAction" | ||
android:visibility="invisible"/> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="gray">#444440</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<resources> | ||
|
||
<!-- Base application theme. --> | ||
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> | ||
<!-- Customize your theme here. --> | ||
</style> | ||
|
||
<style name="SplashTheme" parent="android:Theme.Holo.NoActionBar"> | ||
<item name="android:windowBackground">@drawable/background_splash</item> | ||
</style> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package de.pccoholic.pretix.dpc; | ||
|
||
import android.app.Application; | ||
import android.os.SystemClock; | ||
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
public class App extends Application { | ||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
|
||
// Don't do this! This is just so cold launches take some time | ||
SystemClock.sleep(TimeUnit.SECONDS.toMillis(3)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package de.pccoholic.pretix.dpc; | ||
|
||
import android.app.Activity; | ||
import android.app.admin.DevicePolicyManager; | ||
import android.content.ComponentName; | ||
import android.content.Context; | ||
import android.content.SharedPreferences; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.TextView; | ||
|
||
public class SetupActivity extends Activity { | ||
private DevicePolicyManager dpm; | ||
private ComponentName deviceAdmin; | ||
private SharedPreferences prefs; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
setContentView(R.layout.setup); | ||
|
||
dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); | ||
deviceAdmin = new ComponentName(this, AdminReceiver.class); | ||
prefs = getSharedPreferences(getPackageName(), Context.MODE_PRIVATE); | ||
|
||
TextView title = findViewById(R.id.setupErrorTitle); | ||
TextView expl = findViewById(R.id.setupErrorExpl); | ||
Button actionButton = findViewById(R.id.setupAction); | ||
|
||
if (!dpm.isDeviceOwnerApp(getPackageName())) { | ||
title.setText(R.string.setup_not_device_owner); | ||
expl.setText(R.string.setup_not_device_owner_expl); | ||
} else if (!dpm.isAdminActive(deviceAdmin)) { | ||
title.setText(R.string.setup_not_device_admin); | ||
expl.setText(R.string.setup_not_device_admin_expl); | ||
} else if (!prefs.getBoolean("isProvisioned", false)) { | ||
title.setText(R.string.setup_not_provisioned); | ||
expl.setText(R.string.setup_not_provisioned_expl); | ||
} else if (true == false) { | ||
// ToDo: Check if Kiosk-App is installed | ||
title.setText(R.string.setup_no_kioskapp); | ||
expl.setText(R.string.setup_no_kioskapp_expl); | ||
actionButton.setText(R.string.setup_no_kioskapp_button); | ||
actionButton.setVisibility(View.VISIBLE); | ||
|
||
actionButton.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
// ToDo: Trigger the installation of the Kiosk-App | ||
} | ||
}); | ||
} else { | ||
title.setText(R.string.setup_everything_fine); | ||
expl.setText(R.string.setup_everything_fine_expl); | ||
actionButton.setText(R.string.setup_everything_fine_button); | ||
actionButton.setVisibility(View.VISIBLE); | ||
|
||
actionButton.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
finishAndRemoveTask(); | ||
} | ||
}); | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package de.pccoholic.pretix.dpc; | ||
|
||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
|
||
|
||
public class SplashActivity extends Activity { | ||
boolean isProvisioned = false; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
Class<?> intentToLaunch = DPC.class; | ||
|
||
if (isProvisioned != true) { | ||
intentToLaunch = SetupActivity.class; | ||
} | ||
|
||
Intent intent = new Intent(this, intentToLaunch); | ||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME); | ||
startActivity(intent); | ||
finish(); | ||
} | ||
} |