Commit 93e70d43 authored by Daniel Wolf's avatar Daniel Wolf

Updated main UI a bit

parent ef19e09d
Subproject commit 15846800dc064d5233bd85ac30eab478eb953057
Subproject commit ded00d8d84c6265e2f5439690aab244d9e8e133f
......@@ -35,6 +35,7 @@ import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;
import com.frostnerd.dnschanger.LogFactory;
......@@ -81,14 +82,13 @@ import java.util.regex.Pattern;
* You can contact the developer at daniel.wolf@frostnerd.com.
*/
public class MainFragment extends Fragment {
private Button startStopButton;
private Switch startStopButton;
private boolean vpnRunning, wasStartedWithTasker = false;
private MaterialEditText met_dns1, met_dns2;
public EditText dns1, dns2;
private static final String LOG_TAG = "[MainActivity]";
private TextView connectionText;
private ImageView connectionImage;
private View running_indicator;
private boolean advancedMode;
public boolean settingV6 = false;
private final BroadcastReceiver serviceStateReceiver = new BroadcastReceiver() {
......@@ -119,8 +119,7 @@ public class MainFragment extends Fragment {
if (vpnRunning) {
connectionText.setText(R.string.running);
if(connectionImage != null)connectionImage.setImageResource(R.drawable.ic_thumb_up);
startStopButton.setText(R.string.stop);
running_indicator.setBackgroundColor(Color.parseColor("#4CAF50"));
startStopButton.setChecked(true);
} else {
TypedValue typedValue = new TypedValue();
Resources.Theme theme = requireContext().getTheme();
......@@ -128,8 +127,7 @@ public class MainFragment extends Fragment {
if(PreferencesAccessor.isEverythingDisabled(requireContext())) connectionText.setText(R.string.info_functionality_disabled);
else connectionText.setText(R.string.not_running);
if(connectionImage != null)connectionImage.setImageResource(R.drawable.ic_thumb_down);
startStopButton.setText(R.string.start);
running_indicator.setBackgroundColor(typedValue.data);
startStopButton.setChecked(false);
}
LogFactory.writeMessage(requireContext(), LOG_TAG, "IndictorState set");
}
......@@ -149,7 +147,6 @@ public class MainFragment extends Fragment {
dns1 = dns2 = null;
connectionText = null;
connectionImage = null;
running_indicator = null;
contentView = null;
}
......@@ -167,8 +164,7 @@ public class MainFragment extends Fragment {
dns2 = (EditText) findViewById(R.id.dns2);
connectionImage = vertical ? null : (ImageView)findViewById(R.id.connection_status_image);
connectionText = (TextView)findViewById(R.id.connection_status_text);
running_indicator = findViewById(R.id.running_indicator);
startStopButton = (Button) findViewById(R.id.startStopButton);
startStopButton = (Switch) findViewById(R.id.startStopButton);
if(settingV6 || PreferencesAccessor.areCustomPortsEnabled(requireContext())){
dns1.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
......
......@@ -28,7 +28,7 @@ import com.frostnerd.utils.apis.dataexchangers.PreferencesExchanger;
*/
public class DataService extends DataExchangeService{
public void handleMessage(Message message){
public boolean handleMessage(Message message){
if(message.replyTo != null){
try {
DataExchanger.executeExchangersAndSendAnswers(Preferences.getInstance(this), message, message.replyTo, PreferencesExchanger.class);
......@@ -36,5 +36,6 @@ public class DataService extends DataExchangeService{
e.printStackTrace();
}
}
return true;
}
}
......@@ -161,22 +161,16 @@
android:maxWidth="64dp" />
</RelativeLayout>
<View
android:id="@+id/running_indicator"
android:layout_width="match_parent"
android:layout_height="9dp" />
<Button
android:id="@+id/startStopButton"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/startStopButton"
android:nextFocusUp="@id/default_dns_view"
android:nextFocusForward="@id/dns1"
android:nextFocusDown="@id/dns1"
android:layout_marginTop="15dp"
android:background="?attr/cardColor"
android:text="@string/start"
android:textColor="#FFF" />
android:layout_marginTop="45dp"
android:layout_gravity="center_horizontal"
android:textColor="#FFF"
/>
</LinearLayout>
</RelativeLayout>
......@@ -105,23 +105,17 @@
android:textColor="#FFF" />
</LinearLayout>
<Button
android:id="@+id/startStopButton"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/startStopButton"
android:nextFocusUp="@id/default_dns_view"
android:nextFocusForward="@id/dns1"
android:nextFocusDown="@id/dns1"
android:layout_marginTop="45dp"
android:background="?attr/cardColor"
android:text="@string/start"
android:textColor="#FFF" />
<View
android:id="@+id/running_indicator"
android:layout_width="match_parent"
android:layout_height="9dp" />
android:layout_gravity="center_horizontal"
android:textColor="#FFF"
/>
<TextView
android:id="@+id/connection_status_text"
......
......@@ -307,8 +307,8 @@
<string name="notification_text_running_in_advanced_mode">Erweiterte Einstellungen aktiv.</string>
<string name="show_system_apps">Zeige Systemapps</string>
<string name="only_show_apps_with_internet">Zeige nur Apps mit Internet-Berechtigung</string>
<string name="hint_dns1">DNS 1</string>
<string name="hint_dns2">DNS 2</string>
<string name="hint_dns1">Primärer Server</string>
<string name="hint_dns2">Sekundärer Server</string>
<string name="hint_dns_entry_name">Name</string>
<string name="hint_pin">PIN</string>
<string name="loading_exporting_queries">Exporting Anfragen, bitte warten…</string>
......
......@@ -308,8 +308,8 @@
<string name="notification_text_running_in_advanced_mode">Impostazioni avanzate abilitate.</string>
<string name="show_system_apps">Mostra app di sistema</string>
<string name="only_show_apps_with_internet">Mostra solo app con autorizzazione Internet</string>
<string name="hint_dns1">DNS 1</string>
<string name="hint_dns2">DNS 2</string>
<string name="hint_dns1">Server primario</string>
<string name="hint_dns2">Server secondario</string>
<string name="hint_dns_entry_name">Nome</string>
<string name="hint_pin">PIN</string>
<string name="loading_exporting_queries">Esportare le query, attendere…</string>
......
......@@ -306,8 +306,8 @@
<string name="notification_text_running_in_advanced_mode">Configurações avançadas habilitadas.</string>
<string name="show_system_apps">Mostrar aplicativos do sistema</string>
<string name="only_show_apps_with_internet">Apenas mostre aplicativos com a permissão de internet</string>
<string name="hint_dns1">DNS 1</string>
<string name="hint_dns2">DNS 2</string>
<string name="hint_dns1">Servidor principal</string>
<string name="hint_dns2">Servidor secundário</string>
<string name="hint_dns_entry_name">Nome</string>
<string name="hint_pin">PIN</string>
<string name="loading_exporting_queries">Exportando consultas, por favor aguarde…</string>
......
......@@ -307,8 +307,8 @@
<string name="notification_text_running_in_advanced_mode">高级设置已启用。</string>
<string name="show_system_apps">显示系统应用</string>
<string name="only_show_apps_with_internet">只显示具有互联网权限的应用程序</string>
<string name="hint_dns1">DNS 1</string>
<string name="hint_dns2">DNS 2</string>
<string name="hint_dns1">主服务器</string>
<string name="hint_dns2">辅助服务器</string>
<string name="hint_dns_entry_name">名称</string>
<string name="hint_pin"></string>
<string name="loading_exporting_queries">导出查询,请稍候…</string>
......
......@@ -319,8 +319,8 @@
<string name="content_description_app_entry_icon" translatable="false">App icon</string>
<string name="default_dns1" translatable="false">8.8.8.8</string>
<string name="default_dns2" translatable="false">8.8.4.4</string>
<string name="hint_dns1">DNS 1</string>
<string name="hint_dns2">DNS 2</string>
<string name="hint_dns1">Primary server</string>
<string name="hint_dns2">Secondary server</string>
<string name="hint_dns_entry_name">Name</string>
<string name="hint_pin">PIN</string>
<string name="loading_exporting_queries">Exporting queries, please wait…</string>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment