Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android CHIP demo app #1412

Merged
merged 1 commit into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/android/CHIPTool/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
.gradle
/local.properties
/.idea/caches
/.idea/codeStyles
/.idea/gradle.xml
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
Expand Down
21 changes: 0 additions & 21 deletions src/android/CHIPTool/.idea/gradle.xml

This file was deleted.

10 changes: 8 additions & 2 deletions src/android/CHIPTool/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 30
Expand All @@ -15,7 +17,7 @@ android {

// NOTE: This build assumes CHIP was configured and built for armeabi-v7a. Deal with
// other archs later when build is sane.
ndk {abiFilters 'armeabi-v7a'}
// ndk {abiFilters 'armeabi-v7a'}
}

buildTypes {
Expand Down Expand Up @@ -52,5 +54,9 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "androidx.core:core-ktx:1.3.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}

2 changes: 2 additions & 0 deletions src/android/CHIPTool/app/libs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory will contain any .jar files required by the CHIPTool demo app for
Android.
2 changes: 1 addition & 1 deletion src/android/CHIPTool/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</intent-filter>
</activity>
<activity
android:name=".BarcodeReaderActivity"
android:name=".setuppayloadscanner.BarcodeReaderActivity"
android:exported="false"
android:screenOrientation="portrait"/>
<activity
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,22 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import com.google.chip.chiptool.setuppayloadscanner.BarcodeReaderActivity;

public class CHIPToolActivity extends AppCompatActivity {

private static int BARCODE_READER_ACTIVITY_REQUEST = 100;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.top_activity);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.top_frame, new CHIPFragment(this))
.add(R.id.top_frame, new CHIPFragment(this))
.commit();
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
}

public static class CHIPFragment extends Fragment {
Expand All @@ -53,7 +52,7 @@ public static class CHIPFragment extends Fragment {
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.xml.root_fragment, container, false);
return inflater.inflate(R.layout.root_fragment, container, false);
}

@Override
Expand All @@ -63,8 +62,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
button.setOnClickListener(
new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(activity, BarcodeReaderActivity.class);
startActivityForResult(intent, BarcodeReaderActivity.BARCODE_READER_ACTIVITY_REQUEST);
startActivity(new Intent(activity, BarcodeReaderActivity.class));
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public ConnectionStatusFragment() {}
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View inflated = inflater.inflate(R.xml.connection_status_fragment, container, false);
View inflated = inflater.inflate(R.layout.connection_status_fragment, container, false);

TextView statusView = (TextView) inflated.findViewById(R.id.connection_status);
statusView.setText(CHIPNativeBridge.getInstance().getConnectionInfo());
// statusView.setText(CHIPNativeBridge.getInstance().getConnectionInfo());

return inflated;
}
Expand All @@ -50,7 +50,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {

private void updateStatusInternal() {
TextView statusView = (TextView) getView().findViewById(R.id.connection_status);
statusView.setText(CHIPNativeBridge.getInstance().getConnectionInfo());
// statusView.setText(CHIPNativeBridge.getInstance().getConnectionInfo());
}

// Should be called by an activity after status connection has changed or when the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static class EchoClientFragment extends Fragment {
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View inflated = inflater.inflate(R.xml.echo_client_fragment, container, false);
View inflated = inflater.inflate(R.layout.echo_client_fragment, container, false);

inflated.findViewById(R.id.send_echo_request).setOnClickListener(activity);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static class OnOffFragment extends Fragment {
@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View inflated = inflater.inflate(R.xml.on_off_fragment, container, false);
View inflated = inflater.inflate(R.layout.on_off_fragment, container, false);

inflated.findViewById(R.id.send_on_request).setOnClickListener(activity);

Expand Down
Loading