RecyclerView for sync profile, new launcher icon
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 109 KiB |
|
@ -7,9 +7,9 @@
|
|||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:icon="@mipmap/launcher_handshake_square"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:roundIcon="@mipmap/launcher_handshake_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
|
@ -17,7 +17,6 @@
|
|||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
|
|
@ -10,6 +10,9 @@ import android.support.design.widget.Snackbar;
|
|||
import android.support.design.widget.TextInputLayout;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
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.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
@ -22,15 +25,20 @@ import android.widget.CompoundButton;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import com.android.volley.VolleyError;
|
||||
import de.overview.wg.its.mispauth.adapter.OrganisationInfoEntryAdapter;
|
||||
import de.overview.wg.its.mispauth.auxiliary.PreferenceManager;
|
||||
import de.overview.wg.its.mispauth.auxiliary.ReadableError;
|
||||
import de.overview.wg.its.mispauth.cam.DialogFactory;
|
||||
import de.overview.wg.its.mispauth.model.Organisation;
|
||||
import de.overview.wg.its.mispauth.model.StringPair;
|
||||
import de.overview.wg.its.mispauth.model.User;
|
||||
import de.overview.wg.its.mispauth.network.MispRequest;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@SuppressLint("SetTextI18n")
|
||||
public class CredentialsActivity extends AppCompatActivity implements View.OnClickListener {
|
||||
|
@ -42,12 +50,16 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
|
|||
|
||||
private TextInputLayout urlLayout, apiLayout;
|
||||
private TextView emptyView;
|
||||
private ViewGroup organisationView;
|
||||
// private ViewGroup organisationView;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
private Organisation myOrganisation;
|
||||
private User myUser;
|
||||
|
||||
private RecyclerView recyclerView;
|
||||
private OrganisationInfoEntryAdapter adapter;
|
||||
private List<StringPair> orgInfoEntries = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
|
@ -120,10 +132,17 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
|
|||
urlLayout = findViewById(R.id.input_layout_server_url);
|
||||
apiLayout = findViewById(R.id.input_layout_api_key);
|
||||
emptyView = findViewById(R.id.empty);
|
||||
organisationView = findViewById(R.id.myOrganisationView);
|
||||
// organisationView = findViewById(R.id.myOrganisationView);
|
||||
|
||||
FloatingActionButton fab = findViewById(R.id.fab_download_own_org_info);
|
||||
fab.setOnClickListener(this);
|
||||
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
adapter = new OrganisationInfoEntryAdapter();
|
||||
RecyclerView.LayoutManager manager = new LinearLayoutManager(this);
|
||||
recyclerView.setLayoutManager(manager);
|
||||
recyclerView.setItemAnimator(new DefaultItemAnimator());
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -141,15 +160,16 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
|
|||
if (myOrganisation == null) {
|
||||
|
||||
emptyView.setVisibility(View.VISIBLE);
|
||||
organisationView.setVisibility(View.GONE);
|
||||
// organisationView.setVisibility(View.GONE);
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
|
||||
} else {
|
||||
|
||||
emptyView.setVisibility(View.GONE);
|
||||
organisationView.setVisibility(View.VISIBLE);
|
||||
// organisationView.setVisibility(View.VISIBLE);
|
||||
recyclerView.setVisibility(View.VISIBLE);
|
||||
|
||||
visualizeOrganisation();
|
||||
|
||||
}
|
||||
}
|
||||
private void savePreferences() {
|
||||
|
@ -290,7 +310,8 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
|
|||
return;
|
||||
}
|
||||
|
||||
organisationView.setVisibility(View.VISIBLE);
|
||||
recyclerView.setVisibility(View.VISIBLE);
|
||||
// organisationView.setVisibility(View.VISIBLE);
|
||||
emptyView.setVisibility(View.GONE);
|
||||
|
||||
progressBar.setVisibility(View.GONE);
|
||||
|
@ -301,7 +322,8 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
|
|||
public void onError(VolleyError volleyError) {
|
||||
makeSnackBar(ReadableError.toReadable(volleyError));
|
||||
progressBar.setVisibility(View.GONE);
|
||||
organisationView.setVisibility(View.GONE);
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
// organisationView.setVisibility(View.GONE);
|
||||
emptyView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
@ -311,7 +333,8 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
|
|||
public void onError(VolleyError volleyError) {
|
||||
makeSnackBar(ReadableError.toReadable(volleyError));
|
||||
progressBar.setVisibility(View.GONE);
|
||||
organisationView.setVisibility(View.GONE);
|
||||
recyclerView.setVisibility(View.GONE);
|
||||
// organisationView.setVisibility(View.GONE);
|
||||
emptyView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
@ -320,25 +343,32 @@ public class CredentialsActivity extends AppCompatActivity implements View.OnCli
|
|||
|
||||
private void visualizeOrganisation() {
|
||||
|
||||
TextView title = organisationView.findViewById(R.id.organisation_title);
|
||||
title.setText(myOrganisation.getName());
|
||||
orgInfoEntries.add(new StringPair("Name", myOrganisation.getName()));
|
||||
// TextView title = organisationView.findViewById(R.id.organisation_title);
|
||||
// TextView title = findViewById(R.id.org_title);
|
||||
// title.setText(myOrganisation.getName());
|
||||
|
||||
TextView uuid = organisationView.findViewById(R.id.organisation_uuid);
|
||||
uuid.setText(myOrganisation.getUuid());
|
||||
orgInfoEntries.add(new StringPair("UUID", myOrganisation.getUuid()));
|
||||
// TextView uuid = organisationView.findViewById(R.id.organisation_uuid);
|
||||
// uuid.setText(myOrganisation.getUuid());
|
||||
|
||||
TextView description = organisationView.findViewById(R.id.organisation_description);
|
||||
description.setText(myOrganisation.getDescription());
|
||||
orgInfoEntries.add(new StringPair("Description", myOrganisation.getDescription()));
|
||||
// TextView description = organisationView.findViewById(R.id.organisation_description);
|
||||
// description.setText(myOrganisation.getDescription());
|
||||
|
||||
TextView nationality = organisationView.findViewById(R.id.organisation_nationality);
|
||||
nationality.setText(myOrganisation.getNationality());
|
||||
orgInfoEntries.add(new StringPair("Nationality", myOrganisation.getNationality()));
|
||||
// TextView nationality = organisationView.findViewById(R.id.organisation_nationality);
|
||||
// nationality.setText(myOrganisation.getNationality());
|
||||
|
||||
TextView sector = findViewById(R.id.organisation_sector);
|
||||
sector.setText(myOrganisation.getSector());
|
||||
orgInfoEntries.add(new StringPair("Sector", myOrganisation.getSector()));
|
||||
// TextView sector = findViewById(R.id.organisation_sector);
|
||||
// sector.setText(myOrganisation.getSector());
|
||||
|
||||
TextView users = findViewById(R.id.organisation_user_count);
|
||||
|
||||
users.setText("" + myOrganisation.getUserCount());
|
||||
orgInfoEntries.add(new StringPair("User Count", "" + myOrganisation.getUserCount()));
|
||||
// TextView users = findViewById(R.id.organisation_user_count);
|
||||
// users.setText("" + myOrganisation.getUserCount());
|
||||
|
||||
adapter.setList(orgInfoEntries);
|
||||
}
|
||||
|
||||
private void exitSafely() {
|
||||
|
|
|
@ -92,17 +92,16 @@ public class UploadActivity extends AppCompatActivity implements View.OnClickLis
|
|||
}
|
||||
|
||||
private List<UploadState> syncUploadStates = new ArrayList<>();
|
||||
|
||||
private void SyncUpload() {
|
||||
|
||||
partnerOrganisation = partnerInformation.getOrganisation();
|
||||
partnerSyncUser = partnerInformation.getUser();
|
||||
partnerServer = partnerInformation.getServer();
|
||||
|
||||
syncUploadStates.add(new UploadState("Add local organisation"));
|
||||
syncUploadStates.add(new UploadState("Add sync user to organisation"));
|
||||
syncUploadStates.add(new UploadState("Add external organisation"));
|
||||
syncUploadStates.add(new UploadState("Add sync server"));
|
||||
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.setStateList(syncUploadStates);
|
||||
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package de.overview.wg.its.mispauth.adapter;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.util.Pair;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import de.overview.wg.its.mispauth.R;
|
||||
import de.overview.wg.its.mispauth.model.StringPair;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class OrganisationInfoEntryAdapter extends RecyclerView.Adapter<OrganisationInfoEntryAdapter.MyViewHolder> {
|
||||
|
||||
private List<StringPair> list = new ArrayList<>();
|
||||
|
||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView title, value;
|
||||
|
||||
private MyViewHolder(View view) {
|
||||
super(view);
|
||||
|
||||
this.title = view.findViewById(R.id.title);
|
||||
this.value = view.findViewById(R.id.value);
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View row = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_org_info_entry, parent, false);
|
||||
return new OrganisationInfoEntryAdapter.MyViewHolder(row);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
|
||||
holder.title.setText(list.get(position).key);
|
||||
holder.value.setText(list.get(position).value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
public void setList(List<StringPair> list) {
|
||||
this.list = list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package de.overview.wg.its.mispauth.model;
|
||||
|
||||
public class StringPair {
|
||||
|
||||
public String key, value;
|
||||
|
||||
public StringPair(String key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -48,7 +48,7 @@
|
|||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="42dp"
|
||||
android:paddingBottom="32dp"
|
||||
app:passwordToggleEnabled="true"
|
||||
app:passwordToggleTint="#FFF"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -70,18 +70,41 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include
|
||||
android:layout_width="0dp"
|
||||
<!--<include-->
|
||||
<!--android:layout_width="0dp"-->
|
||||
<!--android:layout_height="0dp"-->
|
||||
<!--layout="@layout/view_organisation"-->
|
||||
<!--app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!--android:layout_marginStart="16dp"-->
|
||||
<!--app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!--android:layout_marginTop="32dp"-->
|
||||
<!--app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!--android:layout_marginEnd="16dp"-->
|
||||
<!--app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!--android:layout_marginBottom="16dp"/>-->
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/org_title"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:layout_marginTop="32dp"-->
|
||||
<!--app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!--app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!--app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!--tools:text="Organisation A"-->
|
||||
<!--android:textAppearance="@android:style/TextAppearance.Material.Title"-->
|
||||
<!--android:textAlignment="center"/>-->
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
layout="@layout/view_organisation"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="16dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="16dp"/>
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"
|
||||
>
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty"
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent" android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textColor="#000"
|
||||
android:text="Test Title" android:textSize="17sp" android:textStyle="normal"/>
|
||||
|
||||
<TextView
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:id="@+id/value"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:text="Test Subtitle"/>
|
||||
|
||||
<View
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_below="@id/value"
|
||||
android:layout_width="match_parent" android:layout_height="1dp"
|
||||
android:background="#11000000"/>
|
||||
|
||||
</RelativeLayout>
|
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 30 KiB |