mirror of https://github.com/MISP/misp-bump
				
				
				
			started sync activity, cleanup
							parent
							
								
									b7111a47d8
								
							
						
					
					
						commit
						b49cc7a66f
					
				|  | @ -1,34 +1,34 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
| 	<component name="NullableNotNullManager"> | ||||
| 		<option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | ||||
| 		<option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | ||||
| 		<option name="myNullables"> | ||||
| 			<value> | ||||
| 				<list size="5"> | ||||
| 					<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | ||||
| 					<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | ||||
| 					<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> | ||||
| 					<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | ||||
| 					<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | ||||
| 				</list> | ||||
| 			</value> | ||||
| 		</option> | ||||
| 		<option name="myNotNulls"> | ||||
| 			<value> | ||||
| 				<list size="4"> | ||||
| 					<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | ||||
| 					<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | ||||
| 					<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | ||||
| 					<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | ||||
| 				</list> | ||||
| 			</value> | ||||
| 		</option> | ||||
| 	</component> | ||||
| 	<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||||
| 		<output url="file://$PROJECT_DIR$/build/classes" /> | ||||
| 	</component> | ||||
| 	<component name="ProjectType"> | ||||
| 		<option name="id" value="Android" /> | ||||
| 	</component> | ||||
| </project> | ||||
|   <component name="NullableNotNullManager"> | ||||
|     <option name="myDefaultNullable" value="android.support.annotation.Nullable" /> | ||||
|     <option name="myDefaultNotNull" value="android.support.annotation.NonNull" /> | ||||
|     <option name="myNullables"> | ||||
|       <value> | ||||
|         <list size="5"> | ||||
|           <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" /> | ||||
|           <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" /> | ||||
|           <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" /> | ||||
|           <item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" /> | ||||
|           <item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" /> | ||||
|         </list> | ||||
|       </value> | ||||
|     </option> | ||||
|     <option name="myNotNulls"> | ||||
|       <value> | ||||
|         <list size="4"> | ||||
|           <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" /> | ||||
|           <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" /> | ||||
|           <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" /> | ||||
|           <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" /> | ||||
|         </list> | ||||
|       </value> | ||||
|     </option> | ||||
|   </component> | ||||
|   <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||||
|     <output url="file://$PROJECT_DIR$/build/classes" /> | ||||
|   </component> | ||||
|   <component name="ProjectType"> | ||||
|     <option name="id" value="Android" /> | ||||
|   </component> | ||||
| </project> | ||||
|  | @ -1,45 +1,136 @@ | |||
| package de.overview.wg.its.mispauth.activity; | ||||
| 
 | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.support.v4.app.FragmentManager; | ||||
| import android.support.v4.app.FragmentStatePagerAdapter; | ||||
| import android.support.v4.view.PagerAdapter; | ||||
| import android.support.v4.view.ViewPager; | ||||
| import android.support.v7.app.AppCompatActivity; | ||||
| import android.os.Bundle; | ||||
| import android.view.View; | ||||
| import android.widget.Button; | ||||
| import android.widget.LinearLayout; | ||||
| import com.android.volley.VolleyError; | ||||
| import de.overview.wg.its.mispauth.R; | ||||
| import de.overview.wg.its.mispauth.auxiliary.PreferenceManager; | ||||
| import de.overview.wg.its.mispauth.fragment.ScanQrFragment; | ||||
| import de.overview.wg.its.mispauth.fragment.ShowQrFragment; | ||||
| import de.overview.wg.its.mispauth.fragment.SyncStartFragment; | ||||
| import de.overview.wg.its.mispauth.fragment.UploadFragment; | ||||
| import de.overview.wg.its.mispauth.model.Organisation; | ||||
| import de.overview.wg.its.mispauth.network.MispRequest; | ||||
| import org.json.JSONObject; | ||||
| import de.overview.wg.its.mispauth.custom_viewpager.ExtendedViewPager; | ||||
| import org.json.JSONArray; | ||||
| 
 | ||||
| public class SyncActivity extends AppCompatActivity { | ||||
| 
 | ||||
| 	private PreferenceManager preferenceManager; | ||||
| 
 | ||||
| 	private static final int PAGE_COUNT = 3; | ||||
| 	private ExtendedViewPager viewPager; | ||||
| 	private PagerAdapter pagerAdapter; | ||||
| 	private LinearLayout bottomLayout; | ||||
| 
 | ||||
| 
 | ||||
| 	@Override | ||||
| 	protected void onCreate(Bundle savedInstanceState) { | ||||
| 		super.onCreate(savedInstanceState); | ||||
| 		setContentView(R.layout.activity_sync); | ||||
| 
 | ||||
| 		preferenceManager = PreferenceManager.Instance(this); | ||||
| 		uploadOrganisation(preferenceManager.getMyOrganisation()); | ||||
| 
 | ||||
| 		setupViewPager(); | ||||
| 	} | ||||
| 
 | ||||
| 	private void setupViewPager() { | ||||
| 		bottomLayout = findViewById(R.id.linearLayout); | ||||
| 
 | ||||
| 		pagerAdapter = new SimplePagerAdapter(getSupportFragmentManager()); | ||||
| 
 | ||||
| 		viewPager = findViewById(R.id.viewPager); | ||||
| 		viewPager.setPagingEnabled(false); | ||||
| 		viewPager.setAdapter(pagerAdapter); | ||||
| 
 | ||||
| 		viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { | ||||
| 
 | ||||
| 			@Override | ||||
| 			public void onPageSelected(int position) { | ||||
| 				if (position == 0) { | ||||
| 					bottomLayout.setVisibility(View.GONE); | ||||
| 				} else { | ||||
| 					bottomLayout.setVisibility(View.VISIBLE); | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			@Override | ||||
| 			public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { | ||||
| 
 | ||||
| 			} | ||||
| 
 | ||||
| 			// SCROLL_STATE_IDLE, SCROLL_STATE_DRAGGING, SCROLL_STATE_SETTLING
 | ||||
| 			@Override | ||||
| 			public void onPageScrollStateChanged(int state) { | ||||
| 
 | ||||
| 			} | ||||
| 		}); | ||||
| 
 | ||||
| 		Button next = findViewById(R.id.nextButton); | ||||
| 		Button back = findViewById(R.id.backButton); | ||||
| 
 | ||||
| 		next.setOnClickListener(new View.OnClickListener() { | ||||
| 			@Override | ||||
| 			public void onClick(View v) { | ||||
| 				viewPager.setCurrentItem(viewPager.getCurrentItem() + 1, true); | ||||
| 			} | ||||
| 		}); | ||||
| 
 | ||||
| 		back.setOnClickListener(new View.OnClickListener() { | ||||
| 			@Override | ||||
| 			public void onClick(View v) { | ||||
| 				viewPager.setCurrentItem(viewPager.getCurrentItem() - 1, true); | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
| 
 | ||||
| 	private class SimplePagerAdapter extends FragmentStatePagerAdapter { | ||||
| 
 | ||||
| 		public SimplePagerAdapter(FragmentManager fm) { | ||||
| 			super(fm); | ||||
| 		} | ||||
| 
 | ||||
| 		@Override | ||||
| 		public Fragment getItem(int position) { | ||||
| 
 | ||||
| 			switch (position) { | ||||
| 				case 0: | ||||
| 					return new SyncStartFragment(); // start fragment
 | ||||
| 
 | ||||
| 				case 1: | ||||
| 					return new ScanQrFragment(); // scan fragment
 | ||||
| 
 | ||||
| 				case 2: | ||||
| 					return new ShowQrFragment(); // show QR fragment
 | ||||
| 
 | ||||
| 				case 3: | ||||
| 					return new UploadFragment(); // show upload fragment
 | ||||
| 
 | ||||
| 				default: | ||||
| 					return null; // This should not be happening
 | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		@Override | ||||
| 		public int getCount() { | ||||
| 			return PAGE_COUNT; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	private void uploadOrganisation(Organisation org) { | ||||
| 		MispRequest mispRequest = MispRequest.Instance(this); | ||||
| 
 | ||||
| //		mispRequest.addOrganisation(org, new MispRequest.OrganisationCallback() {
 | ||||
| //			@Override
 | ||||
| //			public void onResult(JSONObject organisationInformation) {
 | ||||
| //
 | ||||
| //			}
 | ||||
| //
 | ||||
| //			@Override
 | ||||
| //			public void onError(VolleyError volleyError) {
 | ||||
| //
 | ||||
| //			}
 | ||||
| //		});
 | ||||
| 
 | ||||
| 		mispRequest.getServers(new MispRequest.ServerCallback() { | ||||
| 		mispRequest.getOrganisations(new MispRequest.OrganisationsCallback() { | ||||
| 			@Override | ||||
| 			public void onResult(JSONObject servers) { | ||||
| 			public void onResult(JSONArray organisations) { | ||||
| 
 | ||||
| 			} | ||||
| 
 | ||||
|  |  | |||
|  | @ -0,0 +1,38 @@ | |||
| package de.overview.wg.its.mispauth.custom_viewpager; | ||||
| 
 | ||||
| import android.content.Context; | ||||
| import android.support.v4.view.ViewPager; | ||||
| import android.util.AttributeSet; | ||||
| import android.view.MotionEvent; | ||||
| 
 | ||||
| public class ExtendedViewPager extends ViewPager { | ||||
| 
 | ||||
| 	private boolean enabled; | ||||
| 
 | ||||
| 	public ExtendedViewPager(Context context, AttributeSet attrs) { | ||||
| 		super(context, attrs); | ||||
| 		this.enabled = true; | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public boolean onTouchEvent(MotionEvent event) { | ||||
| 		if (this.enabled) { | ||||
| 			return super.onTouchEvent(event); | ||||
| 		} | ||||
| 
 | ||||
| 		return false; | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	public boolean onInterceptTouchEvent(MotionEvent event) { | ||||
| 		if (this.enabled) { | ||||
| 			return super.onInterceptTouchEvent(event); | ||||
| 		} | ||||
| 
 | ||||
| 		return false; | ||||
| 	} | ||||
| 
 | ||||
| 	public void setPagingEnabled(boolean enabled) { | ||||
| 		this.enabled = enabled; | ||||
| 	} | ||||
| } | ||||
|  | @ -0,0 +1,17 @@ | |||
| package de.overview.wg.its.mispauth.fragment; | ||||
| 
 | ||||
| import android.os.Bundle; | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import de.overview.wg.its.mispauth.R; | ||||
| 
 | ||||
| public class ScanQrFragment extends Fragment { | ||||
| 
 | ||||
| 	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||||
| 		View v = inflater.inflate(R.layout.fragment_sync_scan, null); | ||||
| 		return v; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,27 @@ | |||
| package de.overview.wg.its.mispauth.fragment; | ||||
| 
 | ||||
| import android.os.Bundle; | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import android.widget.ImageView; | ||||
| import de.overview.wg.its.mispauth.R; | ||||
| import net.glxn.qrgen.android.QRCode; | ||||
| 
 | ||||
| public class ShowQrFragment extends Fragment { | ||||
| 
 | ||||
| 	private ImageView qrImageView; | ||||
| 
 | ||||
| 	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||||
| 		View v = inflater.inflate(R.layout.fragment_sync_show, null); | ||||
| 
 | ||||
| 		qrImageView = v.findViewById(R.id.image_view_qr); | ||||
| 		setQr("Hallo hier steht leide nur scheiße, aber ansonsten hat alles geklappt!  (Y)"); | ||||
| 		return v; | ||||
| 	} | ||||
| 
 | ||||
| 	public void setQr(String msg) { | ||||
| 		qrImageView.setImageBitmap(QRCode.from(msg).bitmap()); | ||||
| 	} | ||||
| } | ||||
|  | @ -0,0 +1,17 @@ | |||
| package de.overview.wg.its.mispauth.fragment; | ||||
| 
 | ||||
| import android.os.Bundle; | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import de.overview.wg.its.mispauth.R; | ||||
| 
 | ||||
| public class SyncStartFragment extends Fragment { | ||||
| 
 | ||||
| 	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||||
| 		View v = inflater.inflate(R.layout.fragment_sync_start, null); | ||||
| 		return v; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,17 @@ | |||
| package de.overview.wg.its.mispauth.fragment; | ||||
| 
 | ||||
| import android.os.Bundle; | ||||
| import android.support.v4.app.Fragment; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
| import de.overview.wg.its.mispauth.R; | ||||
| 
 | ||||
| public class UploadFragment extends Fragment { | ||||
| 
 | ||||
| 	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||||
| 		View v = inflater.inflate(R.layout.fragment_sync_upload, null); | ||||
| 		return v; | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
|  | @ -0,0 +1,42 @@ | |||
| package de.overview.wg.its.mispauth.network; | ||||
| 
 | ||||
| import com.android.volley.NetworkResponse; | ||||
| import com.android.volley.ParseError; | ||||
| import com.android.volley.Response; | ||||
| import com.android.volley.toolbox.HttpHeaderParser; | ||||
| import com.android.volley.toolbox.JsonRequest; | ||||
| import org.json.JSONArray; | ||||
| import org.json.JSONException; | ||||
| import org.json.JSONObject; | ||||
| 
 | ||||
| import java.io.UnsupportedEncodingException; | ||||
| 
 | ||||
| public class JsonArrayRequestWithJsonObject extends JsonRequest<JSONArray> { | ||||
| 	/** | ||||
| 	 * Creates a new request. | ||||
| 	 * @param method the HTTP method to use | ||||
| 	 * @param url URL to fetch the JSON from | ||||
| 	 * @param jsonRequest A {@link JSONObject} to post with the request. Null is allowed and | ||||
| 	 *   indicates no parameters will be posted along with request. | ||||
| 	 * @param listener Listener to receive the JSON response | ||||
| 	 * @param errorListener Error listener, or null to ignore errors. | ||||
| 	 */ | ||||
| 
 | ||||
| 	public JsonArrayRequestWithJsonObject(int method, String url, JSONObject jsonRequest, Response.Listener<JSONArray> listener, Response.ErrorListener errorListener) { | ||||
| 		super(method, url, (jsonRequest == null) ? null : jsonRequest.toString(), listener, errorListener); | ||||
| 	} | ||||
| 
 | ||||
| 	@Override | ||||
| 	protected Response<JSONArray> parseNetworkResponse(NetworkResponse response) { | ||||
| 		try { | ||||
| 
 | ||||
| 			String jsonString = new String(response.data, HttpHeaderParser.parseCharset(response.headers, PROTOCOL_CHARSET)); | ||||
| 			return Response.success(new JSONArray(jsonString), HttpHeaderParser.parseCacheHeaders(response)); | ||||
| 
 | ||||
| 		} catch (UnsupportedEncodingException | JSONException e) { | ||||
| 
 | ||||
| 			return Response.error(new ParseError(e)); | ||||
| 
 | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | @ -7,11 +7,13 @@ import com.android.volley.Request; | |||
| import com.android.volley.RequestQueue; | ||||
| import com.android.volley.Response; | ||||
| import com.android.volley.VolleyError; | ||||
| import com.android.volley.toolbox.JsonArrayRequest; | ||||
| import com.android.volley.toolbox.JsonObjectRequest; | ||||
| import com.android.volley.toolbox.Volley; | ||||
| import de.overview.wg.its.mispauth.auxiliary.PreferenceManager; | ||||
| import de.overview.wg.its.mispauth.auxiliary.ReadableError; | ||||
| import de.overview.wg.its.mispauth.model.Organisation; | ||||
| import org.json.JSONArray; | ||||
| import org.json.JSONException; | ||||
| import org.json.JSONObject; | ||||
| 
 | ||||
|  | @ -163,11 +165,25 @@ public class MispRequest { | |||
| 		requestQueue.add(r); | ||||
| 	} | ||||
| 
 | ||||
| 	public void getServers(ServerCallback callback) { | ||||
| 		Response.Listener<JSONObject> listener = new Response.Listener<JSONObject>() { | ||||
| 	public void getOrganisations(final OrganisationsCallback callback) { | ||||
| 		Response.Listener<JSONArray> listener = new Response.Listener<JSONArray>() { | ||||
| 			@Override | ||||
| 			public void onResponse(JSONObject response) { | ||||
| 				Log.d(TAG, "onResponse: " + response.toString()); | ||||
| 			public void onResponse(JSONArray response) { | ||||
| 
 | ||||
| 				JSONArray resultArray = new JSONArray(); | ||||
| 
 | ||||
| 				int orgCount = response.length(); | ||||
| 
 | ||||
| 				for(int i = 0; i < orgCount; i++) { | ||||
| 					try { | ||||
| 						resultArray.put(response.getJSONObject(i).getJSONObject("Organisation")); | ||||
| 					} catch (JSONException e) { | ||||
| 						e.printStackTrace(); | ||||
| 					} | ||||
| 				} | ||||
| 
 | ||||
| 				callback.onResult(resultArray); | ||||
| 				Log.d(TAG, "onResponse: " + resultArray.toString()); | ||||
| 			} | ||||
| 		}; | ||||
| 
 | ||||
|  | @ -178,9 +194,9 @@ public class MispRequest { | |||
| 			} | ||||
| 		}; | ||||
| 
 | ||||
| 		Request r = objectRequest( | ||||
| 		Request r = arrayRequestWithJsonObject( | ||||
| 				Request.Method.GET, | ||||
| 				serverUrl + "/servers/view/", | ||||
| 				serverUrl + "/organisations/index", | ||||
| 				null, | ||||
| 				listener, | ||||
| 				errorListener); | ||||
|  | @ -188,15 +204,12 @@ public class MispRequest { | |||
| 		requestQueue.add(r); | ||||
| 	} | ||||
| 
 | ||||
| 	private JsonArrayRequestWithJsonObject arrayRequestWithJsonObject(int method, String url, | ||||
| 	                                                                  @Nullable JSONObject body, | ||||
| 	                                                                  Response.Listener<JSONArray> listener, | ||||
| 	                                                                  Response.ErrorListener errorListener) { | ||||
| 
 | ||||
| 	private JsonObjectRequest objectRequest(int method, | ||||
| 	                                        String url, | ||||
| 	                                        @Nullable JSONObject body, | ||||
| 	                                        Response.Listener<JSONObject> listener, | ||||
| 	                                        Response.ErrorListener errorListener) { | ||||
| 
 | ||||
| 		return new JsonObjectRequest(method, url, body, listener, errorListener) { | ||||
| 
 | ||||
| 		return new JsonArrayRequestWithJsonObject(method, url, body, listener, errorListener) { | ||||
| 			@Override | ||||
| 			public Map<String, String> getHeaders() { | ||||
| 				Map<String, String> params = new HashMap<>(); | ||||
|  | @ -207,10 +220,27 @@ public class MispRequest { | |||
| 
 | ||||
| 				return params; | ||||
| 			} | ||||
| 
 | ||||
| 		}; | ||||
| 	} | ||||
| 
 | ||||
| 	private JsonObjectRequest objectRequest(int method, String url, | ||||
| 	                                        @Nullable JSONObject body, | ||||
| 	                                        Response.Listener<JSONObject> listener, | ||||
| 	                                        Response.ErrorListener errorListener) { | ||||
| 
 | ||||
| 		return new JsonObjectRequest(method, url, body, listener, errorListener) { | ||||
| 			@Override | ||||
| 			public Map<String, String> getHeaders() { | ||||
| 				Map<String, String> params = new HashMap<>(); | ||||
| 
 | ||||
| 				params.put("Authorization", apiKey); | ||||
| 				params.put("Accept", "application/json"); | ||||
| 				params.put("Content-Type", "application/json; utf-8"); | ||||
| 
 | ||||
| 				return params; | ||||
| 			} | ||||
| 		}; | ||||
| 	} | ||||
| 
 | ||||
| 	public void setServerCredentials(String serverUrl, String apiKey) { | ||||
| 		this.serverUrl = serverUrl; | ||||
|  | @ -225,15 +255,12 @@ public class MispRequest { | |||
| 		return instance; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	public interface IntegerCallback { | ||||
| 		void onResult(int result); | ||||
| 
 | ||||
| 	public interface OrganisationsCallback { | ||||
| 		void onResult(JSONArray organisations); | ||||
| 		void onError(VolleyError volleyError); | ||||
| 	} | ||||
| 	public interface OrganisationCallback { | ||||
| 		void onResult(JSONObject organisationInformation); | ||||
| 
 | ||||
| 		void onError(VolleyError volleyError); | ||||
| 	} | ||||
| 	public interface UserCallback { | ||||
|  |  | |||
|  | @ -0,0 +1,9 @@ | |||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|         android:width="24dp" | ||||
|         android:height="24dp" | ||||
|         android:viewportWidth="24.0" | ||||
|         android:viewportHeight="24.0"> | ||||
|     <path | ||||
|         android:fillColor="#11000000" | ||||
|         android:pathData="M12,4L12,1L8,5l4,4L12,6c3.31,0 6,2.69 6,6 0,1.01 -0.25,1.97 -0.7,2.8l1.46,1.46C19.54,15.03 20,13.57 20,12c0,-4.42 -3.58,-8 -8,-8zM12,18c-3.31,0 -6,-2.69 -6,-6 0,-1.01 0.25,-1.97 0.7,-2.8L5.24,7.74C4.46,8.97 4,10.43 4,12c0,4.42 3.58,8 8,8v3l4,-4 -4,-4v3z"/> | ||||
| </vector> | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 3.5 MiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 3.5 MiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 322 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 64 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 3.5 MiB | 
|  | @ -1,270 +1,76 @@ | |||
| <?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" | ||||
| 		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:layout_width="match_parent" | ||||
|     android:layout_height="match_parent" | ||||
| 		android:layout_width="match_parent" | ||||
| 		android:layout_height="match_parent" | ||||
| 
 | ||||
|     tools:context=".activity.SyncActivity" | ||||
|     android:background="@color/colorPrimary"> | ||||
| 		tools:context=".activity.SyncActivity" | ||||
| 		android:background="@color/colorPrimary"> | ||||
| 
 | ||||
|     <android.support.design.widget.AppBarLayout | ||||
|         android:id="@+id/sync.appbar" | ||||
|         app:elevation="0dp" | ||||
|         android:background="@color/colorPrimaryDark" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:theme="@style/AppTheme.AppBarOverlay"> | ||||
| 	<android.support.design.widget.AppBarLayout | ||||
| 			android:id="@+id/sync.appbar" | ||||
| 			android:background="@color/colorPrimaryDark" | ||||
| 			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="?attr/actionBarSize" | ||||
|             android:backgroundTint="@color/colorPrimary" | ||||
|             android:background="@drawable/background_rounded_main" | ||||
|             app:popupTheme="@style/AppTheme.PopupOverlay" /> | ||||
| 		<android.support.v7.widget.Toolbar | ||||
| 				android:id="@+id/toolbar" | ||||
| 				android:layout_width="match_parent" | ||||
| 				android:layout_height="?attr/actionBarSize" | ||||
| 				android:backgroundTint="@color/colorPrimary" | ||||
| 				android:background="@drawable/background_rounded_main" | ||||
| 				app:popupTheme="@style/AppTheme.PopupOverlay"/> | ||||
| 
 | ||||
|         <LinearLayout | ||||
|             android:background="@color/colorPrimary" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:orientation="horizontal"> | ||||
| 	</android.support.design.widget.AppBarLayout> | ||||
| 
 | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_weight="1" | ||||
|                 android:text="Scan" | ||||
|                 android:textAlignment="center" /> | ||||
| 	<android.support.constraint.ConstraintLayout | ||||
| 			android:layout_width="match_parent" | ||||
| 			android:layout_height="match_parent" | ||||
| 			android:background="@drawable/background_rounded_main" | ||||
| 			android:padding="0dp" | ||||
| 			app:layout_behavior="@string/appbar_scrolling_view_behavior"> | ||||
| 
 | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_weight="1" | ||||
|                 android:text="Share" | ||||
|                 android:textAlignment="center" /> | ||||
| 		<de.overview.wg.its.mispauth.custom_viewpager.ExtendedViewPager | ||||
| 				android:id="@+id/viewPager" | ||||
| 				android:layout_width="match_parent" | ||||
| 				android:layout_height="0dp" | ||||
| 				app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent" | ||||
| 				app:layout_constraintEnd_toEndOf="parent" | ||||
| 				app:layout_constraintBottom_toTopOf="@+id/linearLayout"/> | ||||
| 
 | ||||
|             <TextView | ||||
|                 android:layout_width="wrap_content" | ||||
|                 android:layout_height="wrap_content" | ||||
|                 android:layout_weight="1" | ||||
|                 android:text="Upload" | ||||
|                 android:textAlignment="center" /> | ||||
|         </LinearLayout> | ||||
| 		<LinearLayout | ||||
| 				android:id="@+id/linearLayout" | ||||
| 				android:background="@color/colorPrimary" | ||||
| 				android:layout_width="match_parent" | ||||
| 				android:layout_height="wrap_content" | ||||
| 				android:orientation="horizontal" | ||||
| 				app:layout_constraintBottom_toBottomOf="parent" | ||||
| 				app:layout_constraintStart_toStartOf="parent" | ||||
| 				app:layout_constraintEnd_toEndOf="parent"> | ||||
| 
 | ||||
|         <ProgressBar | ||||
|             android:id="@+id/progressBar" | ||||
|             style="@style/Widget.AppCompat.ProgressBar.Horizontal" | ||||
|             android:layout_width="match_parent" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:background="@color/colorPrimary" | ||||
|             android:indeterminate="false" | ||||
|             android:max="100" | ||||
|             android:progress="100" | ||||
|             android:paddingBottom="8dp" | ||||
|             android:paddingEnd="60dp" | ||||
|             android:paddingStart="60dp" | ||||
|             android:paddingTop="8dp" | ||||
|             android:progressTint="@color/colorAccent" | ||||
|             android:visibility="visible" /> | ||||
|     </android.support.design.widget.AppBarLayout> | ||||
| 			<Button style="@style/Widget.AppCompat.Button.Borderless.Colored" | ||||
| 			        android:id="@+id/backButton" | ||||
| 			        android:text="Back" | ||||
| 			        android:layout_width="wrap_content" | ||||
| 			        android:layout_height="wrap_content"/> | ||||
| 
 | ||||
|     <android.support.constraint.ConstraintLayout | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="match_parent" | ||||
|         android:background="@drawable/background_rounded_main" | ||||
|         android:padding="0dp" | ||||
|         app:layout_behavior="@string/appbar_scrolling_view_behavior"> | ||||
| 			<TextView | ||||
| 					android:layout_weight="1" | ||||
| 					android:layout_width="0dp" | ||||
| 					android:layout_height="wrap_content"/> | ||||
| 
 | ||||
|         <!--<LinearLayout--> | ||||
|         <!--android:layout_width="match_parent"--> | ||||
|         <!--android:layout_height="match_parent"--> | ||||
|         <!--android:orientation="vertical">--> | ||||
| 			<Button style="@style/Widget.AppCompat.Button.Borderless.Colored" | ||||
| 			        android:id="@+id/nextButton" | ||||
| 			        android:text="Next" | ||||
| 			        android:layout_width="wrap_content" | ||||
| 			        android:layout_height="wrap_content"/> | ||||
| 		</LinearLayout> | ||||
| 
 | ||||
|         <!--<FrameLayout--> | ||||
|         <!--android:layout_width="match_parent"--> | ||||
|         <!--android:layout_height="match_parent">--> | ||||
| 
 | ||||
|         <!--<ImageView--> | ||||
|         <!--android:layout_width="match_parent"--> | ||||
|         <!--android:layout_height="match_parent"--> | ||||
|         <!--android:adjustViewBounds="true"--> | ||||
|         <!--android:cropToPadding="true"--> | ||||
|         <!--android:scaleType="centerCrop"--> | ||||
|         <!--android:src="@drawable/test_image_low_res" />--> | ||||
| 
 | ||||
|         <!--<ImageView--> | ||||
|         <!--android:layout_width="match_parent"--> | ||||
|         <!--android:layout_height="match_parent"--> | ||||
|         <!--android:src="@drawable/ic_qr_aim"--> | ||||
|         <!--android:tint="@color/colorPrimary" />--> | ||||
| 
 | ||||
|         <!--</FrameLayout>--> | ||||
| 
 | ||||
|         <!--<ImageView--> | ||||
|         <!--android:id="@+id/sync_my_qr"--> | ||||
|         <!--android:layout_width="match_parent"--> | ||||
|         <!--android:layout_height="match_parent"--> | ||||
|         <!--android:adjustViewBounds="false"--> | ||||
|         <!--android:cropToPadding="false"--> | ||||
|         <!--android:scaleType="center"/>--> | ||||
| 
 | ||||
|         <android.support.v7.widget.CardView | ||||
|             android:layout_margin="16dp" | ||||
|             android:id="@+id/cardView_0" | ||||
|             android:layout_width="0dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginEnd="8dp" | ||||
|             android:layout_marginStart="8dp" | ||||
|             android:layout_marginTop="8dp" | ||||
|             app:contentPadding="8dp" | ||||
|             app:layout_constraintEnd_toEndOf="parent" | ||||
|             app:layout_constraintStart_toStartOf="parent" | ||||
|             app:layout_constraintTop_toTopOf="parent"> | ||||
| 
 | ||||
|             <RelativeLayout | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="match_parent"> | ||||
| 
 | ||||
|                 <TextView | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:gravity="center_vertical" | ||||
|                     android:text="Test connection to server" | ||||
|                     android:textStyle="bold" /> | ||||
| 
 | ||||
|                 <ImageView | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:layout_alignParentEnd="true" | ||||
|                     android:src="@drawable/ic_check" | ||||
|                     android:tint="@color/colorPrimary" /> | ||||
| 
 | ||||
|             </RelativeLayout> | ||||
| 
 | ||||
|         </android.support.v7.widget.CardView> | ||||
| 
 | ||||
|         <android.support.v7.widget.CardView | ||||
|             android:id="@+id/cardView_1" | ||||
|             android:layout_width="0dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_margin="16dp" | ||||
|             android:layout_marginEnd="8dp" | ||||
|             android:layout_marginStart="8dp" | ||||
|             android:layout_marginTop="32dp" | ||||
|             app:contentPadding="8dp" | ||||
|             app:layout_constraintEnd_toEndOf="parent" | ||||
|             app:layout_constraintStart_toStartOf="parent" | ||||
|             app:layout_constraintTop_toBottomOf="@+id/cardView_0"> | ||||
| 
 | ||||
|             <RelativeLayout | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="match_parent"> | ||||
| 
 | ||||
|                 <TextView | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:gravity="center_vertical" | ||||
|                     android:text="Add organisation" | ||||
|                     android:textStyle="bold" /> | ||||
| 
 | ||||
|                 <ImageView | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:layout_alignParentEnd="true" | ||||
|                     android:src="@drawable/ic_check" | ||||
|                     android:tint="@color/colorPrimary" /> | ||||
| 
 | ||||
|             </RelativeLayout> | ||||
| 
 | ||||
|         </android.support.v7.widget.CardView> | ||||
| 
 | ||||
|         <android.support.v7.widget.CardView | ||||
|             android:layout_margin="16dp" | ||||
|             android:id="@+id/cardView_2" | ||||
|             android:layout_width="0dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginEnd="8dp" | ||||
|             android:layout_marginStart="8dp" | ||||
|             android:layout_marginTop="24dp" | ||||
|             app:contentPadding="8dp" | ||||
|             app:layout_constraintEnd_toEndOf="parent" | ||||
|             app:layout_constraintStart_toStartOf="parent" | ||||
|             app:layout_constraintTop_toBottomOf="@+id/cardView_1"> | ||||
| 
 | ||||
|             <RelativeLayout | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="match_parent"> | ||||
| 
 | ||||
|                 <TextView | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:gravity="center_vertical" | ||||
|                     android:text="Add user to organisation" | ||||
|                     android:textStyle="bold" /> | ||||
| 
 | ||||
|                 <ImageView | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:layout_alignParentEnd="true" | ||||
|                     android:src="@drawable/ic_check" | ||||
|                     android:tint="@color/colorPrimary" /> | ||||
| 
 | ||||
|             </RelativeLayout> | ||||
| 
 | ||||
|         </android.support.v7.widget.CardView> | ||||
| 
 | ||||
|         <android.support.v7.widget.CardView | ||||
|             android:layout_margin="16dp" | ||||
|             android:id="@+id/cardView_3" | ||||
|             android:layout_width="0dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:layout_marginEnd="8dp" | ||||
|             android:layout_marginStart="8dp" | ||||
|             android:layout_marginTop="24dp" | ||||
|             app:contentPadding="8dp" | ||||
|             app:layout_constraintEnd_toEndOf="parent" | ||||
|             app:layout_constraintStart_toStartOf="parent" | ||||
|             app:layout_constraintTop_toBottomOf="@+id/cardView_2"> | ||||
| 
 | ||||
|             <RelativeLayout | ||||
|                 android:layout_width="match_parent" | ||||
|                 android:layout_height="match_parent"> | ||||
| 
 | ||||
|                 <TextView | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:gravity="center_vertical" | ||||
|                     android:text="Add sync server" | ||||
|                     android:textStyle="bold" /> | ||||
| 
 | ||||
|                 <ImageView | ||||
|                     android:layout_width="wrap_content" | ||||
|                     android:layout_height="wrap_content" | ||||
|                     android:layout_alignParentEnd="true" | ||||
|                     android:src="@drawable/ic_check" | ||||
|                     android:tint="@color/colorPrimary" /> | ||||
| 
 | ||||
|             </RelativeLayout> | ||||
| 
 | ||||
|         </android.support.v7.widget.CardView> | ||||
| 
 | ||||
|         <Button | ||||
|             android:id="@+id/button3" | ||||
|             style="@style/CustomButton" | ||||
|             android:layout_width="0dp" | ||||
|             android:layout_height="wrap_content" | ||||
|             android:background="@drawable/background_rounded_main" | ||||
|             android:backgroundTint="@color/colorPrimary" | ||||
|             android:text="finish" | ||||
|             app:layout_constraintBottom_toBottomOf="parent" | ||||
|             app:layout_constraintEnd_toEndOf="parent" | ||||
|             app:layout_constraintStart_toStartOf="parent" /> | ||||
| 
 | ||||
|         <!--</LinearLayout>--> | ||||
|     </android.support.constraint.ConstraintLayout> | ||||
| 	</android.support.constraint.ConstraintLayout> | ||||
| 
 | ||||
| </android.support.design.widget.CoordinatorLayout> | ||||
|  | @ -0,0 +1,17 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.constraint.ConstraintLayout | ||||
| 		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"> | ||||
| 
 | ||||
| 	<TextView | ||||
| 			android:layout_width="wrap_content" | ||||
| 			android:layout_height="wrap_content" | ||||
| 			android:text="Scan QR" | ||||
| 			app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp" | ||||
| 			app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="8dp" | ||||
| 			app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="8dp" | ||||
| 			app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="8dp"/> | ||||
| 
 | ||||
| </android.support.constraint.ConstraintLayout> | ||||
|  | @ -0,0 +1,12 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.constraint.ConstraintLayout | ||||
| 		xmlns:android="http://schemas.android.com/apk/res/android" | ||||
| 		android:layout_width="match_parent" | ||||
| 		android:layout_height="match_parent"> | ||||
| 
 | ||||
| 	<ImageView | ||||
| 			android:id="@+id/image_view_qr" | ||||
| 			android:layout_width="match_parent" | ||||
| 			android:layout_height="match_parent"/> | ||||
| 
 | ||||
| </android.support.constraint.ConstraintLayout> | ||||
|  | @ -0,0 +1,36 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.constraint.ConstraintLayout | ||||
| 		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"> | ||||
| 
 | ||||
| 	<ImageView | ||||
| 			android:id="@+id/sync_image" | ||||
| 			android:src="@drawable/ic_sync_alpha" | ||||
| 			android:layout_width="match_parent" | ||||
| 			android:layout_height="128dp"/> | ||||
| 
 | ||||
| 	<TextView | ||||
| 			android:gravity="center" | ||||
| 			android:id="@+id/help_text_sync" | ||||
| 			android:text="I am partner" | ||||
| 			android:layout_width="match_parent" | ||||
| 			android:layout_height="wrap_content" | ||||
| 			app:layout_constraintTop_toBottomOf="@+id/sync_image"/> | ||||
| 
 | ||||
| 	<Button style="@style/CustomButton" | ||||
| 	        android:id="@+id/button_scan" | ||||
| 	        android:text="Scan" | ||||
| 	        android:layout_width="match_parent" | ||||
| 	        android:layout_height="wrap_content" android:layout_marginBottom="8dp" | ||||
| 	        app:layout_constraintBottom_toTopOf="@+id/button_share"/> | ||||
| 
 | ||||
| 	<Button style="@style/CustomButton" | ||||
| 	        android:id="@+id/button_share" | ||||
| 	        android:text="Share" | ||||
| 	        android:layout_width="match_parent" | ||||
| 	        android:layout_height="wrap_content" android:layout_marginBottom="8dp" | ||||
| 	        app:layout_constraintBottom_toBottomOf="parent"/> | ||||
| 
 | ||||
| </android.support.constraint.ConstraintLayout> | ||||
|  | @ -0,0 +1,17 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <android.support.constraint.ConstraintLayout | ||||
| 		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"> | ||||
| 
 | ||||
| 	<TextView | ||||
| 			android:layout_width="wrap_content" | ||||
| 			android:layout_height="wrap_content" | ||||
| 			android:text="Upload" | ||||
| 			app:layout_constraintEnd_toEndOf="parent" android:layout_marginEnd="8dp" | ||||
| 			app:layout_constraintStart_toStartOf="parent" android:layout_marginStart="8dp" | ||||
| 			app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="8dp" | ||||
| 			app:layout_constraintTop_toTopOf="parent" android:layout_marginTop="8dp"/> | ||||
| 
 | ||||
| </android.support.constraint.ConstraintLayout> | ||||
|  | @ -1,10 +1,10 @@ | |||
| <resources> | ||||
| 
 | ||||
|     <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | ||||
|         <item name="colorPrimary">@color/colorPrimary</item> | ||||
|         <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||||
|         <item name="colorAccent">@color/colorAccent</item> | ||||
|     </style> | ||||
| 	<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | ||||
| 		<item name="colorPrimary">@color/colorPrimary</item> | ||||
| 		<item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||||
| 		<item name="colorAccent">@color/colorAccent</item> | ||||
| 	</style> | ||||
| 
 | ||||
|     <style name="TextLabel" parent="TextAppearance.AppCompat"> | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Felix Prahl-Kamps
						Felix Prahl-Kamps