commit 2a9ff2cdbeb66442b82f4387aa6eb34f0bbee7a6 Author: eko Date: Thu Aug 11 15:14:39 2022 +0700 first diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..526b4c2 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1dd784c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..b4dc24a --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,45 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 32 + + defaultConfig { + applicationId "com.unej.inventaris" + minSdk 19 + targetSdk 32 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'com.google.android.material:material:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + + implementation 'com.google.code.gson:gson:2.6.2' + implementation 'com.squareup.retrofit2:retrofit:2.5.0' + implementation 'com.squareup.retrofit2:converter-gson:2.5.0' + implementation 'com.squareup.retrofit2:converter-scalars:2.5.0' + implementation 'com.squareup.okhttp3:okhttp:3.4.1' + implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1' +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/unej/inventaris/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/unej/inventaris/ExampleInstrumentedTest.java new file mode 100644 index 0000000..b3643a8 --- /dev/null +++ b/app/src/androidTest/java/com/unej/inventaris/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.unej.inventaris; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.unej.inventaris", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..f5b5660 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/unej/inventaris/Adapter.java b/app/src/main/java/com/unej/inventaris/Adapter.java new file mode 100644 index 0000000..5f72bea --- /dev/null +++ b/app/src/main/java/com/unej/inventaris/Adapter.java @@ -0,0 +1,68 @@ +package com.unej.inventaris; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import androidx.recyclerview.widget.RecyclerView; + +import java.util.List; + +public class Adapter extends RecyclerView.Adapter { + private List listJadawalmodel; + private Context context; + + public Adapter(List listJadawalmodel, Context context) { + this.listJadawalmodel = listJadawalmodel; + this.context = context; + } + + @Override + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { + View view = LayoutInflater.from(context).inflate(R.layout.recycleview_barang, parent, false); + return new ViewHolder(view); + } + + @Override + public void onBindViewHolder(ViewHolder holder, int position) { + Model.data model = listJadawalmodel.get(position); + + try { + holder.textViewNamaBarang.setText(model.getNama_barang()); + holder.textViewSerialNumber.setText(model.getSerial_number()); + holder.textViewJumlah.setText(model.getJumlah_barang()+" / "+model.getNama_satuan()); + holder.textViewLokasi.setText(model.getLokasi()); + holder.textViewKeterangan.setText(model.getKeterangan()); + holder.textViewTglMasuk.setText("Tanggal Masuk : "+model.getTanggal_masuk()); +// holder.textViewTglInput.setText(model.getWaktu_input()); + holder.textViewJenis.setText(model.getNama_jenis()); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public int getItemCount() { + return listJadawalmodel.size(); + } + + public class ViewHolder extends RecyclerView.ViewHolder { + public TextView textViewNamaBarang, textViewSerialNumber, textViewJumlah, + textViewLokasi, textViewKeterangan, textViewTglMasuk, textViewTglInput, textViewJenis; + + public ViewHolder(View itemView) { + super(itemView); + + textViewNamaBarang = (TextView) itemView.findViewById(R.id.textViewNamaBarang); + textViewSerialNumber = (TextView) itemView.findViewById(R.id.textViewSerialNumber); + textViewJumlah = (TextView) itemView.findViewById(R.id.textViewJumlah); + textViewLokasi = (TextView) itemView.findViewById(R.id.textViewLokasi); + textViewKeterangan = (TextView) itemView.findViewById(R.id.textViewKeterangan); + textViewTglMasuk = (TextView) itemView.findViewById(R.id.textViewTglMasuk); +// textViewTglInput = (TextView) itemView.findViewById(R.id.textViewTglInput); + textViewJenis = (TextView) itemView.findViewById(R.id.textViewJenis); + } + } +} diff --git a/app/src/main/java/com/unej/inventaris/MainActivity.java b/app/src/main/java/com/unej/inventaris/MainActivity.java new file mode 100644 index 0000000..3696f79 --- /dev/null +++ b/app/src/main/java/com/unej/inventaris/MainActivity.java @@ -0,0 +1,76 @@ +package com.unej.inventaris; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import android.app.ProgressDialog; +import android.os.Bundle; +import android.util.Log; + +import java.util.ArrayList; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; + +public class MainActivity extends AppCompatActivity { + + private RecyclerView recyclerView; + private RecyclerView.LayoutManager layoutManager; + private ProgressDialog progressDialog; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + recyclerView = (RecyclerView) findViewById(R.id.rc); + progressDialog = new ProgressDialog(this); + + + progressDialog.setTitle("Memuat data barang"); + progressDialog.setMessage("Tunggu Sebentar ..."); + progressDialog.show(); + + Method method = RetrofitClient.getRetrofit().create(Method.class); + Call call = method.getAll(); + + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) { + + try { + Model model = response.body(); + Log.e("TAG", "respone :"+model.getMsg()); + + ArrayList list = response.body().getData(); + for (Model.data data1 : list){ + Log.e("TAG", "response mail :"+data1.nama_barang); + } + + Adapter adapter = new Adapter(list, MainActivity.this); + recyclerView.setLayoutManager(new LinearLayoutManager(MainActivity.this)); + recyclerView.setItemAnimator(new DefaultItemAnimator()); + recyclerView.setHasFixedSize(true); + layoutManager = new LinearLayoutManager(MainActivity.this); + recyclerView.setLayoutManager(layoutManager); + recyclerView.setAdapter(adapter); + + progressDialog.dismiss(); + + } catch (Exception e) { + e.printStackTrace(); + progressDialog.dismiss(); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + Log.e("TAG", "on failure :"+t.getMessage()); + progressDialog.dismiss(); + } + }); + + } +} \ No newline at end of file diff --git a/app/src/main/java/com/unej/inventaris/Method.java b/app/src/main/java/com/unej/inventaris/Method.java new file mode 100644 index 0000000..c25fbbf --- /dev/null +++ b/app/src/main/java/com/unej/inventaris/Method.java @@ -0,0 +1,15 @@ +package com.unej.inventaris; + +import retrofit2.Call; +import retrofit2.http.GET; + +public interface Method { + + +// @GET("api/users?page=2") +// Call getAll(); + + @GET("barang") + Call getAll(); + +} diff --git a/app/src/main/java/com/unej/inventaris/Model.java b/app/src/main/java/com/unej/inventaris/Model.java new file mode 100644 index 0000000..4748f08 --- /dev/null +++ b/app/src/main/java/com/unej/inventaris/Model.java @@ -0,0 +1,137 @@ +package com.unej.inventaris; + +import java.util.ArrayList; + +public class Model { + + String msg; + ArrayList data; + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public ArrayList getData() { + return data; + } + + public void setData(ArrayList data) { + this.data = data; + } + + public class data{ + + String id; + String jenis_barang_id; + String satuan_id; + String nama_barang; + String serial_number; + String jumlah_barang; + String lokasi; + String keterangan; + String tanggal_masuk; + String waktu_input; + String nama_satuan; + String nama_jenis; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getJenis_barang_id() { + return jenis_barang_id; + } + + public void setJenis_barang_id(String jenis_barang_id) { + this.jenis_barang_id = jenis_barang_id; + } + + public String getSatuan_id() { + return satuan_id; + } + + public void setSatuan_id(String satuan_id) { + this.satuan_id = satuan_id; + } + + public String getNama_barang() { + return nama_barang; + } + + public void setNama_barang(String nama_barang) { + this.nama_barang = nama_barang; + } + + public String getSerial_number() { + return serial_number; + } + + public void setSerial_number(String serial_number) { + this.serial_number = serial_number; + } + + public String getJumlah_barang() { + return jumlah_barang; + } + + public void setJumlah_barang(String jumlah_barang) { + this.jumlah_barang = jumlah_barang; + } + + public String getLokasi() { + return lokasi; + } + + public void setLokasi(String lokasi) { + this.lokasi = lokasi; + } + + public String getKeterangan() { + return keterangan; + } + + public void setKeterangan(String keterangan) { + this.keterangan = keterangan; + } + + public String getTanggal_masuk() { + return tanggal_masuk; + } + + public void setTanggal_masuk(String tanggal_masuk) { + this.tanggal_masuk = tanggal_masuk; + } + + public String getWaktu_input() { + return waktu_input; + } + + public void setWaktu_input(String waktu_input) { + this.waktu_input = waktu_input; + } + + public String getNama_satuan() { + return nama_satuan; + } + + public void setNama_satuan(String nama_satuan) { + this.nama_satuan = nama_satuan; + } + + public String getNama_jenis() { + return nama_jenis; + } + + public void setNama_jenis(String nama_jenis) { + this.nama_jenis = nama_jenis; + } + } +} diff --git a/app/src/main/java/com/unej/inventaris/RetrofitClient.java b/app/src/main/java/com/unej/inventaris/RetrofitClient.java new file mode 100644 index 0000000..e7a86cf --- /dev/null +++ b/app/src/main/java/com/unej/inventaris/RetrofitClient.java @@ -0,0 +1,21 @@ +package com.unej.inventaris; + +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + +public class RetrofitClient { + private static Retrofit retrofit; + private static String BASE_URL = "https://simak.uptti.unej.ac.id/api/"; +// private static String BASE_URL = "https://reqres.in/"; + + public static Retrofit getRetrofit(){ + if (retrofit == null){ + retrofit = new Retrofit.Builder() + .baseUrl(BASE_URL) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + + } + return retrofit; + } +} diff --git a/app/src/main/java/com/unej/inventaris/login/LoginActivity.java b/app/src/main/java/com/unej/inventaris/login/LoginActivity.java new file mode 100644 index 0000000..3b6cc4f --- /dev/null +++ b/app/src/main/java/com/unej/inventaris/login/LoginActivity.java @@ -0,0 +1,46 @@ +package com.unej.inventaris.login; + +import static android.content.ContentValues.TAG; + +import androidx.appcompat.app.AppCompatActivity; + +import android.content.Intent; +import android.os.Bundle; +import android.util.Log; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import com.unej.inventaris.MainActivity; +import com.unej.inventaris.R; + +public class LoginActivity extends AppCompatActivity { + private EditText editTextUsername, editTextPassword; + private Button buttonLogin; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + getSupportActionBar().hide(); + + editTextUsername = findViewById(R.id.editTextTextUsername); + editTextPassword = findViewById(R.id.editTextTextPassword); + buttonLogin = findViewById(R.id.buttonLogin); + + buttonLogin.setOnClickListener(view -> { + String username = editTextUsername.getText().toString(); + String password = editTextPassword.getText().toString(); + Log.e(TAG, "onCreate: "+username + password); + if(username.equals("sugengwa") && password.equals("123qweasdzxc")) { + + Intent i = new Intent(this, MainActivity.class); + startActivity(i); + + } else { + Toast.makeText(this, "Username Password Salah", Toast.LENGTH_SHORT).show(); + } + + }); + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_jenis.xml b/app/src/main/res/drawable/ic_jenis.xml new file mode 100644 index 0000000..356cb73 --- /dev/null +++ b/app/src/main/res/drawable/ic_jenis.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_keterangan.xml b/app/src/main/res/drawable/ic_keterangan.xml new file mode 100644 index 0000000..912eaf6 --- /dev/null +++ b/app/src/main/res/drawable/ic_keterangan.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_lokasi.xml b/app/src/main/res/drawable/ic_lokasi.xml new file mode 100644 index 0000000..17fc4dc --- /dev/null +++ b/app/src/main/res/drawable/ic_lokasi.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_waktu.xml b/app/src/main/res/drawable/ic_waktu.xml new file mode 100644 index 0000000..de99e40 --- /dev/null +++ b/app/src/main/res/drawable/ic_waktu.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/login_blue_gradient.xml b/app/src/main/res/drawable/login_blue_gradient.xml new file mode 100644 index 0000000..469b852 --- /dev/null +++ b/app/src/main/res/drawable/login_blue_gradient.xml @@ -0,0 +1,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_blue.xml b/app/src/main/res/drawable/rounded_blue.xml new file mode 100644 index 0000000..4a4f918 --- /dev/null +++ b/app/src/main/res/drawable/rounded_blue.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_blue_gradient.xml b/app/src/main/res/drawable/rounded_blue_gradient.xml new file mode 100644 index 0000000..74070c2 --- /dev/null +++ b/app/src/main/res/drawable/rounded_blue_gradient.xml @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_blue_stroke.xml b/app/src/main/res/drawable/rounded_blue_stroke.xml new file mode 100644 index 0000000..54c2921 --- /dev/null +++ b/app/src/main/res/drawable/rounded_blue_stroke.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_grey.xml b/app/src/main/res/drawable/rounded_grey.xml new file mode 100644 index 0000000..4c5426c --- /dev/null +++ b/app/src/main/res/drawable/rounded_grey.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_white_edittext.xml b/app/src/main/res/drawable/rounded_white_edittext.xml new file mode 100644 index 0000000..244c54c --- /dev/null +++ b/app/src/main/res/drawable/rounded_white_edittext.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_white_kehadiran.xml b/app/src/main/res/drawable/rounded_white_kehadiran.xml new file mode 100644 index 0000000..b85208a --- /dev/null +++ b/app/src/main/res/drawable/rounded_white_kehadiran.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sibanu.png b/app/src/main/res/drawable/sibanu.png new file mode 100644 index 0000000..472d393 Binary files /dev/null and b/app/src/main/res/drawable/sibanu.png differ diff --git a/app/src/main/res/drawable/simak.png b/app/src/main/res/drawable/simak.png new file mode 100644 index 0000000..15135b3 Binary files /dev/null and b/app/src/main/res/drawable/simak.png differ diff --git a/app/src/main/res/drawable/stroke_bluesoft.xml b/app/src/main/res/drawable/stroke_bluesoft.xml new file mode 100644 index 0000000..78cd4ae --- /dev/null +++ b/app/src/main/res/drawable/stroke_bluesoft.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml new file mode 100644 index 0000000..72732e5 --- /dev/null +++ b/app/src/main/res/layout/activity_login.xml @@ -0,0 +1,84 @@ + + + + + + + + + +