created pdf and doc
This commit is contained in:
parent
9d7b925247
commit
8fc238f012
|
@ -9,6 +9,8 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:name=".AirKoalityApplication"
|
||||
|
@ -27,6 +29,19 @@
|
|||
|
||||
<meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/google_maps_key"/>
|
||||
|
||||
<provider
|
||||
android:authorities="@string/provider_authority"
|
||||
android:name="android.support.v4.content.FileProvider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true"
|
||||
>
|
||||
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/provider_paths" />
|
||||
|
||||
</provider>
|
||||
|
||||
<service android:name=".service.LocationService"/>
|
||||
|
||||
<activity android:name=".ui.activity.SplashActivity"
|
||||
|
|
|
@ -4,17 +4,24 @@ import android.content.BroadcastReceiver;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import at.fhj.airkoality.R;
|
||||
|
@ -24,6 +31,7 @@ import at.fhj.airkoality.model.LatestMeasurements;
|
|||
import at.fhj.airkoality.model.Measurement;
|
||||
import at.fhj.airkoality.network.HttpsGetTask;
|
||||
import at.fhj.airkoality.network.RequestCallback;
|
||||
import at.fhj.airkoality.util.Util;
|
||||
|
||||
public class MeasurementActivity extends AppCompatActivity implements RequestCallback {
|
||||
|
||||
|
@ -39,6 +47,7 @@ public class MeasurementActivity extends AppCompatActivity implements RequestCal
|
|||
private TextView tvPM25value;
|
||||
private TextView tvSO2value;
|
||||
private TextView tvNO2value;
|
||||
private View rootView;
|
||||
|
||||
private NetworkStateReceiver networkStateReceiver;
|
||||
|
||||
|
@ -56,7 +65,7 @@ public class MeasurementActivity extends AppCompatActivity implements RequestCal
|
|||
tvSO2value = findViewById(R.id.tvSO2value);
|
||||
tvNO2value = findViewById(R.id.tvNO2value);
|
||||
|
||||
|
||||
rootView = findViewById(R.id.rootView);
|
||||
|
||||
//TODO: get locationname from intent
|
||||
locationName = getIntent().getStringExtra("location_name");
|
||||
|
@ -205,4 +214,52 @@ public class MeasurementActivity extends AppCompatActivity implements RequestCal
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
|
||||
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.menu_measurement, menu);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
|
||||
switch (item.getItemId()){
|
||||
case R.id.action_share:
|
||||
shareMeasurements();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void shareMeasurements() {
|
||||
Bitmap bitmap = Util.getBitmapFromView(rootView);
|
||||
try {
|
||||
Uri uri = Util.savePng(this, bitmap,"measurements.png");
|
||||
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.putExtra(Intent.EXTRA_STREAM, uri);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, "Messdaten von " + locationName);
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, "AirKoality Daten");
|
||||
intent.setType("image/png");
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
startActivity(intent);
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package at.fhj.airkoality.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.net.Uri;
|
||||
import android.support.v4.content.FileProvider;
|
||||
import android.view.View;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import at.fhj.airkoality.R;
|
||||
|
||||
public class Util {
|
||||
public static Bitmap getBitmapFromView(View view) {
|
||||
Bitmap b = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas c = new Canvas(b);
|
||||
view.draw(c);
|
||||
return b;
|
||||
}
|
||||
|
||||
public static Uri savePng(Context context, Bitmap image, String filename) throws IOException {
|
||||
File imagesFolder = new File(context.getFilesDir(), "images");
|
||||
Uri uri;
|
||||
imagesFolder.mkdirs();
|
||||
File file = new File(imagesFolder, filename);
|
||||
|
||||
FileOutputStream stream = new FileOutputStream(file);
|
||||
image.compress(Bitmap.CompressFormat.PNG, 90, stream);
|
||||
stream.flush();
|
||||
stream.close();
|
||||
uri = FileProvider.getUriForFile(context, context.getString(R.string.provider_authority), file);
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FDF9FB"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>
|
||||
</vector>
|
|
@ -3,6 +3,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/rootView"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item android:id="@+id/action_share" app:showAsAction="always" android:title="Share" android:icon="@drawable/ic_share"/>
|
||||
|
||||
|
||||
</menu>
|
|
@ -8,4 +8,5 @@
|
|||
<string name="country_label">Country:</string>
|
||||
<string name="latest_measurements">Latest measurements:</string>
|
||||
<string name="google_maps_key">AIzaSyBQhcmDlyP01yNwTd4RTlatQIAJH3wJHw0</string>
|
||||
<string name="provider_authority">at.fhj.airkoality.provider</string>
|
||||
</resources>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<paths>
|
||||
<files-path
|
||||
name="images"
|
||||
path="images/" />
|
||||
</paths>
|
||||
</resources>
|
14
README.md
14
README.md
|
@ -108,3 +108,17 @@ ActivityMain
|
|||
|
||||
- Content Provider kennengelernt
|
||||
- wird verwendet um Daten für andere Apps bereitzustellen (z.B. Kontakte)
|
||||
- besteht aus URI - Content Resolver - Content Provider - Persistierung
|
||||
- Messdaten aus AirKoality in andere App übertragen (als PNG) [App die den Intent entgegennimmt muss den Filtype unterstützen]
|
||||
|
||||
- Wie kann eine App published werden?
|
||||
- Apk-File direkt (unsicher und unschön)
|
||||
- Market Places
|
||||
- Google Play
|
||||
- Amazon
|
||||
- Um im Play Store zu publishen muss man einen Developer Account anlegen (einmalige Zahlung von 25$)
|
||||
- max. 100MB
|
||||
- Target API ab Version 26
|
||||
- App signing
|
||||
- App wird mit einem Zertifikat signiert (Release oder Debug)
|
||||
- alle folgenden Updates der App müssen mit dem gleichen Key signiert werden
|
||||
|
|
BIN
README.pdf
BIN
README.pdf
Binary file not shown.
Loading…
Reference in New Issue