Skip to content

Commit

Permalink
Removes ANNOING warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mariogrip committed Nov 3, 2014
1 parent 7610ab4 commit 5f5ea5f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 6 deletions.
16 changes: 12 additions & 4 deletions app/src/main/java/com/mariogrip/octodroid/Activity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.AlertDialog;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
Expand Down Expand Up @@ -110,16 +111,22 @@ public void onDrawerOpened(View drawerView) {
selectItem(0);
}
prefs = PreferenceManager.getDefaultSharedPreferences(Activity.this);

ip = prefs.getString("ip", "localhost");
key = prefs.getString("api", "0");
senderr = prefs.getBoolean("err", true);
push = prefs.getBoolean("push", true);

running = false;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Warning!");
builder.setMessage("I understand that this application is experimental and might crash. There are some functions that do not work like push notifications. Please report bugs!");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
SharedPreferences sharedPref = Activity.this.getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putBoolean("warning", false);
editor.commit();
dialog.dismiss();
}
});
Expand All @@ -129,7 +136,10 @@ public void onClick(DialogInterface dialog, int id) {
}
});
AlertDialog dialog = builder.create();
dialog.show();
SharedPreferences sharedPref = Activity.this.getPreferences(Context.MODE_PRIVATE);
if (sharedPref.getBoolean("warning", true)){
dialog.show();
}
logD("Done!");
}
public void startrunner(){
Expand Down Expand Up @@ -201,8 +211,6 @@ public void runner(){
timerTask = new TimerTask() {
@Override
public void run() {


Activity.this.runOnUiThread(new Runnable() {
public void run() {
if (!server_status){
Expand Down Expand Up @@ -338,7 +346,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
public void onPause(){
super.onPause();
running = false;
timerTask.cancel();
timerTask.cancel(); //TODO CRASH NullPointerException
}
public void onResume(){
super.onResume();
Expand Down
49 changes: 49 additions & 0 deletions app/src/main/res/layout/controls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,53 @@

</RelativeLayout>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Z"
android:id="@+id/buttonZ"
android:layout_toRightOf="@id/button_down"
android:layout_below="@id/button_right"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Y"
android:id="@+id/buttonY"
android:layout_above="@+id/button_home"
android:layout_toLeftOf="@id/buttonUp" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="X"
android:id="@+id/buttonX"
android:layout_above="@+id/button_home"
android:layout_toRightOf="@id/buttonUp" />

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start Print"
android:id="@+id/button_start"
android:layout_below="@id/layout1"
android:layout_alignParentRight="true"
/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pause Print"
android:id="@+id/button_pause"
android:layout_below="@id/layout1"
android:layout_centerHorizontal="true"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stop Print"
android:id="@+id/button_stop"
android:layout_below="@id/layout1"
/>

</RelativeLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/status_tab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@



</RelativeLayout>
</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:background="#9f000000"
Expand Down Expand Up @@ -292,4 +292,5 @@
android:layout_toEndOf="@id/textView22"
android:layout_toRightOf="@id/textView22"/>
</RelativeLayout>

</RelativeLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/naw.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string-array name="nawbars">
<item>Status</item>
<item>Controls</item>
<item>Controls-WORK-IN-PROGRESS</item>
</string-array>
<string name="drawer_open">Open navigation drawer</string>
<string name="drawer_close">Close navigation drawer</string>
Expand Down

0 comments on commit 5f5ea5f

Please sign in to comment.