Skip to content

Commit

Permalink
GitBook: [master] 15 pages and 21 assets modified
Browse files Browse the repository at this point in the history
  • Loading branch information
yemreak authored and gitbook-bot committed Nov 5, 2019
1 parent 7abfbf4 commit 8eb3ce4
Show file tree
Hide file tree
Showing 36 changed files with 915 additions and 21 deletions.
Binary file modified .gitbook/assets/image (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (10).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (11).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (12).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (13).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (14).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (15).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (16).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (17).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (18).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (19).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (2).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (20).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (3).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (4).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (5).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (6).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (7).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (8).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image (9).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .gitbook/assets/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Tam olarak hangi alanların değiştiğini merak ediyorsan, alttaki linkten GitH

## 🌍 Tüm [YEmreAk ](https://wiki.yemreak.com)İçerikleri

![YEmreAk tüm içerikleri \(her sütun bir web sitesidir\)](.gitbook/assets/image%20%2810%29.png)
![YEmreAk tüm içerikleri \(her sütun bir web sitesidir\)](.gitbook/assets/image%20%2815%29.png)

## 💖 Destek ve İletişim

Expand All @@ -51,5 +51,5 @@ Tam olarak hangi alanların değiştiğini merak ediyorsan, alttaki linkten GitH

**The** [**MIT License**](https://choosealicense.com/licenses/mit/) **© Yunus Emre Ak**

![](.gitbook/assets/image%20%281%29.png)
![](.gitbook/assets/image%20%282%29.png)

26 changes: 19 additions & 7 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
* [📱 YAndroid](README.md)
* [🌟 Faydalı Kaynaklar](https://learn.yemreak.com/icerikler/android)
* [✍ Kişisel Notlarım](kisisel-notlarim.md)
* [Untitled](untitled.md)

## Programlama Notları
## Programlama Notları <a id="programlama-notlari-1"></a>

* [🧐 Component İsimleri](programlama-notlari/component-isimleri.md)
* [🚧 Proje İşlemleri](programlama-notlari/proje-islemleri.md)
* [📃 Activity Notları](programlama-notlari/activity-notlari.md)
* [💾 Veri Saklama Yöntemleri](programlama-notlari/veri-saklama-yoentemleri.md)
* [⏩ Kaydırmalı Uygulama \(ViewPager ve PageAdapter\)](programlama-notlari/kaydirmali-uygulama-viewpager-ve-pageadapter.md)
* [🎪 Android'de Animasyonlar](programlama-notlari/androidde-animasyonlar.md)
* [🔰 Giriş](programlama-notlari-1/giris.md)
* [👶 İlk Etkileşimli UI](programlama-notlari-1/ilk-etkilesimli-ui.md)
* [🔤 TextView](programlama-notlari-1/textview.md)
* [⏬ Scrolling views](programlama-notlari-1/scrolling-views.md)
* [📜 XML Örneği](programlama-notlari-1/xml-oernegi.md)
* [⏩ Activity ve Intent'ler](programlama-notlari-1/activity-ve-intentler.md)
* [💫 Activity lifecycle and state](programlama-notlari-1/activity-lifecycle-and-state.md)
* [🏹 Implicit intents](programlama-notlari-1/implicit-intents.md)

## Faydalı Bilgiler

Expand All @@ -20,3 +23,12 @@
* [🐛 Hata Notları](faydali-bilgiler/hata-notlari.md)
* [🥴 Karışık Notlar](faydali-bilgiler/karisik-notlar.md)

## Eski Notlarım <a id="programlama-notlari"></a>

* [🧐 Component İsimleri](programlama-notlari/component-isimleri.md)
* [🚧 Proje İşlemleri](programlama-notlari/proje-islemleri.md)
* [📃 Activity Notları](programlama-notlari/activity-notlari.md)
* [💾 Veri Saklama Yöntemleri](programlama-notlari/veri-saklama-yoentemleri.md)
* [⏩ Kaydırmalı Uygulama \(ViewPager ve PageAdapter\)](programlama-notlari/kaydirmali-uygulama-viewpager-ve-pageadapter.md)
* [🎪 Android'de Animasyonlar](programlama-notlari/androidde-animasyonlar.md)

61 changes: 61 additions & 0 deletions programlama-notlari-1/activity-lifecycle-and-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# 💫 Activity lifecycle and state

## Activity states and lifecycle callback methods

![](../.gitbook/assets/image%20%2819%29.png)

### Temel Kullanım

```java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// The activity is being created.
}
```

## Saving Activity instance state

* Lifecycle metodlarından değildir
* Kullanıcı `Activity`'den ayrılıken çağırılır.
* Bazen `onStop()`'tan önce çalışır

```java
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);

// Save the user's current game state
savedInstanceState.putInt("score", mCurrentScore);
savedInstanceState.putInt("level", mCurrentLevel);
}
```

### Restoring Activity instance state

* Kaydedilen `Bundle` verileri `onCreate()` callback metodunda kullanılmakta
* `Activity` oluşturulduktan sonra çalışan `onStart()` metodunun ardından çalışan `onRestoreInstanceState()`callback metodunda da kullanılabilir

{% hint style="warning" %}
İlk kez uygulama oluşturulduğunda `Bundle` verisi olmayacağından `null` kontrolü yapılması gerekir.
{% endhint %}

```java
@Override
protected void onCreate(Bundle savedInstanceState) {
// Always call the superclass first
super.onCreate(savedInstanceState);

// Check if recreating a previously destroyed instance.
if (savedInstanceState != null) {
// Restore value of members from saved state.
mCurrentScore = savedInstanceState.getInt("score");
mCurrentLevel = savedInstanceState.getInt("level");
} else {
// Initialize members with default values for a new instance.
// ...
}
// ... Rest of code
}
```

182 changes: 182 additions & 0 deletions programlama-notlari-1/activity-ve-intentler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# ⏩ Activity ve Intent'ler

## Create the Activity

When you create a new project in Android Studio and choose the **Backwards Compatibility \(AppCompat\)** option, the `MainActivity` is, by default, a subclass of the [`AppCompatActivity`](https://developer.android.com/reference/android/support/v7/app/AppCompatActivity.html) class. The `AppCompatActivity` class lets you use up-to-date Android app features such as the app bar and Material Design, while still enabling your app to be compatible with devices running older versions of Android.

Here is a skeleton subclass of `AppCompatActivity`:

```java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
```

### 📑 Declare the Activity in AndroidManifest.xml

```java
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
```

## ⏫ Starting an Activity with an explicit Intent

Yeni aktivity oluşturulduğunda eskisi **Paused** olur

```java
Intent messageIntent = new Intent(this, ShowMessageActivity.class);
startActivity(messageIntent);
```

## 💾 Add data to the Intent

```java
Intent messageIntent = new Intent(this, ShowMessageActivity.class);
// A web page URL
messageIntent.setData(Uri.parse("http://www.google.com"));
// a Sample file URI
messageIntent.setData(Uri.fromFile(new File("/sdcard/sample.jpg")));
// A sample content: URI for your app's data model
messageIntent.setData(Uri.parse("content://mysample.provider/data"));
// Custom URI
messageIntent.setData(Uri.parse("custom:" + dataID + buttonId));

startActivity(messageIntent);
```

### Add extras to the Intent

```java
Intent messageIntent = new Intent(this, ShowMessageActivity.class);

// Tek tek koyma
messageIntent.putExtra(EXTRA_MESSAGE, "this is my message");
messageIntent.putExtra(EXTRA_POSITION_X, 100);
messageIntent.putExtra(EXTRA_POSITION_Y, 500);

// Bundle yapısı
Bundle extras = new Bundle();
extras.putString(EXTRA_MESSAGE, "this is my message");
extras.putInt(EXTRA_POSITION_X, 100);
extras.putInt(EXTRA_POSITION_Y, 500);

messageIntent.putExtras(extras);

startActivity(messageIntent);
```

### Retrieve the data from the Intent in the started Activity

```java
Intent intent = getIntent();

// Data alma
Uri locationUri = intent.getData();

// Extra alma
String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
int positionX = intent.getIntExtra(MainActivity.EXTRA_POSITION_X);
int positionY = intent.getIntExtra(MainActivity.EXTRA_POSITION_Y);

// Bundle alma
Bundle extras = intent.getExtras();
String message = extras.getString(MainActivity.EXTRA_MESSAGE);
```

## 🔙 Getting data back from an Activity

### Use startActivityForResult\(\) to launch the Activity

```java
startActivityForResult(messageIntent, TEXT_REQUEST);

// İstek tipleri
public static final int PHOTO_REQUEST = 1;
public static final int PHOTO_PICK_REQUEST = 2;
public static final int TEXT_REQUEST = 3;
```

### Return a response from the launched Activity

```java
Intent returnIntent = new Intent();

public final static String EXTRA_RETURN_MESSAGE =
"com.example.mysampleapp.RETURN_MESSAGE";

messageIntent.putExtra(EXTRA_RETURN_MESSAGE, mMessage);
setResult(RESULT_OK,replyIntent);

// Activity'i sonlandırma
finish();
```

{% hint style="warning" %}
To avoid confusing sent data with returned data, use a new `Intent` object rather than reusing the original sending `Intent` object.
{% endhint %}

### Read response data in onActivityResult\(\)

* Aktivity'den yanıt geldiğinde çalışır

```java
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == TEXT_REQUEST) {
if (resultCode == RESULT_OK) {
String reply =
data.getStringExtra(SecondActivity.EXTRA_RETURN_MESSAGE);
// process data
}
}
}
```

## 🏹 Activity Navigation

### Back navigation, tasks, and the back stack

![](../.gitbook/assets/image%20%284%29.png)

### Implement Up navigation with a parent Activity

```markup
<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">
<!-- The main activity (it has no parent activity) -->
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- The child activity) -->
<activity android:name=".SecondActivity"
android:label = "Second Activity"
android:parentActivityName=".MainActivity">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.android.twoactivities.MainActivity" />
</activity>
</application>
```

{% hint style="info" %}
To support older versions of Android, include `<meta-data>` information to define the parent `Activity` explicitly
{% endhint %}

16 changes: 16 additions & 0 deletions programlama-notlari-1/giris.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
description: Android dünyasına giriş
---

# 🔰 Giriş

* To install Android Studio, go to [Android Studio](https://developer.android.com/sdk/index.html) and follow the instructions to download and install it.
* When creating a new app, ensure that **API 15: Android 4.0.3 IceCreamSandwich** is set as the Minimum SDK.
* To see the app's Android hierarchy in the Project pane, click the **Project** tab in the vertical tab column, and then choose **Android** in the popup menu at the top.
* Edit the `build.gradle(Module:app)` file when you need to add new libraries to your project or change library versions.
* All code and resources for the app are located within the `app` and `res` folders. The `java` folder includes activities, tests, and other components in Java source code. The `res` folder holds resources, such as layouts, strings, and images.
* Edit the `AndroidManifest.xml` file to add features components and permissions to your Android app. All components for an app, such as multiple activities, must be declared in this XML file.
* Use the [Android Virtual Device \(AVD\) manager](http://developer.android.com/tools/devices/managing-avds.html) to create a virtual device \(also known as an emulator\) to run your app.
* Add [`Log`](https://developer.android.com/reference/android/util/Log.html) statements to your app, which display messages in the Logcat pane as a basic tool for debugging.
* To run your app on a physical Android device using Android Studio, turn on USB Debugging on the device. Open **Settings &gt; About phone** and tap **Build number** seven times. Return to the previous screen \(**Settings**\), and tap **Developer options**. Choose **USB Debugging**.

57 changes: 57 additions & 0 deletions programlama-notlari-1/ilk-etkilesimli-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
description: Kullanıcı ile etkileşimli ilk arayüzü programlama
---

# 👶 İlk Etkileşimli UI

`View`, `ViewGroup`, and layouts:

* All UI elements are subclasses of the [`View`](http://developer.android.com/reference/android/view/View.html) class and therefore inherit many properties of the `View` superclass.
* `View` elements can be grouped inside a [`ViewGroup`](https://developer.android.com/reference/android/view/ViewGroup.html), which acts as a container. The relationship is parent-child, in which the _parent_ is a `ViewGroup`, and the _child_ is a `View` or another `ViewGroup`.
* The [`onCreate()`](https://developer.android.com/reference/android/app/Activity.html#onCreate%28android.os.Bundle%29) method is used to _inflate the layout_, which means to set the content view of the screen to the XML layout. You can also use it to get references to other UI elements in the layout.
* A [`View`](https://developer.android.com/reference/android/view/View.html), like a string, is a resource that can have an id. The [`findViewById`](https://developer.android.com/reference/android/view/View.html) call takes the ID of a view as its parameter and returns the `View`.

Using the layout editor:

* Click the **Design** tab to manipulate elements and the layout, and the **Text** tab to edit the XML code for the layout.
* In the **Design** tab, the **Palettes** pane shows UI elements that you can use in your app's layout, and the **Component tree** pane shows the view hierarchy of UI elements.
* The design and blueprint panes of the layout editor show the UI elements in the layout.
* The **Attributes** tab displays the **Attributes** pane for setting properties for a UI element.
* Constraint handle: Click a constraint handle, shown as a circle on each side of an element, and then drag to another constraint handle or to parent boundary to create a constraint. The constraint is represented by the zigzag line.
* Resizing handle: You can drag the square resizing handles to resize the element. While dragging, the handle changes to an angled corner.
* When enabled, the Autoconnect tool automatically creates two or more constraints for a UI element to the parent layout. After you drag the element to the layout, it creates constraints based on the element's position.
* You can remove constraints from an element by selecting the element and hovering your pointer over it to show the Clear Constraints ![click the specific handle that sets the constraint. \[IMAGEINFO\]: remove\_constraints\_button.png](https://codelabs.developers.google.com/codelabs/android-training-layout-editor-part-a/img/59d14927db41ffe.png) button. Click this button to remove _all_ constraints on the selected element. To clear a single constraint, click the specific handle that sets the constraint.
* The **Attributes** pane offers access to all of the XML attributes you can assign to a UI element. It also includes a square sizing panel called the _view inspector_ at the top. The symbols inside the square represent the height and width settings.

Setting layout width and height:

The `layout_width` and `layout_height` attributes change as you change the height and width size controls in the view inspector. These attributes can take one of three values for a `ConstraintLayout`:

* The `match_constraint` setting expands the view to fill its parent by width or height—up to a margin, if one is set.
* The `wrap_content` setting shrinks the view dimensions so the view is just big enough to enclose its content. If there is no content, the view becomes invisible.
* Use a fixed number of `dp` \([density-independent pixels](https://developer.android.com/training/multiscreen/screendensities.html)\) to specify a fixed size, adjusted for the screen size of the device.

Extracting string resources:

Instead of hard-coding strings, it is a best practice to use string resources, which represent the strings. Follow these steps:

1. Click once on the hardcoded string to extract, press **Alt-Enter** \(**Option-Enter** on the Mac\), and choose **Extract string resources** from the popup menu.
2. Set the **Resource name**`.`
3. Click **OK**. This creates a string resource in the `values/res/string.xml` file, and the string in your code is replaced with a reference to the resource: `@string/button_label_toast`

Handling clicks:

* A _click handler_ is a method that is invoked when the user clicks or taps on a UI element.
* Specify a click handler for a UI element such as a `Button` by entering its name in the `onClick` field in the **Design** tab's **Attributes** pane, or in the XML editor by adding the `android:onClick` property to a UI element such as a `Button`.
* Create the click handler in the main `Activity` using the `View` parameter. Example: `public void showToast(View view) {/...}`.
* You can find information on all `Button` properties in the [Button class documentation](http://developer.android.com/reference/android/widget/Button.html), and all the `TextView` properties in the [TextView class documentation](http://developer.android.com/reference/android/widget/TextView.html).

Displaying Toast messages:

A [`Toast`](https://developer.android.com/reference/android/widget/Toast.html) provides a way to show a simple message in a small popup window. It fills only the amount of space required for the message. To create an instance of a `Toast`, follow these steps:

1. Call the [`makeText()`](https://developer.android.com/reference/android/widget/Toast.html#makeText%28android.content.Context,%20int,%20int%29) factory method on the [`Toast`](https://developer.android.com/reference/android/widget/Toast.html) class.
2. Supply the [context](https://developer.android.com/reference/android/content/Context.html) of the app `Activity` and the message to display \(such as a string resource\).
3. Supply the duration of the display, for example [`Toast.LENGTH_SHORT`](https://developer.android.com/reference/android/widget/Toast.html#LENGTH_SHORT) for a short period. The duration can be either `Toast.LENGTH_LONG` or `Toast.LENGTH_SHORT`.
4. Show the `Toast` by calling [`show()`](https://developer.android.com/reference/android/widget/Toast.html#show%28%29).

Loading

0 comments on commit 8eb3ce4

Please sign in to comment.