Skip to content

Commit

Permalink
drop xml for activity
Browse files Browse the repository at this point in the history
  • Loading branch information
thermatk committed Nov 15, 2017
1 parent f294917 commit d94693b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import android.os.Bundle;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.Switch;
import android.widget.TextView;

public class OptionActivity extends Activity implements Switch.OnCheckedChangeListener {

Expand All @@ -32,7 +35,7 @@ public void onClick(DialogInterface dialogInterface, int i) {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
hideIconSwitch.setChecked(false);
hideIconSwitch.setVisibility(View.GONE);
}
})
.create()
Expand All @@ -42,9 +45,27 @@ public void onClick(DialogInterface dialogInterface, int i) {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_option);

hideIconSwitch = (Switch) findViewById(R.id.hide_icon_switch);
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(LinearLayout.VERTICAL);
int padding = SixteenDpFromPix();
linearLayout.setPadding(padding,padding,padding,padding);

TextView textView = new TextView(this);
textView.setText(R.string.hello);
linearLayout.addView(textView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

hideIconSwitch = new Switch(this);
hideIconSwitch.setText(R.string.hide_icon);
linearLayout.addView(hideIconSwitch, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

setContentView(linearLayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));

hideIconSwitch.setOnCheckedChangeListener(this);
}

private int SixteenDpFromPix() {
float scale = getResources().getDisplayMetrics().density;
return (int) (16 * scale + 0.5f);
}
}
23 changes: 0 additions & 23 deletions app/src/main/res/layout/activity_option.xml

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/main/res/values-sw720dp-land/dimens.xml

This file was deleted.

7 changes: 0 additions & 7 deletions app/src/main/res/values/dimens.xml

This file was deleted.

4 changes: 1 addition & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="hello_world">Нечего настраивать :) Приложение работает само, если может.</string>
<string name="hello">Нечего настраивать :) Приложение работает само, если может.</string>
<string name="connectedto">Подключён к HSE</string>
<string name="authsent">Запрос на аутентификацию отправлен</string>
<string name="hide_icon">Скрывать значок приложения</string>

</resources>

0 comments on commit d94693b

Please sign in to comment.