Commit dddddc04 authored by shofinadhiroh's avatar shofinadhiroh

add project

parents
Pipeline #35813947 failed with stages
in 1 minute and 17 seconds
*.iml
.gradle
/local.properties
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WizardSettings">
<option name="children">
<map>
<entry key="vectorWizard">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipartAsset">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/social/ic_school_black_24dp.xml" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="color" value="ffffff" />
<entry key="height" value="36" />
<entry key="outputName" value="ic_school_black_24dp" />
<entry key="overrideSize" value="true" />
<entry key="sourceFile" value="C:\Users\Nadhiroh" />
<entry key="width" value="36" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</component>
</project>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="5">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
apply plugin: 'com.android.application'
repositories {
maven { url 'https://maven.google.com' }
}
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.shofi.perantaraadmin"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:recyclerview-v7:27.1.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
{
"project_info": {
"project_number": "100305051684",
"firebase_url": "https://perantarafirebase.firebaseio.com",
"project_id": "perantarafirebase",
"storage_bucket": "perantarafirebase.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:100305051684:android:98c4681dd8e16c9b",
"android_client_info": {
"package_name": "com.shofi.perantaraadmin"
}
},
"oauth_client": [
{
"client_id": "100305051684-7a4h0lnbd2optj8e5l82vjpde8g4rd13.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.shofi.perantaraadmin",
"certificate_hash": "e25275b37e17fbc84f1cdf919cabd2435d7ca0ce"
}
},
{
"client_id": "100305051684-2d34ah8usalpuc6iuq1t209enp71fj8m.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBetSNS2C2mlfNka4K_xAWyQ3YuPOWQkts"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "100305051684-2d34ah8usalpuc6iuq1t209enp71fj8m.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:100305051684:android:a3b1a80c32bb1f70",
"android_client_info": {
"package_name": "com.shofi.uascihuy"
}
},
"oauth_client": [
{
"client_id": "100305051684-ipd9kdrjjmbspt10mttoaeudm82mokef.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.shofi.uascihuy",
"certificate_hash": "e25275b37e17fbc84f1cdf919cabd2435d7ca0ce"
}
},
{
"client_id": "100305051684-2d34ah8usalpuc6iuq1t209enp71fj8m.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyBetSNS2C2mlfNka4K_xAWyQ3YuPOWQkts"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 2,
"other_platform_oauth_client": [
{
"client_id": "100305051684-2d34ah8usalpuc6iuq1t209enp71fj8m.apps.googleusercontent.com",
"client_type": 3
}
]
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
# 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
package com.shofi.perantaraadmin;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.shofi.perantaraadmin", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shofi.perantaraadmin">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<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=".DemografiList"></activity>
</application>
</manifest>
\ No newline at end of file
package com.shofi.perantaraadmin;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.ArrayList;
public class AdapterDemografi extends RecyclerView.Adapter<AdapterDemografi.ViewHolder> {
private ArrayList<Demografi> daftarDemografi;
private Context context;
public AdapterDemografi(ArrayList<Demografi> demografis, Context ctx){
/**
* Inisiasi data dan variabel yang akan digunakan
*/
daftarDemografi = demografis;
context = ctx;
}
class ViewHolder extends RecyclerView.ViewHolder {
/**
* Inisiasi View
* Di tutorial ini kita hanya menggunakan data String untuk tiap item
* dan juga view nya hanyalah satu TextView
*/
TextView tvJk;
TextView tvUsia;
TextView tvPendidikan;
TextView tvPekerjaan;
TextView tvEmail;
ViewHolder(View v) {
super(v);
tvJk = (TextView) v.findViewById(R.id.textViewJk);
tvUsia = (TextView) v.findViewById(R.id.textViewUsia);
tvPendidikan = (TextView) v.findViewById(R.id.textViewPend);
tvPekerjaan = (TextView) v.findViewById(R.id.textViewJob);
tvEmail = (TextView) v.findViewById(R.id.textViewEmail);
}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
/**
* Inisiasi ViewHolder
*/
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_demografi_list, parent, false);
// mengeset ukuran view, margin, padding, dan parameter layout lainnya
ViewHolder vh = new ViewHolder(v);
return vh;
}
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
/**
* Menampilkan data pada view
*/
final String email = daftarDemografi.get(position).getEmail();
final String jk = daftarDemografi.get(position).getJk();
final String usia = daftarDemografi.get(position).getUsia();
final String pendidikan = daftarDemografi.get(position).getPendidikan();
final String pekerjaan = daftarDemografi.get(position).getPekerjaan();
holder.tvEmail.setText(email);
holder.tvJk.setText(jk);
holder.tvUsia.setText(usia);
holder.tvPendidikan.setText(pendidikan);
holder.tvPekerjaan.setText(pekerjaan);
}
@Override
public int getItemCount() {
/**
* Mengembalikan jumlah item pada barang
*/
return daftarDemografi.size();
}
}
\ No newline at end of file
package com.shofi.perantaraadmin;
import java.io.Serializable;
public class Demografi implements Serializable {
private String jk;
private String usia;
private String pendidikan;
private String pekerjaan;
private String email;
private String key;
public Demografi() {
}
public Demografi(String jk, String usia, String pendidikan, String pekerjaan, String email){
this.jk = jk;
this.usia = usia;
this.pendidikan = pendidikan;
this.pekerjaan = pekerjaan;
this.email = email;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getJk() {
return jk;
}
public void setJk(String jk) {
this.jk = jk;
}
public String getUsia() {
return usia;
}
public void setUsia(String usia) {
this.usia = usia;
}
public String getPendidikan() {
return pendidikan;
}
public void setPendidikan(String pendidikan) {
this.pendidikan = pendidikan;
}
public String getPekerjaan() {
return pekerjaan;
}
public void setPekerjaan(String pekerjaan) {
this.pekerjaan = pekerjaan;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return " "+jk+"\n" +
" "+usia +"\n" +
" "+pendidikan +"\n" +
" "+pekerjaan +"\n" +
" "+email;
}
}
package com.shofi.perantaraadmin;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity{
/**
* Mendefinisikan variable yang akan dipakai
*/
DatabaseReference database;
private RecyclerView rvView;
private RecyclerView.Adapter adapter;
private RecyclerView.LayoutManager layoutManager;
private ArrayList<Demografi> daftarDemografi;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**
* Mengeset layout
*/
setContentView(R.layout.activity_main);
/**
* Inisialisasi RecyclerView & komponennya
*/
rvView = (RecyclerView) findViewById(R.id.rv_main);
rvView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(this);
rvView.setLayoutManager(layoutManager);
/**
* Inisialisasi dan mengambil Firebase Database Reference
*/
database = FirebaseDatabase.getInstance().getReference();
/**
* Mengambil data barang dari Firebase Realtime DB
*/
database.child("demografi").addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
/**
* Saat ada data baru, masukkan datanya ke ArrayList
*/
daftarDemografi = new ArrayList<>();
for (DataSnapshot noteDataSnapshot : dataSnapshot.getChildren()) {
/**
* Mapping data pada DataSnapshot ke dalam object Barang
* Dan juga menyimpan primary key pada object Barang