Skip to content
Open
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
1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/Project_Default.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

18 changes: 1 addition & 17 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="recyclerview-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
<orderEntry type="library" exported="" name="design-23.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="autobahn-0.5.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
<orderEntry type="library" exported="" name="design-23.1.1" level="project" />
</component>
</module>
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
defaultConfig {
applicationId "alon24.smartcarandroid"
minSdkVersion 15
targetSdkVersion 23
targetSdkVersion 18
versionCode 1
versionName "1.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,24 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
public void OnMoved(int pan, int tilt) {
txtX.setText(Integer.toString(pan));
txtY.setText(Integer.toString(tilt));
String cmd = String.format("%s %d %d", CAR_COMMAND, pan, tilt);
String cmd = String.format("{\"JSTK\":[%d,%d]}", pan, tilt);
mCallback.onCarChangeDirectionCommand(cmd);
}

@Override
public void OnReleased() {
txtX.setText("stopped");
txtY.setText("stopped");
String cmd = String.format("%s %d %d", CAR_COMMAND, 0, 0);
String cmd = String.format("{\"JSTK\":[%d,%d]}", 0, 0);
mCallback.onCarChangeDirectionCommand(cmd);
}
};

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
updateUI();
String cmd = String.format("%s 4 %d %d", FREQ_COMMAND, freqBar.getProgress(), pwrBar.getProgress());
String cmd = String.format("{\"BAR\":[%d,%d]}", freqBar.getProgress(), pwrBar.getProgress());
mCallback.onCarChangeDirectionCommand(cmd);

}

@Override
Expand Down
21 changes: 6 additions & 15 deletions app/src/main/java/alon24/smartcarandroid/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener, View.OnClickListener, CompoundButton.OnCheckedChangeListener, TextWatcher, CarMoveListener {

private static String TAG = "SmartCar";
private String CONTROLLER_TYPE = "conteoller";
private String CONTROLLER_TYPE = "controller";
// private WebSocketClient mWebSocketClient;
WifiManager wifi;
String wifis[];
Expand Down Expand Up @@ -76,15 +76,6 @@ protected void onCreate(Bundle savedInstanceState) {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "מצא מכונית והתחבר", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
Expand Down Expand Up @@ -421,25 +412,25 @@ private void updateUI() {
@Override
public void run() {
if (!connectModeSwitch.isChecked()) {
connectModeSwitch.setText("מכובה");
connectModeSwitch.setText("Mode not Checked");
connectBtn.setEnabled(false);
connectBtn.setText("מנותק!");
connectBtn.setText("Not enabled");
connectBtn.setEnabled(false);
if (mConnection != null && mConnection.isConnected()) {
mConnection.disconnect();
}
}
else {
connectModeSwitch.setText("מאופשר");
connectModeSwitch.setText("Switch");
connectBtn.setEnabled(true);
if (isConnecting) {
connectBtn.setText("trying to connect!");
connectBtn.setEnabled(true);
} else if (isConnected) {
connectBtn.setText("מחובר!");
connectBtn.setText("connected");
// connectBtn.setEnabled(true);
} else {
connectBtn.setText("התחבר");
connectBtn.setText("Not conected");
// connectBtn.setEnabled(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

View view = inflater.inflate(R.layout.table_control_fragment, container, false);

repeatListener = new RepeatListener(0,100, this);
repeatListener = new RepeatListener(0,250, this);
((Button) view.findViewById(R.id.upBtn)).setOnTouchListener(repeatListener);

((Button)view.findViewById(R.id.downBtn)).setOnTouchListener(repeatListener);
Expand Down Expand Up @@ -93,7 +93,7 @@ public void onClick(View v) {
}

private void sendMoveXYMessage(int x, int y) {
String cmd = String.format("%s %d %d", CAR_COMMAND, x, y);
String cmd = String.format("{\"BTN\":[%d,%d]}", x, y);
mCallback.onCarChangeDirectionCommand(cmd);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class JoystickView extends View {

private Handler handler = new Handler();
private int initialInterval;
private final int normalInterval = 100;
private final int normalInterval = 250;

private Runnable handlerRunnable = new Runnable() {
@Override
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/layout/app_bar_main2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,4 @@

<include layout="@layout/content_main" />

<android.support.design.widget.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:src="@android:drawable/ic_dialog_email" />

</android.support.design.widget.CoordinatorLayout>
8 changes: 4 additions & 4 deletions app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_main2" tools:context=".MainActivity">

<TextView android:text="המכונית של תום" android:layout_width="wrap_content"
<TextView android:text="@string/textViewText" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textSize="30dp"
Expand All @@ -23,7 +23,7 @@
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="מאופשר"
android:text="Switch"
android:id="@+id/connectModeSwitch"
android:checked="false"
android:layout_below="@id/textView"
Expand All @@ -33,7 +33,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/carIpText"
android:text="192.168.4.1"
android:text="10.0.0.217"
android:textAlignment="center"
android:layout_below="@+id/textView"
android:layout_alignParentLeft="true"
Expand All @@ -45,7 +45,7 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="התחבר"
android:text="Connect Status"
android:id="@+id/connectStateBtn"
android:checked="false"
android:enabled="false"
Expand Down
25 changes: 14 additions & 11 deletions app/src/main/res/layout/joystick_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<alon24.smartcarandroid.joystick.JoystickView
android:id="@+id/joystickView" android:layout_gravity="center_horizontal"
android:id="@+id/joystickView"
android:layout_marginTop="20dip" android:layout_width="175dip"
android:layout_height="175dip" />
<TableLayout android:layout_width="wrap_content"
Expand All @@ -25,26 +25,27 @@
android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
</TableRow>
</TableLayout>

</LinearLayout>

<SeekBar
android:layout_width="match_parent"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:id="@+id/freqSeekeBar"
android:layout_marginBottom="16dp"
android:layout_marginTop="20dp"
android:max="200"
android:progress="40"
android:max="100"
android:progress="50"
android:indeterminate="false" />

<SeekBar
android:layout_width="match_parent"
android:layout_width="346dp"
android:layout_height="wrap_content"
android:id="@+id/PWRSeekBar"
android:layout_marginBottom="16dp"
android:layout_marginTop="20dp"
android:max="1023"
android:progress="500"
android:max="100"
android:progress="50"
android:indeterminate="false" />

<TextView
Expand All @@ -56,10 +57,12 @@
android:id="@+id/freqPwrLab" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="stop"
android:id="@+id/stopBtn"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BStop"
android:id="@+id/stopBtn"
android:enabled="true" />

<!--<alon24.smartcarandroid.joystick.JoystickView-->
<!--android:id="@+id/joystickView" android:layout_gravity="center_horizontal"-->
<!--android:layout_marginTop="20dip" android:layout_width="175dip"-->
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/res/layout/table_control_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ android:id="@+id/linearLayout">
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:text="מ ק.שמאלה"
android:text="@string/upLeftBtnText"
android:id="@+id/upLeftBtn"
android:background="@android:color/holo_purple"
/>
Expand All @@ -25,12 +25,12 @@ android:id="@+id/linearLayout">
android:layout_weight="1"
android:background="@android:color/holo_blue_light"
android:id="@+id/upBtn"
android:text="קדימה" />
android:text="@string/upBtnText" />
<Button
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:text="מ ק.ימינה"
android:text="@string/upRightBtnText"
android:id="@+id/upRightBtn"
android:background="@android:color/holo_purple"/>
</LinearLayout>
Expand All @@ -45,22 +45,22 @@ android:id="@+id/linearLayout">
android:layout_weight="1"
android:background="@android:color/holo_blue_light"
android:id="@+id/leftBtn"
android:text="שמאלה" />
android:text="@string/leftBtnText" />

<Button
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:background="@android:color/holo_red_dark"
android:id="@+id/stopBtn"
android:text="עצור" />
android:text="@string/stopBtnText" />
<Button
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:background="@android:color/holo_blue_light"
android:id="@+id/rightBtn"
android:text="ימינה" />
android:text="@string/rightBtnText" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
Expand All @@ -71,7 +71,7 @@ android:id="@+id/linearLayout">
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:text="מ א.שמאלה"
android:text="@string/downLeftBtnText"
android:id="@+id/downRightBtn"
android:background="@android:color/holo_purple"/>

Expand All @@ -80,13 +80,13 @@ android:id="@+id/linearLayout">
android:layout_height="80dp"
android:layout_weight="1"
android:id="@+id/downBtn"
android:text="אחורה"
android:text="@string/downBtnText"
android:background="@android:color/holo_blue_light"/>
<Button
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:text="מ א.ימינה"
android:text="@string/downRightBtnText"
android:id="@+id/downLeftBtn"
android:background="@android:color/holo_purple"/>
</LinearLayout>
Expand Down
Loading