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 @@ ...@@ -9,13 +9,17 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".MainActivity"> <activity android:name=".UploadResultActivity"></activity>
<activity android:name=".ScanActivity">
</activity>
<activity android:name=".MainActivity" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity android:name=".UploadActivity"></activity>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -29,7 +29,7 @@ public class AppAdapter extends ArrayAdapter<AppInfo> ...@@ -29,7 +29,7 @@ public class AppAdapter extends ArrayAdapter<AppInfo>
List<AppInfo> apps; List<AppInfo> apps;
public AppAdapter(@NonNull Context context, 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); layoutInflater = LayoutInflater.from(context);
packageManager = context.getPackageManager(); packageManager = context.getPackageManager();
this.apps = apps; this.apps = apps;
...@@ -42,29 +42,11 @@ public class AppAdapter extends ArrayAdapter<AppInfo> ...@@ -42,29 +42,11 @@ public class AppAdapter extends ArrayAdapter<AppInfo>
View view = convertView; View view = convertView;
if(view == null) 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); TextView textViewTitle = (TextView)view.findViewById(R.id.titleTextView);
textViewTitle.setText(current.label); 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); ImageView imageView = (ImageView)view.findViewById(R.id.icon_image);
Drawable background = current.info.loadIcon(packageManager); Drawable background = current.info.loadIcon(packageManager);
imageView.setBackgroundDrawable(background); imageView.setBackgroundDrawable(background);
......
...@@ -7,7 +7,7 @@ import android.os.Bundle; ...@@ -7,7 +7,7 @@ import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.Button; 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_upload;
Button btn_scan; Button btn_scan;
...@@ -15,7 +15,7 @@ public class HomeActivity extends AppCompatActivity implements View.OnClickListe ...@@ -15,7 +15,7 @@ public class HomeActivity extends AppCompatActivity implements View.OnClickListe
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home); setContentView(R.layout.activity_main);
btn_upload = findViewById(R.id.btn_upload); btn_upload = findViewById(R.id.btn_upload);
btn_scan = findViewById(R.id.btn_scan); btn_scan = findViewById(R.id.btn_scan);
...@@ -29,11 +29,11 @@ public class HomeActivity extends AppCompatActivity implements View.OnClickListe ...@@ -29,11 +29,11 @@ public class HomeActivity extends AppCompatActivity implements View.OnClickListe
public void onClick(View v) { public void onClick(View v) {
switch (v.getId()){ switch (v.getId()){
case R.id.btn_upload: case R.id.btn_upload:
Intent uploadIntent = new Intent(HomeActivity.this, MainActivity.class); Intent uploadIntent = new Intent(MainActivity.this, UploadActivity.class);
startActivity(uploadIntent); startActivity(uploadIntent);
break; break;
case R.id.btn_scan: case R.id.btn_scan:
Intent scanIntent = new Intent(HomeActivity.this, ScanActivity.class); Intent scanIntent = new Intent(MainActivity.this, ScanActivity.class);
startActivity(scanIntent); startActivity(scanIntent);
break; break;
} }
......
package com.example.tad3ti03.Model; package com.example.tad3ti03.Model;
import android.content.pm.ApplicationInfo; 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 ApplicationInfo info;
public String label; 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; package com.example.tad3ti03;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcelable;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.GridView; import android.widget.GridView;
import android.widget.ListView;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.widget.Toolbar;
import com.example.tad3ti03.Adapter.AppAdapter; import com.example.tad3ti03.Adapter.AppAdapter;
import com.example.tad3ti03.Model.AppInfo; import com.example.tad3ti03.Model.AppInfo;
import com.google.android.material.snackbar.Snackbar;
import java.io.Serializable;
import java.text.Collator; import java.text.Collator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
public class MainActivity extends AppCompatActivity { public class UploadActivity extends AppCompatActivity {
GridView gridView; GridView gridView;
boolean mIncludeSystemApps; boolean mIncludeSystemApps;
...@@ -33,7 +30,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -33,7 +30,7 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_upload);
gridView = findViewById(R.id.griview); gridView = findViewById(R.id.griview);
gridView.setTextFilterEnabled(true); gridView.setTextFilterEnabled(true);
...@@ -42,16 +39,18 @@ public class MainActivity extends AppCompatActivity { ...@@ -42,16 +39,18 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
AppInfo app = (AppInfo) parent.getItemAtPosition(position); AppInfo app = (AppInfo) parent.getItemAtPosition(position);
Intent myintent = getPackageManager().getLaunchIntentForPackage(app.info.packageName); // Intent myintent = getPackageManager().getLaunchIntentForPackage(app.info.packageName);
Intent uploadIntent = new Intent(UploadActivity.this, UploadResultActivity.class);
if(myintent == null) uploadIntent.putExtra("AppInfo" , app);
{ startActivity(uploadIntent);
Toast.makeText(getApplicationContext() , "No launcher attached with this app", Toast.LENGTH_LONG).show(); // if(myintent == null)
} // {
else // Toast.makeText(getApplicationContext() , "No launcher attached with this app", Toast.LENGTH_LONG).show();
{ // }
startActivity(myintent); // else
} // {
// startActivity(myintent);
// }
} }
}); });
...@@ -74,7 +73,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -74,7 +73,7 @@ public class MainActivity extends AppCompatActivity {
//sort the data //sort the data
Collections.sort(apps, new DNComparator()); 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; ...@@ -2,13 +2,33 @@ package com.example.tad3ti03;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.tad3ti03.Model.AppInfo;
public class UploadResultActivity extends AppCompatActivity { public class UploadResultActivity extends AppCompatActivity {
TextView namaApk;
TextView malware;
TextView Status;
ImageView imageView;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload_result); 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 @@ ...@@ -6,13 +6,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
tools:context=".HomeActivity"> tools:context=".MainActivity">
<Button <Button
android:id="@+id/btn_upload" android:id="@+id/btn_upload"
android:layout_height="60dp" android:layout_height="wrap_content"
android:layout_width="200dp" android:layout_width="wrap_content"
android:drawableLeft="@drawable/ic_file_upload_black_24dp" android:drawableLeft="@drawable/ic_file_upload_black_24dp"
android:text="Scan My apps" android:text="Scan My apps"
android:textSize="20sp" android:textSize="20sp"
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<Button <Button
android:id="@+id/btn_scan" android:id="@+id/btn_scan"
android:layout_height="60dp" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:drawableLeft="@drawable/ic_file_upload_black_24dp" android:drawableLeft="@drawable/ic_file_upload_black_24dp"
android:text="Scan My Phone" android:text="Scan My Phone"
......
<?xml version="1.0" encoding="utf-8"?> <?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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:gravity="center"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ScanActivity"> tools:context=".ScanActivity">
</androidx.constraintlayout.widget.ConstraintLayout> <TextView
\ No newline at end of file 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 @@ ...@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity"> tools:context=".UploadActivity">
<GridView <GridView
android:id="@+id/griview" android:id="@+id/griview"
......
<?xml version="1.0" encoding="utf-8"?> <?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:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".UploadResultActivity"> tools:context=".UploadResultActivity">
</androidx.constraintlayout.widget.ConstraintLayout> <TextView
\ No newline at end of file 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"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"> 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> </LinearLayout>
\ No newline at end of file
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
<color name="colorPrimary">#008577</color> <color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color> <color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color> <color name="colorAccent">#D81B60</color>
<color name="colorText">#ffffff</color>
</resources> </resources>
<resources> <resources>
<string name="app_name">TAD3TI03</string> <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> </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