Prepares proxy

This commit is contained in:
stom79 2018-01-19 18:20:31 +01:00
parent 84d0aa7a43
commit d252ebf585
5 changed files with 150 additions and 0 deletions

View File

@ -0,0 +1,63 @@
/* Copyright 2017 Thomas Schneider
*
* This file is a part of Mastalab
*
* This program is free software; you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
* License, or (at your option) any later version.
*
* Mastalab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.activities;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.ViewGroup;
import android.view.Window;
import fr.gouv.etalab.mastodon.R;
/**
* Created by Thomas on 19/01/2018.
* Proxy activity class
*/
public class ProxyActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setTheme(R.style.AppThemeDark_NoActionBar);
setContentView(R.layout.activity_proxy);
getWindow().setLayout(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
Bundle b = getIntent().getExtras();
if( getSupportActionBar() != null)
getSupportActionBar().hide();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}

View File

@ -269,6 +269,11 @@ public class Helper {
public static final String EP_AUTHORIZE = "/oauth/authorize";
//Proxy
public static final String SET_PROXY_HOST = "set_proxy_host";
public static final String SET_PROXY_PORT = "set_proxy_port";
public static final String SET_PROXY_LOGIN = "set_proxy_login";
public static final String SET_PROXY_PASSWORD = "set_proxy_password";
//Refresh job
public static final int MINUTES_BETWEEN_NOTIFICATIONS_REFRESH = 15;
public static final int MINUTES_BETWEEN_HOME_TIMELINE = 30;

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:fitsSystemWindows="true"
tools:context="fr.gouv.etalab.mastodon.activities.ProxyActivity"
android:layout_margin="@dimen/fab_margin"
android:id="@+id/container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="300dp">
<CheckBox
android:id="@+id/enable_proxy"
android:checked="false"
android:text="@string/proxy_enable"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="@+id/host"
android:inputType="textUri"
android:hint="@string/poxy_host"
android:layout_width="0dp"
android:layout_weight="3"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/port"
android:inputType="number"
android:hint="@string/poxy_port"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" />
</LinearLayout>
<EditText
android:id="@+id/proxy_login"
android:hint="@string/poxy_login"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/proxy_password"
android:inputType="textPassword"
android:hint="@string/poxy_password"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/pickup_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_insert_photo"
android:visibility="invisible"
app:fabSize="mini" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/take_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_photo_camera"
android:visibility="invisible"
app:fabSize="mini" />
</FrameLayout>

View File

@ -475,4 +475,11 @@
<string name="data_export_toots">Export statuses for %1$s</string>
<string name="data_export_success">%1$s toots out of %2$s have been exported.</string>
<string name="data_export_error">Something went wrong when exporting data for %1$s</string>
<string name="proxy_enable">Enable proxy?</string>
<string name="poxy_host">host</string>
<string name="poxy_port">port</string>
<string name="poxy_login">login</string>
<string name="poxy_password">password</string>
</resources>