removing old files

pull/5/head
Felix Prahl-Kamps 2018-09-10 17:44:47 +02:00
parent 5d6a19d55f
commit 5dc4f64b3e
25 changed files with 163 additions and 949 deletions

View File

@ -21,13 +21,9 @@ import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;
import de.overview.wg.its.mispbump.adapter.SyncedPartnerAdapter;
import de.overview.wg.its.mispbump.auxiliary.AESSecurity;
import de.overview.wg.its.mispbump.auxiliary.PreferenceManager;
import de.overview.wg.its.mispbump.model.SyncedPartner;
import de.overview.wg.its.mispbump.preferences.AppPreferenceActivity;
import de.overview.wg.its.mispbump.preferences.AppPreferenceFragment;
import java.security.PublicKey;
import java.util.ArrayList;
import java.util.List;
@ -72,39 +68,12 @@ public class MainActivity extends AppCompatActivity {
case R.id.menu_item_delete_local_data:
createSelectDeleteDialog();
return true;
case R.id.main_menu_settings:
startActivity(new Intent(this, AppPreferenceActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
private void testAESSecurity() {
String data = "This is the secret message";
AESSecurity aesA = AESSecurity.getInstance();
AESSecurity aesB = AESSecurity.getInstance();
PublicKey pubA = aesA.getPublicKey();
PublicKey pubB = aesB.getPublicKey();
aesA.setForeignPublicKey(pubB);
aesB.setForeignPublicKey(pubA);
emptyPartnerListView.setText("ORIGINAL: " + data + "\n");
String encrypted = aesA.encrypt(data);
emptyPartnerListView.append("ENCRYPTED BY A: " + encrypted + "\n");
String decrypted = aesB.decrypt(encrypted);
emptyPartnerListView.append("DECRYPTED BY B: " + decrypted);
}
private void initializeViews() {
Toolbar toolbar = findViewById(R.id.toolbar);

View File

@ -265,10 +265,19 @@ public class QrSyncActivity extends AppCompatActivity implements View.OnClickLis
AlertDialog.Builder adb = new AlertDialog.Builder(this);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View title = inflater.inflate(R.layout.dialog_public_key, null);
@SuppressLint("InflateParams")
View title = inflater.inflate(R.layout.dialog_public_key, null);
adb.setCustomTitle(title);
adb.setMessage("\nOrganisation: " + pkqr.getOrganisation() + "\nEmail: " + pkqr.getEmail());
View pkInfoView = inflater.inflate(R.layout.view_pk_info, null);
TextView name = pkInfoView.findViewById(R.id.pk_info_organisation_name);
name.setText(pkqr.getOrganisation());
TextView email = pkInfoView.findViewById(R.id.pk_info_email);
email.setText(pkqr.getEmail());
adb.setView(pkInfoView);
adb.setPositiveButton(getString(R.string.accept), new DialogInterface.OnClickListener() {
@Override
@ -299,10 +308,12 @@ public class QrSyncActivity extends AppCompatActivity implements View.OnClickLis
AlertDialog.Builder adb = new AlertDialog.Builder(this);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View title = inflater.inflate(R.layout.dialog_sync_info, null);
@SuppressLint("InflateParams")
View title = inflater.inflate(R.layout.dialog_sync_info, null);
adb.setCustomTitle(title);
@SuppressLint("InflateParams") View orgView = inflater.inflate(R.layout.view_organisation, null);
@SuppressLint("InflateParams")
View orgView = inflater.inflate(R.layout.view_organisation, null);
TextView orgTitle = orgView.findViewById(R.id.organisation_title);
orgTitle.setText(siqr.getOrganisation().getName());

View File

@ -1,279 +0,0 @@
package de.overview.wg.its.mispbump;
import android.animation.Animator;
import android.content.Intent;
import android.graphics.Point;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.Display;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.WindowManager;
import android.view.animation.DecelerateInterpolator;
import android.widget.*;
import com.google.gson.Gson;
import de.overview.wg.its.mispbump.auxiliary.AESSecurity;
import de.overview.wg.its.mispbump.auxiliary.PreferenceManager;
import de.overview.wg.its.mispbump.auxiliary.RandomString;
import de.overview.wg.its.mispbump.auxiliary.TempAuth;
import de.overview.wg.its.mispbump.cam.CameraFragment;
import de.overview.wg.its.mispbump.model.*;
import net.glxn.qrgen.android.QRCode;
@Deprecated
public class SyncActivity extends AppCompatActivity implements View.OnClickListener {
private static final String SCAN_PUB_KEY_FRAG_TAG = "scan_public_key_fragment_tag";
private static final String SCAN_INFO_FRAG_TAG = "scan_info_fragment_tag";
private AESSecurity aesSecurity;
private Fragment currentFragment;
private String currentFragmentTag;
private LinearLayout qrBackground;
private ImageView qrImageView;
private Button forwardButton;
private TextView forwardDescription;
private SyncInformationQr partnerInformation;
private FragmentManager manager;
private FragmentTransaction transaction;
private PreferenceManager preferenceManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_public_key_exchange);
manager = getSupportFragmentManager();
preferenceManager = PreferenceManager.Instance(this);
initializeViews();
aesSecurity = AESSecurity.getInstance();
setScanTypeFragment(0);
}
private void initializeViews() {
ImageButton closeButton = findViewById(R.id.close);
forwardButton = findViewById(R.id.forward);
closeButton.setOnClickListener(this);
forwardButton.setOnClickListener(this);
forwardButton.setEnabled(false);
forwardDescription = findViewById(R.id.forward_description);
qrImageView = findViewById(R.id.qr_imageView);
qrBackground = findViewById(R.id.qr_background);
setContinueScreenEnabled(false);
}
private void setScanTypeFragment(int mode) {
transaction = manager.beginTransaction();
User myUser = preferenceManager.getMyUser();
Organisation myOrg = preferenceManager.getMyOrganisation();
switch (mode) {
case 0:
setContinueScreenEnabled(false);
PublicKeyQr pkqr = new PublicKeyQr(myOrg.getName(),
myUser.getEmail(),
AESSecurity.publicKeyToString(aesSecurity.getPublicKey()));
setQrContent(pkqr.toJSON().toString(), 0.6f);
// currentFragment = CameraFragment.newInstance(CameraFragment.ScanMode.PUBLIC_KEY);
currentFragmentTag = SCAN_PUB_KEY_FRAG_TAG;
break;
case 1:
setContinueScreenEnabled(false);
TempAuth.TMP_AUTH_KEY = new RandomString(40).nextString();
Server serverForMeOnOtherInstance = new Server();
serverForMeOnOtherInstance.setAuthkey(TempAuth.TMP_AUTH_KEY);
serverForMeOnOtherInstance.setName("SyncServer for " + myOrg.getName());
serverForMeOnOtherInstance.setUrl(preferenceManager.getMyServerUrl());
SyncInformationQr siqr = new SyncInformationQr(
preferenceManager.getMyOrganisation(),
serverForMeOnOtherInstance,
preferenceManager.getMyUser());
setQrContent(aesSecurity.encrypt(siqr.toJSON().toString()), 0.9f);
// currentFragment = CameraFragment.newInstance(CameraFragment.ScanMode.INFO);
currentFragmentTag = SCAN_INFO_FRAG_TAG;
break;
default:
transaction.remove(currentFragment);
transaction.commit();
currentFragment = null;
finish();
return;
}
transaction.replace(R.id.fragment_container, currentFragment, currentFragmentTag);
transaction.commit();
}
private void setQrContent(String content, float qrToScreenRatio) {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = (int) (size.x * qrToScreenRatio);
//noinspection SuspiciousNameCombination
qrImageView.setImageBitmap(QRCode.from(content)
.withColor(0xFF000000, 0x00FFFFFF)
.withSize(width, width)
.bitmap());
circularReveal(qrBackground, true, 400);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.close:
finish();
break;
case R.id.forward:
if (currentFragmentTag.equals(SCAN_PUB_KEY_FRAG_TAG)) {
setScanTypeFragment(1);
} else if (currentFragmentTag.equals(SCAN_INFO_FRAG_TAG)) {
startUploadActivity();
}
break;
}
}
private void setContinueScreenEnabled(boolean enabled) {
if (enabled) {
forwardButton.setVisibility(View.VISIBLE);
forwardDescription.setVisibility(View.VISIBLE);
} else {
forwardButton.setVisibility(View.INVISIBLE);
forwardDescription.setVisibility(View.INVISIBLE);
}
forwardButton.setEnabled(enabled);
}
public void onPublicKeyResult(PublicKeyQr pkqr) {
aesSecurity.setForeignPublicKey(AESSecurity.publicKeyFromString(pkqr.getKey()));
runOnUiThread(new Runnable() {
@Override
public void run() {
setContinueScreenEnabled(true);
}
});
}
public void onSyncInfoResult(SyncInformationQr siqr) {
partnerInformation = siqr;
runOnUiThread(new Runnable() {
@Override
public void run() {
setContinueScreenEnabled(true);
}
});
}
private void startUploadActivity() {
Intent i = new Intent(this, SyncUploadActivity.class);
i.putExtra(SyncUploadActivity.PARTNER_INFO_BUNDLE_KEY, new Gson().toJson(partnerInformation));
startActivity(i);
finish();
}
private void circularReveal(final View v, final boolean open, final long duration) {
v.post(new Runnable() {
@Override
public void run() {
int cx = v.getWidth() / 2;
int cy = v.getHeight() / 2;
float finalRadius = (float) Math.hypot(cx, cy);
Animator anim;
if (open) {
anim = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, finalRadius);
v.setVisibility(View.VISIBLE);
} else {
anim = ViewAnimationUtils.createCircularReveal(v, cx, cy, finalRadius, 0);
}
anim.setInterpolator(new DecelerateInterpolator());
anim.setDuration(duration);
anim.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (!open) {
v.setVisibility(View.INVISIBLE);
}
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
});
anim.start();
}
});
}
}

View File

@ -11,6 +11,7 @@ import android.view.View;
import com.android.volley.VolleyError;
import com.google.gson.Gson;
import de.overview.wg.its.mispbump.adapter.UploadStateAdapter;
import de.overview.wg.its.mispbump.auxiliary.PreferenceManager;
import de.overview.wg.its.mispbump.auxiliary.ReadableError;
import de.overview.wg.its.mispbump.auxiliary.TempAuth;
import de.overview.wg.its.mispbump.model.*;
@ -18,6 +19,8 @@ import de.overview.wg.its.mispbump.network.MispRequest;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.List;
public class SyncUploadActivity extends AppCompatActivity implements View.OnClickListener {
static final String PARTNER_INFO_BUNDLE_KEY = "partner_info";
@ -34,6 +37,14 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
private UploadState[] uploadStates;
private int currentTask = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload);
initializeContent();
}
@Override
public void onClick(View v) {
int id = v.getId();
@ -55,14 +66,6 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload);
initializeContent();
}
private void initializeContent() {
@ -105,7 +108,7 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
uploadStates[0] = new UploadState("Validate upload information");
uploadStates[1] = new UploadState("Check connection to server");
uploadStates[2] = new UploadState("Create local organisation");
uploadStates[3] = new UploadState("Create sync user & add to organisation");
uploadStates[3] = new UploadState("Create sync user / add to organisation");
uploadStates[4] = new UploadState("Create external organisation");
uploadStates[5] = new UploadState("Create sync server");
@ -180,7 +183,7 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
currentTask++;
if (currentTask > uploadStates.length) {
return;
addToSyncedList();
}
executeTask(currentTask);
@ -221,6 +224,13 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
private void checkBundle(UploadState state) {
state.setInProgress();
state.setDone();
executeNextTask();
if(true) {
return;
}
Bundle b = getIntent().getExtras();
if (b != null) {
@ -249,6 +259,12 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
private void checkConnection(final UploadState state) {
state.setInProgress();
state.setDone();
executeNextTask();
if(true) {
return;
}
mispRequest.testConnection(new MispRequest.ConnectionCallback() {
@Override
@ -267,6 +283,12 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
private void createOrganisation(final UploadState state, boolean undo) {
state.setInProgress();
state.setDone();
executeNextTask();
if (true) {
return;
}
if (!undo) {
mispRequest.addOrganisation(partnerOrganisation, new MispRequest.OrganisationCallback() {
@ -310,6 +332,11 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
private void createSyncUser(final UploadState state, boolean undo) {
state.setInProgress();
state.setDone();
executeNextTask();
if (true) {
return;
}
partnerSyncUser.setAuthkey(TempAuth.TMP_AUTH_KEY);
partnerSyncUser.setRoleId(User.RoleId.SYNC_USER);
@ -345,10 +372,16 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
private void createExternalOrganisation(final UploadState state, boolean undo) {
final String originalOrgName = partnerOrganisation.getName();
state.setInProgress();
// executeNextTask();
if (true) {
return;
}
final String originalOrgName = partnerOrganisation.getName();
if (!undo) {
partnerOrganisation.setName(partnerOrganisation.getName() + " (Remote)");
partnerOrganisation.setLocal(false);
@ -363,7 +396,7 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
partnerServer.setRemoteOrgId(extOrgId);
partnerServer.setPush(true);
// Reset partner organisation name TODO why?
// Reset partner organisation name because it will show as (remote) name in syncedList
partnerOrganisation.setName(originalOrgName);
state.setDone();
@ -398,6 +431,10 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
private void createSyncServer(final UploadState state, boolean undo) {
state.setInProgress();
if (true) {
return;
}
if (!undo) {
mispRequest.addServer(partnerServer, new MispRequest.ServerCallback() {
@Override
@ -411,12 +448,23 @@ public class SyncUploadActivity extends AppCompatActivity implements View.OnClic
state.setError(ReadableError.toReadable(volleyError));
}
});
} else {
}
}
private void addToSyncedList() {
// todo implementation
if(true) {
return;
}
PreferenceManager preferenceManager = PreferenceManager.Instance(this);
List<SyncedPartner> syncedPartnerList = preferenceManager.getSyncedPartnerList();
SyncedPartner sp = new SyncedPartner(partnerOrganisation.getName(), partnerServer.getUrl());
sp.generateTimeStamp();
syncedPartnerList.add(sp);
preferenceManager.setSyncedPartnerList(syncedPartnerList);
}
}

View File

@ -1,243 +0,0 @@
package de.overview.wg.its.mispbump;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import com.android.volley.VolleyError;
import com.google.gson.Gson;
import de.overview.wg.its.mispbump.adapter.UploadStateAdapter;
import de.overview.wg.its.mispbump.auxiliary.PreferenceManager;
import de.overview.wg.its.mispbump.auxiliary.ReadableError;
import de.overview.wg.its.mispbump.auxiliary.TempAuth;
import de.overview.wg.its.mispbump.model.*;
import de.overview.wg.its.mispbump.network.MispRequest;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
@Deprecated
@SuppressWarnings("ConstantConditions")
public class UploadActivity extends AppCompatActivity implements View.OnClickListener {
static final String PARTNER_INFO_BUNDLE_KEY = "partner_info";
private MispRequest mispRequest;
private SyncInformationQr partnerInformation;
private Organisation partnerOrganisation;
private User partnerSyncUser;
private Server partnerServer;
private UploadStateAdapter uploadStateAdapter;
private FloatingActionButton fab;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload);
Bundle b = getIntent().getExtras();
assert b != null;
String info = b.getString(PARTNER_INFO_BUNDLE_KEY);
partnerInformation = new Gson().fromJson(info, SyncInformationQr.class);
mispRequest = MispRequest.Instance(this, true);
initializeViews();
SyncUpload();
}
private void initializeViews() {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(true);
fab = findViewById(R.id.fab_continue_sync_info);
fab.setOnClickListener(this);
fab.setVisibility(View.GONE);
RecyclerView recyclerView = findViewById(R.id.recyclerView);
uploadStateAdapter = new UploadStateAdapter();
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(uploadStateAdapter);
}
@Override
public void onClick(View v) {
int id = v.getId();
switch (id) {
case R.id.fab_continue_sync_info:
finish();
break;
}
}
private void setUploadSucces() {
fab.setVisibility(View.VISIBLE);
}
private void setCurrentStateWrapper(int stateNumber, UploadState.State state) {
// syncUploadStates.get(stateNumber).setCurrentState(state);
uploadStateAdapter.notifyItemChanged(stateNumber);
}
private List<UploadState> syncUploadStates = new ArrayList<>();
private void SyncUpload() {
partnerOrganisation = partnerInformation.getOrganisation();
partnerSyncUser = partnerInformation.getUser();
partnerServer = partnerInformation.getServer();
syncUploadStates.add(new UploadState("Create local organisation"));
syncUploadStates.add(new UploadState("Create sync user & add to organisation"));
syncUploadStates.add(new UploadState("Create external organisation"));
syncUploadStates.add(new UploadState("Create sync server"));
// uploadStateAdapter.setStates(syncUploadStates);
uploadSyncOrganisation();
fab.setVisibility(View.VISIBLE);
}
private void uploadSyncOrganisation() {
setCurrentStateWrapper(0, UploadState.State.IN_PROGRESS);
mispRequest.addOrganisation(partnerOrganisation, new MispRequest.OrganisationCallback() {
@Override
public void onResult(JSONObject organisationInformation) {
try {
Organisation retOrg = new Organisation(organisationInformation);
setCurrentStateWrapper(0, UploadState.State.DONE);
uploadSyncUser(retOrg.getId());
} catch (JSONException e) {
syncUploadStates.get(0).setError("Unknown error: could not read server response");
setCurrentStateWrapper(0, UploadState.State.ERROR);
e.printStackTrace();
}
}
@Override
public void onError(VolleyError volleyError) {
syncUploadStates.get(0).setError(ReadableError.toReadable(volleyError));
setCurrentStateWrapper(0, UploadState.State.ERROR);
}
});
}
private void uploadSyncUser(int orgID) {
setCurrentStateWrapper(1, UploadState.State.IN_PROGRESS);
partnerSyncUser.setOrgId(orgID);
partnerSyncUser.setAuthkey(TempAuth.TMP_AUTH_KEY);
partnerSyncUser.setRoleId(User.RoleId.SYNC_USER);
mispRequest.addUser(partnerSyncUser, new MispRequest.UserCallback() {
@Override
public void onResult(JSONObject myUserInformation) {
setCurrentStateWrapper(1, UploadState.State.DONE);
uploadExternalSyncOrganisation();
}
@Override
public void onError(VolleyError volleyError) {
syncUploadStates.get(1).setError(ReadableError.toReadable(volleyError));
setCurrentStateWrapper(1, UploadState.State.ERROR);
}
});
}
private void uploadExternalSyncOrganisation() {
setCurrentStateWrapper(2, UploadState.State.IN_PROGRESS);
partnerOrganisation.setName(partnerOrganisation.getName() + " (Remote)");
partnerOrganisation.setLocal(false);
mispRequest.addOrganisation(partnerOrganisation, new MispRequest.OrganisationCallback() {
@Override
public void onResult(JSONObject organisationInformation) {
try {
Organisation extOrg = new Organisation(organisationInformation);
setCurrentStateWrapper(2, UploadState.State.DONE);
uploadSyncServer(extOrg.getId());
} catch (JSONException e) {
syncUploadStates.get(2).setError("Could not read server response");
setCurrentStateWrapper(2, UploadState.State.ERROR);
e.printStackTrace();
}
}
@Override
public void onError(VolleyError volleyError) {
syncUploadStates.get(2).setError(ReadableError.toReadable(volleyError));
setCurrentStateWrapper(2, UploadState.State.ERROR);
}
});
}
private void uploadSyncServer(int remoteOrgId) {
setCurrentStateWrapper(3, UploadState.State.IN_PROGRESS);
partnerServer.setRemoteOrgId(remoteOrgId);
partnerServer.setPush(true);
mispRequest.addServer(partnerServer, new MispRequest.ServerCallback() {
@Override
public void onResult(JSONObject servers) {
setCurrentStateWrapper(3, UploadState.State.DONE);
updateSyncedOrganisationList();
}
@Override
public void onError(VolleyError volleyError) {
syncUploadStates.get(3).setError(ReadableError.toReadable(volleyError));
setCurrentStateWrapper(3, UploadState.State.ERROR);
}
});
}
private void updateSyncedOrganisationList() {
PreferenceManager preferenceManager = PreferenceManager.Instance(this);
List<SyncedPartner> syncedPartnerList = preferenceManager.getSyncedPartnerList();
if (syncedPartnerList == null) {
syncedPartnerList = new ArrayList<>();
}
SyncedPartner sp = new SyncedPartner(
partnerInformation.getOrganisation().getName(),
partnerInformation.getServer().getUrl());
sp.generateTimeStamp();
syncedPartnerList.add(sp);
preferenceManager.setSyncedPartnerList(syncedPartnerList);
}
}

View File

@ -1,34 +0,0 @@
package de.overview.wg.its.mispbump.preferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.preference.PreferenceManager;
import android.support.v7.widget.Toolbar;
import de.overview.wg.its.mispbump.R;
public class AppPreferenceActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_preference);
getSupportFragmentManager().beginTransaction()
.replace(R.id.settings_content, new AppPreferenceFragment())
.commit();
initializeContent();
}
private void initializeContent() {
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//noinspection ConstantConditions
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
}
}

View File

@ -1,14 +0,0 @@
package de.overview.wg.its.mispbump.preferences;
import android.os.Bundle;
import android.support.v7.preference.PreferenceFragmentCompat;
import de.overview.wg.its.mispbump.R;
public class AppPreferenceFragment extends PreferenceFragmentCompat {
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.app_preferences);
}
}

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/settings_content"
android:layout_width="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:animateLayoutChanges="true"
android:id="@+id/coordinator"
tools:context=".MainActivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/settings.appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
<android.support.design.widget.TextInputLayout
android:background="@color/colorPrimary"
android:id="@+id/input_layout_server_url"
android:paddingStart="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingEnd="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/edit_server_url"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/server_url"
android:inputType="textUri"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:background="@color/colorPrimary"
android:id="@+id/input_layout_automation_key"
android:paddingStart="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingEnd="16dp"
android:paddingBottom="32dp"
app:passwordToggleEnabled="true"
app:passwordToggleTint="#FFF"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/edit_api_key"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/authkey"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
</android.support.design.widget.AppBarLayout>
<android.support.constraint.ConstraintLayout
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/empty"
android:text="@string/empty_my_org"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_download_own_org_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
app:fabSize="normal"
app:layout_anchor="@id/settings.appbar"
app:layout_anchorGravity="bottom|right|end"
android:tint="@color/colorWhite"
app:srcCompat="@drawable/icon_cloud_download"/>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,81 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:background="#000"
android:fitsSystemWindows="false">
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#96000000">
<LinearLayout
android:visibility="visible"
android:id="@+id/qr_background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/rounded_square">
<ImageView
android:contentDescription="@string/qr_code"
android:id="@+id/qr_imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<TextView
android:visibility="visible"
android:id="@+id/forward_description"
android:layout_below="@id/qr_background"
android:layout_centerHorizontal="true"
android:padding="32dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorWhite"
android:text="@string/sync_information"/>
<ImageButton
android:contentDescription="@string/exit"
android:id="@+id/close"
android:padding="16dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:tint="@color/colorWhite"
android:src="@drawable/icon_close"
android:background="?android:selectableItemBackgroundBorderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/forward"
android:visibility="visible"
android:padding="16dp"
android:layout_marginTop="32dp"
android:layout_below="@id/forward_description"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str_continue"
android:textColor="@color/colorWhite"
android:textAllCaps="true"
style="@style/Widget.AppCompat.Button.Colored"/>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>

View File

@ -1,66 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
<android.support.v7.widget.LinearLayoutCompat
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="wrap_content"
android:layout_marginBottom="16dp"
app:cardBackgroundColor="@color/colorWhite"
app:cardElevation="1dp"
app:cardCornerRadius="0dp"
app:cardPreventCornerOverlap="true"
app:contentPadding="16dp">
android:orientation="vertical"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:paddingTop="16dp"
android:paddingStart="16dp" android:paddingEnd="16dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_weight="1.0"
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textStyle="bold"
android:text="Title"/>
<ImageView
android:id="@+id/state_pending"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:tint="@color/colorPrimary"
android:src="@drawable/icon_hour_glass"/>
<ProgressBar
android:id="@+id/state_in_progress"
android:layout_width="24dp" android:layout_height="24dp"/>
<ImageView
android:id="@+id/state_done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#4CAF50"
android:src="@drawable/icon_round_check"/>
<ImageView
android:id="@+id/state_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#f44336"
android:src="@drawable/icon_round_error"/>
</LinearLayout>
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/state_error_text"
android:text="This will be a meaningful error, somewhen in the future!"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="#f44336"/>
android:layout_weight="1.0"
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"/>
<ImageView
android:id="@+id/state_pending"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:tint="@color/colorPrimary"
android:src="@drawable/icon_hour_glass"/>
<ProgressBar
android:id="@+id/state_in_progress"
android:layout_width="24dp" android:layout_height="24dp"/>
<ImageView
android:id="@+id/state_done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#4CAF50"
android:src="@drawable/icon_round_check"/>
<ImageView
android:id="@+id/state_error"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#f44336"
android:src="@drawable/icon_round_error"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<TextView
android:id="@+id/state_error_text"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="ERROR"
android:textColor="#f44336" android:visibility="gone"/>
<View
android:layout_width="match_parent" android:layout_height="1dp"
android:layout_marginTop="16dp"
android:background="#11000000"/>
</android.support.v7.widget.LinearLayoutCompat>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp">
<GridLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="horizontal"
android:rowCount="2"
android:columnCount="2">
<TextView android:text="Organisation" android:textStyle="bold"/>
<TextView
android:id="@+id/pk_info_organisation_name"
android:layout_width="0dip"
android:layout_gravity="fill_horizontal"
android:paddingStart="16dp"
android:text="Sample Organisation"/>
<TextView android:text="Email" android:textStyle="bold"/>
<TextView
android:id="@+id/pk_info_email"
android:layout_width="0dip"
android:layout_gravity="fill_horizontal"
android:paddingStart="16dp"
android:text="Sample Email"/>
</GridLayout>
</android.support.v7.widget.LinearLayoutCompat>

View File

@ -10,10 +10,6 @@
app:showAsAction="always">
</item>
<item android:id="@+id/main_menu_settings"
android:title="@string/settings"
android:icon="@drawable/icon_settings"/>
<item android:id="@+id/menu_item_delete_local_data"
android:title="@string/delete_local_data"/>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="languages">
<item>English</item>
<item>German</item>
</string-array>
</resources>

View File

@ -1,35 +0,0 @@
<android.support.v7.preference.PreferenceScreen
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.v7.preference.PreferenceCategory
android:title="Language">
<android.support.v7.preference.SwitchPreferenceCompat
android:key="key1"
android:title="System Default"
android:summary="Use the systems default language"
android:defaultValue="true"/>
<android.support.v7.preference.ListPreference
android:dependency="key1"
android:key="key4"
android:title="Language"
android:summary="Englisch"
android:entries="@array/languages"
android:entryValues="@array/languages" />
</android.support.v7.preference.PreferenceCategory>
<android.support.v7.preference.PreferenceCategory
android:title="Other">
<android.support.v7.preference.SwitchPreferenceCompat
android:key="key9"
android:title="Debug"
android:summary="Enable Debug Mode"
android:defaultValue="true"/>
</android.support.v7.preference.PreferenceCategory>
</android.support.v7.preference.PreferenceScreen>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 516 KiB