Commit 16b6a9ee by Amsal Situmorang

prasidang

parent 037b9250
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
......@@ -9,13 +9,17 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".UploadResultActivity"></activity>
<activity android:name=".ScanActivity">
</activity>
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".UploadActivity"></activity>
</application>
</manifest>
\ No newline at end of file
......@@ -29,7 +29,7 @@ public class AppAdapter extends ArrayAdapter<AppInfo>
List<AppInfo> apps;
public AppAdapter(@NonNull Context context, List<AppInfo> apps) {
super(context, R.layout.app_item_layout, apps);
super(context, R.layout.app_layout, apps);
layoutInflater = LayoutInflater.from(context);
packageManager = context.getPackageManager();
this.apps = apps;
......@@ -42,29 +42,11 @@ public class AppAdapter extends ArrayAdapter<AppInfo>
View view = convertView;
if(view == null)
{
view = layoutInflater.inflate(R.layout.app_item_layout, parent , false);
view = layoutInflater.inflate(R.layout.app_layout, parent , false);
}
TextView textViewTitle = (TextView)view.findViewById(R.id.titleTextView);
textViewTitle.setText(current.label);
try {
PackageInfo packageInfo = packageManager.getPackageInfo(current.info.packageName, 0);
if (!TextUtils.isEmpty(packageInfo.versionName))
{
String versionInfo = String.format("%s", packageInfo.versionName);
TextView textVersion= (TextView)view.findViewById(R.id.versionId);
textVersion.setText(versionInfo);
}
if (!TextUtils.isEmpty(current.info.packageName))
{
TextView textSubTitle= (TextView)view.findViewById(R.id.subTitle);
textSubTitle.setText(current.info.packageName);
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
ImageView imageView = (ImageView)view.findViewById(R.id.icon_image);
Drawable background = current.info.loadIcon(packageManager);
imageView.setBackgroundDrawable(background);
......
......@@ -7,7 +7,7 @@ import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class HomeActivity extends AppCompatActivity implements View.OnClickListener{
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
Button btn_upload;
Button btn_scan;
......@@ -15,7 +15,7 @@ public class HomeActivity extends AppCompatActivity implements View.OnClickListe
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
setContentView(R.layout.activity_main);
btn_upload = findViewById(R.id.btn_upload);
btn_scan = findViewById(R.id.btn_scan);
......@@ -29,11 +29,11 @@ public class HomeActivity extends AppCompatActivity implements View.OnClickListe
public void onClick(View v) {
switch (v.getId()){
case R.id.btn_upload:
Intent uploadIntent = new Intent(HomeActivity.this, MainActivity.class);
Intent uploadIntent = new Intent(MainActivity.this, UploadActivity.class);
startActivity(uploadIntent);
break;
case R.id.btn_scan:
Intent scanIntent = new Intent(HomeActivity.this, ScanActivity.class);
Intent scanIntent = new Intent(MainActivity.this, ScanActivity.class);
startActivity(scanIntent);
break;
}
......
package com.example.tad3ti03.Model;
import android.content.pm.ApplicationInfo;
import android.os.Parcel;
import android.os.Parcelable;
public class AppInfo {
public class AppInfo implements Parcelable {
public ApplicationInfo info;
public String label;
public AppInfo(Parcel in) {
info = in.readParcelable(ApplicationInfo.class.getClassLoader());
label = in.readString();
}
public static final Creator<AppInfo> CREATOR = new Creator<AppInfo>() {
@Override
public AppInfo createFromParcel(Parcel in) {
return new AppInfo(in);
}
@Override
public AppInfo[] newArray(int size) {
return new AppInfo[size];
}
};
public AppInfo() {
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(info, flags);
dest.writeString(label);
}
}
package com.example.tad3ti03;
import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ListView;
import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import com.example.tad3ti03.Adapter.AppAdapter;
import com.example.tad3ti03.Model.AppInfo;
import com.google.android.material.snackbar.Snackbar;
import java.io.Serializable;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class MainActivity extends AppCompatActivity {
public class UploadActivity extends AppCompatActivity {
GridView gridView;
boolean mIncludeSystemApps;
......@@ -33,7 +30,7 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setContentView(R.layout.activity_upload);
gridView = findViewById(R.id.griview);
gridView.setTextFilterEnabled(true);
......@@ -42,16 +39,18 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
AppInfo app = (AppInfo) parent.getItemAtPosition(position);
Intent myintent = getPackageManager().getLaunchIntentForPackage(app.info.packageName);
if(myintent == null)
{
Toast.makeText(getApplicationContext() , "No launcher attached with this app", Toast.LENGTH_LONG).show();
}
else
{
startActivity(myintent);
}
// Intent myintent = getPackageManager().getLaunchIntentForPackage(app.info.packageName);
Intent uploadIntent = new Intent(UploadActivity.this, UploadResultActivity.class);
uploadIntent.putExtra("AppInfo" , app);
startActivity(uploadIntent);
// if(myintent == null)
// {
// Toast.makeText(getApplicationContext() , "No launcher attached with this app", Toast.LENGTH_LONG).show();
// }
// else
// {
// startActivity(myintent);
// }
}
});
......@@ -74,7 +73,7 @@ public class MainActivity extends AppCompatActivity {
//sort the data
Collections.sort(apps, new DNComparator());
gridView.setAdapter(new AppAdapter(MainActivity.this, apps));
gridView.setAdapter(new AppAdapter(UploadActivity.this, apps));
}
......
......@@ -2,13 +2,33 @@ package com.example.tad3ti03;
import androidx.appcompat.app.AppCompatActivity;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.tad3ti03.Model.AppInfo;
public class UploadResultActivity extends AppCompatActivity {
TextView namaApk;
TextView malware;
TextView Status;
ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload_result);
AppInfo app = (AppInfo) getIntent().getParcelableExtra("AppInfo");
PackageManager packageManager = getPackageManager();
namaApk = findViewById(R.id.apkNameTextView);
namaApk.setText(app.label);
imageView = findViewById(R.id.icon_image);
Drawable background = app.info.loadIcon(packageManager);
imageView.setBackgroundDrawable(background);
}
}
......@@ -6,13 +6,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
tools:context=".HomeActivity">
tools:context=".MainActivity">
<Button
android:id="@+id/btn_upload"
android:layout_height="60dp"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:drawableLeft="@drawable/ic_file_upload_black_24dp"
android:text="Scan My apps"
android:textSize="20sp"
......@@ -25,7 +25,7 @@
<Button
android:id="@+id/btn_scan"
android:layout_height="60dp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:drawableLeft="@drawable/ic_file_upload_black_24dp"
android:text="Scan My Phone"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ScanActivity">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Coming soon !"/>
</LinearLayout>
\ No newline at end of file
......@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
tools:context=".UploadActivity">
<GridView
android:id="@+id/griview"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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:orientation="vertical"
tools:context=".UploadResultActivity">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<TextView
android:textStyle="bold"
android:textSize="40dp"
android:textAlignment="center"
android:text="Hasil Analisis Apk"
android:paddingBottom="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<ImageView
android:layout_width="160dp"
android:layout_height="160dp"
android:layout_marginLeft="110dp"
android:layout_marginRight="4dp"
android:id="@+id/icon_image"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textStyle="bold"
android:text="Nama Aplikasi :"/>
<Space
android:layout_width="4dp"
android:layout_height="0dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:id="@+id/apkNameTextView"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textStyle="bold"
android:text="Status : "/>
<Space
android:layout_width="4dp"
android:layout_height="0dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:id="@+id/statusTextView"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:textStyle="bold"
android:text="Malware : "/>
<Space
android:layout_width="4dp"
android:layout_height="0dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:id="@+id/malwareTextView"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?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">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/icon_image"
android:layout_width="60dp"
android:layout_height="60dp" />
<TextView
android:id="@+id/titleTextView"
android:gravity="center"
android:textSize="8sp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
......@@ -3,4 +3,5 @@
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="colorText">#ffffff</color>
</resources>
<resources>
<string name="app_name">TAD3TI03</string>
<string name="file_name">Nama File</string>
<string name="button_upload">Upload APK</string>
<string name="button_scan">Scan APK</string>
<string name="scan_name">Scan The Phone</string>
<string name="button_scanPhone">Scan My Phone</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment