updated arduino and android example
This commit is contained in:
@@ -8,6 +8,7 @@ android {
|
||||
minSdkVersion 26
|
||||
versionCode 7
|
||||
versionName '1.5.0'
|
||||
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -39,11 +40,11 @@ dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
||||
|
||||
implementation 'net.irext.webapi:irext-androidapi:1.5.1'
|
||||
implementation 'net.irext.webapi:irext-androidapi:1.5.2'
|
||||
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
implementation 'com.android.support:design:28.0.0'
|
||||
implementation 'com.android.support:support-v4:28.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||
implementation 'androidx.core:core:1.13.1'
|
||||
implementation 'com.google.android.material:material:1.13.0'
|
||||
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package net.irext.ircontrol.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.MenuItem;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import net.irext.ircontrol.R;
|
||||
import net.irext.ircontrol.ui.fragment.ControlFragment;
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@ package net.irext.ircontrol.ui.activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import net.irext.ircontrol.R;
|
||||
import net.irext.ircontrol.ui.fragment.*;
|
||||
import net.irext.ircontrol.utils.MessageUtil;
|
||||
@@ -53,6 +54,18 @@ public class CreateActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_create);
|
||||
|
||||
OnBackPressedCallback callback = new OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public void handleOnBackPressed() {
|
||||
if (null == mFragment) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
mFragment.onBackPressed();
|
||||
}
|
||||
};
|
||||
getOnBackPressedDispatcher().addCallback(this, callback);
|
||||
|
||||
mMsgHandler = new MsgHandler(this);
|
||||
|
||||
mFragments = new ArrayList<>();
|
||||
@@ -75,17 +88,6 @@ public class CreateActivity extends AppCompatActivity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (null == mFragment) {
|
||||
this.finish();
|
||||
super.onBackPressed();
|
||||
return;
|
||||
}
|
||||
mFragment.onBackPressed();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void switchPage(int next, Integer from) {
|
||||
BaseCreateFragment fragment = mFragments.get(next);
|
||||
Bundle bundle = new Bundle();
|
||||
|
||||
@@ -3,20 +3,19 @@ package net.irext.ircontrol.ui.activity;
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import net.irext.ircontrol.R;
|
||||
import net.irext.ircontrol.bean.RemoteControl;
|
||||
import net.irext.ircontrol.ui.fragment.MainFragment;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package net.irext.ircontrol.ui.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import net.irext.ircontrol.ui.activity.CreateActivity;
|
||||
import net.irext.ircontrol.utils.MessageUtil;
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ package net.irext.ircontrol.ui.fragment;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import net.irext.ircontrol.IRApplication;
|
||||
import net.irext.ircontrol.R;
|
||||
import net.irext.ircontrol.ui.activity.CreateActivity;
|
||||
@@ -22,7 +22,6 @@ import net.irext.webapi.model.Brand;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Filename: BrandFragment.java
|
||||
@@ -97,7 +96,7 @@ public class BrandFragment extends BaseCreateFragment {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
getFrom();
|
||||
View view = inflater.inflate(R.layout.fragment_brand, container, false);
|
||||
mApp = (IRApplication) Objects.requireNonNull(getActivity()).getApplication();
|
||||
mApp = (IRApplication) requireActivity().getApplication();
|
||||
|
||||
mMsgHandler = new MsgHandler(this);
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@ package net.irext.ircontrol.ui.fragment;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import net.irext.decode.sdk.utils.Constants;
|
||||
import net.irext.ircontrol.IRApplication;
|
||||
import net.irext.ircontrol.R;
|
||||
@@ -95,7 +95,7 @@ public class CategoryFragment extends BaseCreateFragment {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
mFrom = -1;
|
||||
View view = inflater.inflate(R.layout.fragment_category, container, false);
|
||||
mApp = (IRApplication) Objects.requireNonNull(getActivity()).getApplication();
|
||||
mApp = (IRApplication) requireActivity().getApplication();
|
||||
|
||||
mMsgHandler = new MsgHandler(this);
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.irext.ircontrol.ui.fragment;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -11,6 +10,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import net.irext.ircontrol.IRApplication;
|
||||
import net.irext.ircontrol.R;
|
||||
import net.irext.ircontrol.ui.activity.CreateActivity;
|
||||
@@ -209,7 +209,7 @@ public class CityFragment extends BaseCreateFragment {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
getFrom();
|
||||
View view = inflater.inflate(R.layout.fragment_city, container, false);
|
||||
mApp = (IRApplication) Objects.requireNonNull(getActivity()).getApplication();
|
||||
mApp = (IRApplication) requireActivity().getApplication();
|
||||
|
||||
mMsgHandler = new MsgHandler(this);
|
||||
|
||||
|
||||
@@ -6,14 +6,13 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Vibrator;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.*;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import net.irext.decode.sdk.IRDecode;
|
||||
import net.irext.decode.sdk.bean.ACStatus;
|
||||
import net.irext.decode.sdk.utils.Constants;
|
||||
@@ -22,8 +21,15 @@ import net.irext.ircontrol.bean.RemoteControl;
|
||||
import net.irext.ircontrol.ui.activity.ControlActivity;
|
||||
import net.irext.ircontrol.utils.FileUtils;
|
||||
import net.irext.ircontrol.utils.MessageUtil;
|
||||
import net.irext.ircontrol.utils.ToastUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* Filename: ControlFragment.java
|
||||
@@ -56,6 +62,11 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
||||
private static final int KEY_HOME = 9;
|
||||
private static final int KEY_MENU = 10;
|
||||
|
||||
private static final int EMITTER_PORT = 8000;
|
||||
|
||||
private Socket emitterConn = null;
|
||||
private int emitterConnected = 0;
|
||||
|
||||
private MsgHandler mHandler;
|
||||
|
||||
private ControlActivity mParent;
|
||||
@@ -78,17 +89,17 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
||||
mParent = (ControlActivity)getActivity();
|
||||
View view = inflater.inflate(R.layout.fragment_control, container, false);
|
||||
|
||||
ImageButton mBtnPower = (ImageButton) view.findViewById(R.id.iv_power);
|
||||
ImageButton mBtnBack = (ImageButton) view.findViewById(R.id.iv_back);
|
||||
ImageButton mBtnHome = (ImageButton) view.findViewById(R.id.iv_home);
|
||||
ImageButton mBtnMenu = (ImageButton) view.findViewById(R.id.iv_menu);
|
||||
ImageButton mBtnUp = (ImageButton) view.findViewById(R.id.iv_up);
|
||||
ImageButton mBtnDown = (ImageButton) view.findViewById(R.id.iv_down);
|
||||
ImageButton mBtnLeft = (ImageButton) view.findViewById(R.id.iv_left);
|
||||
ImageButton mBtnRight = (ImageButton) view.findViewById(R.id.iv_right);
|
||||
ImageButton mBtnOK = (ImageButton) view.findViewById(R.id.iv_ok);
|
||||
ImageButton mBtnPlus = (ImageButton) view.findViewById(R.id.iv_plus);
|
||||
ImageButton mBtnMinus = (ImageButton) view.findViewById(R.id.iv_minus);
|
||||
ImageButton mBtnPower = view.findViewById(R.id.iv_power);
|
||||
ImageButton mBtnBack = view.findViewById(R.id.iv_back);
|
||||
ImageButton mBtnHome = view.findViewById(R.id.iv_home);
|
||||
ImageButton mBtnMenu = view.findViewById(R.id.iv_menu);
|
||||
ImageButton mBtnUp = view.findViewById(R.id.iv_up);
|
||||
ImageButton mBtnDown = view.findViewById(R.id.iv_down);
|
||||
ImageButton mBtnLeft = view.findViewById(R.id.iv_left);
|
||||
ImageButton mBtnRight = view.findViewById(R.id.iv_right);
|
||||
ImageButton mBtnOK = view.findViewById(R.id.iv_ok);
|
||||
ImageButton mBtnPlus = view.findViewById(R.id.iv_plus);
|
||||
ImageButton mBtnMinus = view.findViewById(R.id.iv_minus);
|
||||
|
||||
mBtnPower.setOnClickListener(this);
|
||||
mBtnBack.setOnClickListener(this);
|
||||
@@ -102,6 +113,23 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
||||
mBtnPlus.setOnClickListener(this);
|
||||
mBtnMinus.setOnClickListener(this);
|
||||
|
||||
CheckBox mCbUseEmitter = view.findViewById(R.id.cb_use_emitter);
|
||||
EditText mEtEmitterIp = view.findViewById(R.id.emitter_ip);
|
||||
ImageButton mBtnConnect = view.findViewById(R.id.btn_connection_status);
|
||||
|
||||
mBtnConnect.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String emitterIp = mEtEmitterIp.getText().toString();
|
||||
if (android.net.InetAddresses.isNumericAddress(emitterIp)) {
|
||||
connectToEmitter(emitterIp, String.valueOf(EMITTER_PORT));
|
||||
} else {
|
||||
ToastUtils.showToast(mParent, mParent.getString(R.string.input_emitter_ip_address), null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -145,7 +173,6 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
||||
mIRDecode.closeBinary();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private int[] irControl(int keyCode) {
|
||||
int inputKeyCode;
|
||||
ACStatus acStatus = new ACStatus();
|
||||
@@ -205,6 +232,69 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
||||
return mIRDecode.decodeBinary(inputKeyCode, acStatus, 0);
|
||||
}
|
||||
|
||||
private void onEmitterDisconnected() {
|
||||
if (1 == emitterConnected) {
|
||||
Log.d(TAG, "emitter disconnected");
|
||||
} else {
|
||||
Log.d(TAG, "emitter disconnected");
|
||||
}
|
||||
|
||||
mParent.runOnUiThread(() -> {
|
||||
if (1 == emitterConnected) {
|
||||
ToastUtils.showToast(mParent, mParent.getString(R.string.connect_failed), Toast.LENGTH_SHORT);
|
||||
} else {
|
||||
ToastUtils.showToast(mParent, mParent.getString(R.string.connect_disconnected), Toast.LENGTH_SHORT);
|
||||
}
|
||||
});
|
||||
|
||||
emitterConnected = 0;
|
||||
}
|
||||
|
||||
private void onEmitterResponse(String line) {
|
||||
Log.d(TAG, "emitter: " + line);
|
||||
}
|
||||
|
||||
private void sendDecodedToEmitter(String value) {
|
||||
new Thread(() -> {
|
||||
try {
|
||||
PrintWriter out = new PrintWriter(emitterConn.getOutputStream(), true);
|
||||
out.println(value);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void connectToEmitter(String ipAddress, String port) {
|
||||
if (0 == emitterConnected) {
|
||||
if (null == ipAddress || null == port) {
|
||||
return;
|
||||
}
|
||||
new Thread(() -> {
|
||||
try {
|
||||
emitterConn = new Socket(ipAddress, Integer.parseInt(port));
|
||||
emitterConn.setKeepAlive(true);
|
||||
emitterConnected = 1;
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(emitterConn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
onEmitterResponse(line);
|
||||
}
|
||||
onEmitterDisconnected();
|
||||
} catch (IOException ioException) {
|
||||
onEmitterDisconnected();
|
||||
}
|
||||
}).start();
|
||||
} else {
|
||||
try {
|
||||
emitterConnected = 0;
|
||||
emitterConn.close();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// control
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -242,13 +332,16 @@ public class ControlFragment extends Fragment implements View.OnClickListener {
|
||||
decodedValue += ",";
|
||||
}
|
||||
Log.d(TAG, "decodedValue : " + decodedValue);
|
||||
sendDecodedToEmitter(decodedValue);
|
||||
// send decoded integer array to IR emitter
|
||||
ConsumerIrManager irEmitter =
|
||||
(ConsumerIrManager) mParent.getSystemService(Context.CONSUMER_IR_SERVICE);
|
||||
if (irEmitter.hasIrEmitter()) {
|
||||
if (null != decoded && decoded.length > 0) {
|
||||
if (null != irEmitter && irEmitter.hasIrEmitter()) {
|
||||
if (decoded.length > 0) {
|
||||
irEmitter.transmit(38000, decoded);
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showToast(mParent, this.getString(R.string.ir_not_supported), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.irext.ircontrol.ui.fragment;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -11,6 +10,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import net.irext.ircontrol.IRApplication;
|
||||
import net.irext.ircontrol.bean.RemoteControl;
|
||||
import net.irext.ircontrol.ui.widget.PullToRefreshListView;
|
||||
@@ -212,7 +212,7 @@ public class IndexFragment extends BaseCreateFragment {
|
||||
View view = inflater.inflate(R.layout.fragment_index, container, false);
|
||||
|
||||
mMsgHandler = new MsgHandler(this);
|
||||
mApp = (IRApplication) Objects.requireNonNull(this.getActivity()).getApplication();
|
||||
mApp = (IRApplication) this.requireActivity().getApplication();
|
||||
|
||||
Category category = mParent.getCurrentCategory();
|
||||
Brand brand = mParent.getCurrentBrand();
|
||||
@@ -240,7 +240,6 @@ public class IndexFragment extends BaseCreateFragment {
|
||||
listIndexes();
|
||||
}
|
||||
});
|
||||
|
||||
mIndexList.setOnItemClickListener(new ListView.OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.irext.ircontrol.ui.fragment;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -11,6 +10,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import net.irext.ircontrol.R;
|
||||
import net.irext.ircontrol.bean.RemoteControl;
|
||||
import net.irext.ircontrol.ui.activity.MainActivity;
|
||||
|
||||
@@ -15,8 +15,12 @@ import android.widget.Toast;
|
||||
*/
|
||||
public class ToastUtils {
|
||||
|
||||
public static void showToast(Context context, String text) {
|
||||
int duration = Toast.LENGTH_SHORT;
|
||||
public static void showToast(Context context, String text, Integer specificDuration) {
|
||||
int duration = Toast.LENGTH_LONG;
|
||||
|
||||
if (null != specificDuration) {
|
||||
duration = specificDuration;
|
||||
}
|
||||
|
||||
Toast toast = Toast.makeText(context, text, duration);
|
||||
toast.show();
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="net.irext.ircontrol.ui.activity.ControlActivity">
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="net.irext.ircontrol.ui.activity.CreateActivity">
|
||||
|
||||
<RelativeLayout
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
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"
|
||||
@@ -8,22 +8,21 @@
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="net.irext.ircontrol.ui.activity.MainActivity">
|
||||
|
||||
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/fragment_remote"
|
||||
android:name="net.irext.ircontrol.ui.fragment.MainFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:layout="@layout/fragment_main"/>
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/fragment_remote"
|
||||
android:name="net.irext.ircontrol.ui.fragment.MainFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:layout="@layout/fragment_main"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
android:contentDescription="@string/create_new"
|
||||
app:srcCompat="@mipmap/icon_add"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView android:id="@+id/sv_control"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/sv_control"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_control_panel"
|
||||
android:layout_width="match_parent"
|
||||
@@ -205,8 +208,70 @@
|
||||
android:scaleType="fitCenter"
|
||||
android:contentDescription="@string/button_plus"
|
||||
style="?android:buttonBarButtonStyle"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignParentBottom="true">
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="4dp"
|
||||
android:background="#7F7F7F"/>
|
||||
<CheckBox
|
||||
android:id="@+id/cb_use_emitter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:text="@string/use_emitter"
|
||||
android:checked="false"/>
|
||||
|
||||
</ScrollView>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
tools:ignore="UselessParent">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="60dp"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="18sp"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="@string/emitter_ip">
|
||||
</TextView>
|
||||
<EditText
|
||||
android:id="@+id/emitter_ip"
|
||||
android:layout_width="0dp"
|
||||
android:autofillHints=""
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="18sp"
|
||||
android:hint="@string/default_ip"
|
||||
android:inputType="text"
|
||||
android:layout_height="60dp"
|
||||
android:layout_weight="1">
|
||||
</EditText>
|
||||
<ImageButton
|
||||
android:id="@+id/btn_connection_status"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:src="@mipmap/connect_emitter"
|
||||
android:scaleType="fitCenter"
|
||||
android:contentDescription="@string/connect"
|
||||
style="?android:buttonBarButtonStyle"/>
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_margin="4dp"
|
||||
android:background="#7F7F7F"/>
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -6,7 +6,7 @@
|
||||
<!-- Public UI -->
|
||||
<string name="ptr_pull_to_refresh">下拉刷新</string>
|
||||
<string name="ptr_release_to_refresh">放开以刷新\r\n(本例程只读取前20个数据)</string>
|
||||
<string name="ptr_refreshing">刷新...</string>
|
||||
<string name="ptr_refreshing">刷新…</string>
|
||||
<string name="ptr_last_updated">已刷新: %1$s</string>
|
||||
|
||||
<!-- Main UI -->
|
||||
@@ -30,5 +30,13 @@
|
||||
<string name="button_ok">确定</string>
|
||||
<string name="button_plus">+</string>
|
||||
<string name="button_minus">-</string>
|
||||
<string name="ir_not_supported">该设备不支持红外发射, 请连接外部模块进行发射</string>
|
||||
|
||||
<string name="emitter_ip">发射端 IP</string>
|
||||
<string name="default_ip">192.168.1.100</string>
|
||||
<string name="connect">连接</string>
|
||||
<string name="use_emitter">使用发射器</string>
|
||||
<string name="input_emitter_ip_address">请输入接收器的 IP 地址</string>
|
||||
<string name="connect_failed">连接失败</string>
|
||||
<string name="connect_disconnected">断开连接</string>
|
||||
</resources>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<!-- Public UI -->
|
||||
<string name="ptr_pull_to_refresh">Pull to refresh</string>
|
||||
<string name="ptr_release_to_refresh">Release to refresh</string>
|
||||
<string name="ptr_refreshing">Refreshing...</string>
|
||||
<string name="ptr_refreshing">Refreshing…</string>
|
||||
<string name="ptr_last_updated">Updated: %1$s</string>
|
||||
|
||||
<!-- Main UI -->
|
||||
@@ -30,5 +30,14 @@
|
||||
<string name="button_ok">OK</string>
|
||||
<string name="button_plus">+</string>
|
||||
<string name="button_minus">-</string>
|
||||
<string name="ir_not_supported">IR emitter is not supported in this device, please try with external emitters</string>
|
||||
|
||||
<string name="emitter_ip">Emitter IP</string>
|
||||
<string name="default_ip">192.168.1.100</string>
|
||||
<string name="connect">connect</string>
|
||||
<string name="use_emitter">Use Emitter</string>
|
||||
<string name="input_emitter_ip_address">Please input IP address of emitter</string>
|
||||
<string name="connect_failed">Connect failed</string>
|
||||
<string name="connect_disconnected">Disconnected</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -10,7 +10,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.1.0'
|
||||
classpath 'com.android.tools.build:gradle:8.12.0'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ org.gradle.jvmargs=-Xmx4096M \
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
android.useDeprecatedNdk=true
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonFinalResIds=false
|
||||
|
||||
android.useAndroidX=true
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
Reference in New Issue
Block a user