diff --git a/.DS_Store b/.DS_Store index 3b7abc4..6cf0e40 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Nexacro14/.DS_Store b/Nexacro14/.DS_Store new file mode 100644 index 0000000..53f1e4a Binary files /dev/null and b/Nexacro14/.DS_Store differ diff --git a/Nexacro14/Android/.DS_Store b/Nexacro14/Android/.DS_Store new file mode 100644 index 0000000..82721ba Binary files /dev/null and b/Nexacro14/Android/.DS_Store differ diff --git a/Nexacro14/Android/nexacro14_android/.gitignore b/Nexacro14/Android/nexacro14_android/.gitignore new file mode 100644 index 0000000..9c4de58 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.gitignore @@ -0,0 +1,7 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/Nexacro14/Android/nexacro14_android/.idea/.name b/Nexacro14/Android/nexacro14_android/.idea/.name new file mode 100644 index 0000000..83ebfde --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/.name @@ -0,0 +1 @@ +DroidStudio \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/.idea/compiler.xml b/Nexacro14/Android/nexacro14_android/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/.idea/copyright/profiles_settings.xml b/Nexacro14/Android/nexacro14_android/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/.idea/encodings.xml b/Nexacro14/Android/nexacro14_android/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/.idea/gradle.xml b/Nexacro14/Android/nexacro14_android/.idea/gradle.xml new file mode 100644 index 0000000..68b204e --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/.idea/misc.xml b/Nexacro14/Android/nexacro14_android/.idea/misc.xml new file mode 100644 index 0000000..e0d5b93 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/misc.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/.idea/modules.xml b/Nexacro14/Android/nexacro14_android/.idea/modules.xml new file mode 100644 index 0000000..2a8e725 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/.idea/runConfigurations.xml b/Nexacro14/Android/nexacro14_android/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/.idea/vcs.xml b/Nexacro14/Android/nexacro14_android/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/DroidStudio.iml b/Nexacro14/Android/nexacro14_android/DroidStudio.iml new file mode 100644 index 0000000..886c753 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/DroidStudio.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/app/app.iml b/Nexacro14/Android/nexacro14_android/app/app.iml new file mode 100644 index 0000000..a1ec47f --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/app.iml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/app/build.gradle b/Nexacro14/Android/nexacro14_android/app/build.gradle new file mode 100644 index 0000000..49118b6 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/build.gradle @@ -0,0 +1,33 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 30 + buildToolsVersion "28.0.3" + + defaultConfig { + applicationId "nexacro.launcher" + minSdkVersion 14 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support:support-v4:26.1.0' + implementation 'com.google.android.gms:play-services-maps:16.0.0' + implementation 'com.google.android.gms:play-services-location:16.0.0' + implementation 'com.google.firebase:firebase-core:16.0.6' + implementation 'com.google.firebase:firebase-messaging:17.3.4' + implementation project(':nexacro14') +} + +apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/app/google-services.json b/Nexacro14/Android/nexacro14_android/app/google-services.json new file mode 100644 index 0000000..03997e5 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/google-services.json @@ -0,0 +1,42 @@ +{ + "project_info": { + "project_number": "995072755403", + "firebase_url": "https://summer-nexus-581.firebaseio.com", + "project_id": "summer-nexus-581", + "storage_bucket": "summer-nexus-581.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:995072755403:android:28b014c688afb816", + "android_client_info": { + "package_name": "nexacro.launcher" + } + }, + "oauth_client": [ + { + "client_id": "995072755403-ksam7299dh20s90batq23eis6gpv1749.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAaOYYoqFY9-AcA_P5jUtK_-2EmeoLvy7g" + } + ], + "services": { + "analytics_service": { + "status": 1 + }, + "appinvite_service": { + "status": 1, + "other_platform_oauth_client": [] + }, + "ads_service": { + "status": 2 + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/app/nexacro-example.jks b/Nexacro14/Android/nexacro14_android/app/nexacro-example.jks new file mode 100644 index 0000000..b33b985 Binary files /dev/null and b/Nexacro14/Android/nexacro14_android/app/nexacro-example.jks differ diff --git a/Nexacro14/Android/nexacro14_android/app/proguard-rules.pro b/Nexacro14/Android/nexacro14_android/app/proguard-rules.pro new file mode 100644 index 0000000..774ba9b --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\dev\sdks\android-sdk\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/Nexacro14/Android/nexacro14_android/app/src/androidTest/java/nexacro/launcher/droidstudio/ApplicationTest.java b/Nexacro14/Android/nexacro14_android/app/src/androidTest/java/nexacro/launcher/droidstudio/ApplicationTest.java new file mode 100644 index 0000000..d7219be --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/src/androidTest/java/nexacro/launcher/droidstudio/ApplicationTest.java @@ -0,0 +1,13 @@ +package nexacro.launcher.droidstudio; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/Nexacro14/Android/nexacro14_android/app/src/main/AndroidManifest.xml b/Nexacro14/Android/nexacro14_android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..86bdd9f --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/src/main/AndroidManifest.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/MainActivity.java b/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/MainActivity.java new file mode 100644 index 0000000..b59c122 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/MainActivity.java @@ -0,0 +1,61 @@ +package nexacro.launcher; + +import android.content.Intent; +import android.content.pm.ApplicationInfo; +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.webkit.WebView; + +import com.nexacro.NexacroUpdatorActivity; + +public class MainActivity extends NexacroUpdatorActivity { + + public MainActivity() { + super(); + + setProjectURL("http://your project url"); + setBootstrapURL("http://your bootstrap url/start_android.json"); + + // Default startupClass is NexacroActivity.class + // setStartupClass(UserCustomActivity.class); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Possible work around for market launches. See http://code.google.com/p/android/issues/detail?id=2373 + // for more details. Essentially, the market launches the main activity on top of other activities. + // we never want this to happen. Instead, we check if we are the root and if not, we finish. + if (!isTaskRoot()) { + final Intent intent = getIntent(); + if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(intent.getAction())) { + finish(); + return; + } + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE)) + { + WebView.setWebContentsDebuggingEnabled(true); + } + } + + Intent intent = getIntent(); + if(intent != null) { + String bootstrapURL = intent.getStringExtra("bootstrapURL"); + String projectUrl = intent.getStringExtra("projectUrl"); + if(bootstrapURL != null) { + setBootstrapURL(bootstrapURL); + setProjectURL(projectUrl); + } + } + } + + @Override + public void setContentView(View view) { + super.setContentView(view); + } +} diff --git a/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/ProjectSelectActivity.java b/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/ProjectSelectActivity.java new file mode 100644 index 0000000..4015cf3 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/ProjectSelectActivity.java @@ -0,0 +1,341 @@ +package nexacro.launcher; + +import android.Manifest; +import android.app.Activity; +import android.app.ActivityManager; +import android.app.ActivityManager.RunningTaskInfo; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.PermissionChecker; +import android.util.Log; +import android.view.Window; +import android.widget.Toast; + +import com.nexacro.NexacroUpdatorActivity; + +import org.xmlpull.v1.XmlPullParser; +import org.xmlpull.v1.XmlPullParserException; +import org.xmlpull.v1.XmlPullParserFactory; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map.Entry; + +/** + * 앱을 실행할때 시작 프로젝트를 동적으로 선택할수 있는 디버깅용 액티비티 입니다. + * 사용 방법은 폰의 기본저장소 루트 경로에 n14_devFeature.xml 파일의 존재유무 입니다. + * 파일이 없다면 이 액티비티를 무시한채 기존 NexacroUpdatorActivity.java에 설정된 시작 url로 프로젝트가 시작하게 됩니다. + * + * 이미 시작 프로젝트가 적용된후 다른 프로젝트로 전환하고 싶은 경우에는 "기존 꺼 삭제" 를 클릭하시면 됩니다. + * + * n14_devFeature.xml 파일 예) + * + * + * + * + * + * + * + */ + +public class ProjectSelectActivity extends Activity{ + private static final String LOG_TAG = "ProjectSelectActivity"; + + LinkedHashMap updateUrlList = new LinkedHashMap(); + + private AlertDialog dialog; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + boolean darkTheme = false; + + /* dark */ + if (darkTheme) { + if (Build.VERSION.SDK_INT >= 21 /*Build.VERSION_CODES.LOLLIPOP */) { + setTheme(android.R.style.Theme_Material); + } + else if (Build.VERSION.SDK_INT >= 11 /*Build.VERSION_CODES.HONEYCOMB*/) { + setTheme(android.R.style.Theme_Holo); + } + else { + setTheme(android.R.style.Theme_Black); + } + } + /* light */ + else { + if (Build.VERSION.SDK_INT >= 21 /*Build.VERSION_CODES.LOLLIPOP */) { + setTheme(android.R.style.Theme_Material_Light); + } + else if (Build.VERSION.SDK_INT >= 11 /*Build.VERSION_CODES.HONEYCOMB*/) { + setTheme(android.R.style.Theme_Holo_Light); + } + else { + setTheme(android.R.style.Theme_Light); + } + } + + requestWindowFeature(Window.FEATURE_NO_TITLE); + + // Possible work around for market launches. See http://code.google.com/p/android/issues/detail?id=2373 + // for more details. Essentially, the market launches the main activity on top of other activities. + // we never want this to happen. Instead, we check if we are the root and if not, we finish. + if (!isTaskRoot()) { + final Intent intent = getIntent(); + if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(intent.getAction())) { + finish(); + return; + } + } + } + + @Override + public void onResume() { + super.onResume(); + + if (Build.VERSION.SDK_INT >= 23 /*Build.VERSION_CODES.M*/) { + if (!requestPermisions(new String[]{ + Manifest.permission.READ_EXTERNAL_STORAGE, + Manifest.permission.WRITE_EXTERNAL_STORAGE})) { + start(); + } + } + else { + start(); + } + } + + @Override + public void onPause() { + super.onPause(); + if(dialog != null){ + dialog.dismiss(); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + start(); + } + + private void start() { + checkDebugFile(); + + if (updateUrlList.size() > 0) { + showProjectSelector(); + } else { + Intent intent = new Intent(ProjectSelectActivity.this, getStartActivityClass()); + startActivity(intent); + finish(); + } + } + + private static final int REQUEST_PERMISIONS = 100; + + private boolean requestPermisions(final @NonNull String[] permissions) { + + ArrayList grantedPermissions = new ArrayList(); + ArrayList deniedPermissions = new ArrayList(); + ArrayList deniedOpPermissions = new ArrayList(); + + for (String permission : permissions) { + switch (PermissionChecker.checkSelfPermission(this, permission)) { + case PermissionChecker.PERMISSION_GRANTED: { + grantedPermissions.add(permission); + break; + } + case PermissionChecker.PERMISSION_DENIED: { + deniedPermissions.add(permission); + break; + } + case PermissionChecker.PERMISSION_DENIED_APP_OP: { + deniedOpPermissions.add(permission); + break; + } + default: { + deniedPermissions.add(permission); + break; + } + } + } + + ArrayList requestPermissions = new ArrayList(); + ArrayList rationalPermissions = new ArrayList(); + if (deniedPermissions.size() > 0) + requestPermissions.addAll(deniedPermissions); + //if (deniedOpPermissions.size() > 0) + // requestPermissions.addAll(deniedOpPermissions); + + for (String permission : requestPermissions) { + if (ActivityCompat.shouldShowRequestPermissionRationale(this, permission)) { + rationalPermissions.add(permission); + } + } + + if (requestPermissions.size() <= 0) + return false; + + ActivityCompat.requestPermissions(this, requestPermissions.toArray(new String[requestPermissions.size()]), REQUEST_PERMISIONS); + return true; + } + + private void checkDebugFile() { + XmlPullParserFactory factory; + try { + factory = XmlPullParserFactory.newInstance(); + factory.setNamespaceAware(true); + XmlPullParser parser = factory.newPullParser(); + File file = new File(Environment.getExternalStorageDirectory()+ "/n14_devFeature.xml"); + FileInputStream fis = new FileInputStream(file); + parser.setInput(new InputStreamReader(fis)); + + while(parser.getEventType() != XmlPullParser.END_DOCUMENT) { + if(parser.getEventType() == XmlPullParser.START_TAG) { + if(parser.getName().equals("Project")) { + updateUrlList.put(parser.getAttributeValue(0), parser.getAttributeValue(1)); + } + } + parser.next(); + } + } catch (XmlPullParserException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (FileNotFoundException e) { + Log.d(LOG_TAG, "debugging file not exist!"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private void showProjectSelector() { + List projectItems = new ArrayList(); + + for(Entry e : updateUrlList.entrySet()) { + String key = e.getKey(); + projectItems.add(key); + } + + final CharSequence[] items = projectItems.toArray(new String[projectItems.size()]); + AlertDialog.Builder builder = new AlertDialog.Builder(ProjectSelectActivity.this); + builder.setTitle("시작 프로젝트를 선택해 주세요."); + builder.setCancelable(false); + + builder.setSingleChoiceItems(items, 0, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + Intent intent = new Intent(ProjectSelectActivity.this, getStartActivityClass()); + intent.putExtra("bootstrapURL", getUpdateUrl(items[whichButton].toString())); + intent.putExtra("projectUrl", getProjectUrl(items[whichButton].toString())); + startActivity(intent); + finish(); + } + }).setPositiveButton("하드 코딩 된 값 로드", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + Intent intent = new Intent(ProjectSelectActivity.this, getStartActivityClass()); + startActivity(intent); + finish(); + } + }).setNegativeButton("기존 꺼 삭제", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + clearApplicationData(); + } + }); + + dialog = builder.create(); + dialog.show(); + } + + private String getUpdateUrl(String key) { + return updateUrlList.get(key); + } + + private String getProjectUrl(String key) { + String projectUrl; + projectUrl = updateUrlList.get(key); + projectUrl = projectUrl.substring(0, projectUrl.lastIndexOf("/")+1); + return projectUrl; + } + + public void clearApplicationData() { + File cache = getCacheDir(); + File appDir = new File(cache.getParent()); + if (appDir.exists()) { + String[] children = appDir.list(); + for (String s : children) { + if (!s.equals("lib")) { + deleteDir(new File(appDir, s)); + Log.i("TAG", "**************** File " + appDir.getAbsolutePath() + "/" + s + " DELETED *******************"); + } + } + } + + cache = getExternalCacheDir(); + appDir = new File(cache.getParent()); + if (appDir.exists()) { + String[] children = appDir.list(); + for (String s : children) { + if (!s.equals("lib")) { + deleteDir(new File(appDir, s)); + Log.i("TAG", "**************** File " + appDir.getAbsolutePath() + "/" + s + " DELETED *******************"); + } + } + } + + Toast.makeText(getApplicationContext(), "기존 프로젝트가 삭제 되었습니다.", Toast.LENGTH_SHORT).show(); + + showProjectSelector(); + } + + public static boolean deleteDir(File dir) { + if (dir != null && dir.isDirectory()) { + String[] children = dir.list(); + for (int i = 0; i < children.length; i++) { + boolean success = deleteDir(new File(dir, children[i])); + if (!success) { + return false; + } + } + } + + return dir.delete(); + } + + public Class getStartActivityClass() + { + ActivityManager activitymanager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE); + + List runningtaskinfo = activitymanager.getRunningTasks(1); + String currentPackageName = runningtaskinfo.get(0).baseActivity.getPackageName(); + + Class startActivityClass = null; + + if(currentPackageName.equals("com.nexacro")) { + startActivityClass = NexacroUpdatorActivity.class; + } else { + ClassLoader loader = ProjectSelectActivity.class.getClassLoader(); + try { + startActivityClass = (Class) loader.loadClass("nexacro.launcher.MainActivity"); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + return startActivityClass; + } +} diff --git a/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/UserCustomActivity.java b/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/UserCustomActivity.java new file mode 100644 index 0000000..ef2085a --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/src/main/java/nexacro/launcher/UserCustomActivity.java @@ -0,0 +1,55 @@ +package nexacro.launcher; + +import android.content.Context; +import android.os.Bundle; +import android.support.v4.app.FragmentActivity; +import android.view.View; +import android.widget.Button; +import android.widget.CompoundButton; +import android.widget.Toast; +import android.widget.ToggleButton; + +import com.nexacro.view.NexacroLayout; + +public class UserCustomActivity extends FragmentActivity { + final Context context = this; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(getResources().getIdentifier("user_custom", "layout", getPackageName())); + + Button btn = (Button)findViewById(R.id.button); + btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Toast.makeText(UserCustomActivity.this, "Android button component click.", Toast.LENGTH_SHORT).show(); + } + }); + + ToggleButton toggleButton = (ToggleButton) findViewById(R.id.toggleButton); + toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + NexacroLayout nexacroLayout = (NexacroLayout) findViewById(R.id.nexacro_layout); + if (isChecked) { + nexacroLayout.setVisibility(View.VISIBLE); + } else { + nexacroLayout.setVisibility(View.INVISIBLE); + } + } + }); + + } + + @Override + protected void onResume() { + super.onResume(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + } +} diff --git a/Nexacro14/Android/nexacro14_android/app/src/main/res/layout/user_custom.xml b/Nexacro14/Android/nexacro14_android/app/src/main/res/layout/user_custom.xml new file mode 100644 index 0000000..7f5e964 --- /dev/null +++ b/Nexacro14/Android/nexacro14_android/app/src/main/res/layout/user_custom.xml @@ -0,0 +1,53 @@ + + + + + + + +