Skip to content

Commit

Permalink
GitBook: [master] 4 pages modified
Browse files Browse the repository at this point in the history
  • Loading branch information
yemreak authored and gitbook-bot committed Dec 29, 2019
1 parent 8469a95 commit bdc96a2
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 3 deletions.
4 changes: 3 additions & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* [🧐 Component İsimleri](temel/component-isimleri.md)
* [🌍 Global Değişkenler](temel/global-degiskenler.md)
* [🎪 Android'de Animasyonlar](temel/androidde-animasyonlar.md)
* [🗨 AlertDialog](temel/alertdialog.md)
* [🗂️ RcycleView](temel/rcycleview.md)
* [👨‍💼 Verilerin Yönetimi](veriler/README.md)
* [🔸 Veri Saklama Yöntemleri](veriler/veri-saklama-yoentemleri.md)
* [👐 Shared Preference](veriler/shared-preference.md)
Expand All @@ -31,7 +33,7 @@
* [📢 Broadcast](haberlesme/broadcast/README.md)
* [🔰 Giriş \| Broadcast](haberlesme/broadcast/giris.md)
* [🏗️ Broadcast Oluşturma](haberlesme/broadcast/olusturma.md)
* [📡 Broadcast Receiver](haberlesme/broadcast/receiver.md)
* [📡 Broadcast Alma](haberlesme/broadcast/receiver.md)
* [💌 HTTP İstekleri](haberlesme/http-istekleri.md)
* [📶 WiFi P2P](haberlesme/wifi.md)
* [✨ Faydalı Bilgiler](faydali/README.md)
Expand Down
20 changes: 18 additions & 2 deletions haberlesme/broadcast/receiver.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 📡 Broadcast Receiver
# 📡 Broadcast Alma

## ❣️ Receiver Hakkında
## ❣️ Broadcast Receiver Hakkında

* 🚫 UI thread üzerinden gerçekleştiğinden uzun işlemler yapılmamalı
*`onReceive()` metodu içerisinde asenkron işlemler yapmayın
Expand Down Expand Up @@ -98,6 +98,22 @@ LocalBroadcastManager.getInstance(this)
.unregisterReceiver(mReceiver);
```

## 🔏 İzin Gerektirenlerin Alımı

```markup
<receiver android:name=".MyBroadcastReceiver"
android:permission="android.permission.SEND_SMS">
<intent-filter>
<action android:name="android.intent.action.AIRPLANE_MODE"/>
</intent-filter>
</receiver>
```

```java
IntentFilter filter = new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED);
registerReceiver(receiver, filter, Manifest.permission.SEND_SMS, null );
```

## 👮‍♂ Broadcast Kısıtlamaları

![](../../.gitbook/assets/image%20%2854%29.png)
Expand Down
74 changes: 74 additions & 0 deletions temel/alertdialog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 🗨 AlertDialog

## 🕐 Zaman Seçme

```java
public static class TimePickerFragment extends DialogFragment
implements TimePickerDialog.OnTimeSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current time as the default values for the picker
final Calendar c = Calendar.getInstance();
int hour = c.get(Calendar.HOUR_OF_DAY);
int minute = c.get(Calendar.MINUTE);
// Create a new instance of TimePickerDialog and return it
return new TimePickerDialog(getActivity(), this, hour, minute,
DateFormat.is24HourFormat(getActivity()));
}
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
// Do something with the time chosen by the user
}
}
```

```markup
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pick_time"
android:onClick="showTimePickerDialog" />
```

```java
public void showTimePickerDialog(View v) {
DialogFragment newFragment = new TimePickerFragment();
newFragment.show(getSupportFragmentManager(), "timePicker");
}
```

## 📅 Tarih Seçme

```java
public static class DatePickerFragment extends DialogFragment
implements DatePickerDialog.OnDateSetListener {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the current date as the default date in the picker
final Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
// Create a new instance of DatePickerDialog and return it
return new DatePickerDialog(getActivity(), this, year, month, day);
}
public void onDateSet(DatePicker view, int year, int month, int day) {
// Do something with the date chosen by the user
}
}
```

```markup
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pick_date"
android:onClick="showDatePickerDialog" />
```

```java
public void showDatePickerDialog(View v) {
DialogFragment newFragment = new DatePickerFragment();
newFragment.show(getSupportFragmentManager(), "datePicker");
}
```

108 changes: 108 additions & 0 deletions temel/rcycleview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# 🗂️ RcycleView

## 📦 Bağımlılıkları Dahil Etme

```text
dependencies {
implementation 'com.android.support:recyclerview-v7:28.0.0'
}
```

## 📝 XML Dosyasında Tanımlama

```text
<?xml version="1.0" encoding="utf-8"?>
<!-- A RecyclerView with some commonly used attributes -->
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
```

## 📃 Activity Üzerinde Tanımlama

```java
public class MyActivity extends Activity {
private RecyclerView recyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager layoutManager;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.my_activity);
recyclerView = (RecyclerView) findViewById(R.id.my_recycler_view);

// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
recyclerView.setHasFixedSize(true);

// use a linear layout manager
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);

// specify an adapter (see also next example)
mAdapter = new MyAdapter(myDataset);
recyclerView.setAdapter(mAdapter);
}
// ...
}
```

## 📂 Adapter Sınıfı

```java
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder> {
private String[] mDataset;

// Provide a reference to the views for each data item
// Complex data items may need more than one view per item, and
// you provide access to all the views for a data item in a view holder
public static class MyViewHolder extends RecyclerView.ViewHolder {
// each data item is just a string in this case
public TextView textView;
public MyViewHolder(TextView v) {
super(v);
textView = v;
}
}

// Provide a suitable constructor (depends on the kind of dataset)
public MyAdapter(String[] myDataset) {
mDataset = myDataset;
}

// Create new views (invoked by the layout manager)
@Override
public MyAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent,
int viewType) {
// create a new view
TextView v = (TextView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.my_text_view, parent, false);
...
MyViewHolder vh = new MyViewHolder(v);
return vh;
}

// Replace the contents of a view (invoked by the layout manager)
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
// - get element from your dataset at this position
// - replace the contents of the view with that element
holder.textView.setText(mDataset[position]);

}

// Return the size of your dataset (invoked by the layout manager)
@Override
public int getItemCount() {
return mDataset.length;
}
}
```

## 🔗 Faydalı Bağlantılar

{% embed url="https://developer.android.com/guide/topics/ui/layout/recyclerview" %}

0 comments on commit bdc96a2

Please sign in to comment.