Skip to content
Permalink
Browse files

layout/fragments: add the GUI for appmonitor (3/3)

This adds the GUI for the appmonitor framework. The main part
are the two fragments which are build up in a classic master->
detail view.
All used ressources are desgined to be used again.

Some things might change over time, depending on user feedback.

Signed-off-by: Blechd0se <alex.christ@hotmail.de>
  • Loading branch information
Blechd0se committed Jun 6, 2015
1 parent 9fa4f80 commit e383b9b0ec1374f4f8c796904d62cf42ffa9306c
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.aero.control"
android:versionCode="24"
android:versionCode="25"
android:versionName="2.1.2">

<uses-sdk
@@ -31,6 +31,7 @@

<activity
android:name=".AeroActivity"
android:launchMode="singleTop"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -39,7 +40,8 @@

<activity
android:name="com.aero.control.boot.RebootActivity"
android:theme="@style/RebootDialog" />
android:theme="@style/RebootDialog"
android:excludeFromRecents="true" />

<activity
android:name=".settings.PrefsActivity">
@@ -45,6 +45,7 @@
private ArrayList<Line> lines = new ArrayList<Line>();
private Paint paint = new Paint();
private Paint txtPaint = new Paint();
private final int mAxisColor;
private float minY = 0, minX = 0;
private float maxY = 0, maxX = 0;
private boolean isMaxYUserSet = false;
@@ -56,6 +57,7 @@
private boolean showMinAndMax = false;
private boolean showHorizontalGrid = false;
private int gridColor = 0xffffffff;
private boolean showClickedPoint = false;

public LineGraph(Context context){
this(context,null);
@@ -65,6 +67,7 @@ public LineGraph(Context context, AttributeSet attrs) {
txtPaint.setColor(0xffffffff);
txtPaint.setTextSize(20);
txtPaint.setAntiAlias(true);
mAxisColor = Color.LTGRAY;
}
public void setGridColor(int color)
{
@@ -78,6 +81,11 @@ public void showMinAndMaxValues(boolean show)
{
showMinAndMax = show;
}

public void showClickedPoint(boolean show) {
this.showClickedPoint = show;
}

public void setTextColor(int color)
{
txtPaint.setColor(color);
@@ -190,12 +198,13 @@ public void onDraw(Canvas ca) {
if (fullImage == null || shouldUpdate) {
fullImage = Bitmap.createBitmap(getWidth(), getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(fullImage);
canvas.drawColor(Color.WHITE);
String max = (int)maxY+"";// used to display max
String min = (int)minY+"";// used to display min
paint.reset();
Path path = new Path();

float bottomPadding = 1, topPadding = 0;
float bottomPadding = 0, topPadding = 0;
float sidePadding = 10;
if (this.showMinAndMax)
sidePadding = txtPaint.measureText(max);
@@ -275,16 +284,16 @@ public void onDraw(Canvas ca) {

paint.reset();

paint.setColor(this.gridColor);
paint.setAlpha(50);
paint.setColor(mAxisColor);
paint.setStrokeWidth(2 * getResources().getDisplayMetrics().density);
paint.setAntiAlias(true);
canvas.drawLine(sidePadding, getHeight() - bottomPadding, getWidth(), getHeight()-bottomPadding, paint);
if(this.showHorizontalGrid)
for(int i=1;i<=10;i++)
{
canvas.drawLine(sidePadding, getHeight() - bottomPadding-(i*lineSpace), getWidth(), getHeight()-bottomPadding-(i*lineSpace), paint);
}
paint.setAlpha(255);
paint.reset();


for (Line line : lines){
@@ -337,17 +346,17 @@ public void onDraw(Canvas ca) {
float yPixels = getHeight() - bottomPadding - (usableHeight*yPercent);

paint.setColor(Color.GRAY);
canvas.drawCircle(xPixels, yPixels, 10, paint);
canvas.drawCircle(xPixels, yPixels, 15, paint);
paint.setColor(Color.WHITE);
canvas.drawCircle(xPixels, yPixels, 5, paint);
canvas.drawCircle(xPixels, yPixels, 10, paint);

Path path2 = new Path();
path2.addCircle(xPixels, yPixels, 30, Direction.CW);
p.setPath(path2);
p.setRegion(new Region((int)(xPixels-30), (int)(yPixels-30), (int)(xPixels+30), (int)(yPixels+30)));

if (indexSelected == pointCount && listener != null){
paint.setColor(Color.parseColor("#33B5E5"));
paint.setColor(line.getColor());
paint.setAlpha(100);
canvas.drawPath(p.getPath(), paint);
paint.setAlpha(255);
@@ -360,8 +369,9 @@ public void onDraw(Canvas ca) {

shouldUpdate = false;
if (this.showMinAndMax) {
paint.setColor(Color.BLACK);
ca.drawText(max, 0, txtPaint.getTextSize(), txtPaint);
ca.drawText(min,0,this.getHeight(),txtPaint);
ca.drawText(min, 0, this.getHeight(),txtPaint);
}
}

@@ -394,7 +404,8 @@ public boolean onTouchEvent(MotionEvent event) {
if (r.contains(point.x, point.y) && listener != null) {
listener.onClick(lineCount, pointCount);
}
indexSelected = -1;
if (!showClickedPoint)
indexSelected = -1;
}
}

Binary file not shown.
Binary file not shown.
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape
android:shape="rectangle">
<solid android:color="@color/card_grey" />
<corners android:radius="2dp"/>
</shape>
</item>
<item android:right="1px" android:left="1px" android:bottom="2dp">
<shape
android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="2dp"/>
</shape>
</item>
</layer-list>
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape
android:shape="rectangle">
<solid android:color="@color/card_grey" />
<corners android:radius="2dp"/>
</shape>
</item>
<item android:right="1px" android:left="1px" android:bottom="2dp">
<shape
android:shape="rectangle">
<solid android:color="@color/material_orange"/>
<corners android:radius="2dp"/>
</shape>
</item>
</layer-list>
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/bg_grey">

<com.db.chart.view.LineChartView
android:padding="5dp"
android:layout_margin="5dp"
android:layout_width="match_parent"
android:layout_height="230dp"
android:background="@drawable/card"
android:id="@+id/graph"/>


<TextView
android:padding="5dp"
android:layout_margin="5dp"
android:textAllCaps="true"
android:background="@drawable/card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/graph"
android:textColor="@color/light_grey"
android:id="@+id/header"/>

<RelativeLayout
android:id="@+id/wrapper"
android:layout_margin="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@+id/header" >

<GridView
android:id="@+id/gridview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnWidth="96dp"
android:numColumns="auto_fit"
android:gravity="center"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="spacingWidthUniform"
android:layout_marginBottom="50dp"/>
</RelativeLayout>

</RelativeLayout>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp">

<TextView android:id="@+id/noData"
android:textSize="20sp"
android:fontFamily="sans-serif-medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="32dp"
android:text="NO DATA FOUND YET, CHECK BACK IN A FEW MINUTES!"
android:textColor="@color/light_grey" />

<ListView
android:id="@+id/apppstatistics"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="48dp"
android:divider="@android:color/transparent"
android:dividerHeight="5dip"/>

</LinearLayout>
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">

<RelativeLayout
android:id="@+id/wrapper"
android:layout_width="96dp"
android:layout_height="96dp">

<TextView
android:id="@+id/card_title"
android:padding="3dp"
android:layout_margin="1dip"
android:textAllCaps="true"
android:textSize="12sp"
android:gravity="start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/light_grey"/>

<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="@color/card_shadow"
android:layout_below="@+id/card_title"/>

<TextView
android:id="@+id/card_content"
android:padding="5dp"
android:layout_margin="1dip"
android:textAllCaps="true"
android:textSize="18sp"
android:gravity="center"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/light_grey"/>

</RelativeLayout>

</merge>
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/card"
android:padding="5dp"
android:descendantFocusability="beforeDescendants">

<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowimage"
android:layout_width="42dp"
android:layout_height="42dp"
android:padding="2dp"
android:layout_alignParentLeft="true"/>

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowtext"
android:layout_width="wrap_content"
android:textColor="@color/light_grey"
android:textSize="16sp"
android:padding="2dp"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/rowimage"/>
</RelativeLayout>
@@ -15,6 +15,11 @@
android:title="@string/pref_per_app_service"
android:summary="@string/pref_per_app_service_sum" />

<CheckBoxPreference
android:key="per_app_monitor"
android:title="Per App Monitor"
android:summary="Enable or disable the AppMonitor." />

<ListPreference
android:key="boot_delay"
android:title="@string/pref_boot_delay"
@@ -300,12 +300,15 @@
<string name="pref_profile_undo">Rückgangig</string>
<string name="pref_profile_no_changes">Es wurden noch keine Einstellungen vorgenommen!</string>
<string name="pref_profile_service_not_running">Per App Service ist nicht gestartet, es wurden aber Apps zu Profilen zugewiesen!</string>
<string name="pref_profile_loading_app_data">Programmierung des Flux-Kompensators...</string>
<string name="pref_profile_export">Exportieren</string>
<string name="pref_profile_import">Importieren</string>
<string name="pref_profile_import_select">Profile für Import auswählen</string>
<string name="pref_profile_no_import">Ich habe keine Profile zum Importieren gefunden.</string>

<!-- AppMonitor Fragment -->
<string name="pref_no_appmonitor_data">Es sind noch keine Daten verfügbar, schaue später nochmal vorbei.</string>
<string name="pref_appmonitor_disabled">AppMonitor ist deaktiviert. Aktiviere ihn in den Einstellungen um Daten zu sehen.</string>

<!-- Toast Messages -->
<string name="rateIt">Klick mich und bewerte diese App!</string>

@@ -327,4 +330,13 @@
<string name="introduction_tutorial_content">Tutorials erscheinen Dir beim Benutzen von Aero Control. Sie können Dir ein paar Tipps und Tricks verraten.
Wenn Du ein fortgeschrittener Benutzer bist, wirst Du sie vermutlich nicht brauchen.</string>

<!-- Random Loading Texts -->
<string name="random_nsa_loading">Sende alle Daten zur NSA...</string>
<string name="random_programming_flux">Programmierung des Flux-Kompensators...</string>
<string name="random_shovelling_coal">Schaufele Kohle in die CPU...</string>
<string name="random_testing_patience">Überprüfe deine Geduld...</string>
<string name="random_data_somewhere">Einen Moment bitte, Ich weiß die Daten sind hier irgendwo...</string>
<string name="random_working_you_know">Am Arbeiten... Naja... Du weißt schon...</string>
<string name="random_prepare_awesomeness">Bereite Dich auf was tolles vor!</string>

</resources>
@@ -11,6 +11,7 @@
<item>@string/slider_defy_parts</item>
<item>@string/slider_backup_restore</item>
<item>@string/slider_profile</item>
<item>@string/slider_app_monitor</item>
<item>@string/slider_testsuite_settings</item>
</string-array>

@@ -82,4 +82,9 @@
<!-- in progress view indicate min value of progress -->
<attr name="min" format="integer" />

<declare-styleable name="CardBox">
<attr name="cardTitle" format="string" />
<attr name="cardContent" format="string" />
</declare-styleable>

</resources>

0 comments on commit e383b9b

Please sign in to comment.
You can’t perform that action at this time.