Commit bf69c19f by ta 03

1

parent c6122516
......@@ -8,6 +8,7 @@ import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
......@@ -19,7 +20,7 @@ public class DetailResultActivity extends AppCompatActivity {
public static final String DETAIL_APP = "detail_app";
private ImageView logo;
private TextView appName, appStatus, appMalware, appKeterangan;
private LinearLayout appCard;
private CardView appCard;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -29,7 +30,7 @@ public class DetailResultActivity extends AppCompatActivity {
appName = findViewById(R.id.app_name);
appStatus = findViewById(R.id.status);
appMalware = findViewById(R.id.malware_name);
appCard = findViewById(R.id.status_card);
appCard = findViewById(R.id.profileCard);
appKeterangan = findViewById(R.id.detail);
AppResult app = getIntent().getParcelableExtra(DETAIL_APP);
......@@ -40,13 +41,26 @@ public class DetailResultActivity extends AppCompatActivity {
appName.setText(app.getApkName());
appMalware.setText(app.getMalware());
appKeterangan.setText(app.getDetail());
if (app.getStatus().equals("Tidak Berbahaya")) {
appCard.setBackgroundColor(Color.GREEN);
appStatus.setText("TIDAK BERBAHAYA");
appStatus.setText(app.getStatus());
if (app.getStatus().equals("NOT DANGEROUS")) {
appStatus.setTextColor(Color.GREEN);
} else {
appCard.setBackgroundColor(Color.RED);
appStatus.setText("BERBAHAYA");
appStatus.setTextColor(Color.RED);
}
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// handle arrow click here
if (item.getItemId() == android.R.id.home) {
finish(); // close this activity and return to preview activity (if there is any)
}
return super.onOptionsItemSelected(item);
}
}
......@@ -71,9 +71,9 @@ public class IntroActivity extends AppCompatActivity {
// fill list screen
final List<ScreenItem> mList = new ArrayList<>();
mList.add(new ScreenItem("Fresh Food","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur consectetur adipiscing elit",R.drawable.img1));
mList.add(new ScreenItem("Fast Delivery","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur consectetur adipiscing elit",R.drawable.img2));
mList.add(new ScreenItem("Easy Payment","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur consectetur adipiscing elit",R.drawable.img3));
mList.add(new ScreenItem("Malware Detector","MalToR is an application which can analyze mobile applications and detect malware from the applications.",R.drawable.img2));
mList.add(new ScreenItem("Best Accuration","MalToR can scan with high accuracy made with research and datacience.",R.drawable.img1));
mList.add(new ScreenItem("Scanning Apps","MalToR can scan applications by selecting one or more applications in your phone to scan.",R.drawable.img3));
// setup viewpager
screenPager =findViewById(R.id.screen_viewpager);
......
......@@ -10,6 +10,7 @@ import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
......@@ -57,6 +58,20 @@ public class ResultActivity extends AppCompatActivity implements MyAsyncCallback
Async async = new Async(this);
async.execute(apps);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// handle arrow click here
if (item.getItemId() == android.R.id.home) {
finish(); // close this activity and return to preview activity (if there is any)
}
return super.onOptionsItemSelected(item);
}
@Override
......
......@@ -16,7 +16,7 @@ public class SplashscreenActivity extends AppCompatActivity {
Handler handler;
Animation topAnim;
Animation botAnim;
ImageView image;
ImageView image, logo1, logo2;
TextView logo, slogan;
@Override
......@@ -29,10 +29,14 @@ public class SplashscreenActivity extends AppCompatActivity {
botAnim = AnimationUtils.loadAnimation(this, R.anim.bottom_animation);
image = findViewById(R.id.logo);
logo1 = findViewById(R.id.LogoDel);
logo2 = findViewById(R.id.LogoHimatif);
logo = findViewById(R.id.txt_apps_name);
slogan = findViewById(R.id.txt_apps);
image.setAnimation(topAnim);
logo1.setAnimation(botAnim);
logo2.setAnimation(botAnim);
logo.setAnimation(botAnim);
slogan.setAnimation(botAnim);
......
......@@ -54,7 +54,7 @@ public class ResultAdapter extends RecyclerView.Adapter<ResultAdapter.CardViewVi
AppResult result = listAppResult.get(position);
Drawable background = result.getApp().info.loadIcon(packageManager);
holder.appPhoto.setBackgroundDrawable(background);
if (result.getStatus().equals("Tidak Berbahaya")) {
if (result.getStatus().equals("NOT DANGEROUS")) {
holder.tvStatus.setText(result.getStatus());
holder.tvStatus.setTextColor(Color.GREEN);
} else {
......
package com.amsal.ta.ui.account;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
import android.util.Base64;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.preference.PreferenceFragmentCompat;
import com.amsal.ta.R;
import java.io.ByteArrayOutputStream;
public class AccountFragment extends Fragment {
private AccountViewModel notificationsViewModel;
private TextView text;
private ImageView img;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
notificationsViewModel =
ViewModelProviders.of(this).get(AccountViewModel.class);
View root = inflater.inflate(R.layout.fragment_account, container, false);
final TextView textView = root.findViewById(R.id.text_account);
notificationsViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
Fragment childFragment = new PreferenceFragment();
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
transaction.replace(R.id.child_fragment, childFragment).commit();
// text = getView().findViewById(R.id.text);
// img = getView().findViewById(R.id.img_item_photo_profile);
// text.setOnClickListener(new View.OnClickListener() {
//
// public void onClick(View v) {
//
// }
// });
}
}
\ No newline at end of file
package com.amsal.ta.ui.account;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.preference.EditTextPreference;
import androidx.preference.PreferenceFragmentCompat;
import com.amsal.ta.R;
public class PreferenceFragment extends PreferenceFragmentCompat {
private String DEFAULT_VALUE = "Tidak Ada";
private String NAME;
private String EMAIL;
private String PHONE;
private EditTextPreference namePreference;
private EditTextPreference emailPreference;
private EditTextPreference phonePreference;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.preferences);
init();
setSummaries();
}
private void init() {
NAME = getResources().getString(R.string.key_name);
EMAIL = getResources().getString(R.string.key_email);
PHONE = getResources().getString(R.string.key_phone);
namePreference = findPreference(NAME);
emailPreference = findPreference(EMAIL);
phonePreference = findPreference(PHONE);
}
private void setSummaries() {
SharedPreferences sh = getPreferenceManager().getSharedPreferences();
namePreference.setSummary(sh.getString(NAME, DEFAULT_VALUE));
emailPreference.setSummary(sh.getString(EMAIL, DEFAULT_VALUE));
phonePreference.setSummary(sh.getString(PHONE, DEFAULT_VALUE));
}
@Override
public void onResume() {
super.onResume();
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this::onSharedPreferenceChanged);
}
@Override
public void onPause() {
super.onPause();
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this::onSharedPreferenceChanged);
}
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(NAME)) {
namePreference.setSummary(sharedPreferences.getString(NAME, DEFAULT_VALUE));
}
if (key.equals(EMAIL)) {
emailPreference.setSummary(sharedPreferences.getString(EMAIL, DEFAULT_VALUE));
}
if (key.equals(PHONE)) {
phonePreference.setSummary(sharedPreferences.getString(PHONE, DEFAULT_VALUE));
}
}
}
......@@ -4,32 +4,51 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.amsal.ta.R;
import com.amsal.ta.ui.dashboard.DashboardFragment;
public class HomeFragment extends Fragment {
private HomeViewModel homeViewModel;
Animation botAnim;
Animation topAnim;
ImageView image;
CardView cardView;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
final TextView textView = root.findViewById(R.id.text_home);
homeViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
botAnim = AnimationUtils.loadAnimation(getContext(), R.anim.bottom_animation);
topAnim = AnimationUtils.loadAnimation(getContext(), R.anim.top_animation);
image = getView().findViewById(R.id.imageLogo);
cardView = getView().findViewById(R.id.card);
cardView.setAnimation(botAnim);
image.setAnimation(topAnim);
}
}
\ No newline at end of file
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